Index: firmware/App/Monitors/Buttons.c =================================================================== diff -u -r395522dffef1348e176564925656012f529c1910 -r9fcd1ad071bcce7a592833367c103e235e49654f --- firmware/App/Monitors/Buttons.c (.../Buttons.c) (revision 395522dffef1348e176564925656012f529c1910) +++ firmware/App/Monitors/Buttons.c (.../Buttons.c) (revision 9fcd1ad071bcce7a592833367c103e235e49654f) @@ -47,24 +47,6 @@ NUM_OF_BUTTONS ///< Number of hardware buttons } BUTTON_T; -/// Enumeration of off button commands to UI. -typedef enum OffButtonCmdsToUI -{ - OFF_BUTTON_CMD_PROMPT_USER_TO_CONFIRM = 0, ///< Prompt user to confirm power off command - OFF_BUTTON_CMD_CANCEL_USER_CONFIRM_PROMPT, ///< Cancel user confirm prompt command - OFF_BUTTON_CMD_REJECT_USER_OFF_REQUEST, ///< Reject user off request command - NUM_OF_OFF_BUTTON_CMDS ///< Number of off button commands to UI -} OFF_BUTTON_CMD_T; - -/// Enumeration of off button responses from UI. -typedef enum OffButtonRspsFromUI -{ - OFF_BUTTON_RSP_USER_REQUESTS_POWER_OFF = 0, ///< User requests power off response - OFF_BUTTON_RSP_USER_CONFIRMS_POWER_OFF, ///< User confirms power off response - OFF_BUTTON_RSP_USER_REJECTS_POWER_OFF, ///< User rejects power off response - NUM_OF_OFF_BUTTON_RSPS ///< Number of off button responses from UI -} OFF_BUTTON_RSP_T; - #define OFF_REQUEST_PULSE_COUNT 4 ///< Number of edges for power off sequence on power off output signal. #define OFF_REQUEST_PULSE_INTVL_MS 50 ///< Duration (in ms) of power off sequence steps. #define OFF_REQUEST_DELAY_TIME_MS 2000 ///< Duration (in ms) of delay before power off sequence is initiated to provide sub-systems time to wrap things up. @@ -80,11 +62,11 @@ static OVERRIDE_U32_T dataOffButtonState; ///< Current off button state (overrideable). static BUTTON_STATE_T prevOffButtonState; ///< Previous state of off button. static BOOL offRequestAwaitingUserConfirmation = FALSE; ///< Flag indicates whether a power off request is pending user confirmation. -static U32 offRequestPendingTimer; ///< Timer counter for pending power off request. -static BOOL offButtonPressPending; ///< Flag indicates whether a confirmed power off request is pending execution. -static U32 offRequestPulseCount; ///< Power off sequence step counter. -static U32 offRequestPulseTimer; ///< Power off sequence step timer counter. -static U32 offRequestDelayTimer; ///< Power off sequence delay timer counter. +static volatile U32 offRequestPendingTimer; ///< Timer counter for pending power off request. +static volatile BOOL offButtonPressPending; ///< Flag indicates whether a confirmed power off request is pending execution. +static volatile U32 offRequestPulseCount; ///< Power off sequence step counter. +static volatile U32 offRequestPulseTimer; ///< Power off sequence step timer counter. +static volatile U32 offRequestDelayTimer; ///< Power off sequence delay timer counter. static OVERRIDE_U32_T dataStopButtonState; ///< Current stop button state (overrideable). static BUTTON_STATE_T prevStopButtonState; ///< Previous state of stop button. @@ -299,12 +281,12 @@ offRequestAwaitingUserConfirmation = TRUE; offRequestPendingTimer = 0; #ifndef SIMULATE_UI - sendOffButtonMsgToUI( OFF_BUTTON_CMD_PROMPT_USER_TO_CONFIRM ); + sendOffButtonMsgToUI( GENERIC_CONFIRM_CMD_REQUEST_OPEN ); #endif } else { // Send rejection response to power off request - sendOffButtonMsgToUI( OFF_BUTTON_CMD_REJECT_USER_OFF_REQUEST ); + ;//sendOffButtonMsgToUI( GENERIC_CONFIRM_CMD_REJECT ); } break; @@ -317,8 +299,9 @@ // If we are in a mode that allows power off, initiate power off sequence if ( TRUE == isCurrentOpModeOkToTurnOff() ) { - POWER_OFF_WARNING_DATA_T data; + sendOffButtonMsgToUI( GENERIC_CONFIRM_CMD_ACCEPT_CLOSE ); + POWER_OFF_WARNING_DATA_T data; data.powerOffWarning = 0; broadcastData( MSG_ID_POWER_OFF_WARNING, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08*)&data, sizeof( POWER_OFF_WARNING_DATA_T ) ); @@ -329,12 +312,12 @@ } else { - sendOffButtonMsgToUI( OFF_BUTTON_CMD_REJECT_USER_OFF_REQUEST ); + sendOffButtonMsgToUI( GENERIC_CONFIRM_CMD_REJECT ); } } else { - sendOffButtonMsgToUI( OFF_BUTTON_CMD_REJECT_USER_OFF_REQUEST ); + sendOffButtonMsgToUI( GENERIC_CONFIRM_CMD_REJECT ); } break; @@ -429,7 +412,7 @@ if ( offRequestPendingTimer >= OFF_REQUEST_EXPIRATION_TIME_MS ) { offRequestAwaitingUserConfirmation = FALSE; - sendOffButtonMsgToUI( OFF_BUTTON_CMD_CANCEL_USER_CONFIRM_PROMPT ); + sendOffButtonMsgToUI( GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE ); } }