Index: firmware/App/Controllers/Buttons.c =================================================================== diff -u -r56b75f69ad7964feb825429db978de284095e0cb -rff5d79f69db29d73a440d0ca8e6854b5837205d3 --- firmware/App/Controllers/Buttons.c (.../Buttons.c) (revision 56b75f69ad7964feb825429db978de284095e0cb) +++ firmware/App/Controllers/Buttons.c (.../Buttons.c) (revision ff5d79f69db29d73a440d0ca8e6854b5837205d3) @@ -370,6 +370,7 @@ offRequestPulseTimer = 0; offRequestPulseCount = OFF_REQUEST_PULSE_COUNT; offButtonPressPending = TRUE; +<<<<<<< HEAD } /*********************************************************************//** @@ -406,6 +407,46 @@ // If user confirmed off button press, manage off request sequence if ( TRUE == offButtonPressPending ) +======= +} + +/*********************************************************************//** + * @brief + * The handleOffButtonProcessing function checks for and processes off button + * activity. + * @details Inputs: offButtonState, prevOffButtonState + * @details Outputs: offButtonPressPending, offRequestPulseCount, offRequestPulseTimer + * @return none + *************************************************************************/ +static void handleOffButtonProcessing( void ) +{ + // Handle button state transitions for off button + if ( getOffButtonState() != prevOffButtonState ) + { + if ( getOffButtonState() == BUTTON_STATE_PRESSED ) + { + // If off request in a valid mode, send to UI for user confirmation + userConfirmOffButton( OFF_BUTTON_RSP_USER_REQUESTS_POWER_OFF ); + // Log off button press + sendTreatmentLogEventData( OFF_BUTTON_PRESSED_EVENT, 0.0F, 0.0F ); + } + prevOffButtonState = getOffButtonState(); + } + + // If off request has not been confirmed by user before it expires, cancel it + if ( TRUE == offRequestAwaitingUserConfirmation ) + { + offRequestPendingTimer += TASK_PRIORITY_INTERVAL; + if ( offRequestPendingTimer >= OFF_REQUEST_EXPIRATION_TIME_MS ) + { + offRequestAwaitingUserConfirmation = FALSE; + sendOffButtonMsgToUI( OFF_BUTTON_CMD_CANCEL_USER_CONFIRM_PROMPT ); + } + } + + // If user confirmed off button press, manage off request sequence + if ( TRUE == offButtonPressPending ) +>>>>>>> ad5e8205... Logging of various things { // Delay power off to provide sub-systems time to prepare for shutdown offRequestDelayTimer += TASK_PRIORITY_INTERVAL; @@ -423,6 +464,7 @@ } toggleCPLDOffRequest(); } +<<<<<<< HEAD } } } @@ -475,6 +517,62 @@ * @param value override state for the off button * @return TRUE if override successful, FALSE if not *************************************************************************/ +======= + } + } +} + +/*********************************************************************//** + * @brief + * The handleStopButtonProcessing function checks for and processes stop button + * activity. + * @details Inputs: stopButtonState, prevStopButtonState + * @details Outputs: stopButtonPressPending + * @return none + *************************************************************************/ +static void handleStopButtonProcessing( void ) +{ + // Handle button state transitions for stop button + if ( getStopButtonState() != prevStopButtonState ) + { + if ( getStopButtonState() == BUTTON_STATE_PRESSED ) + { + stopButtonPressPending = TRUE; + stopButtonPendingTimer = getMSTimerCount(); + // Log stop button press + sendTreatmentLogEventData( STOP_BUTTON_PRESSED_EVENT, 0.0F, 0.0F ); + } + prevStopButtonState = getStopButtonState(); + } + + // Handle when a stop button press is pending + if ( TRUE == stopButtonPressPending ) + { + // If stop button not consumed within a reasonable time, s/w fault + if ( TRUE == didTimeout( stopButtonPendingTimer, STOP_BUTTON_PENDING_TIMEOUT_MS ) ) + { + stopButtonPressPending = FALSE; + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_BUTTONS_STOP_BUTTON_NOT_CONSUMED ) + } + } +} + + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + + +/*********************************************************************//** + * @brief + * The testSetOffButtonStateOverride function overrides the state of then + * off button with a given state.n + * @details Inputs: none + * @details Outputs: dataOffButtonState + * @param value override state for the off button + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +>>>>>>> ad5e8205... Logging of various things BOOL testSetOffButtonStateOverride( U32 value ) { BOOL result = FALSE; Index: firmware/App/Controllers/Switches.c =================================================================== diff -u -ref6d5a5ca314cbe30131156824e9d32792402fc4 -rff5d79f69db29d73a440d0ca8e6854b5837205d3 --- firmware/App/Controllers/Switches.c (.../Switches.c) (revision ef6d5a5ca314cbe30131156824e9d32792402fc4) +++ firmware/App/Controllers/Switches.c (.../Switches.c) (revision ff5d79f69db29d73a440d0ca8e6854b5837205d3) @@ -120,8 +120,19 @@ // If the debounce time has been elapsed, update the switch status to the new status else if ( TRUE == didTimeout( switchesStatus[ i ].debounceStartTime, SWITCHES_DEBOUNCE_TIME_MS ) ) { - switchesStatus[ i ].debounceStartTime = 0; + + if (FRONT_DOOR == i) + { + // Log front door switch change + sendTreatmentLogEventData( FRONT_DOOR_SWITCH_CHANGED_EVENT, (F32)switchesStatus[ i ].status.data, (F32)currentSwitchStatus ); + } + else if (PUMP_TRACK_SWITCH == i) + { + // Log pump track switch change + sendTreatmentLogEventData( PUMP_TRACK_SWITCH_CHANGED_EVENT, (F32)switchesStatus[ i ].status.data, (F32)currentSwitchStatus ); + } // If the bit is 0, the door switch is open, because it is normally open switch + switchesStatus[ i ].debounceStartTime = 0; switchesStatus[ i ].status.data = currentSwitchStatus; } } Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -r9944e4f766d9eb4cdf7a5ca7587e3ceca556e106 -rff5d79f69db29d73a440d0ca8e6854b5837205d3 --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 9944e4f766d9eb4cdf7a5ca7587e3ceca556e106) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision ff5d79f69db29d73a440d0ca8e6854b5837205d3) @@ -940,6 +940,11 @@ 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; + // Log syringe detect switch changes + if ( prevSyringeDetected != isSyringeDetected()) + { + sendTreatmentLogEventData( HEPARIN_PUMP_SWITCH_CHANGED_EVENT, (F32)prevSyringeDetected, (F32)isSyringeDetected()); + } #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_SYRINGE_PUMP_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) #endif Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -r9944e4f766d9eb4cdf7a5ca7587e3ceca556e106 -rff5d79f69db29d73a440d0ca8e6854b5837205d3 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 9944e4f766d9eb4cdf7a5ca7587e3ceca556e106) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision ff5d79f69db29d73a440d0ca8e6854b5837205d3) @@ -1117,6 +1117,7 @@ pendingUFVolumeChange = uFVolume; pendingTreatmentTimeChange = trtTime; timeDiff = trtTime - ( (U32)( (F32)presTreatmentTimeSecs / (F32)SEC_PER_MIN ) + 1 ); + } else { Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r9944e4f766d9eb4cdf7a5ca7587e3ceca556e106 -rff5d79f69db29d73a440d0ca8e6854b5837205d3 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 9944e4f766d9eb4cdf7a5ca7587e3ceca556e106) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision ff5d79f69db29d73a440d0ca8e6854b5837205d3) @@ -656,6 +656,7 @@ { // Convert volume level to attenuation level alarmAudioVolumeLevel.data = MAX_ALARM_VOLUME_LEVEL - volumeLevel; accepted = TRUE; + sendTreatmentLogEventData( ALARM_AUDIO_VOLUME_CHANGED_EVENT, (F32)volumeLevel, (F32)getAlarmAudioVolume()); } else { Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r6e86723c766c0097c9867af984c0c7e82802537a -rff5d79f69db29d73a440d0ca8e6854b5837205d3 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 6e86723c766c0097c9867af984c0c7e82802537a) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision ff5d79f69db29d73a440d0ca8e6854b5837205d3) @@ -1145,6 +1145,15 @@ handleUIServiceModeRequest( message ); break; + case MSG_ID_UI_CHANGED_SCREEN_BRIGHTNESS: + handleUIChangedScreenBrightness( message ); + break; + + case MSG_ID_DG_SWITCH_CHANGE: + handleDGSwitchChanged( message ); + break; + + // NOTE: this always must be the last case case MSG_ID_TESTER_LOGIN_REQUEST: handleTesterLogInRequest( message ); Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r29b362c485f28f45ef367342ac895e1c1907ac45 -rff5d79f69db29d73a440d0ca8e6854b5837205d3 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 29b362c485f28f45ef367342ac895e1c1907ac45) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision ff5d79f69db29d73a440d0ca8e6854b5837205d3) @@ -40,7 +40,12 @@ #include "TreatmentStop.h" #include "Utilities.h" #include "WatchdogMgmt.h" +<<<<<<< HEAD +======= +#include "HDDefs.h" + +>>>>>>> ad5e8205... Logging of various things /** * @addtogroup SystemCommMessages * @{ @@ -2637,6 +2642,7 @@ +<<<<<<< HEAD /*********************************************************************//** * @brief * The handleChangeUFSettingsRequest function handles a ultrafiltration @@ -2739,6 +2745,111 @@ { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } +======= +/*********************************************************************//** + * @brief + * The handleChangeUFSettingsRequest function handles a ultrafiltration + * change settings request message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleChangeUFSettingsRequest( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(F32) ) + { + F32 uFVolume; + + memcpy( &uFVolume, message->payload, sizeof(F32) ); + + verifyUFSettingsChange( uFVolume ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief + * The handleChangeUFSettingsConfirmation function handles a ultrafiltration + * change setting confirmation message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleChangeUFSettingsConfirmation( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T) ) + { + UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T) ); + + verifyUFSettingsConfirmation( payload.volume_mL, payload.adjustType ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief + * The handleChangeTreatmentDurationRequest function handles a treatment + * duration setting change message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleChangeTreatmentDurationRequest( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(U32) ) + { + U32 timeInMin; + + memcpy( &timeInMin, message->payload, sizeof(U32) ); + + verifyTreatmentDurationSettingChange( timeInMin ); + + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief + * The handleChangeBloodDialysateRateChangeRequest function handles a blood + * and dialysate rate settings change message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleChangeBloodDialysateRateChangeRequest( MESSAGE_T *message ) +{ + U32 expPayloadSize = sizeof(U32) + sizeof(U32); + + if ( expPayloadSize == message->hdr.payloadLen ) + { + U32 bloodRate; + U32 dialRate; + + memcpy( &bloodRate, &message->payload[0], sizeof(U32) ); + memcpy( &dialRate, &message->payload[sizeof(U32)], sizeof(U32) ); + + verifyBloodAndDialysateRateSettingsChange( bloodRate, dialRate ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +>>>>>>> ad5e8205... Logging of various things } /*********************************************************************//** @@ -2818,6 +2929,71 @@ /*********************************************************************//** * @brief + * The handleUIChangedScreenBrightness function handles a screen brightness change + * message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleUIChangedScreenBrightness( MESSAGE_T *message ) +{ + if ( sizeof( U32 ) == message->hdr.payloadLen ) + { + U32 payload; + + memcpy( &payload, &message->payload[0], sizeof( U32 ) ); + sendTreatmentLogEventData( SCREEN_BRIGHTNESS_CHANGED_EVENT, (F32)0.0, (F32)payload ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief + * The handleDGSwitchChanged function handles a DG switch change + * message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleDGSwitchChanged( MESSAGE_T *message ) +{ + U32 expPayloadSize = sizeof(U32) + sizeof(U32); + + if ( expPayloadSize == message->hdr.payloadLen ) + { + U32 switchId; + U32 newstate; + U32 oldstate = (U32)0; + + memcpy( &switchId, &message->payload[0], sizeof(U32) ); + memcpy( &newstate, &message->payload[sizeof(U32)], sizeof(U32) ); + + if ((U32)0 == newstate) + { + oldstate = 1; + } + if ((U32)0 == switchId) + { + sendTreatmentLogEventData( CONCENTRATE_CAP_SWITCH_CHANGED_EVENT, (F32)oldstate, (F32)newstate ); + } + if ((U32)1 == switchId) + { + sendTreatmentLogEventData( DIALYSATE_CAP_SWITCH_CHANGED_EVENT, (F32)oldstate, (F32)newstate ); + } + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief * The handleSalineBolusRequest function handles a saline bolus request * message from the UI. * @details Inputs: none Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r6e86723c766c0097c9867af984c0c7e82802537a -rff5d79f69db29d73a440d0ca8e6854b5837205d3 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 6e86723c766c0097c9867af984c0c7e82802537a) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision ff5d79f69db29d73a440d0ca8e6854b5837205d3) @@ -240,6 +240,12 @@ // MSG_ID_UI_SET_ALARM_AUDIO_VOLUME_LEVEL_CMD void handleAlarmAudioVolumeSetCmd( MESSAGE_T *message ); +// MSG_ID_UI_CHANGED_SCREEN_BRIGHTNESS +void handleUIChangedScreenBrightness( MESSAGE_T *message ); + +// MSG_ID_DG_SWITCH_CHANGE +void handleDGSwitchChanged( MESSAGE_T *message ); + // MSG_ID_HD_ALARM_AUDIO_VOLUME_SET_RESPONSE BOOL sendAlarmAudioVolumeSetResponse( U32 accepted, U32 rejReason );