Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -rf326ce71744dca862c186bc00795e84562e80936 -r1cbf981dbed9d9f375c50edfef1d40819295ef2b --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision f326ce71744dca862c186bc00795e84562e80936) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 1cbf981dbed9d9f375c50edfef1d40819295ef2b) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2019-2022 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2023 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 ModeInitPOST.c * -* @author (last) Dara Navaei -* @date (last) 15-Jul-2022 +* @author (last) Michael Garthwaite +* @date (last) 01-Mar-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -17,6 +17,7 @@ #include "reg_crc.h" // Used to hold reset reason code at startup before bits get cleared #include "reg_system.h" // Used to access exception status registers for reset reason code at startup +#include "system.h" #include "Accel.h" #include "AlarmLamp.h" @@ -37,7 +38,7 @@ #include "RTC.h" #include "SafetyShutdown.h" #include "SyringePump.h" -#include "system.h" +#include "SystemComm.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" #include "Temperatures.h" @@ -118,11 +119,23 @@ *************************************************************************/ U32 transitionToInitAndPOSTMode( void ) { + initInitAndPOSTMode(); + // Set user alarm recovery actions allowed in this mode setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, FALSE ); setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, FALSE ); + resetRTCPOSTState(); + resetNVDataMgmtPOSTState(); + resetAccelPOSTState(); + resetWatchdogPOSTState(); + resetSafetyShutdownPOSTState(); + resetValvesPOSTState(); + resetAlarmAudioPOSTState(); + resetAlarmLampPOSTState(); + resetStuckButtonPOSTState(); + return postState; } @@ -156,30 +169,30 @@ postState = handlePOSTStatus( testStatus ); break; - case POST_STATE_WATCHDOG: - testStatus = execWatchdogTest(); + // NOTE: RTC's POST must go before NVDataMgmt + case POST_STATE_RTC: + testStatus = execRTCSelfTest(); postState = handlePOSTStatus( testStatus ); break; - case POST_STATE_SAFETY_SHUTDOWN: - testStatus = execSafetyShutdownTest(); + // NOTE: all the actuators and sensors must execute their POST after NVDataMgmt + // NVDataMgmt must load all the calibration data into RAM so the actuators + // can query their corresponding calibration values successfully + case POST_STATE_NVDATAMGMT: + testStatus = execNVDataMgmtSelfTest(); postState = handlePOSTStatus( testStatus ); break; - // NOTE: RTC's POST must go before NVDataMgmt - case POST_STATE_RTC: - testStatus = execRTCSelfTest(); + case POST_STATE_WATCHDOG: + testStatus = execWatchdogTest(); postState = handlePOSTStatus( testStatus ); break; - case POST_STATE_NVDATAMGMT: - testStatus = execNVDataMgmtSelfTest(); + case POST_STATE_SAFETY_SHUTDOWN: + testStatus = execSafetyShutdownTest(); postState = handlePOSTStatus( testStatus ); break; - // NOTE: all the actuators and sensors must execute their POST after NVDataMgmt - // NVDataMgmt must load all the calibration data into RAM so the actuators - // can query their corresponding calibration values successfully case POST_STATE_BLOOD_FLOW: testStatus = execBloodFlowTest(); postState = handlePOSTStatus( testStatus ); @@ -297,12 +310,16 @@ break; case POST_STATE_COMPLETED: - // Set overall HD POST status to "passed" - postPassed = TRUE; + // Set overall HD POST completed status to TRUE postCompleted = TRUE; - // Broadcast final POST passed - sendPOSTFinalResult( TRUE ); + // Broadcast final POST passed once. We stay in this state for POST_COMPLETED_DELAY. + if ( FALSE == postPassed ) + { + sendPOSTFinalResult( TRUE ); + } + // Set overall HD POST status to "passed" + postPassed = TRUE; // Delay before going to standby mode if ( ++postCompleteDelayTimerCtr > POST_COMPLETED_DELAY ) { @@ -392,6 +409,18 @@ /*********************************************************************//** * @brief + * The getDGVersion function returns the DG version information. + * @details Inputs: dgVersion + * @details Outputs: none + * @return dgVersion + *************************************************************************/ +DG_VERSIONS_T getDGVersion( void ) +{ + return dgVersion; +} + +/*********************************************************************//** + * @brief * The isPOSTCompleted function determines whether all HD POST have * been run and completed. If true, call the isPOSTPassed() to see final * result (pass/fail). @@ -480,7 +509,10 @@ sendUIVersionRequest(); // request UI to send us its version - needed for compatibility check - sendRequestForDGResendAlarms(); // request DG to re-send any active alarms that may have been triggered before we came up + if ( TRUE == isDGCommunicating() ) + { + sendRequestForDGResendAlarms(); // request DG to re-send any active alarms that may have been triggered before we came up + } // Send the startup event SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_STARTUP, systemREG1->DEV, 0x12345678 ) // log startup event w/ device ID bits @@ -507,13 +539,11 @@ { SELF_TEST_STATUS_T result = SELF_TEST_STATUS_PASSED; -#ifndef DISABLE_UI_POST_TEST if ( uiVersion.compatibility != SW_COMPATIBILITY_REV ) { result = SELF_TEST_STATUS_FAILED; SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_UI_COMPATIBILITY_ERROR, uiVersion.compatibility, SW_COMPATIBILITY_REV ) } -#endif return result; } @@ -527,7 +557,6 @@ *************************************************************************/ static SELF_TEST_STATUS_T execUITest( void ) { -#ifndef DISABLE_UI_POST_TEST SELF_TEST_STATUS_T result = SELF_TEST_STATUS_IN_PROGRESS; // UI should have sent POST results before we start this test @@ -549,9 +578,6 @@ SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_UI_POST_FAILED, 1 ) result = SELF_TEST_STATUS_FAILED; } -#else - SELF_TEST_STATUS_T result = SELF_TEST_STATUS_PASSED; -#endif return result; }