Index: firmware/App/Controllers/Buttons.c =================================================================== diff -u -r8c00197ce69e80f1967aa3f2eb36beb3573f36f3 -r8bd1ae47aa13a843aa8abd6321ddc050deacb4a6 --- firmware/App/Controllers/Buttons.c (.../Buttons.c) (revision 8c00197ce69e80f1967aa3f2eb36beb3573f36f3) +++ firmware/App/Controllers/Buttons.c (.../Buttons.c) (revision 8bd1ae47aa13a843aa8abd6321ddc050deacb4a6) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file Buttons.c +* @file Buttons.c * -* @author (last) Sean Nash -* @date (last) 24-Sep-2020 +* @author (last) Sean Nash +* @date (last) 01-Mar-2021 * -* @author (original) Dara Navaei -* @date (original) 05-Nov-2019 +* @author (original) Dara Navaei +* @date (original) 05-Nov-2019 * ***************************************************************************/ @@ -297,7 +297,7 @@ // If we are in a mode that allows power off, initiate power off sequence if ( TRUE == isCurrentOpModeOkToTurnOff() ) { - broadcastPowerOffWarning(); + broadcastData( MSG_ID_POWER_OFF_WARNING, COMM_BUFFER_OUT_CAN_HD_BROADCAST, (U08*)0, 0 ); signalPowerOffWarning(); offButtonPressPending = TRUE; offRequestPulseCount = OFF_REQUEST_PULSE_COUNT; @@ -348,6 +348,24 @@ } return result; +} + +/*********************************************************************//** + * @brief + * The initiatePowerOff function initiates a power off sequence. + * @details Inputs: none + * @details Outputs: offRequestDelayTimer, offRequestPulseTimer, offRequestPulseCount, offButtonPressPending + * @return none + *************************************************************************/ +void initiatePowerOff( void ) +{ + // Warn NV Data Mgr that power will be lost shortly + signalPowerOffWarning(); + // Mimic confirmed power off button state to initiate power off cycle + offRequestDelayTimer = 0; + offRequestPulseTimer = 0; + offRequestPulseCount = OFF_REQUEST_PULSE_COUNT; + offButtonPressPending = TRUE; } /*********************************************************************//**