Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -rc9df9f42e294adae397a57bf83c2a67fa831b164 -r39dd0b7734331c784b8410f2bbd481e0f792892e --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision c9df9f42e294adae397a57bf83c2a67fa831b164) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 39dd0b7734331c784b8410f2bbd481e0f792892e) @@ -385,6 +385,7 @@ U08 dpiErrorCtr = getFPGADialInPumpOcclusionErrorCounter(); U08 dpoErrorCtr = getFPGADialOutPumpOcclusionErrorCounter(); +#ifndef DISABLE_PRESSURE_CHECKS // Check for sensor errors if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_BP_OCCLUSION_SENSOR_ERROR, ( bpErrorCtr != lastBPErrorCtr ) ) ) { @@ -412,6 +413,7 @@ { activateAlarmNoData( ALARM_ID_HD_DPO_OCCLUSION_READ_TIMEOUT_ERROR ); } +#endif // Record occlusion sensor readings bloodPumpOcclusion.data = (U32)getFPGABloodPumpOcclusion(); Index: firmware/App/Drivers/InternalADC.c =================================================================== diff -u -r158b4394cb66d4585bbcef39471193a7396709c6 -r39dd0b7734331c784b8410f2bbd481e0f792892e --- firmware/App/Drivers/InternalADC.c (.../InternalADC.c) (revision 158b4394cb66d4585bbcef39471193a7396709c6) +++ firmware/App/Drivers/InternalADC.c (.../InternalADC.c) (revision 39dd0b7734331c784b8410f2bbd481e0f792892e) @@ -57,7 +57,7 @@ INT_ADC_NOT_USED, // 20 INT_ADC_NOT_USED, // 21 INT_ADC_24V_ACTUATORS, // 22 - INT_ADC_BACKUP_ALARM_CURRENT // 23 + INT_ADC_BACKUP_ALARM_CURRENT // 23 - No longer used - moved to FPGA. }; const F32 ADC_CHANNEL_READ_TO_UNITS[ NUM_OF_INT_ADC_CHANNELS ] = Index: firmware/App/Drivers/InternalADC.h =================================================================== diff -u -r158b4394cb66d4585bbcef39471193a7396709c6 -r39dd0b7734331c784b8410f2bbd481e0f792892e --- firmware/App/Drivers/InternalADC.h (.../InternalADC.h) (revision 158b4394cb66d4585bbcef39471193a7396709c6) +++ firmware/App/Drivers/InternalADC.h (.../InternalADC.h) (revision 39dd0b7734331c784b8410f2bbd481e0f792892e) @@ -58,7 +58,7 @@ INT_ADC_5V_LOGIC, ///< Internal ADC channel for 5V to logic INT_ADC_PRIMARY_ALARM_CURRENT_LG, ///< Internal ADC channel for primary alarm audio current low gain INT_ADC_24V_ACTUATORS, ///< Internal ADC channel for 24V to actuators - INT_ADC_BACKUP_ALARM_CURRENT, ///< Internal ADC channel for backup alarm audio current + INT_ADC_BACKUP_ALARM_CURRENT, ///< Internal ADC channel for backup alarm audio current - No longer used - moved to FPGA. INT_ADC_DUMMY, ///< Internal ADC channel - not used, needed to get even number of channels NUM_OF_INT_ADC_CHANNELS ///< Number of used internal ADC channels. } INT_ADC_CHANNEL_T; Index: firmware/App/HDCommon.h =================================================================== diff -u -rec76cd7277fc01f63dc29328bb40da032b9ef83b -r39dd0b7734331c784b8410f2bbd481e0f792892e --- firmware/App/HDCommon.h (.../HDCommon.h) (revision ec76cd7277fc01f63dc29328bb40da032b9ef83b) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 39dd0b7734331c784b8410f2bbd481e0f792892e) @@ -37,7 +37,7 @@ // #define RUN_WITHOUT_DG 1 // Run HD w/o DG // #define SIMULATE_UI 1 // Build w/o requirement that UI be there // #define TASK_TIMING_OUTPUT_ENABLED 1 // Re-purposes alarm lamp pins for task timing - #define DISABLE_ALARM_AUDIO 1 // Disable alarm audio +// #define DISABLE_ALARM_AUDIO 1 // Disable alarm audio // #define SKIP_POST 1 // Skip POST tests - all pass // #define DONT_SKIP_NV_POST 1 // Do not skip NV Data POST // #define USE_LIBRARY_TIME_FUNCTIONS 1 // Use the C library functions mktime() and gmtime() for epoch<=>date conversions @@ -51,9 +51,9 @@ // #define DISABLE_PUMP_FLOW_CHECKS 1 // Do not error on HD pump flow checks // #define DISABLE_PUMP_SPEED_CHECKS 1 // Do not error on HD pump speed checks // #define DISABLE_PUMP_DIRECTION_CHECKS 1 // Do not error on HD pump direction checks -// #define DISABLE_SYRINGE_PUMP 1 // Disable syringe pump functionality + #define DISABLE_SYRINGE_PUMP 1 // Disable syringe pump functionality #define ALWAYS_ALLOW_SYRINGE_PUMP_CMDS 1 // Allow syringe pump commands at any time except when pump is busy -// #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure checks + #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure checks // #define DISABLE_UF_ALARMS 1 // Do not error on HD ultrafiltration checks // #define DISABLE_VALVE_ALARMS 1 // Do not error on HD valve position #define DISABLE_CAL_CHECK 1 // Disable calibration checks @@ -63,7 +63,7 @@ // #define EMC_TEST_BUILD 1 // EMC test build - HD/DG run separately but connected, HD pumps toggle on/off w/ stop button #define ALARMS_DEBUG 1 // Triggered alarms sent to debug UART #define ALARM_VOLUME_DEFAULT_LOW 1 // Set default alarm volume to lowest - #define TEMP_UI_ALARM_SILENCE_FIX 1 // Temporary UI fix for handling alarm silence request msg +// #define TEMP_UI_ALARM_SILENCE_FIX 1 // Temporary UI fix for handling alarm silence request msg #define SKIP_PRIMING 1 // Skip Pre-treatment Prime #define SKIP_WET_SELF_TESTS 1 // Skip Pre-treatment prime wet self-tests // #define V2_0_SYSTEM 1 // Build for v2.0 system @@ -79,7 +79,7 @@ // #define DISABLE_FPGA_COUNTER_CHECKS 1 // Disable alarms associated with FPGA read/error counters // #define DISABLE_VOLTAGE_MONITOR 1 // Disable voltage monitoring/alarms #define ALLOW_1_MIN_TREATMENT_DURATION 1 // Allow user to change treatment duration to as low as 1 minute -// #define DISABLE_SYRINGE_PUMP_ALARMS 1 // Disable some syringe pump alarms that are triggering intermittently + #define DISABLE_SYRINGE_PUMP_ALARMS 1 // Disable some syringe pump alarms that are triggering intermittently // #define NO_PUMP_FLOW_LIMITS 1 // Allow any commanded flow rate for peristaltic pumps #define DISABLE_BUBBLE_ALARMS 1 // Disable bubble alarms Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r406b3ea2507978267a519af0e9cbfbaaf03027c7 -r39dd0b7734331c784b8410f2bbd481e0f792892e --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 406b3ea2507978267a519af0e9cbfbaaf03027c7) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 39dd0b7734331c784b8410f2bbd481e0f792892e) @@ -111,8 +111,6 @@ // Ignore stop button in this mode. } - // TODO - send POST status on CAN - // Execute current POST state *Note - these switch cases must be in same order as enum HD_POST_States switch ( postState ) { Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r793769afaa008c10c04f527c75c2feed850f15c3 -r39dd0b7734331c784b8410f2bbd481e0f792892e --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 793769afaa008c10c04f527c75c2feed850f15c3) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 39dd0b7734331c784b8410f2bbd481e0f792892e) @@ -59,8 +59,9 @@ #define CLR_BACKUP_AUDIO_ENABLE() {mibspiREG3->PC3 &= ~BACKUP_AUDIO_ENABLE_SPI3_PORT_MASK;} ///< Macro to disable backup alarm audio. #define ALARM_AUDIO_TEST_TONE 4 ///< Alarm audio state for continuous test tone. -#define ALARM_AUDIO_CURRENT_HG_MIN_MA 10.0 ///< Minimum audio current (high gain) during test tone self-test (in mA). -#define ALARM_AUDIO_CURRENT_LG_MIN_MA 10.0 ///< Minimum audio current (low gain) during test tone self-test (in mA). +#define ALARM_AUDIO_CURRENT_HG_MIN_MA 20.0 ///< Minimum audio current (high gain) during test tone self-test (in mA). // TODO - Why is HG so low? S/B same as LG I think. +#define ALARM_AUDIO_CURRENT_LG_MIN_MA 200.0 ///< Minimum audio current (low gain) during test tone self-test (in mA). +#define ALARM_AUDIO_MAX_TEST_TIME_MS 1000 ///< Maximum time for audio current to reach threshold in test. /// Alarm priority ranking record. typedef struct @@ -70,6 +71,15 @@ U32 timeSinceTriggeredMS; ///< Time (in ms) since this alarm was triggered } ALARM_PRIORITY_RANKS_T; +/// Enumeration of alarm audio self-test states. +typedef enum Alarm_Lamp_Self_Test_States +{ + ALARM_AUDIO_SELF_TEST_STATE_START = 0, ///< Start state of alarm lamp self-test. + ALARM_AUDIO_SELF_TEST_STATE_PRIMARY, ///< Red state of alarm lamp self-test. + ALARM_AUDIO_SELF_TEST_STATE_COMPLETE, ///< Completed state of alarm lamp self-test. + NUM_OF_ALARM_AUDIO_SELF_TEST_STATES ///< Number of states in alarm lamp self-test. +} ALARM_AUDIO_SELF_TEST_STATE_T; + // ********** private data ********** static U32 alarmStatusPublicationTimerCounter = 0; ///< Used to schedule alarm status publication to CAN bus. @@ -105,6 +115,8 @@ /// Alarm user recovery actions enabled flags. static BOOL alarmUserRecoveryActionEnabled[ NUMBER_OF_ALARM_USER_ACTIONS ]; +/// Current state of the alarm audio self tests. +static ALARM_AUDIO_SELF_TEST_STATE_T alarmAudioSelfTestState; /// Flag indicates whether alarm audio test tone should be output. static BOOL alarmAudioTestToneRequested; @@ -179,7 +191,8 @@ alarmStatus.noDialRecirc = FALSE; alarmStatus.usrACKRequired = FALSE; - alarmAudioTestToneRequested = FALSE; + alarmAudioTestToneRequested = FALSE; + alarmAudioSelfTestState = ALARM_AUDIO_SELF_TEST_STATE_START; } /*********************************************************************//** @@ -656,7 +669,7 @@ alarmPrimaryAudioCurrentHG.data = getIntADCVoltageConverted( INT_ADC_PRIMARY_ALARM_CURRENT_HG ); alarmPrimaryAudioCurrentLG.data = getIntADCVoltageConverted( INT_ADC_PRIMARY_ALARM_CURRENT_LG ); - alarmBackupAudioCurrent.data = getIntADCVoltageConverted( INT_ADC_BACKUP_ALARM_CURRENT ); + alarmBackupAudioCurrent.data = getFPGABackupAlarmAudioCurrent(); // TODO - Check current vs. expected audio output @@ -803,15 +816,23 @@ { U32 volume = getAlarmAudioVolume(); + // If we're not in Init-POST mode, ensure audio test tone request is cancelled. + if ( getCurrentOperationMode() != MODE_INIT ) + { + alarmAudioTestToneRequested = FALSE; + } + + // If audio test in progress, play test tone. if ( TRUE == alarmAudioTestToneRequested ) - { // Play test tone at max volume for next 50 ms + { // Play test tone at max volume setAlarmAudioState( ALARM_AUDIO_TEST_TONE, 0 ); - alarmAudioTestToneRequested = FALSE; } + // If alarm silenced, play no alarm audio. else if ( TRUE == alarmStatus.alarmsSilenced ) { setAlarmAudioState( ALARM_PRIORITY_NONE, volume ); } + // Otherwise, play alarm audio as appropriate based on current alarm status else { if ( alarmStatus.alarmsState < NUM_OF_ALARM_PRIORITIES ) @@ -1194,36 +1215,55 @@ * The execAlarmAudioSelfTest function outputs a test audio tone and * measures the audio current level. The test passes if the audio current * exceeds TBD mA. - * @details Inputs: alarmBackupAudioCurrent + * @details Inputs: alarmAudioSelfTestState * @details Outputs: none * @return the current backup alarm audio current (in mA). *************************************************************************/ SELF_TEST_STATUS_T execAlarmAudioSelfTest( void ) { SELF_TEST_STATUS_T result = SELF_TEST_STATUS_IN_PROGRESS; + static U32 testStartTime; - if ( alarmAudioTestToneRequested != TRUE ) + switch ( alarmAudioSelfTestState ) { - alarmAudioTestToneRequested = TRUE; - setAlarmAudio(); - } - else - { - F32 almHGCurrent = getIntADCVoltageConverted( INT_ADC_PRIMARY_ALARM_CURRENT_HG ); - F32 almLGCurrent = getIntADCVoltageConverted( INT_ADC_PRIMARY_ALARM_CURRENT_LG ); + case ALARM_AUDIO_SELF_TEST_STATE_START: + testStartTime = getMSTimerCount(); + // Start test tone + alarmAudioTestToneRequested = TRUE; + setAlarmAudio(); + alarmAudioSelfTestState = ALARM_AUDIO_SELF_TEST_STATE_PRIMARY; + break; - // Check if alarm audio current is sufficiently high indicating alarm tone is being output -// TODO - need tone to be on longer than 50ms. make duration long (1 sec) at first to characterize the audio, then change to exit test when threshold met or t/o -// if ( ( almHGCurrent > ALARM_AUDIO_CURRENT_HG_MIN_MA ) && -// ( almLGCurrent > ALARM_AUDIO_CURRENT_LG_MIN_MA ) ) - { - result = SELF_TEST_STATUS_PASSED; - } -// else -// { -// result = SELF_TEST_STATUS_FAILED; -// SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_ALARM_AUDIO_SELF_TEST_FAILURE, almHGCurrent, almLGCurrent ); -// } + case ALARM_AUDIO_SELF_TEST_STATE_PRIMARY: + { + F32 almHGCurrent = getIntADCVoltageConverted( INT_ADC_PRIMARY_ALARM_CURRENT_HG ); + F32 almLGCurrent = getIntADCVoltageConverted( INT_ADC_PRIMARY_ALARM_CURRENT_LG ); + + // Check if alarm audio current is sufficiently high indicating alarm tone is being output + if ( ( almHGCurrent > ALARM_AUDIO_CURRENT_HG_MIN_MA ) && + ( almLGCurrent > ALARM_AUDIO_CURRENT_LG_MIN_MA ) ) + { + alarmAudioTestToneRequested = FALSE; + result = SELF_TEST_STATUS_PASSED; + alarmAudioSelfTestState = ALARM_AUDIO_SELF_TEST_STATE_COMPLETE; + } + else if ( TRUE == didTimeout( testStartTime, ALARM_AUDIO_MAX_TEST_TIME_MS ) ) + { + alarmAudioTestToneRequested = FALSE; + result = SELF_TEST_STATUS_FAILED; + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_ALARM_AUDIO_SELF_TEST_FAILURE, almHGCurrent, almLGCurrent ); + alarmAudioSelfTestState = ALARM_AUDIO_SELF_TEST_STATE_COMPLETE; + } + } + break; + + case ALARM_AUDIO_SELF_TEST_STATE_COMPLETE: + alarmAudioSelfTestState = ALARM_AUDIO_SELF_TEST_STATE_START; // Should only get here if re-starting self-tests. + break; + + default: + // TODO - s/w fault + break; } return result; Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r1240b612f790f931825aba86ec37f37eccce9336 -r39dd0b7734331c784b8410f2bbd481e0f792892e --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 1240b612f790f931825aba86ec37f37eccce9336) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 39dd0b7734331c784b8410f2bbd481e0f792892e) @@ -100,6 +100,8 @@ #define FPGA_ALARM_AUDIO_VOLUME_SHIFT 3 ///< Shift alarm audio volume 3 bits to left before writing to register. +#define FPGA_BACKUP_ALARM_AUDIO_CONVERT 0.4 ///< Converts backup (piezo) alarm audio ADC volts to amps. + // FPGA Sensors Record #pragma pack(push,1) /// Record structure for FPGA header read. @@ -177,13 +179,13 @@ S16 VBVPosition; ///< Reg 360. Encoder position from VBV pinch valve. 0 until PID interface is enabled. S16 VDiPosition; ///< Reg 362. Encoder position from VDi pinch valve. 0 until PID interface is enabled. S16 VDoPosition; ///< Reg 364. Encoder position from VDo pinch valve. 0 until PID interface is enabled. - S16 VSparePosition; ///< Reg 366. Encoder position from VSpare pinch valve. 0 until PID interface is enabled. + S16 fpgaIntVoltage; ///< Reg 366. Internal FPGA Vcc voltage. 3V range over 12 bits (0..4095). U16 valveStatus; ///< Reg 368. Valve status register. U16 VBAPWMTarget; ///< Reg 370. PWM target duty cycle for VBA pinch valve. U16 VBVPWMTarget; ///< Reg 372. PWM target duty cycle for VBV pinch valve. U16 VDiPWMTarget; ///< Reg 374. PWM target duty cycle for VDi pinch valve. U16 VDoPWMTarget; ///< Reg 376. PWM target duty cycle for VDo pinch valve. - U16 VSparePWMTarget; ///< Reg 378. PWM target duty cycle for Vspare pinch valve. + U16 VSparePWMTarget; ///< Reg 378. Internal FPGA Vcc Aux voltage. U08 syringePumpStatus; ///< Reg 380. Syringe pump status register. U08 syringePumpADCReadCounter; ///< Reg 381. Syringe pump ADC read counter. U08 syringePumpADCandDACStatus; ///< Reg 382. Syringe pump ADC and DAC status register. @@ -203,6 +205,8 @@ U16 VDiCurrent; ///< Reg 410. VDi pinch valve current (Register VAUX11) U16 VSpareSpeed; ///< Reg 412. VSpare speed (Register VAUX5) U16 VSpareCurrent; ///< Reg 414. VSpare current (Register VAUX13) + U16 timerCounterMs; ///< Reg 416. Free running 1ms timer counter. Rolls over at 65535. + U16 backupAlarmAudioPeakCurrent; ///< Reg 418. Piezo alarm peak ADC current in previous 10ms. 12 bit unsigned. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. @@ -1811,6 +1815,22 @@ /*********************************************************************//** * @brief + * The getFPGABackupAlarmAudioCurrent function gets the latest piezo alarm + * audio current reading. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return Latest piezo alarm audio current reading + *************************************************************************/ +F32 getFPGABackupAlarmAudioCurrent( void ) +{ + U16 adcCnts = fpgaSensorReadings.backupAlarmAudioPeakCurrent; + F32 result = ( ( (F32)adcCnts / (F32)BITS_12_FULL_SCALE ) * FPGA_BACKUP_ALARM_AUDIO_CONVERT ) * (F32)MA_PER_AMP; + + return result; +} + +/*********************************************************************//** + * @brief * The getFPGAAirTrapLevels function gets the latest air trap level sensor * readings. * @details Inputs: fpgaSensorReadings Index: firmware/App/Services/FPGA.h =================================================================== diff -u -r1240b612f790f931825aba86ec37f37eccce9336 -r39dd0b7734331c784b8410f2bbd481e0f792892e --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision 1240b612f790f931825aba86ec37f37eccce9336) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 39dd0b7734331c784b8410f2bbd481e0f792892e) @@ -110,6 +110,8 @@ void getFPGAAccelMaxes( S16 *xm, S16*ym, S16*zm ); void getFPGAAccelStatus( U16 *cnt, U16 *accelFPGAFaultReg ); +F32 getFPGABackupAlarmAudioCurrent( void ); + void getFPGAAirTrapLevels( BOOL *airAtLower, BOOL *airAtUpper ); void setFPGASensorTest( U08 sensorTest ); Index: firmware/App/Services/Interrupts.c =================================================================== diff -u -r421ffbd3887d136b66da26ee3eeb17dcd9a773b8 -r39dd0b7734331c784b8410f2bbd481e0f792892e --- firmware/App/Services/Interrupts.c (.../Interrupts.c) (revision 421ffbd3887d136b66da26ee3eeb17dcd9a773b8) +++ firmware/App/Services/Interrupts.c (.../Interrupts.c) (revision 39dd0b7734331c784b8410f2bbd481e0f792892e) @@ -34,9 +34,6 @@ #include "TaskPriority.h" #include "TaskTimer.h" #include "Utilities.h" -#ifdef DEBUG_ENABLED - #include "SystemCommMessages.h" -#endif /** * @addtogroup Interrupts Index: firmware/App/Services/WatchdogMgmt.c =================================================================== diff -u -rf3326a3d0fd2a465a518e31ee578e335db301c27 -r39dd0b7734331c784b8410f2bbd481e0f792892e --- firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision f3326a3d0fd2a465a518e31ee578e335db301c27) +++ firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 39dd0b7734331c784b8410f2bbd481e0f792892e) @@ -16,6 +16,7 @@ ***************************************************************************/ #include "CPLD.h" +#include "FPGA.h" #include "InternalADC.h" #include "SafetyShutdown.h" #include "SystemCommMessages.h" @@ -30,11 +31,11 @@ // ********** private definitions ********** #define MIN_WATCHDOG_PET_INTERVAL_MS 45 ///< Minimum watchdog pet interval (in ms). -#define WATCHDOG_POST_TIMEOUT_MS 100 ///< Watchdog POST test timeout (in ms). +#define WATCHDOG_POST_TIMEOUT_MS 500 ///< Watchdog POST test timeout (in ms). #define WATCHDOG_RECOVERY_TIME_MS 250 ///< After watchdog POST test, wait this long (in ms) before moving on. -#define MAX_24V_LEVEL_ON_WATCHDOG_EXPIRED 1.0 ///< Maximum voltage on 24V line when watchdog is expired. -#define MIN_BACKUP_ALARM_CURRENT 10.0 ///< Minimum backup alarm audio current (in mA) detected when watchdog is expired. +#define MAX_24V_LEVEL_ON_WATCHDOG_EXPIRED 5.0 ///< Maximum voltage on 24V line when watchdog is expired. // TODO - check w/ Systems. Takes time for V to bleed off. Had to raise to 5V. +#define MIN_BACKUP_ALARM_CURRENT_MA 200.0 ///< Minimum backup alarm audio current (in mA) detected when watchdog is expired. /// Enumeration of watchdog self-test states. typedef enum Watchdog_Self_Test_States @@ -124,7 +125,6 @@ } } - /*********************************************************************//** * @brief * The checkInWithWatchdogMgmt function checks a given task in with the @@ -168,23 +168,30 @@ // Waiting here for w.d. test period to prevent this task from checking in - watchdog should expire } if ( getCPLDWatchdogExpired() == PIN_SIGNAL_HIGH ) - { + { + F32 v24 = getIntADCVoltageConverted( INT_ADC_24V_ACTUATORS ); + F32 audioCurrent = getFPGABackupAlarmAudioCurrent(); + // Verify 24V is down when w.d. expired - if ( getIntADCVoltageConverted( INT_ADC_24V_ACTUATORS ) > MAX_24V_LEVEL_ON_WATCHDOG_EXPIRED ) + if ( v24 > MAX_24V_LEVEL_ON_WATCHDOG_EXPIRED ) { - // TODO - alarm + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_WATCHDOG_POST_TEST_FAILED, 2.0, v24 ); + watchdogSelfTestStatus = SELF_TEST_STATUS_FAILED; } // Verify backup alarm audio is on when w.d. expired - if ( getIntADCVoltageConverted( INT_ADC_BACKUP_ALARM_CURRENT ) < MIN_BACKUP_ALARM_CURRENT ) + else if ( audioCurrent < MIN_BACKUP_ALARM_CURRENT_MA ) { - // TODO - alarm + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_WATCHDOG_POST_TEST_FAILED, 3.0, audioCurrent ); + watchdogSelfTestStatus = SELF_TEST_STATUS_FAILED; } - // TODO - user needs to verify backup alarm audio and LED? - watchdogSelfTestStatus = SELF_TEST_STATUS_PASSED; + else + { + watchdogSelfTestStatus = SELF_TEST_STATUS_PASSED; + } } else { - activateAlarmNoData( ALARM_ID_WATCHDOG_POST_TEST_FAILED ); + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_WATCHDOG_POST_TEST_FAILED, 1 ); watchdogSelfTestStatus = SELF_TEST_STATUS_FAILED; } watchdogSelfTestTimerCount = getMSTimerCount();