remove fan error simulation automaton
This commit is contained in:
parent
6755791778
commit
09fee4e64d
|
|
@ -489,38 +489,6 @@ void countFanSpeed()
|
||||||
fan_edge_counter[1] = 0;
|
fan_edge_counter[1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define SIMULATE_FAN_ERRORS
|
|
||||||
#ifdef SIMULATE_FAN_ERRORS
|
|
||||||
struct FanSpeedErrorSimulator {
|
|
||||||
unsigned long lastMillis = 0;
|
|
||||||
bool state = false; // zatim mam 0 - klid, 1 reportuju chybu
|
|
||||||
//! @return pocet simulovanych chyb
|
|
||||||
inline uint8_t step(){
|
|
||||||
unsigned long ms = _millis();
|
|
||||||
switch(state){
|
|
||||||
case false:
|
|
||||||
if( (ms - lastMillis) > 120000UL ){ // funkcni ventilator chci 2 minuty
|
|
||||||
state = true;
|
|
||||||
lastMillis = ms;
|
|
||||||
SERIAL_ECHOLNPGM("SIM Fan error");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case true:
|
|
||||||
if( (ms - lastMillis) > 20000UL ){ // vypadek ventilatoru chci uz 20s,
|
|
||||||
//abych stihl udelat pokusnej resume print, kdyz jeste jsou rozbity vetraky
|
|
||||||
state = false;
|
|
||||||
lastMillis = ms;
|
|
||||||
SERIAL_ECHOLNPGM("SIM Fan ok");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return state ? 20 : 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static FanSpeedErrorSimulator fanSpeedErrorSimulator;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void checkFanSpeed()
|
void checkFanSpeed()
|
||||||
{
|
{
|
||||||
uint8_t max_print_fan_errors = 0;
|
uint8_t max_print_fan_errors = 0;
|
||||||
|
|
@ -544,10 +512,6 @@ void checkFanSpeed()
|
||||||
else fan_speed_errors[1] = 0;
|
else fan_speed_errors[1] = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SIMULATE_FAN_ERRORS
|
|
||||||
fan_speed_errors[0] = fanSpeedErrorSimulator.step();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// drop the fan_check_error flag when both fans are ok
|
// drop the fan_check_error flag when both fans are ok
|
||||||
if( fan_speed_errors[0] == 0 && fan_speed_errors[1] == 0 && fan_check_error == EFCE_REPORTED){
|
if( fan_speed_errors[0] == 0 && fan_speed_errors[1] == 0 && fan_check_error == EFCE_REPORTED){
|
||||||
// we may even send some info to the LCD from here
|
// we may even send some info to the LCD from here
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue