Minor code cleanup

This commit is contained in:
Scott Lahteine 2020-04-01 18:53:58 -05:00
parent 7f5dc7b919
commit 514afddeb4
8 changed files with 17 additions and 34 deletions

View file

@ -1254,7 +1254,7 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
#endif #endif
} }
if (axis_connection) ui.set_status_P(GET_TEXT(MSG_ERROR_TMC)); if (axis_connection) LCD_MESSAGEPGM(MSG_ERROR_TMC);
} }
#endif // HAS_TRINAMIC_CONFIG #endif // HAS_TRINAMIC_CONFIG

View file

@ -2164,7 +2164,7 @@
#define SHARED_SD_CARD #define SHARED_SD_CARD
#endif #endif
#if DISABLED(SHARED_SD_CARD) #if DISABLED(SHARED_SD_CARD)
#define INIT_SDCARD_ON_BOOT #define INIT_SDCARD_ON_BOOT 1
#endif #endif
#endif #endif

View file

@ -367,11 +367,11 @@ void MarlinUI::init_lcd() {
} }
bool MarlinUI::detected() { bool MarlinUI::detected() {
return true return (true
#if EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) && defined(DETECT_DEVICE) #if EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) && defined(DETECT_DEVICE)
&& lcd.LcdDetected() == 1 && lcd.LcdDetected() == 1
#endif #endif
; );
} }
#if HAS_SLOW_BUTTONS #if HAS_SLOW_BUTTONS

View file

@ -244,13 +244,7 @@ void MarlinUI::init_lcd() {
#if DISABLED(MKS_LCD12864B) #if DISABLED(MKS_LCD12864B)
#if PIN_EXISTS(LCD_BACKLIGHT) #if PIN_EXISTS(LCD_BACKLIGHT)
OUT_WRITE(LCD_BACKLIGHT_PIN, ( OUT_WRITE(LCD_BACKLIGHT_PIN, DISABLED(DELAYED_BACKLIGHT_INIT)); // Illuminate after reset or right away
#if ENABLED(DELAYED_BACKLIGHT_INIT)
LOW // Illuminate after reset
#else
HIGH // Illuminate right away
#endif
));
#endif #endif
#if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306)

View file

@ -441,7 +441,6 @@ void DGUSScreenVariableHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variab
DGUSLCD_SendStringToDisplay(var); DGUSLCD_SendStringToDisplay(var);
} }
void DGUSScreenVariableHandler::SDCardInserted() { void DGUSScreenVariableHandler::SDCardInserted() {
top_file = 0; top_file = 0;
auto cs = ScreenHandler.getCurrentScreen(); auto cs = ScreenHandler.getCurrentScreen();

View file

@ -351,10 +351,8 @@ void MarlinUI::init() {
#endif #endif
#endif #endif
#if HAS_ENCODER_ACTION #if HAS_ENCODER_ACTION && HAS_SLOW_BUTTONS
#if HAS_SLOW_BUTTONS slow_buttons = 0;
slow_buttons = 0;
#endif
#endif #endif
update_buttons(); update_buttons();

View file

@ -1391,7 +1391,7 @@ void MarlinSettings::postprocess() {
DEBUG_ECHO_START(); DEBUG_ECHO_START();
DEBUG_ECHOLNPAIR("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")"); DEBUG_ECHOLNPAIR("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")");
#if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT) #if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT)
ui.set_status_P(GET_TEXT(MSG_ERR_EEPROM_VERSION)); LCD_MESSAGEPGM(MSG_ERR_EEPROM_VERSION);
#endif #endif
eeprom_error = true; eeprom_error = true;
} }
@ -2199,7 +2199,7 @@ void MarlinSettings::postprocess() {
DEBUG_ECHO_START(); DEBUG_ECHO_START();
DEBUG_ECHOLNPAIR("Index: ", int(eeprom_index - (EEPROM_OFFSET)), " Size: ", datasize()); DEBUG_ECHOLNPAIR("Index: ", int(eeprom_index - (EEPROM_OFFSET)), " Size: ", datasize());
#if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT) #if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT)
ui.set_status_P(GET_TEXT(MSG_ERR_EEPROM_INDEX)); LCD_MESSAGEPGM(MSG_ERR_EEPROM_INDEX);
#endif #endif
} }
else if (working_crc != stored_crc) { else if (working_crc != stored_crc) {
@ -2207,7 +2207,7 @@ void MarlinSettings::postprocess() {
DEBUG_ERROR_START(); DEBUG_ERROR_START();
DEBUG_ECHOLNPAIR("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!"); DEBUG_ECHOLNPAIR("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
#if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT) #if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT)
ui.set_status_P(GET_TEXT(MSG_ERR_EEPROM_CRC)); LCD_MESSAGEPGM(MSG_ERR_EEPROM_CRC);
#endif #endif
} }
else if (!validating) { else if (!validating) {

View file

@ -542,22 +542,14 @@ volatile bool Temperature::raw_temps_ready = false;
// Make sure heating is actually working // Make sure heating is actually working
#if WATCH_BED || WATCH_HOTENDS #if WATCH_BED || WATCH_HOTENDS
if ( if (BOTH(WATCH_BED, WATCH_HOTENDS) || isbed == DISABLED(WATCH_HOTENDS)) {
#if WATCH_BED && WATCH_HOTENDS if (!heated) { // If not yet reached target...
true if (current_temp > next_watch_temp) { // Over the watch temp?
#elif WATCH_HOTENDS next_watch_temp = current_temp + watch_temp_increase; // - set the next temp to watch for
!isbed temp_change_ms = ms + watch_temp_period * 1000UL; // - move the expiration timer up
#else if (current_temp > watch_temp_target) heated = true; // - Flag if target temperature reached
isbed
#endif
) {
if (!heated) { // If not yet reached target...
if (current_temp > next_watch_temp) { // Over the watch temp?
next_watch_temp = current_temp + watch_temp_increase; // - set the next temp to watch for
temp_change_ms = ms + watch_temp_period * 1000UL; // - move the expiration timer up
if (current_temp > watch_temp_target) heated = true; // - Flag if target temperature reached
} }
else if (ELAPSED(ms, temp_change_ms)) // Watch timer expired else if (ELAPSED(ms, temp_change_ms)) // Watch timer expired
_temp_error(heater, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD)); _temp_error(heater, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
} }
else if (current_temp < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far? else if (current_temp < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far?