Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r953879c2319ea70007bfc303422155dd162d87e5 -rc65ad0538ff99c3e13d7d7866ac15e38a1ef6002 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 953879c2319ea70007bfc303422155dd162d87e5) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision c65ad0538ff99c3e13d7d7866ac15e38a1ef6002) @@ -36,7 +36,7 @@ // ********** private definitions ********** /// Interval to control lamp and audio and to publish alarm status data. -static const U32 ALARM_STATUS_PUBLISH_INTERVAL = ( ALARM_LAMP_AND_AUDIO_CONTROL_INTERVAL_MS / TASK_GENERAL_INTERVAL ); +#define ALARM_STATUS_PUBLISH_INTERVAL ( ALARM_LAMP_AND_AUDIO_CONTROL_INTERVAL_MS / TASK_GENERAL_INTERVAL ) /// Interval (ms/task time) at which the alarm information is published on the CAN bus. #define ALARM_INFO_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) @@ -108,6 +108,8 @@ static BOOL alarmIsDetected[ NUM_OF_ALARM_IDS ]; /// Table - when alarm became active for each alarm (if active) or zero (if inactive) static OVERRIDE_U32_T alarmStartedAt[ NUM_OF_ALARM_IDS ]; +/// Interval (in task intervals) at which to publish alarm status to CAN bus. +static OVERRIDE_U32_T alarmStatusPublishInterval = { ALARM_STATUS_PUBLISH_INTERVAL, ALARM_STATUS_PUBLISH_INTERVAL, ALARM_STATUS_PUBLISH_INTERVAL, 0 }; /// Interval (in task intervals) at which to publish alarm information to CAN bus. static OVERRIDE_U32_T alarmInfoPublishInterval = { ALARM_INFO_PUB_INTERVAL, ALARM_INFO_PUB_INTERVAL, ALARM_INFO_PUB_INTERVAL, 0 }; #ifndef ALARM_VOLUME_DEFAULT_LOW @@ -155,6 +157,7 @@ static U32 getAlarmStartTime( ALARM_ID_T alarmID ); static void publishAlarmInfo( void ); +static U32 getPublishAlarmStatusInterval( void ); static U32 getPublishAlarmInfoInterval( void ); /*********************************************************************//** @@ -229,7 +232,7 @@ updateAlarmsFlags(); updateAlarmsSilenceStatus(); // Publish alarm status at interval - if ( ++alarmStatusPublicationTimerCounter >= ALARM_STATUS_PUBLISH_INTERVAL ) + if ( ++alarmStatusPublicationTimerCounter >= getPublishAlarmStatusInterval() ) { // Lamp and audio timing sync'd with broadcast so UI can stay in sync with lamp rhythm setAlarmLamp(); @@ -1138,8 +1141,28 @@ /*********************************************************************//** * @brief - * The getPublishAlarmInfoInterval function gets the blood flow data + * The getPublishAlarmStatusInterval function gets the alarm status data * publication interval. + * @details Inputs: alarmStatusPublishInterval + * @details Outputs: none + * @return the current alarm status publication interval (in task intervals). + *************************************************************************/ +static U32 getPublishAlarmStatusInterval( void ) +{ + U32 result = alarmStatusPublishInterval.data; + + if ( OVERRIDE_KEY == alarmStatusPublishInterval.override ) + { + result = alarmStatusPublishInterval.ovData; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The getPublishAlarmInfoInterval function gets the alarm information + * publication interval. * @details Inputs: alarmInfoPublishInterval * @details Outputs: none * @return the current alarm information publication interval (in task intervals). @@ -1467,6 +1490,53 @@ /*********************************************************************//** * @brief + * The testSetAlarmStatusPublishIntervalOverride function sets the override of the + * alarm status publication interval. + * @details Inputs: none + * @details Outputs: alarmStatusPublishInterval + * @param ms milliseconds between alarm status broadcasts + * @return TRUE if override set successful, FALSE if not + *************************************************************************/ +BOOL testSetAlarmStatusPublishIntervalOverride( U32 ms ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + U32 intvl = ms / TASK_GENERAL_INTERVAL; + + result = TRUE; + alarmStatusPublishInterval.ovData = intvl; + alarmStatusPublishInterval.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetAlarmStatusPublishIntervalOverride function resets the override of the + * alarm status publication interval. + * @details Inputs: none + * @details Outputs: alarmStatusPublishInterval + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetAlarmStatusPublishIntervalOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + alarmStatusPublishInterval.override = OVERRIDE_RESET; + alarmStatusPublishInterval.ovData = alarmStatusPublishInterval.ovInitData; + } + + return result; +} + +/*********************************************************************//** + * @brief * The testSetAlarmInfoPublishIntervalOverride function sets the override of the * alarm information publication interval. * @details Inputs: none