Index: firmware/App/Controllers/AirPump.c =================================================================== diff -u -r069dee3a2428d3c6bb281db1844a372ae6e2063a -re4eceb1ac6e8091d10e0fab49d2d5a9c5e5f1c67 --- firmware/App/Controllers/AirPump.c (.../AirPump.c) (revision 069dee3a2428d3c6bb281db1844a372ae6e2063a) +++ firmware/App/Controllers/AirPump.c (.../AirPump.c) (revision e4eceb1ac6e8091d10e0fab49d2d5a9c5e5f1c67) @@ -8,7 +8,7 @@ * @file AirPump.c * * @author (last) Varshini Nagabooshanam -* @date (last) 02-Jul-2026 +* @date (last) 18-Jun-2026 * * @author (original) Sean Nash * @date (original) 19-Sep-2024 @@ -35,8 +35,6 @@ #define AIR_PUMP_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Air pump data publish interval. #define DATA_PUBLISH_COUNTER_START_COUNT 13 ///< Air pump data publish start counter. #define AIR_PUMP_STALL_PERSISTENCE ( 150 / TASK_GENERAL_INTERVAL ) ///< Stall duration before alarm (150 ms) -#define AIR_PUMP_STALL_START_DELAY_MS 200 ///< Delay before evaluating stall condition -#define AIR_PUMP_STALL_START_DELAY_COUNT ( AIR_PUMP_STALL_START_DELAY_MS / TASK_GENERAL_INTERVAL ) ///< Air pump stall delay count interval #pragma pack(push, 1) /// Payload record structure for air pump test set command message payload. @@ -51,7 +49,6 @@ static AIR_PUMP_STATE_T currentAirPumpState; ///< Current air pump control state. static U08 airPumpStallCounter; ///< Air pump stall counter -static U08 airPumpStartDelayCounter; ///< Delay before evaluating air pump stall condition static U16 currentAirPumpRPM; ///< Current air pump RPM static F32 currentAirPumpPowerLevel; ///< Current air pump power level setting in % duty cycle (0..100%). static U32 airPumpDataPublicationTimerCounter; ///< Air pump data broadcast timer counter. @@ -83,7 +80,6 @@ currentAirPumpPowerLevel = AIR_PUMP_MOTOR_OFF; currentAirPumpRPM = 0; airPumpStallCounter = 0; - airPumpStartDelayCounter = 0; airPumpDataPublishInterval.data = AIR_PUMP_DATA_PUB_INTERVAL; airPumpDataPublishInterval.ovData = AIR_PUMP_DATA_PUB_INTERVAL; airPumpDataPublishInterval.ovInitData = AIR_PUMP_DATA_PUB_INTERVAL; @@ -247,36 +243,22 @@ *************************************************************************/ static void checkAirPumpStallCondition( void ) { - if ( ( AIR_PUMP_STATE_ON == currentAirPumpState ) && ( currentAirPumpPowerLevel > 0 ) ) - { - // Allow RPM time to populate before evaluating stall condition - if ( airPumpStartDelayCounter < AIR_PUMP_STALL_START_DELAY_COUNT ) - { - airPumpStartDelayCounter++; - airPumpStallCounter = 0; - } - else if ( 0 == currentAirPumpRPM ) - { - // Air pump commanded on but RPM remains zero - if ( ++airPumpStallCounter >= AIR_PUMP_STALL_PERSISTENCE ) - { - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_AIR_PUMP_STALL, currentAirPumpPowerLevel, currentAirPumpRPM ); - // Stop H12 air pump - setAirPumpState( AIR_PUMP_STATE_OFF, AIR_PUMP_MOTOR_OFF ); - } - } - else - { - // RPM detected, clear stall counter - airPumpStallCounter = 0; - } - } - else - { - // Pump is off, reset counters - airPumpStartDelayCounter = 0; - airPumpStallCounter = 0; - } + if ( ( currentAirPumpPowerLevel > 0 ) && ( currentAirPumpRPM == 0 ) ) + { + // we are commanding air pump to run but zero measured pump speed indicates it is not running + if ( ++airPumpStallCounter >= AIR_PUMP_STALL_PERSISTENCE ) + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_AIR_PUMP_STALL, currentAirPumpPowerLevel, currentAirPumpRPM ); + // Stop H12 air pump + setAirPumpState( AIR_PUMP_STATE_OFF, AIR_PUMP_MOTOR_OFF ); + // Stop air trap control + endAirTrapControl(); + } + } + else + { + airPumpStallCounter = 0; + } } /*********************************************************************//**