Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -rfc11115c26447a2da7b12f5f38ff0d4af06c579b -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision fc11115c26447a2da7b12f5f38ff0d4af06c579b) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -346,8 +346,14 @@ } else { - checkPersistentAlarm( ALARM_ID_RO_FLOW_TOO_LOW_WHILE_PRIMARY_HEATER_IS_ON, FALSE, 0.0, 0.0 ); - checkPersistentAlarm( ALARM_ID_DIALYSATE_FLOW_TOO_LOW_WHILE_TRIMMER_HEATER_IS_ON, FALSE, 0.0, 0.0 ); + if ( DG_PRIMARY_HEATER == heater ) + { + checkPersistentAlarm( ALARM_ID_RO_FLOW_TOO_LOW_WHILE_PRIMARY_HEATER_IS_ON, FALSE, 0.0, 0.0 ); + } + else + { + checkPersistentAlarm( ALARM_ID_DIALYSATE_FLOW_TOO_LOW_WHILE_TRIMMER_HEATER_IS_ON, FALSE, 0.0, 0.0 ); + } } } @@ -435,7 +441,7 @@ heatersStatus[ heater ].startHeaterSignal = FALSE; // Depending on which heater is called, go to different states - state = ( heater == DG_PRIMARY_HEATER ? HEATER_EXEC_STATE_PRIMARY_RAMP_TO_TARGET : HEATER_EXEC_STATE_TRIMMER_RAMP_TO_TARGET ); + state = ( DG_PRIMARY_HEATER == heater ? HEATER_EXEC_STATE_PRIMARY_RAMP_TO_TARGET : HEATER_EXEC_STATE_TRIMMER_RAMP_TO_TARGET ); } return state; @@ -656,17 +662,24 @@ *************************************************************************/ static void setHeaterDutyCycle( DG_HEATERS_T heater, F32 pwm ) { - if ( DG_PRIMARY_HEATER == heater ) + if ( heater < NUM_OF_DG_HEATERS ) { - setMainPrimaryHeaterPWM( pwm ); - setSmallPrimaryHeaterPWM( pwm ); + if ( DG_PRIMARY_HEATER == heater ) + { + setMainPrimaryHeaterPWM( pwm ); + setSmallPrimaryHeaterPWM( pwm ); + } + else if ( DG_TRIMMER_HEATER == heater ) + { + setTrimmerHeaterPWM( pwm ); + } + + heatersStatus[ heater ].dutyCycle = pwm; } - else if ( DG_TRIMMER_HEATER == heater ) + else { - setTrimmerHeaterPWM( pwm ); + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_HEATERS_INVALID_HEATER_ID_SELECTED, heater ); } - - heatersStatus[ heater ].dutyCycle = pwm; } /*********************************************************************//** @@ -833,9 +846,9 @@ { HEATERS_DATA_T data; - data.mainPrimayHeaterDC = heatersStatus[ DG_PRIMARY_HEATER ].dutyCycle * 100.0; // The duty cycle of the primary heater is divided into 2 parts and is applied to main // and small primary heaters. So they are always the same. + data.mainPrimayHeaterDC = heatersStatus[ DG_PRIMARY_HEATER ].dutyCycle * 100.0; data.smallPrimaryHeaterDC = heatersStatus[ DG_PRIMARY_HEATER ].dutyCycle * 100.0; data.trimmerHeaterDC = heatersStatus[ DG_TRIMMER_HEATER ].dutyCycle * 100.0; data.primaryTargetTemp = heatersStatus[ DG_PRIMARY_HEATER ].targetTemp;