Merge pull request #819 from neildarlow/Marlin_v1

Activate LiquidTWI2 device detection and space-pad LCD status line.
This commit is contained in:
Bo Herrmannsen 2014-12-17 21:42:53 +01:00
commit 31ca3de72f
6 changed files with 47 additions and 8 deletions

View File

@ -1896,6 +1896,8 @@ void process_commands()
}
lcd_ignore_click(false);
}else{
if (!lcd_detected())
break;
while(!lcd_clicked()){
manage_heater();
manage_inactivity();

View File

@ -141,9 +141,17 @@ void CardReader::initsd()
if(root.isOpen())
root.close();
#ifdef SDSLOW
if (!card.init(SPI_HALF_SPEED,SDSS))
if (!card.init(SPI_HALF_SPEED,SDSS)
#if defined(LCD_SDSS) && (LCD_SDSS != SDSS)
&& !card.init(SPI_HALF_SPEED,LCD_SDSS)
#endif
)
#else
if (!card.init(SPI_FULL_SPEED,SDSS))
if (!card.init(SPI_FULL_SPEED,SDSS)
#if defined(LCD_SDSS) && (LCD_SDSS != SDSS)
&& !card.init(SPI_FULL_SPEED,LCD_SDSS)
#endif
)
#endif
{
//if (!card.init(SPI_HALF_SPEED,SDSS))

View File

@ -779,14 +779,14 @@
#define BTN_EN1 47 //reverse if the encoder turns the wrong way.
#define BTN_EN2 43
#define BTN_ENC 32
#define SDSS 53
#define LCD_SDSS 53
#define SDCARDDETECT -1
#define KILL_PIN 41
#elif defined(LCD_I2C_VIKI)
#define BTN_EN1 22 //reverse if the encoder turns the wrong way.
#define BTN_EN2 7
#define BTN_ENC -1
#define SDSS 53
#define LCD_SDSS 53
#define SDCARDDETECT 49
#else
//arduino pin which triggers an piezzo beeper
@ -1304,7 +1304,7 @@
#ifdef LCD_I2C_PANELOLU2
#ifdef MELZI
#define BTN_ENC 29 //the click switch
#define SDSS 30 //to use the SD card reader on the Panelolu2 rather than the melzi board
#define LCD_SDSS 30 //to use the SD card reader on the Panelolu2 rather than the melzi board
#else
#define BTN_ENC 30 //the click switch
#endif

View File

@ -1262,7 +1262,7 @@ void lcd_update()
lcd_buttons_update();
#if (SDCARDDETECT > 0)
if((IS_SD_INSERTED != lcd_oldcardstatus))
if((IS_SD_INSERTED != lcd_oldcardstatus && lcd_detected()))
{
lcdDrawUpdate = 2;
lcd_oldcardstatus = IS_SD_INSERTED;
@ -1365,6 +1365,11 @@ void lcd_setstatus(const char* message)
if (lcd_status_message_level > 0)
return;
strncpy(lcd_status_message, message, LCD_WIDTH);
size_t i = strlen(lcd_status_message);
memset(lcd_status_message + i, ' ', LCD_WIDTH - i);
lcd_status_message[LCD_WIDTH] = '\0';
lcdDrawUpdate = 2;
#ifdef FILAMENT_LCD_DISPLAY
message_millis=millis(); //get status message to show up for a while
@ -1375,6 +1380,11 @@ void lcd_setstatuspgm(const char* message)
if (lcd_status_message_level > 0)
return;
strncpy_P(lcd_status_message, message, LCD_WIDTH);
size_t i = strlen(lcd_status_message);
memset(lcd_status_message + i, ' ', LCD_WIDTH - i);
lcd_status_message[LCD_WIDTH] = '\0';
lcdDrawUpdate = 2;
#ifdef FILAMENT_LCD_DISPLAY
message_millis=millis(); //get status message to show up for a while
@ -1486,6 +1496,15 @@ void lcd_buttons_update()
lastEncoderBits = enc;
}
bool lcd_detected(void)
{
#if (defined(LCD_I2C_TYPE_MCP23017) || defined(LCD_I2C_TYPE_MCP23008)) && defined(DETECT_DEVICE)
return lcd.LcdDetected() == 1;
#else
return true;
#endif
}
void lcd_buzz(long duration, uint16_t freq)
{
#ifdef LCD_USE_I2C_BUZZER

View File

@ -11,6 +11,7 @@
void lcd_setstatuspgm(const char* message);
void lcd_setalertstatuspgm(const char* message);
void lcd_reset_alert_level();
bool lcd_detected(void);
#ifdef DOGLCD
extern int lcd_contrast;
@ -100,6 +101,7 @@
FORCE_INLINE void lcd_buttons_update() {}
FORCE_INLINE void lcd_reset_alert_level() {}
FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
FORCE_INLINE bool lcd_detected(void) { return true; }
#define LCD_MESSAGEPGM(x)
#define LCD_ALERTMESSAGEPGM(x)

View File

@ -166,13 +166,21 @@ extern volatile uint16_t buttons; //an extended version of the last checked but
#include <Wire.h>
#include <LiquidTWI2.h>
#define LCD_CLASS LiquidTWI2
LCD_CLASS lcd(LCD_I2C_ADDRESS);
#if defined(DETECT_DEVICE)
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
#else
LCD_CLASS lcd(LCD_I2C_ADDRESS);
#endif
#elif defined(LCD_I2C_TYPE_MCP23008)
#include <Wire.h>
#include <LiquidTWI2.h>
#define LCD_CLASS LiquidTWI2
LCD_CLASS lcd(LCD_I2C_ADDRESS);
#if defined(DETECT_DEVICE)
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
#else
LCD_CLASS lcd(LCD_I2C_ADDRESS);
#endif
#elif defined(LCD_I2C_TYPE_PCA8574)
#include <LiquidCrystal_I2C.h>