Index: firmware/App/Controllers/Buttons.c =================================================================== diff -u -rf7e3018ec6ab762fe08efb42b21fb2ca970174b0 -r94895e32fe18e78b98fe3bb7786838cf00afdbfa --- firmware/App/Controllers/Buttons.c (.../Buttons.c) (revision f7e3018ec6ab762fe08efb42b21fb2ca970174b0) +++ firmware/App/Controllers/Buttons.c (.../Buttons.c) (revision 94895e32fe18e78b98fe3bb7786838cf00afdbfa) @@ -14,7 +14,6 @@ * **************************************************************************/ -#include "Common.h" #include "Buttons.h" #include "CPLD.h" #include "OperationModes.h" @@ -274,11 +273,21 @@ // if we're in a mode that allows power off, initiate power off sequence if ( TRUE == isCurrentOpModeOkToTurnOff() ) { + broadcastPowerOffWarning(); + // TODO - maybe delay a bit before starting power off sequence here to allow sub-systems time to get warning and wrap up critical activities offButtonPressPending = TRUE; offRequestPulseCount = OFF_REQUEST_PULSE_COUNT; offRequestPulseTimer = 0; } + else + { + sendOffButtonMsgToUI( OFF_BUTTON_CMD_REJECT_USER_OFF_REQUEST ); + } } + else + { + sendOffButtonMsgToUI( OFF_BUTTON_CMD_REJECT_USER_OFF_REQUEST ); + } break; case OFF_BUTTON_RSP_USER_REJECTS_POWER_OFF: @@ -337,16 +346,7 @@ if ( getOffButtonState() == BUTTON_STATE_PRESSED ) { // if off request in a valid mode, send to UI for user confirmation - if ( TRUE == isCurrentOpModeOkToTurnOff() ) - { - // send off button to UI for user confirmation - sendOffButtonMsgToUI( OFF_BUTTON_CMD_PROMPT_USER_TO_CONFIRM ); - offRequestAwaitingUserConfirmation = TRUE; - offRequestPendingTimer = 0; -#ifdef SIMULATE_UI - userConfirmOffButton( OFF_BUTTON_RSP_USER_REQUESTS_POWER_OFF ); -#endif - } + userConfirmOffButton( OFF_BUTTON_RSP_USER_REQUESTS_POWER_OFF ); } prevOffButtonState = getOffButtonState(); }