TM: Add M310 [F] parameter to enable autotune self-test

This commit is contained in:
Yuri D'Elia 2022-08-30 12:54:47 +02:00 committed by DRracer
parent 9b9ce1733c
commit 10c524fdb3

View File

@ -7520,7 +7520,7 @@ Sigma_Exit:
#### Usage
M310 ; report values
M310 [ A ] ; autotune
M310 [ A ] [ F ] ; autotune
M310 [ S ] ; set 0=disable 1=enable
M310 [ I ] [ R ] ; set resistance at index
M310 [ P | C ] ; set power, capacitance
@ -7538,12 +7538,13 @@ Sigma_Exit:
- `W` - warning threshold (K/s; default in variant)
- `T` - ambient temperature correction (K; default in variant)
- `A` - autotune C+R values
- `F` - force model self-test state (0=off 1=on) during autotune using current values
*/
case 310:
{
// parse all parameters
float P = NAN, C = NAN, R = NAN, E = NAN, W = NAN, T = NAN;
int8_t I = -1, S = -1, B = -1, A = -1;
int8_t I = -1, S = -1, B = -1, A = -1, F = -1;
if(code_seen('C')) C = code_value();
if(code_seen('P')) P = code_value();
if(code_seen('I')) I = code_value_short();
@ -7554,6 +7555,7 @@ Sigma_Exit:
if(code_seen('W')) W = code_value();
if(code_seen('T')) T = code_value();
if(code_seen('A')) A = code_value_short();
if(code_seen('F')) F = code_value_short();
// report values if nothing has been requested
if(isnan(C) && isnan(P) && isnan(R) && isnan(E) && isnan(W) && isnan(T) && I < 0 && S < 0 && B < 0 && A < 0) {
@ -7570,7 +7572,7 @@ Sigma_Exit:
if(S >= 0) temp_model_set_enabled(S);
// run autotune
if(A >= 0) temp_model_autotune(A);
if(A >= 0) temp_model_autotune(A, F > 0);
}
break;
#endif