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
|
#ifdef TMC2130
|
||||||
FORCE_HIGH_POWER_START;
|
FORCE_HIGH_POWER_START;
|
||||||
#endif // TMC2130
|
#endif // TMC2130
|
||||||
#ifdef LCD_BL_PIN
|
|
||||||
FORCE_BL_ON_START;
|
FORCE_BL_ON_START;
|
||||||
#endif // LCD_BL_PIN
|
|
||||||
// Only Z calibration?
|
// Only Z calibration?
|
||||||
if (!onlyZ)
|
if (!onlyZ)
|
||||||
{
|
{
|
||||||
setTargetBed(0);
|
setTargetBed(0);
|
||||||
|
@ -2960,9 +2960,9 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
FORCE_HIGH_POWER_END;
|
FORCE_HIGH_POWER_END;
|
||||||
#endif // TMC2130
|
#endif // TMC2130
|
||||||
#ifdef LCD_BL_PIN
|
|
||||||
FORCE_BL_ON_END;
|
FORCE_BL_ON_END;
|
||||||
#endif // LCD_BL_PIN
|
|
||||||
return final_result;
|
return final_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,13 @@ uint8_t backlightMode = BACKLIGHT_MODE_BRIGHT;
|
||||||
int16_t backlightTimer_period = 10;
|
int16_t backlightTimer_period = 10;
|
||||||
LongTimer backlightTimer;
|
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)
|
void force_bl_on(bool section_start)
|
||||||
{
|
{
|
||||||
if (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);
|
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()
|
void backlight_update()
|
||||||
{
|
{
|
||||||
if (!backlightSupport) return;
|
if (!backlightSupport) return;
|
||||||
|
@ -109,4 +109,12 @@ void backlight_init()
|
||||||
backlightTimer_reset();
|
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
|
#endif //LCD_BL_PIN
|
|
@ -25,7 +25,6 @@ extern int16_t backlightTimer_period;
|
||||||
extern void force_bl_on(bool section_start);
|
extern void force_bl_on(bool section_start);
|
||||||
extern void backlight_update();
|
extern void backlight_update();
|
||||||
extern void backlight_init();
|
extern void backlight_init();
|
||||||
extern void backlightTimer_reset();
|
|
||||||
extern void backlight_save();
|
extern void backlight_save();
|
||||||
extern void backlight_wake(const uint8_t flashNo = 0);
|
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
|
//if critical is true then silend and once mode is ignored
|
||||||
void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){
|
void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){
|
||||||
backlight_wake(1);
|
backlight_wake();
|
||||||
if (!critical){
|
if (!critical){
|
||||||
if (eSoundMode != e_SOUND_MODE_SILENT){
|
if (eSoundMode != e_SOUND_MODE_SILENT){
|
||||||
if(!tone_){
|
if(!tone_){
|
||||||
|
|
|
@ -19,9 +19,7 @@
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
|
||||||
#ifdef LCD_BL_PIN
|
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
#endif //LCD_BL_PIN
|
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "mesh_bed_leveling.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
|
// Make sure EEPROM_WIZARD_ACTIVE is true if entering using different entry point
|
||||||
// other than WizState::Run - it is useful for debugging wizard.
|
// other than WizState::Run - it is useful for debugging wizard.
|
||||||
if (state != S::Run) eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1);
|
if (state != S::Run) eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1);
|
||||||
#ifdef LCD_BL_PIN
|
|
||||||
FORCE_BL_ON_START;
|
FORCE_BL_ON_START;
|
||||||
#endif // LCD_BL_PIN
|
|
||||||
while (!end) {
|
while (!end) {
|
||||||
printf_P(PSTR("Wizard state: %d\n"), state);
|
printf_P(PSTR("Wizard state: %d\n"), state);
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case S::Run: //Run wizard?
|
case S::Run: //Run wizard?
|
||||||
|
@ -5158,10 +5156,9 @@ void lcd_wizard(WizState state)
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LCD_BL_PIN
|
FORCE_BL_ON_END;
|
||||||
FORCE_BL_ON_END;
|
|
||||||
#endif // LCD_BL_PIN
|
|
||||||
printf_P(_N("Wizard end state: %d\n"), state);
|
printf_P(_N("Wizard end state: %d\n"), state);
|
||||||
switch (state) { //final message
|
switch (state) { //final message
|
||||||
case S::Restore: //printer was already calibrated
|
case S::Restore: //printer was already calibrated
|
||||||
|
@ -7403,9 +7400,9 @@ bool lcd_selftest()
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
FORCE_HIGH_POWER_START;
|
FORCE_HIGH_POWER_START;
|
||||||
#endif // TMC2130
|
#endif // TMC2130
|
||||||
#ifdef LCD_BL_PIN
|
|
||||||
FORCE_BL_ON_START;
|
FORCE_BL_ON_START;
|
||||||
#endif // LCD_BL_PIN
|
|
||||||
_delay(2000);
|
_delay(2000);
|
||||||
KEEPALIVE_STATE(IN_HANDLER);
|
KEEPALIVE_STATE(IN_HANDLER);
|
||||||
|
|
||||||
|
@ -7625,10 +7622,10 @@ bool lcd_selftest()
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
FORCE_HIGH_POWER_END;
|
FORCE_HIGH_POWER_END;
|
||||||
#endif // TMC2130
|
#endif // TMC2130
|
||||||
#ifdef LCD_BL_PIN
|
|
||||||
FORCE_BL_ON_END;
|
FORCE_BL_ON_END;
|
||||||
#endif // LCD_BL_PIN
|
|
||||||
KEEPALIVE_STATE(NOT_BUSY);
|
KEEPALIVE_STATE(NOT_BUSY);
|
||||||
return(_result);
|
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)
|
static void lcd_selftest_error(TestError testError, const char *_error_1, const char *_error_2)
|
||||||
{
|
{
|
||||||
lcd_beeper_quick_feedback();
|
lcd_beeper_quick_feedback();
|
||||||
#ifdef LCD_BL_PIN
|
|
||||||
FORCE_BL_ON_END;
|
FORCE_BL_ON_END;
|
||||||
#endif // LCD_BL_PIN
|
|
||||||
|
|
||||||
target_temperature[0] = 0;
|
target_temperature[0] = 0;
|
||||||
target_temperature_bed = 0;
|
target_temperature_bed = 0;
|
||||||
manage_heater();
|
manage_heater();
|
||||||
|
@ -8633,9 +8629,7 @@ void ultralcd_init()
|
||||||
else lcd_autoDeplete = autoDepleteRaw;
|
else lcd_autoDeplete = autoDepleteRaw;
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef LCD_BL_PIN
|
|
||||||
backlight_init();
|
backlight_init();
|
||||||
#endif //LCD_BL_PIN
|
|
||||||
lcd_init();
|
lcd_init();
|
||||||
lcd_refresh();
|
lcd_refresh();
|
||||||
lcd_longpress_func = menu_lcd_longpress_func;
|
lcd_longpress_func = menu_lcd_longpress_func;
|
||||||
|
@ -8784,9 +8778,7 @@ uint8_t get_message_level()
|
||||||
|
|
||||||
void menu_lcd_longpress_func(void)
|
void menu_lcd_longpress_func(void)
|
||||||
{
|
{
|
||||||
#ifdef LCD_BL_PIN
|
backlight_wake();
|
||||||
backlightTimer_reset();
|
|
||||||
#endif //LCD_BL_PIN
|
|
||||||
if (homing_flag || mesh_bed_leveling_flag || menu_menu == lcd_babystep_z || menu_menu == lcd_move_z)
|
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
|
// disable longpress during re-entry, while homing or calibration
|
||||||
|
@ -8886,9 +8878,7 @@ void menu_lcd_lcdupdate_func(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif//CARDINSERTED
|
#endif//CARDINSERTED
|
||||||
#ifdef LCD_BL_PIN
|
|
||||||
backlight_update();
|
backlight_update();
|
||||||
#endif //LCD_BL_PIN
|
|
||||||
if (lcd_next_update_millis < _millis())
|
if (lcd_next_update_millis < _millis())
|
||||||
{
|
{
|
||||||
if (abs(lcd_encoder_diff) >= ENCODER_PULSES_PER_STEP)
|
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);
|
Sound_MakeSound(e_SOUND_TYPE_EncoderMove);
|
||||||
lcd_encoder_diff = 0;
|
lcd_encoder_diff = 0;
|
||||||
lcd_timeoutToStatus.start();
|
lcd_timeoutToStatus.start();
|
||||||
#ifdef LCD_BL_PIN
|
backlight_wake();
|
||||||
backlightTimer_reset();
|
|
||||||
#endif //LCD_BL_PIN
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LCD_CLICKED)
|
if (LCD_CLICKED)
|
||||||
{
|
{
|
||||||
lcd_timeoutToStatus.start();
|
lcd_timeoutToStatus.start();
|
||||||
#ifdef LCD_BL_PIN
|
backlight_wake();
|
||||||
backlightTimer_reset();
|
|
||||||
#endif //LCD_BL_PIN
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(*menu_menu)();
|
(*menu_menu)();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue