Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -rfba3daf7d2ab628bf90da7504b38d0b03f9e0bd9 -r710549dd068ceab73277d24ce4a546f99c0ded8d --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision fba3daf7d2ab628bf90da7504b38d0b03f9e0bd9) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 710549dd068ceab73277d24ce4a546f99c0ded8d) @@ -369,26 +369,26 @@ /*********************************************************************//** * @brief - * The getDialysateTemperature function gets the latest dialysate temperature. - * @details Inputs: dgDialysateTemp + * The getDGDisinfectsStates function returns the DG disinfects readings. + * @details Inputs: none * @details Outputs: none - * @return the current dialysate temperature + * @return the current DG disinfects readings *************************************************************************/ -F32 getDialysateTemperature( void ) +DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ) { - return dgDialysateTemp; + return disinfectsStatus; } /*********************************************************************//** * @brief - * The getDGDisinfectsStates function returns the DG disinfects readings. - * @details Inputs: none + * The getDialysateTemperature function gets the latest dialysate temperature. + * @details Inputs: dgDialysateTemp * @details Outputs: none - * @return the current DG disinfects readings + * @return the current dialysate temperature *************************************************************************/ -DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ) +F32 getDialysateTemperature( void ) { - return disinfectsStatus; + return dgDialysateTemp; } /*********************************************************************//** @@ -883,6 +883,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 Index: firmware/App/HDCommon.h =================================================================== diff -u -r07cdd44ffd0905cb115405e22cc7586585034e7f -r710549dd068ceab73277d24ce4a546f99c0ded8d --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 07cdd44ffd0905cb115405e22cc7586585034e7f) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 710549dd068ceab73277d24ce4a546f99c0ded8d) @@ -10,8 +10,8 @@ * @author (last) Dara Navaei * @date (last) 23-May-2022 * -* @author (original) Sean -* @date (original) 27-Feb-2020 +* @author (original) Sean +* @date (original) 27-Feb-2020 * ***************************************************************************/ @@ -25,7 +25,7 @@ #define HD_VERSION_MAJOR 0 #define HD_VERSION_MINOR 6 #define HD_VERSION_MICRO 0 -#define HD_VERSION_BUILD 47 +#define HD_VERSION_BUILD 318 // ********** development build switches ********** @@ -46,9 +46,9 @@ // #define DISABLE_UI_POST_TEST 1 // Disable the UI POST // TODO stays as a build switch until the calibration structure is updated with the build - #define SKIP_CAL_CHECK 1 // Implement software configuration + #define SKIP_CAL_CHECK 1 // Implement software configuration once the build switch is done - #include +#include #include #endif #endif Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rfba3daf7d2ab628bf90da7504b38d0b03f9e0bd9 -r710549dd068ceab73277d24ce4a546f99c0ded8d --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision fba3daf7d2ab628bf90da7504b38d0b03f9e0bd9) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 710549dd068ceab73277d24ce4a546f99c0ded8d) @@ -28,6 +28,7 @@ #include "Fans.h" #include "FPGA.h" #include "ModeStandby.h" +#include "ModeInitPOST.h" #include "OperationModes.h" #include "RTC.h" #include "SampleWater.h" @@ -2358,13 +2359,13 @@ { TEMPERATURE_SENSORS_DATA_T payload; - memcpy( &payload, message->payload, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); - setDialysateTemperatureReadings( payload.inletDialysate, payload.outletRedundant ); - } - // TODO - what to do if invalid payload length? - // TODO - how to know if DG stops sending these? -} - + memcpy( &payload, message->payload, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); + setDialysateTemperatureReadings( payload.TDi, payload.TRo ); + } + // TODO - what to do if invalid payload length? + // TODO - how to know if DG stops sending these? +} + /*********************************************************************//** * @brief * The handleDialysateFlowData function handles dialysate flow data broadcast @@ -5154,6 +5155,7 @@ if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) { result = testSetBatteryRemainingPercentOverride( payload.state.u32 ); @@ -7029,15 +7031,26 @@ { BOOL status = FALSE; HD_OP_MODE_T currentMode = getCurrentOperationMode(); + DG_OP_MODE_T currentDGMode = getDGOpMode(); REQUEST_REJECT_REASON_CODE_T reject; if ( 0 == message->hdr.payloadLen ) { if ( ( MODE_STAN == currentMode ) || ( MODE_FAUL == currentMode ) ) { - status = TRUE; + requestNewOperationMode( MODE_SERV ); - reject = REQUEST_REJECT_REASON_NONE; + + if ( (DG_MODE_STAN == currentDGMode) || (DG_MODE_FAUL == currentDGMode) ) + { + status = TRUE; + cmdSetDGToServiceMode(); + reject = REQUEST_REJECT_REASON_NONE; + } + else + { + reject = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; + } } else { @@ -7315,4 +7328,28 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The sendDGServiceModeRequest function constructs a service mode request msg + * to the DG and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: DG Service mode request msg constructed and queued. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGServiceModeRequest() +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_REQUEST_DG_SERVICE_MODE; + msg.hdr.payloadLen = 0; + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_REQUIRED ); + + return result; +} + /**@}*/