Index: firmware/App/Controllers/TemperatureSensors.c =================================================================== diff -u -r86eec09ab556fbd970ddcae9dc622727928ee757 -r01d37b6dbd51a2c55ba9bc565e22a222f5df1017 --- firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 86eec09ab556fbd970ddcae9dc622727928ee757) +++ firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 01d37b6dbd51a2c55ba9bc565e22a222f5df1017) @@ -14,7 +14,8 @@ * @date (original) 08-Apr-2020 * ***************************************************************************/ -#include // For temperature calculation +#include // For temperature calculation +#include // For memset() #include "FPGA.h" #include "PersistentAlarm.h" @@ -736,8 +737,8 @@ processTempSnsrsADCRead( TEMPSENSORS_CONDUCTIVITY_SENSOR_2, rawADC, errorCount, readCount ); rawADC = getFPGATHDoTemp(); - errorCount = (U32)getFPGATHDoErrorCount(); - readCount = (U32)getFPGATHDoReadCount(); + errorCount = (U32)getFPGATRoErrorCount(); + readCount = (U32)getFPGATRoReadCount(); processTempSnsrsADCRead( TEMPSENSORS_OUTLET_REDUNDANT, rawADC, errorCount, readCount ); rawADC = getFPGATDiTemp(); @@ -768,7 +769,7 @@ processTempSnsrsADCRead( TEMPSENSORS_FPGA_BOARD_SENSOR, getFPGABoardTemp(), 0, ++simulatedCounter ); processTempSnsrsADCRead( TEMPSENSORS_LOAD_CELL_A1_B1, getFPGALoadCellsA1B1Temp(), getFPGAADC1ErrorCount(), getFPGAADC1ReadCount() ); processTempSnsrsADCRead( TEMPSENSORS_LOAD_CELL_A2_B2, getFPGALoadCellsA2B2Temp(), getFPGAADC2ErrorCount(), getFPGAADC2ReadCount() ); - processTempSnsrsADCRead( TEMPSENSORS_INTERNAL_THDO_RTD, getFPGATHDoInternalTemp(), getFPGATHDoErrorCount(), getFPGATHDoReadCount() ); + processTempSnsrsADCRead( TEMPSENSORS_INTERNAL_THDO_RTD, getFPGATHDoInternalTemp(), getFPGATRoErrorCount(), getFPGATRoReadCount() ); processTempSnsrsADCRead( TEMPSENSORS_INTERNAL_TDI_RTD, getFPGATDiInternalTemp(), getFPGATDiErrorCount(), getFPGATDiReadCount() ); processTempSnsrsADCRead( TEMPSENSORS_INTERNAL_COND_TEMP_SENSOR, getFPGACondSnsrInternalTemp(), getFPGARTDErrorCount(), getFPGARTDReadCount() ); Index: firmware/App/Modes/ModeFault.c =================================================================== diff -u -r379f78f1fad668d741b3ccf1e78c69f3fccc45b5 -r01d37b6dbd51a2c55ba9bc565e22a222f5df1017 --- firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 379f78f1fad668d741b3ccf1e78c69f3fccc45b5) +++ firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 01d37b6dbd51a2c55ba9bc565e22a222f5df1017) @@ -57,6 +57,11 @@ *************************************************************************/ void transitionToFaultMode( void ) { + // Publish POST failure status to UI if fault triggered in Init/POST mode + if ( DG_MODE_INIT == getPreviousOperationMode() ) + { + // TODO - send POST failure to UI + } } /*********************************************************************//** Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -rf06ae950e44b77730b01a32f2f5cabfc75b5e9b8 -r01d37b6dbd51a2c55ba9bc565e22a222f5df1017 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision f06ae950e44b77730b01a32f2f5cabfc75b5e9b8) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 01d37b6dbd51a2c55ba9bc565e22a222f5df1017) @@ -20,6 +20,7 @@ #include "FPGA.h" #include "Heaters.h" #include "LoadCell.h" +#include "ModeFault.h" #include "ModeFill.h" #include "OperationModes.h" #include "PersistentAlarm.h" Index: firmware/App/Modes/ModeRecirculate.c =================================================================== diff -u -r379f78f1fad668d741b3ccf1e78c69f3fccc45b5 -r01d37b6dbd51a2c55ba9bc565e22a222f5df1017 --- firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision 379f78f1fad668d741b3ccf1e78c69f3fccc45b5) +++ firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision 01d37b6dbd51a2c55ba9bc565e22a222f5df1017) @@ -91,23 +91,18 @@ setValveState( VRC, VALVE_STATE_DRAIN_C_TO_NO ); setValveState( VDR, VALVE_STATE_DRAIN_C_TO_NO ); setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); - setROPumpTargetFlowRate( TARGET_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); + setROPumpTargetFlowRate( TARGET_FLUSH_LINES_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); signalDrainPumpHardStop(); + + stopPrimaryHeater(); + requestConcentratePumpsOff( CONCENTRATEPUMPS_CP1_ACID ); requestConcentratePumpsOff( CONCENTRATEPUMPS_CP2_BICARB ); // UV on turnOnUVReactor( INLET_UV_REACTOR ); turnOnUVReactor( OUTLET_UV_REACTOR ); - -#ifndef _VECTORCAST_ - { // TODO - test code to start the fan since we're turning the heater on - F32 fanPWM = 0.25; - etpwmSetCmpA( etpwmREG6, (U32)( (S32)( ( fanPWM * (F32)(etpwmREG6->TBPRD) ) + FLOAT_TO_INT_ROUNDUP_OFFSET ) ) ); - etpwmSetCmpB( etpwmREG6, (U32)( (S32)( ( fanPWM * (F32)(etpwmREG6->TBPRD) ) + FLOAT_TO_INT_ROUNDUP_OFFSET ) ) ); - } -#endif } /*********************************************************************//** Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -r86eec09ab556fbd970ddcae9dc622727928ee757 -r01d37b6dbd51a2c55ba9bc565e22a222f5df1017 --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 86eec09ab556fbd970ddcae9dc622727928ee757) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 01d37b6dbd51a2c55ba9bc565e22a222f5df1017) @@ -162,6 +162,9 @@ SW_FAULT_ID_FILL_MODE_INVALID_EXEC_STATE, SW_FAULT_ID_PRESSURE_INVALID_EXEC_STATE, SW_FAULT_ID_INVALID_NVDATAMGMT_EXEC_CAL_STATE, + SW_FAULT_ID_INVALID_VOLTAGE_MONITOR_STATE, + SW_FAULT_ID_INVALID_MONITORED_VOLTAGE_ID, // 85 + SW_FAULT_ID_INVALID_LOAD_CELL_ID, SW_FAULT_ID_DG_CHEM_DISINFECT_INVALID_EXEC_STATE, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r86eec09ab556fbd970ddcae9dc622727928ee757 -r01d37b6dbd51a2c55ba9bc565e22a222f5df1017 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 86eec09ab556fbd970ddcae9dc622727928ee757) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 01d37b6dbd51a2c55ba9bc565e22a222f5df1017) @@ -1158,6 +1158,14 @@ handleTestDGAccelBroadcastIntervalOverrideRequest( message ); break; + case MSG_ID_DG_MONITORED_VOLTAGES_SEND_INTERVAL_OVERRIDE: + handleTestMonitoredVoltagesSendIntervalOverrideRequest( message ); + break; + + case MSG_ID_DG_MONITORED_VOLTAGES_OVERRIDE: + handleTestMonitoredVoltageOverrideRequest( message ); + break; + case MSG_ID_DRAIN_PUMP_SET_DELTA_PRESSURE_OVERRIDE: handleSetDrainPumpDeltaPressureOverrideRequest( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r86eec09ab556fbd970ddcae9dc622727928ee757 -r01d37b6dbd51a2c55ba9bc565e22a222f5df1017 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 86eec09ab556fbd970ddcae9dc622727928ee757) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 01d37b6dbd51a2c55ba9bc565e22a222f5df1017) @@ -1022,6 +1022,34 @@ /*********************************************************************//** * @brief + * The broadcastVoltagesData function constructs a monitored voltages data msg to + * be broadcast and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: monitored voltages data msg constructed and queued. + * @param data Latest monitored voltage values. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastVoltagesData( VOLTAGES_DATA_PAYLOAD_T data ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_VOLTAGES_DATA; + msg.hdr.payloadLen = sizeof( VOLTAGES_DATA_PAYLOAD_T ); + + memcpy( payloadPtr, &data, sizeof( VOLTAGES_DATA_PAYLOAD_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; +} + +/*********************************************************************//** + * @brief * The broadcastFlushData function sends out the flush mode data. * @details Inputs: none * @details Outputs: flush data msg constructed and queued @@ -2224,6 +2252,70 @@ /*********************************************************************//** * @brief + * The handleTestMonitoredVoltagesSendIntervalOverrideRequest function handles a + * request to override the monitored DG voltages data publication interval. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestMonitoredVoltagesSendIntervalOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetVoltagesDataPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetVoltagesDataPublishIntervalOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestMonitoredVoltageOverrideRequest function handles a + * request to override the monitored DG voltage override. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestMonitoredVoltageOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetLineLevelOverride( payload.index, payload.state.f32 ); + } + else + { + result = testResetLineLevelOverride( payload.index ); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief * The handleTestSetConductivityOverrideRequest function handles a * request to override a conductivity sensor's value * @details Inputs: none Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r86eec09ab556fbd970ddcae9dc622727928ee757 -r01d37b6dbd51a2c55ba9bc565e22a222f5df1017 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 86eec09ab556fbd970ddcae9dc622727928ee757) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 01d37b6dbd51a2c55ba9bc565e22a222f5df1017) @@ -33,6 +33,7 @@ #include "TemperatureSensors.h" #include "Thermistors.h" #include "UVReactors.h" +#include "Voltages.h" /** * @defgroup SystemCommMessages SystemCommMessages @@ -115,6 +116,9 @@ // MSG_ID_DG_FLUSH_DATA BOOL broadcastFlushData( MODE_FLUSH_DATA_T *flushData ); +// MSG_ID_DG_VOLTAGES_DATA +BOOL broadcastVoltagesData( VOLTAGES_DATA_PAYLOAD_T data ); + // MSG_ID_DG_CHEM_DISINFECT_DATA BOOL broadcastChemicalDisinfectData( MODE_CHEMICAL_DISINFECT_DATA_T *chemDisinfectData ); @@ -258,6 +262,12 @@ // MSG_ID_DG_ACCEL_SEND_INTERVAL_OVERRIDE: void handleTestDGAccelBroadcastIntervalOverrideRequest( MESSAGE_T *message ); +// MSG_ID_DG_MONITORED_VOLTAGES_SEND_INTERVAL_OVERRIDE +void handleTestMonitoredVoltagesSendIntervalOverrideRequest( MESSAGE_T *message ); + +// MSG_ID_DG_MONITORED_VOLTAGES_OVERRIDE +void handleTestMonitoredVoltageOverrideRequest( MESSAGE_T *message ); + // MSG_ID_DG_START_STOP_INLET_UV_REACTOR void handleStartStopUVReactors( MESSAGE_T *message );