Index: firmware/App/Modes/ModeGenIdle.c =================================================================== diff -u -r6f434374a54fb71ab32421aad2a17e9a848e0d8c -r6952b2201dff87a6a20282c759c890580e3fd1db --- firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision 6f434374a54fb71ab32421aad2a17e9a848e0d8c) +++ firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision 6952b2201dff87a6a20282c759c890580e3fd1db) @@ -68,6 +68,7 @@ BAD_FILL_SUBSTATES_PUB_INTERVAL, 0, 0 }; ///< Interval (in ms) at which to publish bad fill sub-states to CAN bus. static F32 initialReservoirWeight; ///< Initial weight of inactive reservoir in Gen Idle mode. +static DG_RESERVOIR_ID_T inactiveReservoir; ///< Inactive reservoir // ********** private function prototypes ********** @@ -142,7 +143,8 @@ setCPLDCleanLEDColor( CPLD_CLEAN_LED_OFF ); - initialReservoirWeight = getReservoirWeight( getInactiveReservoir() ); + inactiveReservoir = getInactiveReservoir(); + initialReservoirWeight = getReservoirWeight( inactiveReservoir ); return genIdleState; } @@ -316,6 +318,13 @@ startFillCmd( getTargetFillVolumeML(), getTargetFillFlowRateLPM() ); } + if ( getInactiveReservoir() != inactiveReservoir ) + { + // Inactive Reservoir changed, update the start value + inactiveReservoir = getInactiveReservoir(); + initialReservoirWeight = getReservoirWeight( inactiveReservoir ); + } + // Check for unwanted filling if ( reservoirWeight > ( initialReservoirWeight + MAX_IDLE_RSVR_WEIGHT_GAIN_ML ) ) {