Index: firmware/App/Controllers/LoadCell.c =================================================================== diff -u -r16dfbeeca1bcf1d2115c2f7549999fdaae0700e9 -rc548570b37339819da825092dd07c7081437f30b --- firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision 16dfbeeca1bcf1d2115c2f7549999fdaae0700e9) +++ firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision c548570b37339819da825092dd07c7081437f30b) @@ -177,7 +177,7 @@ * @details * Inputs : none * Outputs : measuredLoadCellReadingsRaw[] - * @param value : override measured raw load cell reading + * @param value : override measured load cell reading * @param loadCellID : ID of the load cell to override. * @return TRUE if override successful, FALSE if not *************************************************************************/ Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r216bd924f989182e648ee5f33f4c91c43ac438ac -rc548570b37339819da825092dd07c7081437f30b --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 216bd924f989182e648ee5f33f4c91c43ac438ac) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision c548570b37339819da825092dd07c7081437f30b) @@ -198,7 +198,7 @@ { if ( roPressure < MIN_RO_PRESSURE || roPressure > MAX_RO_PRESSURE ) { - SET_ALARM_WITH_1_F32_DATA( ALARM_ID_RO_PUMP_OUT_PRESSURE_OUR_OF_RANGE, roPressure ) // TODO - add persistence + SET_ALARM_WITH_1_F32_DATA( ALARM_ID_RO_PUMP_OUT_PRESSURE_OUT_OF_RANGE, roPressure ) // TODO - add persistence } } Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r5ff39fd6948ae3656b4035c85325bd8fca0a37f3 -rc548570b37339819da825092dd07c7081437f30b --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 5ff39fd6948ae3656b4035c85325bd8fca0a37f3) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision c548570b37339819da825092dd07c7081437f30b) @@ -16,6 +16,7 @@ #include "gio.h" +#include "SystemCommMessages.h" #include "TaskGeneral.h" #include "OperationModes.h" #include "ModeChemicalDisinfect.h" @@ -37,12 +38,13 @@ // ********** private definitions ********** -#define DG_OP_MODE_BROADCAST_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the op mode is published on the CAN bus. +#define BROADCAST_DG_OP_MODE_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the op mode is published on the CAN bus. // ********** private data ********** static volatile BOOL modeRequest[NUM_OF_MODES - 1]; ///< Array of mode request flags. static OP_MODE currentMode = MODE_INIT; ///< The currently active mode. +static U32 broadcastModeIntervalCtr = 11; ///< Interval counter used to determine when to broadcase operation mode. Initialize to 11 to stagger broadcast. /// This matrix determines legal transitions from one mode to another. static const OP_MODE MODE_TRANSITION_TABLE[NUM_OF_MODES - 1][NUM_OF_MODES - 1] = @@ -67,6 +69,7 @@ static OP_MODE arbitrateModeRequest( void ); static void transitionToNewOperationMode( OP_MODE newMode ); +static void broadcastOperationMode( void ); /*********************************************************************//** * @brief execOperationModes @@ -194,11 +197,7 @@ } // end switch // publish op mode on interval - if ( ++dgOpModePublicationTimerCounter >= DG_OP_MODE_BROADCAST_INTERVAL ) - { - broadcastDGOpMode( (U32)currentMode ); - dgOpModePublicationTimerCounter = 0; - } + broadcastOperationMode(); } /*********************************************************************//**** @@ -330,4 +329,22 @@ } } +/************************************************************************* + * @brief + * The broadcastOperationMode function sends the current operation mode at \n + * the prescribed interval. + * @details + * Inputs : broadcastModeIntervalCtr + * Outputs : DG operation mode broadcast message sent. + * @return none + *************************************************************************/ +static void broadcastOperationMode( void ) +{ + if ( ++broadcastModeIntervalCtr >= BROADCAST_DG_OP_MODE_INTERVAL ) + { + broadcastModeIntervalCtr = 0; + broadcastDGOperationMode( currentMode ); + } +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r65cca9d3650f1da299e0c0c682bc557439a407f2 -rc548570b37339819da825092dd07c7081437f30b --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 65cca9d3650f1da299e0c0c682bc557439a407f2) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision c548570b37339819da825092dd07c7081437f30b) @@ -314,27 +314,27 @@ } /************************************************************************* - * @brief - * The broadcastDGOpMode function constructs an operation mode msg to be \n - * broadcast and queues the msg for transmit on the appropriate CAN channel. + * @brief broadcastRTCEpoch + * The broadcastRTCEpoch function constructs an epoch msg to \n + * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details * Inputs : none - * Outputs : DG op mode msg constructed and queued. - * @param mode : ID of current DG op mode + * Outputs : RTC time and date in epoch + * @param epoch : Current time and date in epoch * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastDGOpMode( U32 mode ) +BOOL broadcastRTCEpoch( U32 epoch ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_OP_MODE; + msg.hdr.msgID = MSG_ID_RTC_EPOCH; msg.hdr.payloadLen = sizeof( U32 ); - memcpy( payloadPtr, &mode, sizeof( U32 ) ); + memcpy( payloadPtr, &epoch, sizeof( U32 ) ); // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); @@ -343,27 +343,26 @@ } /************************************************************************* - * @brief broadcastRTCEpoch - * The broadcastRTCEpoch function constructs an epoch msg to \n - * be broadcast and queues the msg for transmit on the appropriate CAN channel. + * @brief + * The broadcastDGHDOperationMode function constructs a DG operation mode \n + * broadcast message and queues the msg for transmit on the appropriate CAN channel. * @details * Inputs : none - * Outputs : RTC time and date in epoch - * @param epoch : Current time and date in epoch + * Outputs : DG operation mode msg constructed and queued * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastRTCEpoch( U32 epoch ) +BOOL broadcastDGOperationMode( U32 mode ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_RTC_EPOCH; + msg.hdr.msgID = MSG_ID_DG_OP_MODE; msg.hdr.payloadLen = sizeof( U32 ); - memcpy( payloadPtr, &epoch, sizeof( U32 ) ); + memcpy( payloadPtr, &mode, sizeof( U32 ) ); // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r5ff39fd6948ae3656b4035c85325bd8fca0a37f3 -rc548570b37339819da825092dd07c7081437f30b --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 5ff39fd6948ae3656b4035c85325bd8fca0a37f3) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision c548570b37339819da825092dd07c7081437f30b) @@ -32,12 +32,12 @@ // MSG_ID_ALARM_CLEARED BOOL broadcastAlarmCleared( U16 alarm ); -// MSG_ID_DG_OP_MODE -BOOL broadcastDGOpMode( U32 mode ); - // MSG_ID_RTC_EPOCH BOOL broadcastRTCEpoch( U32 epoch ); // TODO - probably don't want DG to broadcast these +// MSG_ID_DG_OP_MODE +BOOL broadcastDGOperationMode( U32 mode ); + // MSG_ID_LOAD_CELL_READINGS BOOL broadcastLoadCellData( F32 loadCellA1, F32 loadCellA2, F32 loadCellB1, F32 loadCellB2 );