Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r7cf04dc00d1242aba62f3cd4e4bcb19f1e83ebc6 -r94dab74a6432263dc4569e0cf8f9fa0b01bf1917 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 7cf04dc00d1242aba62f3cd4e4bcb19f1e83ebc6) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 94dab74a6432263dc4569e0cf8f9fa0b01bf1917) @@ -7,13 +7,15 @@ * * @file DGInterface.c * -* @author (last) Darren Cox -* @date (last) 10-Mar-2022 +* @author (last) Michael Garthwaite +* @date (last) 08-Aug-2022 * * @author (original) Sean * @date (original) 08-Apr-2020 * ***************************************************************************/ + +#include // To check for NaN #include "DialInFlow.h" #include "Dialysis.h" @@ -135,6 +137,7 @@ for ( j = 0; j < SIZE_OF_LARGE_LOAD_CELL_AVG; j++ ) { lgLoadCellReadings[ i ][ j ] = 0.0; + lgLoadCellBackupReadings[ i ][ j ] = 0.0; } } @@ -481,6 +484,12 @@ *************************************************************************/ void setDialysateFlowData( F32 flowRate ) { + // Check if the sent value by DG is a NaN + if ( isnan( flowRate ) ) + { + flowRate = 0.0; + } + dgDialysateFlowRateMlMin = flowRate; dgDialysateFlowDataFreshFlag = TRUE; } @@ -519,7 +528,7 @@ lgLoadCellReadingsTotal[ res ] += wt; lgFilteredReservoirWeightInGrams[ res ] = lgLoadCellReadingsTotal[ res ] / (F32)SIZE_OF_LARGE_LOAD_CELL_AVG; - wt = ( res == DG_RESERVOIR_1 ? res1Primary : res2Primary ); + wt = ( res == DG_RESERVOIR_1 ? res1Backup : res2Backup ); lgLoadCellBackupReadingsTotal[ res ] -= lgLoadCellBackupReadings[ res ][ lgLoadCellReadingsIdx ]; lgLoadCellBackupReadings[ res ][ lgLoadCellReadingsIdx ] = wt; lgLoadCellBackupReadingsTotal[ res ] += wt; @@ -863,6 +872,19 @@ /*********************************************************************//** * @brief + * The cmdSetDGToServiceMode function sends a request to DG to transition + * to service mode. + * @details Inputs: none + * @details Outputs: none + * @return none + *************************************************************************/ +void cmdSetDGToServiceMode( void ) +{ + sendDGServiceModeRequest(); +} + +/*********************************************************************//** + * @brief * The handleDGCommandResponse function processes the latest DG command response. * @details Inputs: none * @details Outputs: process command response from DG