General fixes and improvements to code
This commit is contained in:
parent
1e09f8c003
commit
cd5ff783cf
5 changed files with 43 additions and 50 deletions
|
@ -2769,10 +2769,10 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|||
#ifdef TMC2130
|
||||
FORCE_HIGH_POWER_START;
|
||||
#endif // TMC2130
|
||||
#ifdef LCD_BL_PIN
|
||||
FORCE_BL_ON_START;
|
||||
#endif // LCD_BL_PIN
|
||||
// Only Z calibration?
|
||||
|
||||
FORCE_BL_ON_START;
|
||||
|
||||
// Only Z calibration?
|
||||
if (!onlyZ)
|
||||
{
|
||||
setTargetBed(0);
|
||||
|
@ -2960,9 +2960,9 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|||
#ifdef TMC2130
|
||||
FORCE_HIGH_POWER_END;
|
||||
#endif // TMC2130
|
||||
#ifdef LCD_BL_PIN
|
||||
FORCE_BL_ON_END;
|
||||
#endif // LCD_BL_PIN
|
||||
|
||||
FORCE_BL_ON_END;
|
||||
|
||||
return final_result;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,13 @@ uint8_t backlightMode = BACKLIGHT_MODE_BRIGHT;
|
|||
int16_t backlightTimer_period = 10;
|
||||
LongTimer backlightTimer;
|
||||
|
||||
static void backlightTimer_reset() //used for resetting the timer and waking the display. Triggered on user interactions.
|
||||
{
|
||||
if (!backlightSupport) return;
|
||||
backlightTimer.start();
|
||||
backlight_update();
|
||||
}
|
||||
|
||||
void force_bl_on(bool section_start)
|
||||
{
|
||||
if (section_start)
|
||||
|
@ -61,13 +68,6 @@ void backlight_save() //saves all backlight data to eeprom.
|
|||
eeprom_update_word((uint16_t *)EEPROM_BACKLIGHT_TIMEOUT, backlightTimer_period);
|
||||
}
|
||||
|
||||
void backlightTimer_reset() //used for resetting the timer and waking the display. Triggered on user interactions.
|
||||
{
|
||||
if (!backlightSupport) return;
|
||||
backlightTimer.start();
|
||||
backlight_update();
|
||||
}
|
||||
|
||||
void backlight_update()
|
||||
{
|
||||
if (!backlightSupport) return;
|
||||
|
@ -109,4 +109,12 @@ void backlight_init()
|
|||
backlightTimer_reset();
|
||||
}
|
||||
|
||||
#else //LCD_BL_PIN
|
||||
|
||||
void force_bl_on(__attribute__((unused)) bool section_start) {}
|
||||
void backlight_update() {}
|
||||
void backlight_init() {}
|
||||
void backlight_save() {}
|
||||
void backlight_wake(__attribute__((unused)) const uint8_t flashNo) {}
|
||||
|
||||
#endif //LCD_BL_PIN
|
|
@ -25,7 +25,6 @@ extern int16_t backlightTimer_period;
|
|||
extern void force_bl_on(bool section_start);
|
||||
extern void backlight_update();
|
||||
extern void backlight_init();
|
||||
extern void backlightTimer_reset();
|
||||
extern void backlight_save();
|
||||
extern void backlight_wake(const uint8_t flashNo = 0);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ Sound_SaveMode();
|
|||
|
||||
//if critical is true then silend and once mode is ignored
|
||||
void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){
|
||||
backlight_wake(1);
|
||||
backlight_wake();
|
||||
if (!critical){
|
||||
if (eSoundMode != e_SOUND_MODE_SILENT){
|
||||
if(!tone_){
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
#include "lcd.h"
|
||||
#include "menu.h"
|
||||
|
||||
#ifdef LCD_BL_PIN
|
||||
#include "backlight.h"
|
||||
#endif //LCD_BL_PIN
|
||||
|
||||
#include "util.h"
|
||||
#include "mesh_bed_leveling.h"
|
||||
|
@ -5019,10 +5017,10 @@ void lcd_wizard(WizState state)
|
|||
// Make sure EEPROM_WIZARD_ACTIVE is true if entering using different entry point
|
||||
// other than WizState::Run - it is useful for debugging wizard.
|
||||
if (state != S::Run) eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1);
|
||||
#ifdef LCD_BL_PIN
|
||||
FORCE_BL_ON_START;
|
||||
#endif // LCD_BL_PIN
|
||||
while (!end) {
|
||||
|
||||
FORCE_BL_ON_START;
|
||||
|
||||
while (!end) {
|
||||
printf_P(PSTR("Wizard state: %d\n"), state);
|
||||
switch (state) {
|
||||
case S::Run: //Run wizard?
|
||||
|
@ -5158,10 +5156,9 @@ void lcd_wizard(WizState state)
|
|||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LCD_BL_PIN
|
||||
FORCE_BL_ON_END;
|
||||
#endif // LCD_BL_PIN
|
||||
|
||||
FORCE_BL_ON_END;
|
||||
|
||||
printf_P(_N("Wizard end state: %d\n"), state);
|
||||
switch (state) { //final message
|
||||
case S::Restore: //printer was already calibrated
|
||||
|
@ -7403,9 +7400,9 @@ bool lcd_selftest()
|
|||
#ifdef TMC2130
|
||||
FORCE_HIGH_POWER_START;
|
||||
#endif // TMC2130
|
||||
#ifdef LCD_BL_PIN
|
||||
FORCE_BL_ON_START;
|
||||
#endif // LCD_BL_PIN
|
||||
|
||||
FORCE_BL_ON_START;
|
||||
|
||||
_delay(2000);
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
|
||||
|
@ -7625,10 +7622,10 @@ bool lcd_selftest()
|
|||
#ifdef TMC2130
|
||||
FORCE_HIGH_POWER_END;
|
||||
#endif // TMC2130
|
||||
#ifdef LCD_BL_PIN
|
||||
FORCE_BL_ON_END;
|
||||
#endif // LCD_BL_PIN
|
||||
KEEPALIVE_STATE(NOT_BUSY);
|
||||
|
||||
FORCE_BL_ON_END;
|
||||
|
||||
KEEPALIVE_STATE(NOT_BUSY);
|
||||
return(_result);
|
||||
}
|
||||
|
||||
|
@ -8037,10 +8034,9 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
|
|||
static void lcd_selftest_error(TestError testError, const char *_error_1, const char *_error_2)
|
||||
{
|
||||
lcd_beeper_quick_feedback();
|
||||
#ifdef LCD_BL_PIN
|
||||
FORCE_BL_ON_END;
|
||||
#endif // LCD_BL_PIN
|
||||
|
||||
|
||||
FORCE_BL_ON_END;
|
||||
|
||||
target_temperature[0] = 0;
|
||||
target_temperature_bed = 0;
|
||||
manage_heater();
|
||||
|
@ -8633,9 +8629,7 @@ void ultralcd_init()
|
|||
else lcd_autoDeplete = autoDepleteRaw;
|
||||
|
||||
}
|
||||
#ifdef LCD_BL_PIN
|
||||
backlight_init();
|
||||
#endif //LCD_BL_PIN
|
||||
lcd_init();
|
||||
lcd_refresh();
|
||||
lcd_longpress_func = menu_lcd_longpress_func;
|
||||
|
@ -8784,9 +8778,7 @@ uint8_t get_message_level()
|
|||
|
||||
void menu_lcd_longpress_func(void)
|
||||
{
|
||||
#ifdef LCD_BL_PIN
|
||||
backlightTimer_reset();
|
||||
#endif //LCD_BL_PIN
|
||||
backlight_wake();
|
||||
if (homing_flag || mesh_bed_leveling_flag || menu_menu == lcd_babystep_z || menu_menu == lcd_move_z)
|
||||
{
|
||||
// disable longpress during re-entry, while homing or calibration
|
||||
|
@ -8886,9 +8878,7 @@ void menu_lcd_lcdupdate_func(void)
|
|||
}
|
||||
}
|
||||
#endif//CARDINSERTED
|
||||
#ifdef LCD_BL_PIN
|
||||
backlight_update();
|
||||
#endif //LCD_BL_PIN
|
||||
if (lcd_next_update_millis < _millis())
|
||||
{
|
||||
if (abs(lcd_encoder_diff) >= ENCODER_PULSES_PER_STEP)
|
||||
|
@ -8899,17 +8889,13 @@ void menu_lcd_lcdupdate_func(void)
|
|||
Sound_MakeSound(e_SOUND_TYPE_EncoderMove);
|
||||
lcd_encoder_diff = 0;
|
||||
lcd_timeoutToStatus.start();
|
||||
#ifdef LCD_BL_PIN
|
||||
backlightTimer_reset();
|
||||
#endif //LCD_BL_PIN
|
||||
backlight_wake();
|
||||
}
|
||||
|
||||
if (LCD_CLICKED)
|
||||
{
|
||||
lcd_timeoutToStatus.start();
|
||||
#ifdef LCD_BL_PIN
|
||||
backlightTimer_reset();
|
||||
#endif //LCD_BL_PIN
|
||||
backlight_wake();
|
||||
}
|
||||
|
||||
(*menu_menu)();
|
||||
|
|
Loading…
Add table
Reference in a new issue