Backlight always on during calibration

This commit is contained in:
leptun 2019-10-18 12:18:43 +03:00
parent 91e94aa0e8
commit 9fc42526e7
4 changed files with 33 additions and 1 deletions

View File

@ -63,6 +63,7 @@
#include "menu.h"
#include "ultralcd.h"
#include "backlight.h"
#include "planner.h"
#include "stepper.h"
@ -2768,6 +2769,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
#ifdef TMC2130
FORCE_HIGH_POWER_START;
#endif // TMC2130
FORCE_BL_ON_START;
// Only Z calibration?
if (!onlyZ)
{
@ -2956,6 +2958,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
#ifdef TMC2130
FORCE_HIGH_POWER_END;
#endif // TMC2130
FORCE_BL_ON_END;
return final_result;
}

View File

@ -18,6 +18,21 @@ uint8_t backlightMode = BACKLIGHT_MODE_BRIGHT;
int16_t backlightTimer_period = 10;
LongTimer backlightTimer;
void force_bl_on(bool section_start)
{
if (section_start)
{
backlightMode = BACKLIGHT_MODE_BRIGHT;
if (backlightLevel_HIGH < 30) backlightLevel_HIGH = 30;
}
else
{
backlightMode = eeprom_read_byte((uint8_t *)EEPROM_BACKLIGHT_MODE);
backlightLevel_HIGH = eeprom_read_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_HIGH);
}
backlight_update();
}
void backlight_save() //saves all backlight data to eeprom.
{
eeprom_update_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_HIGH, (uint8_t)backlightLevel_HIGH);

View File

@ -3,6 +3,8 @@
#define _BACKLIGHT_H
#include <inttypes.h>
#include "Marlin.h"
#include "pins.h"
enum Backlight_Mode
{
@ -17,6 +19,14 @@ extern uint8_t backlightMode;
extern bool backlightSupport;
extern int16_t backlightTimer_period;
#ifdef LCD_BL_PIN
#define FORCE_BL_ON_START force_bl_on(true)
#define FORCE_BL_ON_END force_bl_on(false)
#else
#define FORCE_BL_ON_START
#define FORCE_BL_ON_END
#endif
extern void force_bl_on(bool section_start);
extern void backlight_update();
extern void backlight_init();
extern void backlightTimer_reset();

View File

@ -5019,7 +5019,7 @@ 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);
FORCE_BL_ON_START;
while (!end) {
printf_P(PSTR("Wizard state: %d\n"), state);
switch (state) {
@ -5157,6 +5157,7 @@ void lcd_wizard(WizState state)
}
}
FORCE_BL_ON_END;
printf_P(_N("Wizard end state: %d\n"), state);
switch (state) { //final message
case S::Restore: //printer was already calibrated
@ -7393,6 +7394,7 @@ bool lcd_selftest()
#ifdef TMC2130
FORCE_HIGH_POWER_START;
#endif // TMC2130
FORCE_BL_ON_START;
_delay(2000);
KEEPALIVE_STATE(IN_HANDLER);
@ -7612,6 +7614,7 @@ bool lcd_selftest()
#ifdef TMC2130
FORCE_HIGH_POWER_END;
#endif // TMC2130
FORCE_BL_ON_END;
KEEPALIVE_STATE(NOT_BUSY);
return(_result);
}
@ -8021,6 +8024,7 @@ 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();
FORCE_BL_ON_END;
target_temperature[0] = 0;
target_temperature_bed = 0;