Allow to disable the model warning beeping
Mostly useful for debugging
This commit is contained in:
parent
6832ec7648
commit
8620059067
@ -7776,6 +7776,7 @@ Sigma_Exit:
|
|||||||
- `P` - power
|
- `P` - power
|
||||||
- `C` - capacitance
|
- `C` - capacitance
|
||||||
- `S` - set 0=disable 1=enable (default)
|
- `S` - set 0=disable 1=enable (default)
|
||||||
|
- `B` - beep on warning threshold 0=disable 1=enable (default)
|
||||||
- `E` - error threshold (define min/max values in variants)
|
- `E` - error threshold (define min/max values in variants)
|
||||||
- `W` - warning threshold (define min/max values in variants)
|
- `W` - warning threshold (define min/max values in variants)
|
||||||
- `T` - ambient temperature correction
|
- `T` - ambient temperature correction
|
||||||
@ -7785,25 +7786,27 @@ Sigma_Exit:
|
|||||||
{
|
{
|
||||||
// parse all parameters
|
// parse all parameters
|
||||||
float P = NAN, C = NAN, R = NAN, E = NAN, W = NAN, T = NAN, A = NAN;
|
float P = NAN, C = NAN, R = NAN, E = NAN, W = NAN, T = NAN, A = NAN;
|
||||||
int8_t I = -1, S = -1;
|
int8_t I = -1, S = -1, B = -1;
|
||||||
if(code_seen('C')) C = code_value();
|
if(code_seen('C')) C = code_value();
|
||||||
if(code_seen('P')) P = code_value();
|
if(code_seen('P')) P = code_value();
|
||||||
if(code_seen('I')) I = code_value_short();
|
if(code_seen('I')) I = code_value_short();
|
||||||
if(code_seen('R')) R = code_value();
|
if(code_seen('R')) R = code_value();
|
||||||
if(code_seen('S')) S = code_value_short();
|
if(code_seen('S')) S = code_value_short();
|
||||||
|
if(code_seen('B')) B = code_value_short();
|
||||||
if(code_seen('E')) E = code_value();
|
if(code_seen('E')) E = code_value();
|
||||||
if(code_seen('W')) W = code_value();
|
if(code_seen('W')) W = code_value();
|
||||||
if(code_seen('T')) T = code_value();
|
if(code_seen('T')) T = code_value();
|
||||||
if(code_seen('A')) A = code_value();
|
if(code_seen('A')) A = code_value();
|
||||||
|
|
||||||
// report values if nothing has been requested
|
// report values if nothing has been requested
|
||||||
if(isnan(C) && isnan(P) && isnan(R) && isnan(E) && isnan(W) && isnan(T) && isnan(A) && I < 0 && S < 0) {
|
if(isnan(C) && isnan(P) && isnan(R) && isnan(E) && isnan(W) && isnan(T) && isnan(A) && I < 0 && S < 0 && B < 0) {
|
||||||
temp_model_report_settings();
|
temp_model_report_settings();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update all set parameters
|
// update all set parameters
|
||||||
if(S >= 0) temp_model_set_enabled(S);
|
if(S >= 0) temp_model_set_enabled(S);
|
||||||
|
if(B >= 0) temp_model_set_warn_beep(B);
|
||||||
if(!isnan(C) || !isnan(P) || !isnan(T) || !isnan(W) || !isnan(E)) temp_model_set_params(C, P, T, W, E);
|
if(!isnan(C) || !isnan(P) || !isnan(T) || !isnan(W) || !isnan(E)) temp_model_set_params(C, P, T, W, E);
|
||||||
if(I >= 0 && !isnan(R)) temp_model_set_resistance(I, R);
|
if(I >= 0 && !isnan(R)) temp_model_set_resistance(I, R);
|
||||||
|
|
||||||
|
@ -69,8 +69,9 @@ struct model_data
|
|||||||
void step(uint8_t heater_pwm, uint8_t fan_pwm, float heater_temp, float ambient_temp);
|
void step(uint8_t heater_pwm, uint8_t fan_pwm, float heater_temp, float ambient_temp);
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool enabled; // model check enabled
|
static bool enabled; // model check enabled
|
||||||
static model_data data; // default heater data
|
static bool warn_beep = true; // beep on warning threshold
|
||||||
|
static model_data data; // default heater data
|
||||||
|
|
||||||
static bool calibrated(); // return calibration/model validity status
|
static bool calibrated(); // return calibration/model validity status
|
||||||
static void check(); // check and trigger errors or warnings based on current state
|
static void check(); // check and trigger errors or warnings based on current state
|
||||||
|
@ -2446,14 +2446,18 @@ void handle_warning()
|
|||||||
|
|
||||||
static bool beeper = false;
|
static bool beeper = false;
|
||||||
if(warning_state.assert) {
|
if(warning_state.assert) {
|
||||||
// beep periodically
|
if(warn_beep) {
|
||||||
beeper = !beeper;
|
// beep periodically
|
||||||
WRITE(BEEPER, beeper);
|
beeper = !beeper;
|
||||||
|
WRITE(BEEPER, beeper);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// warning cleared, reset state
|
// warning cleared, reset state
|
||||||
warning_state.warning = false;
|
warning_state.warning = false;
|
||||||
beeper = false;
|
if(warn_beep) {
|
||||||
WRITE(BEEPER, LOW);
|
beeper = false;
|
||||||
|
WRITE(BEEPER, LOW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2520,9 +2524,15 @@ void temp_model_set_enabled(bool enabled)
|
|||||||
SERIAL_ECHOLNPGM("TM: invalid parameters, cannot enable");
|
SERIAL_ECHOLNPGM("TM: invalid parameters, cannot enable");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void temp_model_set_warn_beep(bool enabled)
|
||||||
|
{
|
||||||
|
temp_model::warn_beep = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
void temp_model_set_params(float C, float P, float Ta_corr, float warn, float err)
|
void temp_model_set_params(float C, float P, float Ta_corr, float warn, float err)
|
||||||
{
|
{
|
||||||
TempMgrGuard temp_mgr_guard;
|
TempMgrGuard temp_mgr_guard;
|
||||||
|
|
||||||
if(!isnan(C) && C > 0) temp_model::data.C = C;
|
if(!isnan(C) && C > 0) temp_model::data.C = C;
|
||||||
if(!isnan(P) && P > 0) temp_model::data.P = P;
|
if(!isnan(P) && P > 0) temp_model::data.P = P;
|
||||||
if(!isnan(Ta_corr)) temp_model::data.Ta_corr = Ta_corr;
|
if(!isnan(Ta_corr)) temp_model::data.Ta_corr = Ta_corr;
|
||||||
@ -2570,6 +2580,7 @@ void temp_model_reset_settings()
|
|||||||
temp_model::data.Ta_corr = TEMP_MODEL_Ta_corr;
|
temp_model::data.Ta_corr = TEMP_MODEL_Ta_corr;
|
||||||
temp_model::data.warn = TEMP_MODEL_W;
|
temp_model::data.warn = TEMP_MODEL_W;
|
||||||
temp_model::data.err = TEMP_MODEL_E;
|
temp_model::data.err = TEMP_MODEL_E;
|
||||||
|
temp_model::warn_beep = true;
|
||||||
temp_model::enabled = false;
|
temp_model::enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,6 +231,7 @@ void PID_autotune(float temp, int extruder, int ncycles);
|
|||||||
|
|
||||||
#ifdef TEMP_MODEL
|
#ifdef TEMP_MODEL
|
||||||
void temp_model_set_enabled(bool enabled);
|
void temp_model_set_enabled(bool enabled);
|
||||||
|
void temp_model_set_warn_beep(bool enabled);
|
||||||
void temp_model_set_params(float C = NAN, float P = NAN, float Ta_corr = NAN, float warn = NAN, float err = NAN);
|
void temp_model_set_params(float C = NAN, float P = NAN, float Ta_corr = NAN, float warn = NAN, float err = NAN);
|
||||||
void temp_model_set_resistance(uint8_t index, float R);
|
void temp_model_set_resistance(uint8_t index, float R);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user