added check so that we dont re-enter halt
authorArthur Wolf <wolf.arthur@gmail.com>
Mon, 23 May 2016 21:08:44 +0000 (23:08 +0200)
committerArthur Wolf <wolf.arthur@gmail.com>
Mon, 23 May 2016 21:08:44 +0000 (23:08 +0200)
src/modules/tools/temperaturecontrol/TemperatureControl.cpp

index 72f85c3..cd40b4b 100644 (file)
@@ -516,6 +516,8 @@ void TemperatureControl::on_second_tick(void *argument)
         THEKERNEL->streams->printf("%s:%3.1f /%3.1f @%d\n", designator.c_str(), get_temperature(), ((target_temperature <= 0) ? 0.0 : target_temperature), o);
 
     // Check whether or not there is a temperature runaway issue, if so stop everything and report it
+    if(THEKERNEL->is_halted()) return;
+    
     if( this->target_temperature <= 0 ){ // If we are not trying to heat, state is 0
         this->runaway_state = 0;
         this->runaway_timer = 0;
@@ -533,12 +535,12 @@ void TemperatureControl::on_second_tick(void *argument)
                 break;
             case 2: // If we are in state 2 ( target temperature reached ), check for thermal runaway
                 // If the temperature is outside the acceptable range
-                if( fabs( this->get_temperature() - this->target_temperature ) > 10 ){ // 10 degrees, should be a configurable value
+                if( fabs( this->get_temperature() - this->target_temperature ) > 20 ){ // 10 degrees, should be a configurable value
                     // Increase the timer, aka « One more second with a problem maybe occuring »
                     this->runaway_timer++;
 
                     // If the timer has a too large value ( we have been too long outside the desired temperature range )
-                    if( this->runaway_timer > 15 ){ // 15 seconds, should be a configurable value
+                    if( this->runaway_timer > 10 ){ // 15 seconds, should be a configurable value
                     
                         THEKERNEL->streams->printf("Error: Temperature runaway ! Check whether the heater controller is failing HIGH, or the temperature sensor is detached. IMMEDIATELY TURN OFF POWER\n");
                         THEKERNEL->streams->printf("HALT asserted - reset or M999 required\n");