Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r8a18b5d1fb4598c6b7facb3e7e233252941eaded -r7c8ec681f8c5dc44674893b5c3924a6203f2c8d0 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 8a18b5d1fb4598c6b7facb3e7e233252941eaded) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 7c8ec681f8c5dc44674893b5c3924a6203f2c8d0) @@ -62,6 +62,8 @@ // DG sensor data static F32 dgPressures[ NUM_OF_DG_PRESSURE_SENSORS ]; ///< Latest pressures reported by the DG. +static F32 dgDialysateTemp = 0.0; ///< Dialysate temperature reported by the DG. +static F32 dgRedundantDialysateTemp = 0.0; ///< Redundant dialysate temperature reported by the DG. static F32 dgPrimaryTempSet = 0.0; ///< Primary heater target temperature commanded. static F32 dgPrimaryTemp = 0.0; ///< Latest RO water temperature reported by the DG. static F32 dgTrimmerTempSet = 0.0; ///< Trimmer heater target temperature commanded. @@ -389,6 +391,23 @@ /*********************************************************************//** * @brief + * The setDialysateTemperatureReadings function sets the latest dialysate \n + * temperatures reported by the DG. + * @details + * Inputs : none + * Outputs : dgDialysateTemp, dgRedundantDialysateTemp + * @param temp1 : dialysate temperature reported by DG. + * @param temp2 : redundant dialysate temperature reported by DG. + * @return none + *************************************************************************/ +void setDialysateTemperatureReadings( F32 temp1, F32 temp2 ) +{ + dgDialysateTemp = temp1; + dgRedundantDialysateTemp = temp2; +} + +/*********************************************************************//** + * @brief * The setDGDialysateTemperatures function sets the latest temperature data \n * reported by the DG. * @details Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -r8a18b5d1fb4598c6b7facb3e7e233252941eaded -r7c8ec681f8c5dc44674893b5c3924a6203f2c8d0 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 8a18b5d1fb4598c6b7facb3e7e233252941eaded) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 7c8ec681f8c5dc44674893b5c3924a6203f2c8d0) @@ -67,6 +67,7 @@ U32 getDGDrainPumpRPMSetPt( void ); void setDGOpMode( U32 opMode, U32 subMode ); +void setDialysateTemperatureReadings( F32 temp1, F32 temp2 ); void setDGDialysateTemperatures( F32 primaryHtrTemp, F32 trimmerHtrTemp ); void setDGReservoirsData( DG_RESERVOIR_ID_T resID, U32 fillVol, U32 drainVol ); void setDGPressures( F32 roIn, F32 roOut, F32 drainIn, F32 drainOut ); Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -ra60ec05d359c0d3f014015e9080b6dbcef0fea28 -r7c8ec681f8c5dc44674893b5c3924a6203f2c8d0 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision a60ec05d359c0d3f014015e9080b6dbcef0fea28) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 7c8ec681f8c5dc44674893b5c3924a6203f2c8d0) @@ -1106,6 +1106,10 @@ handleFWVersionRequest( message ); break; + case MSG_ID_DG_TEMPERATURE_DATA: + handleDGTemperatureData( message ); + break; + case MSG_ID_RO_PUMP_DATA: handleROPumpData( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r8a18b5d1fb4598c6b7facb3e7e233252941eaded -r7c8ec681f8c5dc44674893b5c3924a6203f2c8d0 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 8a18b5d1fb4598c6b7facb3e7e233252941eaded) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 7c8ec681f8c5dc44674893b5c3924a6203f2c8d0) @@ -119,7 +119,7 @@ typedef struct { - DG_RESERVOIR_ID_T resID; + U32 resID; U32 setFillToVolumeMl; U32 setDrainToVolumeMl; } DG_RESERVOIRS_DATA_PAYLOAD_T; @@ -130,6 +130,22 @@ U32 adjustType; } UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T; +typedef struct +{ + F32 TPi; + F32 TPo; + F32 TD1; + F32 TD2; + F32 TRo; + F32 TDi; + F32 HtrPrimThermo; + F32 HtrTrimThermo; + F32 HtrPrimColdJunc; + F32 HtrTrimColdJunc; + F32 HtrPrimInternal; + F32 HtrTrimInternal; +} DG_TEMPERATURES_T; + #pragma pack(pop) // ********** private data ********** @@ -1256,10 +1272,34 @@ result = setNewLoadCellReadings( payload.res1PrimaryLoadCell, payload.res1BackupLoadCell, payload.res2PrimaryLoadCell, payload.res2BackupLoadCell ); } // TODO - what to do if invalid payload length? + // TODO - how to know if DG stops sending these? } /************************************************************************* * @brief + * The handleDGTemperatureData function handles a temperature readings \n + * broadcast message from the DG. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleDGTemperatureData( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(DG_TEMPERATURES_T) ) + { + DG_TEMPERATURES_T payload; + + memcpy( &payload, message->payload, sizeof(DG_TEMPERATURES_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 handleROPumpData function handles an RO pump data broadcast \n * message from the DG. * @details @@ -1341,7 +1381,7 @@ DG_RESERVOIRS_DATA_PAYLOAD_T payload; memcpy( &payload, message->payload, sizeof(DG_RESERVOIRS_DATA_PAYLOAD_T) ); - setDGReservoirsData( payload.resID, payload.setFillToVolumeMl, payload.setDrainToVolumeMl ); + setDGReservoirsData( (DG_RESERVOIR_ID_T)payload.resID, payload.setFillToVolumeMl, payload.setDrainToVolumeMl ); } // TODO - what to do if invalid payload length? } Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r477515fb4a6518b538fd218a1638ba2958e82d1c -r7c8ec681f8c5dc44674893b5c3924a6203f2c8d0 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 477515fb4a6518b538fd218a1638ba2958e82d1c) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 7c8ec681f8c5dc44674893b5c3924a6203f2c8d0) @@ -45,6 +45,9 @@ // MSG_ID_LOAD_CELL_READINGS void handleLoadCellReadingsFromDG( MESSAGE_T *message ); +// MSG_ID_DG_TEMPERATURE_DATA: +void handleDGTemperatureData( MESSAGE_T *message ); + // MSG_ID_RO_PUMP_DATA: void handleROPumpData( MESSAGE_T *message );