Activate LiquidTWI2 device detection and space-pad LCD status line.
This commit is contained in:
parent
7f76a0e064
commit
7325d7102e
4 changed files with 33 additions and 2 deletions
|
@ -1627,6 +1627,8 @@ void process_commands()
|
||||||
lcd_update();
|
lcd_update();
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
if (!lcd_detected())
|
||||||
|
break;
|
||||||
while(!lcd_clicked()){
|
while(!lcd_clicked()){
|
||||||
manage_heater();
|
manage_heater();
|
||||||
manage_inactivity();
|
manage_inactivity();
|
||||||
|
|
|
@ -1148,6 +1148,11 @@ void lcd_setstatus(const char* message)
|
||||||
if (lcd_status_message_level > 0)
|
if (lcd_status_message_level > 0)
|
||||||
return;
|
return;
|
||||||
strncpy(lcd_status_message, message, LCD_WIDTH);
|
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;
|
lcdDrawUpdate = 2;
|
||||||
}
|
}
|
||||||
void lcd_setstatuspgm(const char* message)
|
void lcd_setstatuspgm(const char* message)
|
||||||
|
@ -1155,6 +1160,11 @@ void lcd_setstatuspgm(const char* message)
|
||||||
if (lcd_status_message_level > 0)
|
if (lcd_status_message_level > 0)
|
||||||
return;
|
return;
|
||||||
strncpy_P(lcd_status_message, message, LCD_WIDTH);
|
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;
|
lcdDrawUpdate = 2;
|
||||||
}
|
}
|
||||||
void lcd_setalertstatuspgm(const char* message)
|
void lcd_setalertstatuspgm(const char* message)
|
||||||
|
@ -1263,6 +1273,15 @@ void lcd_buttons_update()
|
||||||
lastEncoderBits = enc;
|
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)
|
void lcd_buzz(long duration, uint16_t freq)
|
||||||
{
|
{
|
||||||
#ifdef LCD_USE_I2C_BUZZER
|
#ifdef LCD_USE_I2C_BUZZER
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
void lcd_setstatuspgm(const char* message);
|
void lcd_setstatuspgm(const char* message);
|
||||||
void lcd_setalertstatuspgm(const char* message);
|
void lcd_setalertstatuspgm(const char* message);
|
||||||
void lcd_reset_alert_level();
|
void lcd_reset_alert_level();
|
||||||
|
bool lcd_detected(void);
|
||||||
|
|
||||||
#ifdef DOGLCD
|
#ifdef DOGLCD
|
||||||
extern int lcd_contrast;
|
extern int lcd_contrast;
|
||||||
|
@ -92,6 +93,7 @@
|
||||||
FORCE_INLINE void lcd_buttons_update() {}
|
FORCE_INLINE void lcd_buttons_update() {}
|
||||||
FORCE_INLINE void lcd_reset_alert_level() {}
|
FORCE_INLINE void lcd_reset_alert_level() {}
|
||||||
FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
|
FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
|
||||||
|
FORCE_INLINE bool lcd_detected(void) { return true; }
|
||||||
|
|
||||||
#define LCD_MESSAGEPGM(x)
|
#define LCD_MESSAGEPGM(x)
|
||||||
#define LCD_ALERTMESSAGEPGM(x)
|
#define LCD_ALERTMESSAGEPGM(x)
|
||||||
|
|
|
@ -166,13 +166,21 @@ extern volatile uint16_t buttons; //an extended version of the last checked but
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <LiquidTWI2.h>
|
#include <LiquidTWI2.h>
|
||||||
#define LCD_CLASS LiquidTWI2
|
#define LCD_CLASS LiquidTWI2
|
||||||
|
#if defined(DETECT_DEVICE)
|
||||||
|
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
|
||||||
|
#else
|
||||||
LCD_CLASS lcd(LCD_I2C_ADDRESS);
|
LCD_CLASS lcd(LCD_I2C_ADDRESS);
|
||||||
|
#endif
|
||||||
|
|
||||||
#elif defined(LCD_I2C_TYPE_MCP23008)
|
#elif defined(LCD_I2C_TYPE_MCP23008)
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <LiquidTWI2.h>
|
#include <LiquidTWI2.h>
|
||||||
#define LCD_CLASS LiquidTWI2
|
#define LCD_CLASS LiquidTWI2
|
||||||
|
#if defined(DETECT_DEVICE)
|
||||||
|
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
|
||||||
|
#else
|
||||||
LCD_CLASS lcd(LCD_I2C_ADDRESS);
|
LCD_CLASS lcd(LCD_I2C_ADDRESS);
|
||||||
|
#endif
|
||||||
|
|
||||||
#elif defined(LCD_I2C_TYPE_PCA8574)
|
#elif defined(LCD_I2C_TYPE_PCA8574)
|
||||||
#include <LiquidCrystal_I2C.h>
|
#include <LiquidCrystal_I2C.h>
|
||||||
|
|
Reference in a new issue