Add lcd_setatatus_serial to output lcd status message and serial at the same time
This commit is contained in:
3d-gussner 2022-11-02 10:09:32 +01:00
parent 67877acbf6
commit 4785eedc06
3 changed files with 29 additions and 17 deletions

View File

@ -2794,19 +2794,21 @@ static bool autotune(int16_t cal_temp)
set_fan_speed(0);
for(uint8_t i = 0; i != 2; ++i) {
const char* PROGMEM verb = (i == 0? PSTR("inital"): PSTR("refine"));
const char* PROGMEM verb = (i == 0? PSTR("initial"): PSTR("refine"));
target_temperature[0] = 0;
if(current_temperature[0] >= TEMP_MODEL_CAL_Tl) {
//!01234567890123456789|
//!TM: cool down <50C |
sprintf_P(tm_message, PSTR("TM: cool down <%dC"), TEMP_MODEL_CAL_Tl);
SERIAL_ECHOLN(tm_message);
lcd_setstatus(tm_message);
lcd_setstatus_serial(tm_message);
cooldown(TEMP_MODEL_CAL_Tl);
wait(10000);
}
//!01234567890123456789|
//!TM: initial R est. |
//!TM: refine R est. |
sprintf_P(tm_message, PSTR("TM: %S C est."), verb);
SERIAL_ECHOLN(tm_message);
lcd_setstatus(tm_message);
lcd_setstatus_serial(tm_message);
target_temperature[0] = cal_temp;
samples = record();
if(temp_error_state.v || !samples)
@ -2825,10 +2827,11 @@ static bool autotune(int16_t cal_temp)
wait_temp();
if(i) break; // we don't need to refine R
wait(30000); // settle PID regulation
//!01234567890123456789|
//!TM: initial R 230C |
//!TM: refine R 230C |
sprintf_P(tm_message, PSTR("TM: %S R %dC"), verb, cal_temp);
SERIAL_ECHOLN(tm_message);
lcd_setstatus(tm_message);
lcd_setstatus_serial(tm_message);
samples = record();
if(temp_error_state.v || !samples)
return true;
@ -2851,10 +2854,10 @@ static bool autotune(int16_t cal_temp)
uint8_t speed = 256 / TEMP_MODEL_R_SIZE * (i + 1) - 1;
set_fan_speed(speed);
wait(10000);
//!01234567890123456789|
//!TM: R[15] estimat. |
sprintf_P(tm_message, PSTR("TM: R[%u] estimat."), (unsigned)i);
SERIAL_ECHOLN(tm_message);
lcd_setstatus(tm_message);
lcd_setstatus_serial(tm_message);
samples = record();
if(temp_error_state.v || !samples)
return true;
@ -2892,9 +2895,10 @@ void temp_model_autotune(int16_t temp, bool selftest)
{
char tm_message[20];
if(moves_planned() || printer_active()) {
//!01234567890123456789|
//!TM: Cal. NOT ILDE |
sprintf_P(tm_message, PSTR("TM: Cal. NOT IDLE"));
SERIAL_ECHOLN(tm_message);
lcd_setstatuspgm(tm_message);
lcd_setstatus_serial(tm_message);
return;
}
@ -2906,7 +2910,6 @@ void temp_model_autotune(int16_t temp, bool selftest)
// set the model checking state during self-calibration
bool was_enabled = temp_model::enabled;
temp_model_reset_enabled(selftest);
SERIAL_ECHOLNPGM("TM: calibration start");
bool err = temp_model_cal::autotune(temp > 0 ? temp : TEMP_MODEL_CAL_Th);
@ -2914,9 +2917,10 @@ void temp_model_autotune(int16_t temp, bool selftest)
disable_heater();
if(err) {
//!01234567890123456789|
//!TM: calibr. failed! |
sprintf_P(tm_message, PSTR("TM: calibr. failed!"));
SERIAL_ECHOLN(tm_message);
lcd_setstatuspgm(tm_message); ////MSG_TM_AUTOTUNE_FAILED c=20
lcd_setstatus_serial(tm_message);
if(temp_error_state.v)
temp_model_cal::set_fan_speed(255);
} else {

View File

@ -7591,6 +7591,13 @@ void lcd_setstatuspgm(const char* message)
lcd_updatestatus(message, true);
}
void lcd_setstatus_serial(const char* message)
{
if (lcd_message_check(LCD_STATUS_NONE))
lcd_updatestatus(message);
SERIAL_ECHOLN(message);
}
void lcd_setalertstatus_(const char* message, uint8_t severity, bool progmem)
{
if (lcd_message_check(severity)) {

View File

@ -21,6 +21,7 @@ void ultralcd_init();
// Set the current status message (equivalent to LCD_STATUS_NONE)
void lcd_setstatus(const char* message);
void lcd_setstatuspgm(const char* message);
void lcd_setstatus_serial(const char* message);
//! return to the main status screen and display the alert message
//! Beware - it has sideeffects: