Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r78cee9347b3766ac7c14d413ed848be758c7e9cd -r3f2b9de757500da37e0ed8881e4e906d94f3076c --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 78cee9347b3766ac7c14d413ed848be758c7e9cd) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 3f2b9de757500da37e0ed8881e4e906d94f3076c) @@ -256,7 +256,7 @@ { if ( DG_RECIRCULATE_MODE_STATE_RECIRC_WATER == dgSubMode ) { - cmdStartDGDrain( DRAIN_RESERVOIR_TO_VOLUME_ML, FALSE ); + cmdStartDGDrain( DRAIN_RESERVOIR_TO_VOLUME_ML, TRUE ); } } else if ( DG_MODE_DRAI == dgOpMode ) @@ -543,6 +543,18 @@ /*********************************************************************//** * @brief + * The getDialysateTemperature function gets the latest dialysate temperature. + * @details Inputs: dgDialysateTemp + * @details Outputs: none + * @return the current dialysate temperature + *************************************************************************/ +F32 getDialysateTemperature( void ) +{ + return dgDialysateTemp; +} + +/*********************************************************************//** + * @brief * The getDGDisinfectsStates function returns the DG disinfects readings. * @details Inputs: none * @details Outputs: disinfectsStatus @@ -554,8 +566,8 @@ } /*********************************************************************//** - * The getReservoirWeight function gets the load cell weight of a given - * reservoir. + * @brief + * The getReservoirWeight function gets the load cell weight of a given reservoir. * @details Inputs: loadCellWeightInGrams[] * @details Outputs: none * @param resID ID of reservoir to get weight for Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -r91aa11a47f3b3c744cbbfd9e9c1bd240263aa1bd -r3f2b9de757500da37e0ed8881e4e906d94f3076c --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 91aa11a47f3b3c744cbbfd9e9c1bd240263aa1bd) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 3f2b9de757500da37e0ed8881e4e906d94f3076c) @@ -82,19 +82,31 @@ /// Payload record structure for DG temperature sensors data message. typedef struct { - F32 TPi; ///< Inlet primary heaters temperature sensor - F32 TPo; ///< Outlet primary heaters temperature sensor - F32 TD1; ///< Conductivity sensor 1 temperature sensor - F32 TD2; ///< Conductivity sensor 2 temperature sensor - F32 TRo; ///< Outlet redundant temperature sensor - F32 TDi; ///< Inlet dialysate temperature sensor - F32 HtrPrimThermo; ///< Primary heaters internal temperature sensor - F32 HtrTrimThermo; ///< Trimmer heater internal temperature sensor - F32 HtrPrimColdJunc; ///< Primary heaters cold junction temperature sensor - F32 HtrTrimColdJunc; ///< Trimmer heater cold junction temperature sensor - F32 HtrPrimInternal; ///< Primary heaters internal temperature - F32 HtrTrimInternal; ///< Trimmer heater internal temperature -} DG_TEMPERATURES_T; + F32 inletPrimaryHeater; ///< Inlet primary heater temperature sensor + F32 outletPrimaryHeater; ///< Outlet primary heater temperature sensor + F32 conductivitySensor1; ///< Conductivity sensor 1 temperature sensor + F32 conductivitySensor2; ///< Conductivity sensor 2 temperature sensor + F32 outletRedundant; ///< Outlet redundant temperature sensor + F32 inletDialysate; ///< Inlet dialysate temperature sensor + F32 primaryHeaterThermocouple; ///< Primary heaters thermocouple sensor + F32 trimmerHeaterThermocouple; ///< Trimmer heater thermocouple sensor + F32 priamyHeaterColdjunction; ///< Primary heaters cold junction temperature sensor + F32 trimmerHeaterColdjunction; ///< Trimmer heater cold junction temperature sensor + F32 primaryHeaterInternal; ///< Primary heaters internal temperature (calculated from thermocouple and cold junction) + F32 trimmerHeaterInternal; ///< Trimmer heater internal temperature (calculated from thermocouple and cold junction) + F32 fpgaBoard; ///< FPGA board temperature sensor + F32 loadCellA1B1; ///< Load cell A1/B1 temperature sensor + F32 loadCellA2B2; ///< Load cell A2/B2 temperature sensor + F32 internalTHDORTD; ///< THDo RTD channel temperature sensor + F32 internalTDIRTD; ///< TDI RTD channel temperature sensor + F32 internalCondSnsrTemp; ///< Conductivity Sensor internal temperature sensor + U32 primaryThermoCoupleRaw; ///< Primary heaters thermocouple raw ADC value + U32 primaryColdjuncRaw; ///< Primary heaters cold junction raw ADC value + U32 trimmerThermoCoupleRaw; ///< Trimmer heater thermocouple raw ADC value + U32 trimmerColdjuncRaw; ///< Trimmer heater cold junction raw ADC value + S32 cond1Raw; ///< Conductivity sensor 1 raw temperature ADC value + S32 cond2Raw; ///< Conductivity sensor 2 raw temperature ADC value +} TEMPERATURE_SENSORS_DATA_T; /// Payload record structure for a drain reservoir command message. typedef struct @@ -141,6 +153,7 @@ F32 getLoadCellWeight( LOAD_CELL_ID_T loadCellID ); F32 getReservoirWeight( DG_RESERVOIR_ID_T resID ); F32 getReservoirWeightLargeFilter( DG_RESERVOIR_ID_T resID ); +F32 getDialysateTemperature( void ); DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ); void setDGOpMode( U32 opMode, U32 subMode ); Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -r8e08352e9e7d8749d8f093c6bc57e6dbc32605d5 -r3f2b9de757500da37e0ed8881e4e906d94f3076c --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 8e08352e9e7d8749d8f093c6bc57e6dbc32605d5) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 3f2b9de757500da37e0ed8881e4e906d94f3076c) @@ -14,10 +14,12 @@ * @date (original) 02-Mar-2021 * ***************************************************************************/ +#include #include "AlarmMgmt.h" #include "FPGA.h" -#include "ModeTreatmentParams.h" +#include "ModeTreatmentParams.h" +#include "NVDataMgmt.h" #include "OperationModes.h" #include "PersistentAlarm.h" #include "SafetyShutdown.h" @@ -216,6 +218,7 @@ static U32 syringePumpStallCtr; ///< Counts time when position is not changing during ramp. static U32 syringePumpStallRetryCount; ///< Counts pump ramp up stall retries. +static HD_HEPARIN_FORCE_SENSOR_CAL_RECORD_T forceSensorCalRecord; ///< HD heparin force sensor calibration record. // ********** private function prototypes ********** @@ -251,6 +254,7 @@ static BOOL checkVolumeVsSafetyVolume( BOOL stopPump, F32 pctMargin ); static BOOL checkForStall( BOOL stopPump ); static void publishSyringePumpData( void ); +static BOOL processCalibrationData( void ); /*********************************************************************//** * @brief @@ -946,6 +950,15 @@ *************************************************************************/ static void execSyringePumpMonitor( void ) { + F32 forceSensorBeforCal = 0.0; + + // Check if a new calibration is available + if ( TRUE == isNewCalibrationRecordAvailable() ) + { + // Get the new calibration data and check its validity + processCalibrationData(); + } + S32 encPosition = getFPGASyringePumpEncoderPosition(); // Get latest FPGA status @@ -957,7 +970,14 @@ // Get latest ADC data and convert to V syringePumpMeasHome.data = ( (F32)getFPGASyringePumpADCChannel2() * SYRINGE_PUMP_ADC_REF_V ) / SYRINGE_PUMP_ADC_FULL_SCALE_BITS; syringePumpMeasSyringeDetectionSwitch.data = ( (F32)getFPGASyringePumpADCChannel1() * SYRINGE_PUMP_ADC_REF_V ) / SYRINGE_PUMP_ADC_FULL_SCALE_BITS; - syringePumpMeasForce.data = ( (F32)getFPGASyringePumpADCChannel0() * SYRINGE_PUMP_ADC_REF_V ) / SYRINGE_PUMP_ADC_FULL_SCALE_BITS; + + forceSensorBeforCal = ( (F32)getFPGASyringePumpADCChannel0() * SYRINGE_PUMP_ADC_REF_V ) / SYRINGE_PUMP_ADC_FULL_SCALE_BITS; + syringePumpMeasForce.data = pow(forceSensorBeforCal, 4) * forceSensorCalRecord.hdHeparinForceSensor.fourthOrderCoeff + + pow(forceSensorBeforCal, 3) * forceSensorCalRecord.hdHeparinForceSensor.thirdOrderCoeff + + pow(forceSensorBeforCal, 2) * forceSensorCalRecord.hdHeparinForceSensor.secondOrderCoeff + + forceSensorBeforCal * forceSensorCalRecord.hdHeparinForceSensor.gain + + forceSensorCalRecord.hdHeparinForceSensor.offset; + // Apply home offset to encoder position syringePumpLastPosition = getSyringePumpPosition(); syringePumpPosition.data = encPosition - syringePumpHomePositionOffset; @@ -1059,6 +1079,33 @@ // Publish syringe pump data on interval publishSyringePumpData(); +} + +/*********************************************************************//** + * @brief + * The execSyringePumpSelfTest function executes the state machine for the + * syringe pump self-test. + * @details Inputs: none + * @details Outputs: none + * @return the current state of the BloodFlow self-test. + *************************************************************************/ +SELF_TEST_STATUS_T execSyringePumpSelfTest( void ) +{ + SELF_TEST_STATUS_T result = SELF_TEST_STATUS_IN_PROGRESS; + + BOOL calStatus = processCalibrationData(); + + if ( TRUE == calStatus ) + { + result = SELF_TEST_STATUS_PASSED; + } + else + { + result = SELF_TEST_STATUS_FAILED; + activateAlarmNoData( ALARM_ID_HD_SYRINGE_PUMP_SELF_TEST_FAILURE ); + } + + return result; } /*********************************************************************//** @@ -1813,6 +1860,43 @@ broadcastHeparinData( data.syringePumpVolumeDelivered ); syringePumpDataPublicationTimerCounter = 0; } +} + +/*********************************************************************//** + * @brief + * The processCalibrationData function gets the calibration data and makes + * sure it is valid by checking the calibration date. The calibration date + * should not be 0. + * @details Inputs: none + * @details Outputs: forceSensorCalRecord + * @return TRUE if the calibration record is valid, otherwise FALSE + *************************************************************************/ +static BOOL processCalibrationData( void ) +{ + BOOL status = TRUE; + + // Get the calibration record from NVDataMgmt + HD_HEPARIN_FORCE_SENSOR_CAL_RECORD_T calData = getHDHeparinForceSensorCalibrationRecord(); + + // Check if the calibration data that was received from NVDataMgmt is legitimate + // The calibration date item should not be zero. If the calibration date is 0, + // then the heparin force sensors data is not stored in the NV memory or it was corrupted. + if ( 0 == calData.hdHeparinForceSensor.calibrationTime ) + { +#ifndef SKIP_CAL_CHECK + activateAlarmNoData( ALARM_ID_HD_HEPARIN_FORCE_SENSOR_INVALID_CAL_RECORD ); + status = FALSE; +#endif + } + + // The calibration data was valid, update the local copy + forceSensorCalRecord.hdHeparinForceSensor.fourthOrderCoeff = calData.hdHeparinForceSensor.fourthOrderCoeff; + forceSensorCalRecord.hdHeparinForceSensor.thirdOrderCoeff = calData.hdHeparinForceSensor.thirdOrderCoeff; + forceSensorCalRecord.hdHeparinForceSensor.secondOrderCoeff = calData.hdHeparinForceSensor.secondOrderCoeff; + forceSensorCalRecord.hdHeparinForceSensor.gain = calData.hdHeparinForceSensor.gain; + forceSensorCalRecord.hdHeparinForceSensor.offset = calData.hdHeparinForceSensor.offset; + + return status; } Index: firmware/App/HDCommon.h =================================================================== diff -u -rbad0628d7a6484bfa8a550fd2a589f56d0a6c53d -r3f2b9de757500da37e0ed8881e4e906d94f3076c --- firmware/App/HDCommon.h (.../HDCommon.h) (revision bad0628d7a6484bfa8a550fd2a589f56d0a6c53d) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 3f2b9de757500da37e0ed8881e4e906d94f3076c) @@ -23,9 +23,9 @@ // ********** version ********** #define HD_VERSION_MAJOR 0 -#define HD_VERSION_MINOR 5 -#define HD_VERSION_MICRO 0 -#define HD_VERSION_BUILD 9037 +#define HD_VERSION_MINOR 6 +#define HD_VERSION_MICRO 5 +#define HD_VERSION_BUILD 15 // ********** development build switches ********** @@ -40,6 +40,7 @@ #define DISABLE_ALARM_AUDIO 1 // Disable alarm audio #define SKIP_POST 1 // Skip POST tests - all pass // #define DONT_SKIP_NV_POST 1 // Do not skip NV Data POST + #define IGNORE_CAL_TIMESTAMP 1 // Ignores calibration time stamp by setting an epoch time temporarily // #define USE_LIBRARY_TIME_FUNCTIONS 1 // Use the C library functions mktime() and gmtime() for epoch<=>date conversions #define DISABLE_AIR_TRAP_LEVELING_ALARM 1 // Disable air trap level control alarms // #define DISABLE_3WAY_VALVES 1 // Disable 3-way valves @@ -53,10 +54,10 @@ // #define DISABLE_PUMP_DIRECTION_CHECKS 1 // Do not error on HD pump direction checks #define DISABLE_SYRINGE_PUMP 1 // Disable syringe pump functionality #define ALWAYS_ALLOW_SYRINGE_PUMP_CMDS 1 // Allow syringe pump commands at any time except when pump is busy -// #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure checks + #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure checks // #define DISABLE_UF_ALARMS 1 // Do not error on HD ultrafiltration checks // #define DISABLE_VALVE_ALARMS 1 // Do not error on HD valve position - #define DISABLE_CAL_CHECK 1 // Disable calibration checks + #define SKIP_CAL_CHECK 1 // #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) // #define RAW_FLOW_SENSOR_DATA 1 // Test build will not filter flow sensor data // #define READ_FPGA_ASYNC_DATA 1 // Test build reads non-priority register page every other time Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r69b93e39861c5493d273f25d9e43cacd0b5819e2 -r3f2b9de757500da37e0ed8881e4e906d94f3076c --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 69b93e39861c5493d273f25d9e43cacd0b5819e2) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 3f2b9de757500da37e0ed8881e4e906d94f3076c) @@ -17,6 +17,7 @@ #include "Accel.h" #include "AlarmLamp.h" +#include "Battery.h" #include "BloodFlow.h" #include "Buttons.h" #include "Compatible.h" @@ -129,12 +130,6 @@ postState = handlePOSTStatus( testStatus ); break; - case POST_STATE_BATTERY: - // TODO implement the battery self test - testStatus = SELF_TEST_STATUS_PASSED; - postState = handlePOSTStatus( testStatus ); - break; - case POST_STATE_WATCHDOG: testStatus = execWatchdogTest(); postState = handlePOSTStatus( testStatus ); Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r1eac55db00559965a7dc6752fc42a2c54d56f4b9 -r3f2b9de757500da37e0ed8881e4e906d94f3076c --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 1eac55db00559965a7dc6752fc42a2c54d56f4b9) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 3f2b9de757500da37e0ed8881e4e906d94f3076c) @@ -17,6 +17,7 @@ #include "AirTrap.h" #include "AlarmLamp.h" +#include "Battery.h" #include "BloodFlow.h" #include "Buttons.h" #include "DGInterface.h" @@ -291,6 +292,11 @@ rejReason = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; } + if ( FALSE == isBatteryCharged() ) + { + rejReason = REQUEST_REJECT_REASON_BATTERY_IS_NOT_CHARGED; + } + if ( REQUEST_REJECT_REASON_NONE == rejReason ) { result = TRUE; Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rdbfeaf78c05fc922eba6ff8c7a31ba8a9392c642 -r3f2b9de757500da37e0ed8881e4e906d94f3076c --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision dbfeaf78c05fc922eba6ff8c7a31ba8a9392c642) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 3f2b9de757500da37e0ed8881e4e906d94f3076c) @@ -1080,8 +1080,8 @@ { U16 msgID; - memcpy( &msgID, (U08*)&pendingAckList[ i ].msg[ sizeof( U08 ) + sizeof( U16) ], sizeof( U16 ) ); - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_CAN_MESSAGE_NOT_ACKED, (U32)msgID ); + memcpy( &msgID, (U08*)&pendingAckList[ i ].msg[ sizeof( U08 ) + sizeof( U16) ], sizeof( U16 ) ); + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_CAN_MESSAGE_NOT_ACKED, (U32)msgID ); pendingAckList[ i ].used = FALSE; // Take pending message off of list } } @@ -1156,7 +1156,8 @@ break; case MSG_ID_REQUEST_FW_VERSIONS: - handleFWVersionRequest( message ); + handleFWVersionRequest( message ); + handleHDSerialNumberRequest(); break; case MSG_ID_DG_TEMPERATURE_DATA: @@ -1271,10 +1272,26 @@ handleUITreatmentLogDataRequest( message ); break; + case MSG_ID_UI_DISINFECT_REQUEST: + handleUIDisinfectRequest( message ); + break; + case MSG_ID_DG_COMMAND_RESPONSE: handleDGCmdResp( message ); break; + case MSG_ID_DG_FLUSH_DATA: + handleFlushUIStateReadingFromDG( message ); + break; + + case MSG_ID_DG_HEAT_DISINFECT_DATA: + handleHeatDisinfectUIStateReadingFromDG( message ); + break; + + case MSG_ID_DG_CHEM_DISINFECT_DATA: + handleChemDisinfectUIStateReadingFromDG( message ); + break; + case MSG_ID_UI_HD_SET_RTC_REQUEST: handleUIClockSyncRequest( message ); break; @@ -1291,6 +1308,19 @@ handleUIActiveAlarmsListRequest( message ); break; + case MSG_ID_HD_SET_STANDBY_DISINFECT_SUB_MODE_REQUEST: + handleSetHDStandbyDisinfectSubmodeRequest( message ); + break; + + case MSG_ID_UI_REQUEST_SERVICE_INFO: + handleHDServiceScheduleRequest( message ); + break; + + case MSG_ID_REQUEST_HD_USAGE_INFO: + handleHDUsageInfoRequest( message ); + break; + + // NOTE: this always must be the last case case MSG_ID_TESTER_LOGIN_REQUEST: handleTesterLogInRequest( message ); break; @@ -1559,6 +1589,14 @@ handleBubbleSelfTestRequest( message ); break; + case MSG_ID_HD_SWITCHES_STATUS_OVERRIDE: + handleSetSwitchesStatusOverrideRequest( message ); + break; + + case MSG_ID_HD_SWITCHES_PUBLISH_INTERVAL_OVERRIDE: + handleTestSwitchesPublishIntervalOverrideRequest( message ); + break; + case MSG_ID_HD_BATTERY_REMAINING_PERCENT_OVERRIDE: handleBatteryRemainingPercentOverrideRequest( message ); break; @@ -1603,6 +1641,10 @@ handleTestSyringePumpMeasuredVolumeOverrideRequest( message ); break; + case MSG_ID_HD_VALVES_CURRENT_OVERRIDE: + handleTestValvesCurrentOverrideRequest( message ); + break; + case MSG_ID_HD_MONITORED_VOLTAGES_SEND_INTERVAL_OVERRIDE: handleTestMonitoredVoltagesSendIntervalOverrideRequest( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r7da76d7131d824ab15f58857eeeedcf128e57391 -r3f2b9de757500da37e0ed8881e4e906d94f3076c --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 7da76d7131d824ab15f58857eeeedcf128e57391) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 3f2b9de757500da37e0ed8881e4e906d94f3076c) @@ -21,6 +21,7 @@ #include "Accel.h" #include "AlarmLamp.h" +#include "Battery.h" #include "Buttons.h" #include "ConsumableSelfTest.h" #include "FPGA.h" @@ -668,7 +669,7 @@ { if ( 0 == message->hdr.payloadLen ) { - handleTreatmentLogDataRequest(); + sendTreatmentLogDataToUI(); } else { @@ -927,9 +928,75 @@ // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } - + /*********************************************************************//** * @brief + * The sendTreatmentLogAlarmEventData function constructs a treatment log + * alarm event data message for UI and queues the msg for transmit on the + * appropriate CAN channel. + * @details Inputs: none + * @details Outputs: Treatment log alarm event data msg constructed and queued. + * @param alarmID ID of the occurred alarm + * @param almData1 data associates with the alarm + * @param almData1 data associates with the alarm + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendTreatmentLogAlarmEventData( ALARM_ID_T alarmID, ALARM_DATA_T almData1, ALARM_DATA_T almData2 ) +{ + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + U32 id = (U32)alarmID; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_TREATMENT_LOG_ALARM_EVENT; + msg.hdr.payloadLen = sizeof( U32 ) + 2 * sizeof( F32 ); + + memcpy( payloadPtr, &id, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &almData1.data, sizeof( F32 ) ); + payloadPtr += sizeof( F32 ); + memcpy( payloadPtr, &almData2.data, sizeof( F32 ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); +} + +/*********************************************************************//** + * @brief + * The sendTreatmentLogEventData function constructs a treatment log parameter + * change event data message for UI and queues the msg for transmit on the + * appropriate CAN channel. + * @details Inputs: none + * @details Outputs: Treatment log event data msg constructed and queued. + * @param event ID of parameter change event + * @param oldValue parameter change event old data value + * @param newValue parameter change event new data value + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendTreatmentLogEventData( EVENT_ID_T event, F32 oldValue, F32 newValue ) +{ + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + U32 eventID = (U32)event; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_TREATMENT_LOG_EVENT; + msg.hdr.payloadLen = sizeof( U32 ) + 2 * sizeof( F32 ); + + memcpy( payloadPtr, &eventID, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &oldValue, sizeof( F32 ) ); + payloadPtr += sizeof( F32 ); + memcpy( payloadPtr, &newValue, sizeof( F32 ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); +} + +/*********************************************************************//** + * @brief * The handleSampleWaterCmd function handles a sample water user action command * message from the UI. * @details Inputs: none @@ -3095,12 +3162,12 @@ *************************************************************************/ void handleDGTemperatureData( MESSAGE_T *message ) { - if ( message->hdr.payloadLen == sizeof(DG_TEMPERATURES_T) ) + if ( message->hdr.payloadLen == sizeof( TEMPERATURE_SENSORS_DATA_T ) ) { - DG_TEMPERATURES_T payload; - - memcpy( &payload, message->payload, sizeof(DG_TEMPERATURES_T) ); - setDialysateTemperatureReadings( payload.TDi, payload.TRo ); + 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? @@ -6010,6 +6077,38 @@ /*********************************************************************//** * @brief + * The handleBatteryRemainingPercentOverrideRequest function handles a + * request to override battery remaining percent. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleBatteryRemainingPercentOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + 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 ); + } + else + { + result = testResetSetBatteryRemainingPercentOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief * The handleHDSoftwareResetRequest function handles a request to reset the * HD firmware processor. * @details Inputs: none Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -rdbfeaf78c05fc922eba6ff8c7a31ba8a9392c642 -r3f2b9de757500da37e0ed8881e4e906d94f3076c --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision dbfeaf78c05fc922eba6ff8c7a31ba8a9392c642) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 3f2b9de757500da37e0ed8881e4e906d94f3076c) @@ -32,11 +32,13 @@ #include "Prime.h" #include "ModePostTreat.h" #include "ModePreTreat.h" +#include "ModeStandby.h" #include "ModeTreatment.h" #include "MsgQueues.h" #include "NVDataMgmt.h" #include "PresOccl.h" #include "Rinseback.h" +#include "Switches.h" #include "SyringePump.h" #include "Valves.h" #include "Voltages.h" @@ -64,7 +66,16 @@ void handleUICheckIn( MESSAGE_T *message ); // MSG_ID_REQUEST_FW_VERSIONS -void handleFWVersionRequest( MESSAGE_T *message ); +void handleFWVersionRequest( MESSAGE_T *message ); + +// MSG_ID_REQUEST_FW_VERSIONS +void handleHDSerialNumberRequest( void ); + +// MSG_ID_UI_REQUEST_SERVICE_INFO +void handleHDServiceScheduleRequest( MESSAGE_T *message ); + +// MSG_ID_REQUEST_HD_USAGE_INFO +void handleHDUsageInfoRequest( MESSAGE_T *message ); // MSG_ID_OFF_BUTTON_PRESS BOOL sendOffButtonMsgToUI( U08 cmd ); @@ -268,6 +279,27 @@ // MSG_ID_HD_TREATMENT_LOG_DATA_RESPONSE BOOL sendTreatmentLogData( BOOL accepted, U32 reason, TREATMENT_LOG_DATA_PAYLOAD_T *logDataPtr ); +// MSG_ID_UI_DISINFECT_REQUEST +void handleUIDisinfectRequest( MESSAGE_T *message ); + +// MSG_ID_HD_DISINFECT_RESPONSE +BOOL sendDisinfectConfirmResponse( BOOL accepted, U32 reason ); + +// MSG_ID_HD_SET_STANDBY_DISINFECT_SUB_MODE_REQUEST +void handleSetHDStandbyDisinfectSubmodeRequest( MESSAGE_T *message ); + +// MSG_ID_HD_SET_STANDBY_DISINFECT_SUB_MODE_RESPONSE +BOOL handleSetHDStandbyDisinfectSubmodeResponse( BOOL accepted, U32 reason ); + +// MSG_ID_DG_FLUSH_DATA +void handleFlushUIStateReadingFromDG( MESSAGE_T *message ); + +// MSG_ID_DG_HEAT_DISINFECT_DATA +void handleHeatDisinfectUIStateReadingFromDG( MESSAGE_T *message ); + +// MSG_ID_DG_CHEM_DISINFECT_DATA +void handleChemDisinfectUIStateReadingFromDG( MESSAGE_T *message ); + // MSG_ID_UI_ACTIVE_ALARMS_LIST_REQUEST void handleUIActiveAlarmsListRequest( MESSAGE_T *message ); @@ -315,6 +347,15 @@ // MSG_ID_DG_OP_MODE void handleDGOpMode( MESSAGE_T *message ); +// MSG_ID_DG_START_STOP_FLUSH +BOOL sendDGStartFlushModeCommand( BOOL start ); + +// MSG_ID_DG_START_STOP_HEAT_DISINFECT +BOOL sendDGStartHeatDisinfectModeCommand( BOOL start ); + +// MSG_ID_DG_START_STOP_CHEM_DISINFECT +BOOL sendDGStartChemicalDisinfectModeCommand( BOOL start ); + // *********** public data broad cast functions ********** // MSG_ID_HD_ACCELEROMETER_DATA @@ -416,6 +457,12 @@ // MSG_ID_HD_PRIMING_STATUS_DATA BOOL broadcastPrimeData( PRIMING_DATA_PAYLOAD_T *primeDataPtr ); +// MSG_ID_HD_DISINFECT_STANDBY_DATA +BOOL broadcastDisinfectsData( DISINFECTS_DATA_T *disinfectsData ); + +// MSG_ID_HD_SWITCHES_DATA +BOOL broadcastSwitchesData( SWITCHES_DATA_T *switchesData ); + // MSG_ID_HD_SEND_CALIBRATION_RECORD BOOL sendHDCalibrationRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* calRcrdAddress ); @@ -632,6 +679,12 @@ // MSG_ID_HD_BUBBLE_SELF_TEST_REQUEST void handleBubbleSelfTestRequest( MESSAGE_T *message ); +// MSG_ID_HD_SWITCHES_STATUS_OVERRIDE +void handleSetSwitchesStatusOverrideRequest( MESSAGE_T *message ); + +// MSG_ID_HD_SWITCHES_PUBLISH_INTERVAL_OVERRIDE +void handleTestSwitchesPublishIntervalOverrideRequest( MESSAGE_T *message ); + // MSG_ID_HD_BATTERY_REMAINING_PERCENT_OVERRIDE void handleBatteryRemainingPercentOverrideRequest( MESSAGE_T *message ); @@ -686,6 +739,12 @@ // MSG_ID_HD_SYRINGE_PUMP_MEASURED_VOLUME_OVERRIDE: void handleTestSyringePumpMeasuredVolumeOverrideRequest( MESSAGE_T *message ); +// MSG_ID_HD_VALVES_CURRENT_OVERRIDE +void handleTestValvesCurrentOverrideRequest( MESSAGE_T *message ); + +// MSD_ID_HD_VALVES_POSITION_COUNT_OVERRIDE +void handleTestValvesPositionCountOverrideRequest( MESSAGE_T *message ); + // MSG_ID_HD_MONITORED_VOLTAGES_SEND_INTERVAL_OVERRIDE void handleTestMonitoredVoltagesSendIntervalOverrideRequest( MESSAGE_T *message );