Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r09e6cf9de34acf18f6e1138bf56ac0edb4821186 -r68aefeff8890cdfa956c7bfdf0d4505b4ac25cb7 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 09e6cf9de34acf18f6e1138bf56ac0edb4821186) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 68aefeff8890cdfa956c7bfdf0d4505b4ac25cb7) @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2022 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. @@ -15,9 +15,12 @@ * ***************************************************************************/ +#include "reg_system.h" // Used to access exception status registers for reset reason code at startup + #include "Accel.h" #include "AlarmLamp.h" #include "BloodFlow.h" +#include "BloodLeak.h" #include "Buttons.h" #include "Compatible.h" #include "CPLD.h" @@ -150,10 +153,7 @@ { initiatePowerOff(); } - else - { - postState = POST_STATE_WATCHDOG; - } + postState = POST_STATE_WATCHDOG; break; case POST_STATE_WATCHDOG: @@ -190,6 +190,11 @@ postState = handlePOSTStatus( testStatus ); break; + case POST_STATE_BLOOD_LEAK: + testStatus = execBloodLeakSelfTest(); + postState = handlePOSTStatus( testStatus ); + break; + case POST_STATE_VALVES: testStatus = execValvesSelfTest(); postState = handlePOSTStatus( testStatus ); @@ -429,7 +434,9 @@ sendUIVersionRequest(); // Send the startup event - SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_STARTUP, 0, 0 ) + SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_STARTUP, systemREG1->SYSESR, systemREG1->GBLSTAT ) // log startup event w/ reset reason(s) bits + systemREG1->SYSESR &= ~((U32)0x00008000); // clear power-on reset bit after logging event so subsequent resets can be properly identified as not being power-on resets. + SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_STARTUP, systemREG1->DEV, 0x12345678 ) // log startup event w/ device ID bits // Send the first submode change event. It is the mode Init and it does not start from a previous // mode previous and current are both published as Init SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_OP_MODE_CHANGE, MODE_INIT, MODE_INIT )