Index: firmware/App/Controllers/Fans.h =================================================================== diff -u -rdaf8d5b60c753becab80cbaf164aac0e49d533a2 -r04db56ac0f515f35b7f236d607bfb6f7585f55fb --- firmware/App/Controllers/Fans.h (.../Fans.h) (revision daf8d5b60c753becab80cbaf164aac0e49d533a2) +++ firmware/App/Controllers/Fans.h (.../Fans.h) (revision 04db56ac0f515f35b7f236d607bfb6f7585f55fb) @@ -36,5 +36,4 @@ void stopFan2( void ); // TODO Remove - #endif Index: firmware/App/Controllers/TemperatureSensors.c =================================================================== diff -u -r1538c71d0c6b97469d599befce15f068d9acf5d4 -r04db56ac0f515f35b7f236d607bfb6f7585f55fb --- firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 1538c71d0c6b97469d599befce15f068d9acf5d4) +++ firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 04db56ac0f515f35b7f236d607bfb6f7585f55fb) @@ -74,6 +74,7 @@ #define TEMP_SENSORS_DATA_PUBLISH_INTERVAL (MS_PER_SECOND / TASK_PRIORITY_INTERVAL) ///< Temperature sensors publish data time interval. #define MAX_TEMPERATURE_SENSOR_FAILURES 5//10 ///< Maximum number of temperature sensor errors within window period before alarm. #define MAX_TEMPERATURE_SENSOR_FAILURE_WINDOW_MS (10 * MS_PER_SECOND) ///< Temperature sensor error window. +//#define TEMP_SENSORS_DATA_PUBLISH_INTERVAL (500 / TASK_PRIORITY_INTERVAL) ///< Temperature sensors publish data time interval /// Temperature sensor self-test states. typedef enum tempSensors_Self_Test_States @@ -118,9 +119,6 @@ static TEMPSENSORS_EXEC_STATES_T tempSensorsExecState; ///< TemperatureSensor exec state. static TEMP_SENSOR_T tempSensors [ NUM_OF_TEMPERATURE_SENSORS ]; ///< Temperature sensors' data structure. - -#define TEMP_SENSORS_DATA_PUBLISH_INTERVAL (500 / TASK_PRIORITY_INTERVAL) ///< Temperature sensors publish data time interval - // From master static U32 elapsedTime; ///< Elapsed time variable. static U32 internalHeatersConversionTimer; ///< Conversion timer variable to calculate the heaters internal temperature. @@ -146,7 +144,7 @@ 0.971511471520E-22,-0.121047212750E-25 }; -///< Thermcouple inverse coefficient for positive cold junction temperature. +///< Thermocouple inverse coefficient for positive cold junction temperature. static const F32 positiveTCInverserCoeffs [ SIZE_OF_THERMOCOUPLE_COEFFICIENTS ] = { 0.0, 2.508355E1, 7.860106E-2, -2.503131E-1, 8.315270E-2, Index: firmware/App/Controllers/Thermistors.c =================================================================== diff -u --- firmware/App/Controllers/Thermistors.c (revision 0) +++ firmware/App/Controllers/Thermistors.c (revision 04db56ac0f515f35b7f236d607bfb6f7585f55fb) @@ -0,0 +1,365 @@ + +#include + +#include "Thermistors.h" +#include "FPGA.h" +#include "TaskGeneral.h" +#include "InternalADC.h" +#include "SystemCommMessages.h" + +/** + * @addtogroup Thermistors + * @{ + */ + +// ********** private definitions ********** + +#define THERMISTORS_DATA_PUBLISH_INTERVAL (MS_PER_SECOND / TASK_GENERAL_INTERVAL) ///< Thermistors publish data time interval. +#define THERMISTORS_ADC_READ_INTERVAL (MS_PER_SECOND / (2 * TASK_GENERAL_INTERVAL)) ///< Thermistors ADC read time interval. +#define ADC_FPGA_READ_DELAY_COUNT 1 ///< FGPA read delay upon startup +#define ONBOARD_THERMISTOR_SOURCE_VOLTAGE 3 ///< Onboard thermistor source voltage +#define ONBOARD_THERMISTOR_REFERENCE_RESISTOR 10 ///< Onboard thermistor reference resistor +#define ONBOARD_THERMISTOR_BETA_VALUE 3380 ///< Onboard thermistor beta value +#define ONBOARD_THERMISTOR_REFERENCE_TEMPERATURE 298 ///< Onboard thermistor reference temperature +#define TWELVE_BIT_RESOLUTION 4096 ///< 12 bit resolution conversion + +/// Thermistors self test states +typedef enum thermistors_Self_Test_States +{ + THERMISTORS_SELF_TEST_START = 0, ///< Thermistors self test start + THERMISTROS_SELF_TEST_ADC_CHECK, ///< Thermistors self test ADC check + THERMISTORS_SELF_TEST_COMPLETE, ///< Thermistors self test complete + NUM_OF_THERMISTORS_SEsLF_TEST_STATES, ///< Number of thermistors self test states +} THERMISTORS_SELF_TEST_STATES_T; + +/// Thermistors exec states +typedef enum thermistors_Exec_States +{ + THERMISTORS_EXEC_STATE_START = 0, ///< Thermistors exec state start + THERMISTORS_EXEC_STATE_GET_ADC_VALUES, ///< Thermistors exec state get ADC values + NUM_OF_THERMISTORS_EXEC_STATES, ///< Number of thermistors exec state +} THERMISTORS_EXEC_STATES_T; + +/// Thermistor struct +typedef struct +{ + S32 rawADCRead; ///< Thermistor raw ADC read + OVERRIDE_F32_T temperatureValue; ///< Thermistor temperature value +} THERMISTOR_T; + + +static SELF_TEST_STATUS_T thermistorsSelfTestReslt = SELF_TEST_STATUS_IN_PROGRESS; ///< Thermistors self test result +static THERMISTORS_SELF_TEST_STATES_T thermistorsSelfTestState = THERMISTORS_SELF_TEST_START; ///< Thermistors self test state +static THERMISTORS_EXEC_STATES_T thermistorsExecState = THERMISTORS_EXEC_STATE_START; ///< Thermistors exec state +static THERMISTOR_T thermistorsStatus[ NUM_OF_THERMISTORS ]; ///< Thermistors array + +static F32 tempValuesForPublication[ NUM_OF_THERMISTORS ]; ///< Thermistors data publication array +static OVERRIDE_U32_T thermistorsPublishInterval = { THERMISTORS_DATA_PUBLISH_INTERVAL, + THERMISTORS_DATA_PUBLISH_INTERVAL, 0, 0 }; ///< Thermistors publish time interval override + +static U32 dataPublishCounter; ///< Thermistors data publish timer counter +static U32 adcReadCounter; ///< Thermistors ADC read counter + +// ********** private function prototypes ********** + +static THERMISTORS_EXEC_STATES_T handleExecStart( void ); +static THERMISTORS_EXEC_STATES_T handleExecGetADCValues( void ); + +static void convertADCtoTemperature( THERMISTORS_TEMP_SENSORS_T thermistor ); +static F32 calcualteOnBoardThemristorTemperature( U32 adcValue ); + +static void publishThermistorsData( void ); +static U32 getPublishThermistorsDataInterval( void ); + +/*********************************************************************//** + * @brief + * The initThermistors function initializes the thermistors module. + * @details Inputs: thermistorsSelfTestReslt, thermistorsExecState, + * thermistorsExecState, dataPublishCounter + * @details Outputs: thermistorsSelfTestReslt, thermistorsExecState, + * thermistorsExecState, dataPublishCounter + * @return none + *************************************************************************/ +void initThermistors( void ) +{ + thermistorsSelfTestReslt = SELF_TEST_STATUS_IN_PROGRESS; + thermistorsExecState = THERMISTORS_EXEC_STATE_START; + thermistorsSelfTestState = THERMISTORS_SELF_TEST_START; + dataPublishCounter = 0; +} + +/*********************************************************************//** + * @brief + * The execThermistorsSelfTest function executes the thermistors self test. + * @details Inputs: thermistorsSelfTestState + * @details Outputs: thermistorsSelfTestState + * @return Status of self test + *************************************************************************/ +SELF_TEST_STATUS_T execThermistorsSelfTest( void ) +{ + switch ( thermistorsSelfTestState ) + { + case THERMISTORS_SELF_TEST_START: + break; + + case THERMISTROS_SELF_TEST_ADC_CHECK: + break; + + case THERMISTORS_SELF_TEST_COMPLETE: + // Done with POST. Do nothing. + break; + + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_THERMISTORS_INVALID_SELF_TEST_STATE, thermistorsSelfTestState ); + thermistorsSelfTestState = THERMISTORS_SELF_TEST_COMPLETE; + break; + } + + return thermistorsSelfTestReslt; +} + +/*********************************************************************//** + * @brief + * The execThermistors function executes the thermistors exec states. + * @details Inputs: thermistorsExecState + * @details Outputs: thermistorsExecState + * @return none + *************************************************************************/ +void execThermistors( void ) +{ + switch ( thermistorsExecState ) + { + case THERMISTORS_EXEC_STATE_START: + thermistorsExecState = handleExecStart(); + break; + + case THERMISTORS_EXEC_STATE_GET_ADC_VALUES: + thermistorsExecState = handleExecGetADCValues(); + break; + + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_THERMISTORS_INVALID_EXEC_STATE, thermistorsExecState ); + thermistorsExecState = THERMISTORS_EXEC_STATE_GET_ADC_VALUES; + break; + } + + // Check if it is time to publish any data + publishThermistorsData(); +} + +/*********************************************************************//** + * @brief + * The getThermistorTemperatureValue function returns the temperature of + * a requested thermistor or temperature sensor. + * @details Inputs: thermistorsStatus + * @details Outputs: none + * @param thermistor to get its temperature value + * @return temperature of a thermistor or temperature sensor + *************************************************************************/ +F32 getThermistorTemperatureValue( THERMISTORS_TEMP_SENSORS_T thermistor ) +{ + F32 temperature = 0.0; + + // Check if the thermistor of sensor is in range + if ( thermistor < NUM_OF_THERMISTORS ) + { + if ( thermistorsStatus[ thermistor ].temperatureValue.override == OVERRIDE_KEY ) + { + temperature = thermistorsStatus[ thermistor ].temperatureValue.ovData; + } + else + { + temperature = thermistorsStatus[ thermistor ].temperatureValue.data; + } + } + else + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_THERMISTOR_SELECTED, thermistor ); + } + + return temperature; +} + +/*********************************************************************//** + * @brief + * The handleExecStart function handles the start state of the exec state + * machine. + * @details Inputs: adcReadCounter + * @details Outputs: adcReadCounter + * @return next state of the exec state machine + *************************************************************************/ +static THERMISTORS_EXEC_STATES_T handleExecStart( void ) +{ + THERMISTORS_EXEC_STATES_T state = THERMISTORS_EXEC_STATE_START; + + // Give a short time for FPGA to boot up and start sending the ADC reads + if ( ++adcReadCounter > ADC_FPGA_READ_DELAY_COUNT ) + { + state = THERMISTORS_EXEC_STATE_GET_ADC_VALUES; + adcReadCounter = 0; + } + + return state; +} + +/*********************************************************************//** + * @brief + * The handleExecGetADCValues function handles the get ADC values state + * of the exec state machine. + * @details Inputs: adcReadCounter, thermistorsStatus + * @details Outputs: adcReadCounter, thermistorsStatus + * @return next state of the exec machine + *************************************************************************/ +static THERMISTORS_EXEC_STATES_T handleExecGetADCValues( void ) +{ + THERMISTORS_TEMP_SENSORS_T thermistor; + + THERMISTORS_EXEC_STATES_T state = THERMISTORS_EXEC_STATE_GET_ADC_VALUES; + + // If time has elapsed to read the ADCs, read them all + if ( ++adcReadCounter >= THERMISTORS_ADC_READ_INTERVAL ) + { + thermistorsStatus[ THERMISTOR_ONBOARD_NTC ].rawADCRead = getIntADCReading( INT_ADC_BOARD_THERMISTOR ); + + // Zero the counter for the next round of reading + adcReadCounter = 0; + + // Loop through the list and update the temperature values + for ( thermistor = THERMISTOR_ONBOARD_NTC; thermistor < NUM_OF_THERMISTORS; thermistor++ ) + { + convertADCtoTemperature( thermistor ); + } + } + + return state; +} + +/*********************************************************************//** + * @brief + * The convertADCtoTemperature function converts the ADC values of different + * thermistors and temperature sensors to temperature value. + * @details Inputs: thermistorsStatus + * @details Outputs: thermistorsStatus + * @param thermistor (also covers the temperature sensors) to convert its value + * @return none + *************************************************************************/ +static void convertADCtoTemperature( THERMISTORS_TEMP_SENSORS_T thermistor ) +{ + F32 temperature; + + // Each of the sensors/thermistors have different equations to convert ADC read to temperature + switch ( thermistor ) + { + case THERMISTOR_ONBOARD_NTC: + temperature = calcualteOnBoardThemristorTemperature( thermistorsStatus[ THERMISTOR_ONBOARD_NTC ].rawADCRead ); + thermistorsStatus[ THERMISTOR_ONBOARD_NTC ].temperatureValue.data = temperature; + break; + + case TEMPSENSOR_FPGA_SENSOR: + //TODO do stuff + break; + + case TEMPSENSOR_LOAD_CELL_A1: + case TEMPSENSOR_LOAD_CELL_A2: + case TEMPSENSOR_THDO_RTD: + case TEMPSENSOR_TDI_RTD: + case THERMISTOR_CONDUCTIVITY: + + // TODO fill up the case + break; + + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_THERMISTOR_SELECTED, thermistor ); + break; + } +} + +/*********************************************************************//** + * @brief + * The calcualteOnBoardThemristorTemperature function converts the ADC value + * of the onboard thermistor into temperature in C + * @details Inputs: none + * @details Outputs: none + * @param ADC value to be converted into temperature in C + * @return calculated temperature in C + *************************************************************************/ +static F32 calcualteOnBoardThemristorTemperature( U32 adcValue ) +{ + //TODO add comments + F32 thermistorVoltage = ( adcValue * ONBOARD_THERMISTOR_SOURCE_VOLTAGE ) / TWELVE_BIT_RESOLUTION; + F32 thermistorResistor = ( ( ONBOARD_THERMISTOR_REFERENCE_RESISTOR * ONBOARD_THERMISTOR_SOURCE_VOLTAGE ) - + ( ONBOARD_THERMISTOR_REFERENCE_RESISTOR * thermistorVoltage ) ) / thermistorVoltage; + F32 InvTemperature = ( logf(thermistorResistor/ONBOARD_THERMISTOR_REFERENCE_RESISTOR) / ONBOARD_THERMISTOR_BETA_VALUE ) + + ( 1 / ONBOARD_THERMISTOR_REFERENCE_TEMPERATURE); + F32 temperature = 1 / InvTemperature; + + return temperature; +} + +/*********************************************************************//** + * @brief + * The getPublishThermistorsDataInterval function gets the thermistors + * data publish interval. + * @details Inputs: thermistorsPublishInterval + * @details Outputs: none + * @return data publish time interval in counts + *************************************************************************/ +static U32 getPublishThermistorsDataInterval( void ) +{ + U32 result = thermistorsPublishInterval.data; + + if ( OVERRIDE_KEY == thermistorsPublishInterval.override ) + { + result = thermistorsPublishInterval.ovData; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The publishThermistorsData function publishes the thermistors and + * temperature sensors data at the specified time interval. + * @details Inputs: dataPublishCounter + * @details Outputs: dataPublishCounter + * @return none + *************************************************************************/ +static void publishThermistorsData( void ) +{ + if ( ++dataPublishCounter > getPublishThermistorsDataInterval() ) + { + THERMISTORS_DATA_T sensorsData; + //TODO add the rest too + sensorsData.OnboardThermistor = getThermistorTemperatureValue( THERMISTOR_ONBOARD_NTC ); + + broadcastThermistorsData( &sensorsData ); + + dataPublishCounter = 0; + } +} + +/************************************************************************* +* TEST SUPPORT FUNCTIONS +*************************************************************************/ + +BOOL testSetMeasuredThermistorOverride( U32 thermistor, F32 temperature ) +{ + +} + +BOOL testResetMeasuredThermistorOverride( U32 thermistor ) +{ + +} + +BOOL testSetThermistorPublishIntervalOverride( U32 value ) +{ + +} + +BOOL testResetThermistorPublishIntervalOverride( void ) +{ + +} + + Index: firmware/App/Controllers/Thermistors.h =================================================================== diff -u --- firmware/App/Controllers/Thermistors.h (revision 0) +++ firmware/App/Controllers/Thermistors.h (revision 04db56ac0f515f35b7f236d607bfb6f7585f55fb) @@ -0,0 +1,57 @@ + + +#ifndef _THERMISTORS_H_ +#define _THERMISTORS_H_ + +#include "DGCommon.h" + +/** + * @defgroup Thermistors Thermistors + * @brief Thermistors driver module. Reads and processes the thermistors. + * + * @addtogroup Thermistors + * @{ + */ + + +// ********** public definitions ********** + +/// Enumeration of thermistors +typedef enum thermistors_Name +{ + THERMISTOR_ONBOARD_NTC = 0, ///< Onboard thermistor + TEMPSENSOR_FPGA_SENSOR, ///< FPGA board temperature sensor + TEMPSENSOR_LOAD_CELL_A1, ///< Load cell A1 temperature sensor + TEMPSENSOR_LOAD_CELL_A2, ///< Load cell A2 temperature sensor + TEMPSENSOR_THDO_RTD, ///< THDo RTD temperature sensor + TEMPSENSOR_TDI_RTD, ///< TDi RTD temperature sensor + THERMISTOR_CONDUCTIVITY, ///< Conductivity sensor thermistor + NUM_OF_THERMISTORS, ///< Number of thermistors +} THERMISTORS_TEMP_SENSORS_T; + +/// Thermistors/temperature sensors data publish struct +typedef struct +{ + F32 OnboardThermistor; ///< Onboard thermistor data + F32 FPGABoardSensor; ///< FPGA board temperature sensor data +} THERMISTORS_DATA_T; + +// ********** public function prototypes ********** + +void initThermistors( void ); + +SELF_TEST_STATUS_T execThermistorsSelfTest( void ); + +void execThermistors( void ); + +F32 getThermistorTemperatureValue( THERMISTORS_TEMP_SENSORS_T thermistor ); + +BOOL testSetMeasuredThermistorOverride( U32 thermistor, F32 temperature ); +BOOL testResetMeasuredThermistorOverride( U32 thermistor ); + +BOOL testSetThermistorPublishIntervalOverride( U32 value ); +BOOL testResetThermistorPublishIntervalOverride( void ); + +/**@}*/ + +#endif Index: firmware/App/Controllers/UVReactors.c =================================================================== diff -u -r1538c71d0c6b97469d599befce15f068d9acf5d4 -r04db56ac0f515f35b7f236d607bfb6f7585f55fb --- firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 1538c71d0c6b97469d599befce15f068d9acf5d4) +++ firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 04db56ac0f515f35b7f236d607bfb6f7585f55fb) @@ -49,6 +49,7 @@ U32 reactorEnablePin; ///< UV reactor enable pin of GIO port A U32 reactorHealthStatusPin; ///< UV reactor status pin of N2HET1 U32 reactorUnhealthyCounter; ///< UV reactor counter of the number of times it is unhealthy in a row + BOOL reactorCurrentHealthStatus; ///< UV reactor current health status } UV_REACTOR_STATUS_T; // ********** private data ********** @@ -77,7 +78,7 @@ static BOOL isReactorHealthy( UV_REACTORS_T reactor ); static void setReactorEnableStatus( UV_REACTORS_T reactor, PIN_SIGNAL_STATE_T state ); static void publishUVReactorsData( void ); -static U32 getPublishValvesDataInterval( void ); +static U32 getPublishUVReactorsDataInterval( void ); /*********************************************************************//** * @brief @@ -173,9 +174,23 @@ /*********************************************************************//** * @brief + * The getUVReactorHealth function returns the health status of a UV reactor. + * @details Inputs: reactorsStatus + * @details Outputs: none + * @param reactor to return its health + * @return returns the health of the requested UV reactor + *************************************************************************/ +BOOL getUVReactorHealth( UV_REACTORS_T reactor ) +{ + return reactorsStatus[ reactor ].reactorCurrentHealthStatus; +} + +/*********************************************************************//** + * @brief * The turnOnUVReactor function turns on the selected UV reactor per request. * @details Inputs: reactorsStatus * @details Outputs: reactorsStatus + * @param reactor to turn on * @return returns TRUE if the reactor was not already on *************************************************************************/ BOOL turnOnUVReactor( UV_REACTORS_T reactor ) @@ -196,6 +211,7 @@ * The turnOffUVReactor function turns off the selected UV reactor per request. * @details Inputs: reactorsStatus * @details Outputs: reactorsStatus + * @param reactor to turn off * @return returns TRUE if the reactor was not already off *************************************************************************/ BOOL turnOffUVReactor( UV_REACTORS_T reactor ) @@ -283,6 +299,7 @@ * The handleUVReactorStateOff function handles the off state. * @details Inputs: reactorsStatus * @details Outputs: none + * @param reactor to check its state * @return returns the next state of the exec state machine *************************************************************************/ static UV_REACTOR_STATE_T handleUVReactorStateOff( UV_REACTORS_T reactor ) @@ -310,15 +327,17 @@ * The handleUVReactorStateOn function handles the on state. * @details Inputs: reactorsStatus * @details Outputs: reactorsStatus + * @param reactor to checks it status * @return returns the next state of the exec state machine *************************************************************************/ static UV_REACTOR_STATE_T handleUVReactorStateOn( UV_REACTORS_T reactor ) { UV_REACTOR_STATE_T state = UV_REACTOR_STATE_ON; + BOOL health = isReactorHealthy( reactor ); + reactorsStatus[ reactor ].reactorCurrentHealthStatus = health; // Check if the reactor is healthy - if ( FALSE == isReactorHealthy( reactor ) && - ++reactorsStatus[ reactor ].reactorUnhealthyCounter > MAX_ALLOWED_UNHEALTHY_REACTOR_COUNTER ) + if ( FALSE == health && ++reactorsStatus[ reactor ].reactorUnhealthyCounter > MAX_ALLOWED_UNHEALTHY_REACTOR_COUNTER ) { // The reactor has been unhealthy for a certain amount of time SET_ALARM_WITH_1_U32_DATA( ALARM_ID_UV_REACTOR_NOT_HEALTHY , reactor ); @@ -348,6 +367,8 @@ * disable state. * @details Inputs: reactorsStatus * @details Outputs: none + * @param reactor to set it enable status + * @param state to set the reactor (high or low) * @return none *************************************************************************/ static void setReactorEnableStatus( UV_REACTORS_T reactor, PIN_SIGNAL_STATE_T state ) @@ -361,6 +382,7 @@ * The isReactorHealthy function checks the health status of a reactor. * @details Inputs: reactorsStatus * @details Outputs: none + * @param reactor to check its health * @return returns TRUE if the reactor is healthy otherwise a FALSE *************************************************************************/ static BOOL isReactorHealthy( UV_REACTORS_T reactor ) @@ -377,7 +399,7 @@ * @details Outputs: none * @return returns data publish interval *************************************************************************/ -static U32 getPublishValvesDataInterval( void ) +static U32 getPublishUVReactorsDataInterval( void ) { U32 result = uvReactorsDataPublishInterval.data; @@ -398,7 +420,7 @@ *************************************************************************/ static void publishUVReactorsData( void ) { - if ( ++dataPublishCounter > getPublishValvesDataInterval() ) + if ( ++dataPublishCounter > getPublishUVReactorsDataInterval() ) { UV_REACTORS_DATA_T uvReactorsData; // Publish the reactors health status Index: firmware/App/Controllers/UVReactors.h =================================================================== diff -u -r1538c71d0c6b97469d599befce15f068d9acf5d4 -r04db56ac0f515f35b7f236d607bfb6f7585f55fb --- firmware/App/Controllers/UVReactors.h (.../UVReactors.h) (revision 1538c71d0c6b97469d599befce15f068d9acf5d4) +++ firmware/App/Controllers/UVReactors.h (.../UVReactors.h) (revision 04db56ac0f515f35b7f236d607bfb6f7585f55fb) @@ -21,21 +21,21 @@ NUM_OF_UV_REACTORS, ///< Number of UV reactors } UV_REACTORS_T; -#pragma pack(push, 1) /// UV reactors data publish typedef struct { U32 inletUVReactorHealthStatus; ///< Inlet UV reactor health status U32 outletUVReactorHealthStatus; ///< Outlet UV reactor health status } UV_REACTORS_DATA_T; -#pragma pack(pop) void initUVReactors( void ); SELF_TEST_STATUS_T execUVReactorsSelfTest( void ); void execUVReactos( void ); +BOOL getUVReactorHealth( UV_REACTORS_T reactor ); + BOOL turnOnUVReactor( UV_REACTORS_T reactor ); BOOL turnOffUVReactor( UV_REACTORS_T reactor ); Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -r1538c71d0c6b97469d599befce15f068d9acf5d4 -r04db56ac0f515f35b7f236d607bfb6f7585f55fb --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 1538c71d0c6b97469d599befce15f068d9acf5d4) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 04db56ac0f515f35b7f236d607bfb6f7585f55fb) @@ -146,6 +146,9 @@ SW_FAULT_ID_PERSISTENT_ALARM_INVALID_INDEX, SW_FAULT_ID_UV_REACTORS_INVALID_EXEC_STATE, // 55 SW_FAULT_ID_UV_REACTORS_INVALID_SELF_TEST_STATE, + SW_FAULT_ID_THERMISTORS_INVALID_EXEC_STATE, + SW_FAULT_ID_THERMISTORS_INVALID_SELF_TEST_STATE, + SW_FAULT_ID_INVALID_THERMISTOR_SELECTED, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r1538c71d0c6b97469d599befce15f068d9acf5d4 -r04db56ac0f515f35b7f236d607bfb6f7585f55fb --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1538c71d0c6b97469d599befce15f068d9acf5d4) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 04db56ac0f515f35b7f236d607bfb6f7585f55fb) @@ -761,6 +761,34 @@ return result; } + +/*********************************************************************//** + * @brief + * The broadcastThermistorsData function sends out thermistors data. + * @details + * Inputs : none + * Outputs : thermistors data msg constructed and queued + * @param UV reactors msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastThermistorsData( THERMISTORS_DATA_T *thermistorsData ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_THERMISTORS_DATA; + msg.hdr.payloadLen = sizeof( THERMISTORS_DATA_T ); + + memcpy( payloadPtr, thermistorsData, sizeof( THERMISTORS_DATA_T ) ); + + // 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 ); + + return result; +} // *********************************************************************** // **************** Message Handling Helper Functions ******************** Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r1538c71d0c6b97469d599befce15f068d9acf5d4 -r04db56ac0f515f35b7f236d607bfb6f7585f55fb --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 1538c71d0c6b97469d599befce15f068d9acf5d4) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 04db56ac0f515f35b7f236d607bfb6f7585f55fb) @@ -21,7 +21,8 @@ #include "DGCommon.h" #include "MsgQueues.h" #include "ROPump.h" -#include "UVReactors.h" +#include "UVReactors.h" +#include "Thermistors.h" /** * @defgroup SystemCommMessages SystemCommMessages @@ -120,8 +121,11 @@ BOOL broadcastHeatDisinfectData( U32 internalState, F32 minutesElapsed, U32 currentCycle ); // MSG_ID_DG_UV_REACTORS_DATA -BOOL broadcastUVReactorsData( UV_REACTORS_DATA_T *uvReactorsData ); +BOOL broadcastUVReactorsData( UV_REACTORS_DATA_T *uvReactorsData ); +//MSG_ID_DG_THERMISTORS_DATA +BOOL broadcastThermistorsData( THERMISTORS_DATA_T *thermistorsData ); + // *********** public test support message functions ********** #ifdef DEBUG_ENABLED