Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -ra8bb1da29825b5d666333629fda871652d16229a -r8467f8ff09e382e0991f14d02683080dc811e24e --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision a8bb1da29825b5d666333629fda871652d16229a) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 8467f8ff09e382e0991f14d02683080dc811e24e) @@ -24,6 +24,7 @@ #include "DGDefs.h" #include "Heaters.h" #include "OperationModes.h" +#include "PersistentAlarm.h" #include "PIControllers.h" #include "ROPump.h" #include "SafetyShutdown.h" @@ -129,10 +130,6 @@ static U32 heatersOnWithNoFlowTimer; ///< Heaters are on but there is no sufficient flow. static TEMPERATURE_SENSORS_T primaryHeatersFeedbackTempSensor = TEMPSENSORS_OUTLET_PRIMARY_HEATER; ///< Primary heaters feedback temperature sensors. static TEMPERATURE_SENSORS_T trimmerHeaterFeedbackTempSensor = TEMPSENSORS_OUTLET_REDUNDANT; ///< Trimmer heater feedback temperature sensors. -static U32 primaryHeatersInternalTempOutTimer = 0; ///< Primary heaters internal temperature out of range timer. -static U32 trimmerHeaterInternalTempOutTimer = 0; ///< Trimmer heater internal temperature out of range timer. -static BOOL isPrimaryHeatersTempOutOfRange = FALSE; ///< Boolean flag to indicate if the primary heaters internal temperature out of range. -static BOOL isTrimmerHeaterTempOutOfRange = FALSE; ///< Boolean flag to indicate if the trimmer heater internal temperature out of range. static BOOL isFlowBelowMin = FALSE; ///< Boolean flag to indicate if the flow is below the minimum. // ********** private function prototypes ********** @@ -177,10 +174,6 @@ selfTestElapsedTime = 0; primaryHeatersFeedbackTempSensor = TEMPSENSORS_OUTLET_PRIMARY_HEATER; trimmerHeaterFeedbackTempSensor = TEMPSENSORS_OUTLET_REDUNDANT; - primaryHeatersInternalTempOutTimer = 0; - trimmerHeaterInternalTempOutTimer = 0; - isPrimaryHeatersTempOutOfRange = FALSE; - isTrimmerHeaterTempOutOfRange = FALSE; isFlowBelowMin = FALSE; // Initialize the PI controller for the primary heaters @@ -190,6 +183,10 @@ // Initialize the PI controller for the trimmer heater initializePIController( PI_CONTROLLER_ID_TRIMMER_HEATER, HEATERS_MIN_DUTY_CYCLE, TRIMMER_HEATER_P_COEFFICIENT, TRIMMER_HEATER_I_COEFFICIENT, HEATERS_MIN_DUTY_CYCLE, TRIMMER_HEATER_MAX_DUTY_CYCLE ); + + // Initialize the persistent alarm for heaters' internal temperature out of range + initPersistentAlarm( ALARM_ID_DG_PRIMARY_HEATERS_INTERNAL_TEMP_OUT_OF_RANGE, 0, HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_TIMEOUT_MS ); + initPersistentAlarm( ALARM_ID_DG_TRIMMER_HEATER_INTERNAL_TEMP_OUT_OF_RANGE, 0, HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_TIMEOUT_MS ); } /*********************************************************************//** @@ -350,43 +347,20 @@ F32 trimmerHeaterInternalTemp = getTemperatureValue( TEMPSENSORS_TRIMMER_HEATER_INTERNAL ); // Check if the primary heaters' internal temperature is above the limit - if ( primaryHeatersInternalTemp > HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_C ) + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_DG_PRIMARY_HEATERS_INTERNAL_TEMP_OUT_OF_RANGE, + primaryHeatersInternalTemp > HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_C ) ) { + activateSafetyShutdown(); SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_PRIMARY_HEATERS_INTERNAL_TEMP_OUT_OF_RANGE, primaryHeatersInternalTemp ); - - // If it is above the range for the first time, stop the primary heaters - // and set the variables - if ( FALSE == isPrimaryHeatersTempOutOfRange ) - { - stopPrimaryHeater(); - isPrimaryHeatersTempOutOfRange = TRUE; - primaryHeatersInternalTempOutTimer = getMSTimerCount(); - } - // If the primary heaters internal temperature was out for more than the define period, activate the safety shutdown - else if ( TRUE == didTimeout( primaryHeatersInternalTempOutTimer, HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_TIMEOUT_MS ) ) - { - activateSafetyShutdown(); - } } // Check if the trimmer heater internal temperature is above the limit - if ( trimmerHeaterInternalTemp > HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_C ) + + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_DG_PRIMARY_HEATERS_INTERNAL_TEMP_OUT_OF_RANGE, + primaryHeatersInternalTemp > HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_C ) ) { + activateSafetyShutdown(); SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_TRIMMER_HEATER_INTERNAL_TEMP_OUT_OF_RANGE, trimmerHeaterInternalTemp ); - - // If it is above the range for the first time, stop the trimmer heater - // and set the variables - if ( FALSE == isTrimmerHeaterTempOutOfRange ) - { - stopTrimmerHeater(); - isTrimmerHeaterTempOutOfRange = TRUE; - trimmerHeaterInternalTempOutTimer = getMSTimerCount(); - } - // If the trimmer heater internal temperature was out for more than the define period, activate the safety shutdown - else if ( TRUE == didTimeout( trimmerHeaterInternalTempOutTimer, HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_TIMEOUT_MS ) ) - { - activateSafetyShutdown(); - } } #endif @@ -570,10 +544,9 @@ if ( fabs( convertedTemperature - SMALL_PRIMARY_AND_TRIMMER_HEATERS_POST_TARGET_TEMPERATURE ) > HEATERS_POST_TEMPERATURE_TOLERANCE ) { - //TODO alarm - // TODO POST failed heatersSelfTestResult = SELF_TEST_STATUS_FAILED; state = HEATERS_SELF_TEST_COMPLETE; + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_HEATERS_SELF_TEST_FAILURE, TEMPSENSORS_TRIMMER_HEATER_INTERNAL, convertedTemperature ) } else { @@ -608,9 +581,8 @@ if ( fabs( convertedTemperature - MAIN_PRIMARY_HEATER_POST_TARGET_TEMPERATURE ) > HEATERS_POST_TEMPERATURE_TOLERANCE ) { - //TODO alarm - // TODO POST failed heatersSelfTestResult = SELF_TEST_STATUS_FAILED; + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_HEATERS_SELF_TEST_FAILURE, TEMPSENSORS_PRIMARY_HEATER_INTERNAL, convertedTemperature ) } else { Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -ra8bb1da29825b5d666333629fda871652d16229a -r8467f8ff09e382e0991f14d02683080dc811e24e --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision a8bb1da29825b5d666333629fda871652d16229a) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 8467f8ff09e382e0991f14d02683080dc811e24e) @@ -112,7 +112,6 @@ static F32 roPumpPWMDutyCyclePct = 0.0; ///< Initial RO pump PWM duty cycle. static F32 roPumpDutyCyclePctSet = 0.0; ///< Currently set RO pump PWM duty cycle. static PUMP_CONTROL_MODE_T roPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< Requested RO pump control mode. -static PUMP_CONTROL_MODE_T roPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< Currently set RO pump control mode. TODO do we need this? static F32 targetROPumpFlowRate = 0.0; ///< Target RO flow rate (in L/min). static F32 targetROPumpMaxPressure = 0.0; ///< Target RO max allowed pressure (in PSI). @@ -126,11 +125,6 @@ static F32 roPumpOpenLoopTargetDutyCycle = 0; ///< Target RO pump open loop PWM. -/* TODO These variables are used for POST. POST has not been implemented yet -static RO_PUMP_SELF_TEST_STATE_T roPumpSelfTestState = RO_PUMP_SELF_TEST_STATE_START; ///< Current RO pump self test state. -static U32 roPumpSelfTestTimerCount = 0; ///< Timer counter for RO pump self test. -*/ - static S32 measuredFlowReadingsSum = 0; ///< Raw flow reading sums for averaging. static U32 flowFilterCounter = 0; ///< Flow filtering counter. @@ -154,7 +148,7 @@ * @details Inputs: roControlTimerCounter,roPumpOpenLoopTargetDutyCycle, * roPumpFlowRateRunningSum, roPumpPressureRunningSum, measuredFlowReadingsSum, * flowFilterCounter, flowVerificationCounter, roPumpState, roPumpControlMode - * roPumpDataPublicationTimerCounter, roPumpControlModeSet + * roPumpDataPublicationTimerCounter * @details Outputs: none * @return none *************************************************************************/ @@ -172,16 +166,11 @@ // Initialize the persistent alarm for flow out of upper and lower range initPersistentAlarm( ALARM_ID_FLOW_RATE_OUT_OF_UPPER_RANGE, FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL, FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL ); - initPersistentAlarm( ALARM_ID_FLOW_RATE_OUT_OF_LOWER_RANGE, FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL, FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL ); // Initialize the persistent alarm for max allowed pressure out of range - initPersistentAlarm( ALARM_ID_RO_PUMP_PRESSURE_OUT_OF_RANGE, MAX_PRESSURE_OUT_OF_RANGE_PERSISTENT_INTERVAL, - MAX_PRESSURE_OUT_OF_RANGE_PERSISTENT_INTERVAL ); + initPersistentAlarm( ALARM_ID_RO_PUMP_PRESSURE_OUT_OF_RANGE, MAX_PRESSURE_OUT_OF_RANGE_PERSISTENT_INTERVAL, MAX_PRESSURE_OUT_OF_RANGE_PERSISTENT_INTERVAL ); - // Initialize the persistent alarm for ramp up to target flow timeout - initPersistentAlarm( ALARM_ID_RO_PUMP_RAMP_UP_TO_FLOW_TIMEOUT, MAX_ALLOWED_RAMP_UP_TIME, MAX_ALLOWED_RAMP_UP_TIME ); - // Initialize the persistent alarm for not turning off the pump initPersistentAlarm( ALARM_ID_RO_PUMP_OFF_FAULT, SAFETY_SHUTDOWN_TIMEOUT, SAFETY_SHUTDOWN_TIMEOUT ); @@ -193,7 +182,6 @@ roPumpDataPublicationTimerCounter = 0; roPumpState = RO_PUMP_OFF_STATE; roPumpControlMode = NUM_OF_PUMP_CONTROL_MODES; - roPumpControlModeSet = roPumpControlMode; isROPumpOn = FALSE; } @@ -406,23 +394,6 @@ /*********************************************************************//** * @brief - * The execROPumpTest function executes the state machine for the RO pump - * self-test. - * @details Inputs: TODO FILL UP - * @details Outputs: TODO FILL UP - * @return the current state of the ROPump self test. - *************************************************************************/ -SELF_TEST_STATUS_T execROPumpTest( void ) -{ - SELF_TEST_STATUS_T result = SELF_TEST_STATUS_FAILED; - - // TODO - implement self-test(s) - - return result; -} - -/*********************************************************************//** - * @brief * The handleROPumpOffState function handles the RO pump off state of the * controller state machine. * @details Inputs: roPumpControlMode, roPumpPWMDutyCyclePctSet, @@ -437,7 +408,6 @@ // If there is a flow, transition to the PI controller to get the corresponding pressure of that flow if ( getTargetROPumpFlowRate() > 0 && roPumpControlMode == PUMP_CONTROL_MODE_CLOSED_LOOP ) { - roPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP; // Set pump to on isROPumpOn = TRUE; roPumpDutyCyclePctSet = ROP_FLOW_TO_PWM_DC( getTargetROPumpFlowRate() ); @@ -519,7 +489,6 @@ * The handleROPumpControlToTargetFlowState function handles the control to * target flow state of the RO pump controller state machine. * @details Inputs: roPumpPWMDutyCyclePctSet, roControlTimerCounter, - * roPumpControlModeSet * @details Outputs: roPumpPWMDutyCyclePctSet, roControlTimerCounter * @return next state of the controller state machine *************************************************************************/ @@ -557,7 +526,6 @@ * The handleROPumpControlToMaxPressureState function handles the control * to max pressure state of the RO pump controller state machine. * @details Inputs: roPumpPWMDutyCyclePctSet, roControlTimerCounter, - * roPumpControlModeSet * @details Outputs: roPumpPWMDutyCyclePctSet, roControlTimerCounter * @return next state of the controller state machine *************************************************************************/ Index: firmware/App/Controllers/ROPump.h =================================================================== diff -u -r45f4646609e6dd39691102e109d0b5c14f97e054 -r8467f8ff09e382e0991f14d02683080dc811e24e --- firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision 45f4646609e6dd39691102e109d0b5c14f97e054) +++ firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision 8467f8ff09e382e0991f14d02683080dc811e24e) @@ -56,8 +56,6 @@ BOOL isReverseOsmosisPumpOn( void ); -SELF_TEST_STATUS_T execROPumpTest( void ); - F32 getTargetROPumpFlowRate( void ); F32 getMeasuredROFlowRate( void ); Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r4d7d40a27130dc813d653f044cbb856b1b7d8481 -r8467f8ff09e382e0991f14d02683080dc811e24e --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 4d7d40a27130dc813d653f044cbb856b1b7d8481) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 8467f8ff09e382e0991f14d02683080dc811e24e) @@ -353,7 +353,7 @@ } else { - // TODO - s/w fault + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_VALVE_ID, valveID ); } return result; Index: firmware/App/Drivers/InternalADC.c =================================================================== diff -u -r0b17c6271cdc3c55697a74ecaadb477d9c8f5687 -r8467f8ff09e382e0991f14d02683080dc811e24e --- firmware/App/Drivers/InternalADC.c (.../InternalADC.c) (revision 0b17c6271cdc3c55697a74ecaadb477d9c8f5687) +++ firmware/App/Drivers/InternalADC.c (.../InternalADC.c) (revision 8467f8ff09e382e0991f14d02683080dc811e24e) @@ -135,14 +135,21 @@ { // process readings from last conversion for ( i = 0; i < adcRawReadingsCount; i++ ) - { - U32 ch = adcChannelNum2ChannelId[ adcRawReadings[ i ].id ]; // TODO - need to range check .id? + { + if ( adcRawReadings[ i ].id < NUM_OF_INT_ADC_CHANNELS ) + { + U32 ch = adcChannelNum2ChannelId[ adcRawReadings[ i ].id ]; - adcReadingsTotals[ ch ] -= adcReadings[ ch ][ adcReadingsIdx[ ch ] ]; - adcReadings[ ch ][ adcReadingsIdx[ ch ] ] = adcRawReadings[i].value; - adcReadingsTotals[ ch ] += adcRawReadings[ i ].value; - adcReadingsAvgs[ ch ] = adcReadingsTotals[ ch ] >> ROLLING_AVG_SHIFT_DIVIDER; - adcReadingsIdx[ ch ] = INC_WRAP( adcReadingsIdx[ ch ], 0, SIZE_OF_ROLLING_AVG - 1 ); + adcReadingsTotals[ ch ] -= adcReadings[ ch ][ adcReadingsIdx[ ch ] ]; + adcReadings[ ch ][ adcReadingsIdx[ ch ] ] = adcRawReadings[i].value; + adcReadingsTotals[ ch ] += adcRawReadings[ i ].value; + adcReadingsAvgs[ ch ] = adcReadingsTotals[ ch ] >> ROLLING_AVG_SHIFT_DIVIDER; + adcReadingsIdx[ ch ] = INC_WRAP( adcReadingsIdx[ ch ], 0, SIZE_OF_ROLLING_AVG - 1 ); + } + else + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_INT_ADC_CHANNEL_NUMBER, adcRawReadings[ i ].id ) + } } } else Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r72dd42b6a116e62d1b3ad5d60088c29e067d10d4 -r8467f8ff09e382e0991f14d02683080dc811e24e --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 72dd42b6a116e62d1b3ad5d60088c29e067d10d4) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 8467f8ff09e382e0991f14d02683080dc811e24e) @@ -188,23 +188,19 @@ break; case DG_POST_STATE_COMPLETED: - // set overall HD POST status to "passed" + // set overall DG POST status to "passed" postPassed = TRUE; - // set overall HD POST completed status to TRUE + // set overall DG POST completed status to TRUE postCompleted = TRUE; // TODO - send POST status on CAN // go to standby mode requestNewOperationMode( DG_MODE_STAN ); break; case DG_POST_STATE_FAILED: - // TODO - send POST status on CAN - // will want POST faults to wait for us to get here before sending us to fault mode - requestNewOperationMode( DG_MODE_FAUL ); - break; - + // Should not get here - any failed post test should have already triggered a fault and taken us to fault mode default: - // TODO - s/w fault + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_MODE_INIT_POST_INVALID_POST_STATE, postState ) postState = DG_POST_STATE_FAILED; break; } Index: firmware/App/Modes/ModeRecirculate.c =================================================================== diff -u -rd7926685f2fe3086bab183166119f0965a192a69 -r8467f8ff09e382e0991f14d02683080dc811e24e --- firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision d7926685f2fe3086bab183166119f0965a192a69) +++ firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision 8467f8ff09e382e0991f14d02683080dc811e24e) @@ -88,23 +88,16 @@ 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/Modes/ModeSolo.c =================================================================== diff -u -r4d7d40a27130dc813d653f044cbb856b1b7d8481 -r8467f8ff09e382e0991f14d02683080dc811e24e --- firmware/App/Modes/ModeSolo.c (.../ModeSolo.c) (revision 4d7d40a27130dc813d653f044cbb856b1b7d8481) +++ firmware/App/Modes/ModeSolo.c (.../ModeSolo.c) (revision 8467f8ff09e382e0991f14d02683080dc811e24e) @@ -80,7 +80,7 @@ break; default: - // TODO - s/w fault + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_SOLO_MODE_INVALID_EXEC_STATE, soloState ) soloState = DG_SOLO_STANDBY_STATE_START; break; } Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -r4ef47949b3e17f400efe794467bdef39ca79e4e0 -r8467f8ff09e382e0991f14d02683080dc811e24e --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 4ef47949b3e17f400efe794467bdef39ca79e4e0) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 8467f8ff09e382e0991f14d02683080dc811e24e) @@ -160,8 +160,14 @@ SW_FAULT_ID_RECIRC_MODE_INVALID_EXEC_STATE, SW_FAULT_ID_DRAIN_MODE_INVALID_EXEC_STATE, // 80 SW_FAULT_ID_FILL_MODE_INVALID_EXEC_STATE, + SW_FAULT_ID_SOLO_MODE_INVALID_EXEC_STATE, SW_FAULT_ID_PRESSURE_INVALID_EXEC_STATE, SW_FAULT_ID_INVALID_NVDATAMGMT_EXEC_CAL_STATE, + SW_FAULT_ID_INVALID_VALVE_ID, // 85 + SW_FAULT_ID_INVALID_INT_ADC_CHANNEL_NUMBER, + SW_FAULT_ID_INVALID_RTI_NOTIFICATION, + SW_FAULT_ID_CAN_TX_FAULT, + SW_FAULT_ID_INVALID_CAN_MESSAGE_SIZE, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; Index: firmware/App/Services/Interrupts.c =================================================================== diff -u -r4d7d40a27130dc813d653f044cbb856b1b7d8481 -r8467f8ff09e382e0991f14d02683080dc811e24e --- firmware/App/Services/Interrupts.c (.../Interrupts.c) (revision 4d7d40a27130dc813d653f044cbb856b1b7d8481) +++ firmware/App/Services/Interrupts.c (.../Interrupts.c) (revision 8467f8ff09e382e0991f14d02683080dc811e24e) @@ -45,10 +45,6 @@ // ********** private data ********** -#ifdef DEBUG_ENABLED - static U32 sci1FrameErrorCnt = 0; - static U32 sci1OverrunErrorCnt = 0; -#endif static U32 sci2FrameErrorCnt; ///< SCI2 frame error count. static U32 sci2OverrunErrorCnt; ///< SCI2 overrun error count. @@ -131,7 +127,7 @@ break; default: - // TODO - s/w fault? + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_RTI_NOTIFICATION, notification ) break; } } @@ -168,10 +164,6 @@ *************************************************************************/ void canErrorNotification(canBASE_t *node, uint32 notification) { -#ifdef DEBUG_ENABLED - char debugStr[ 256 ]; -#endif - if ( node == canREG1 ) { if ( notification & canLEVEL_PARITY_ERR ) @@ -181,11 +173,6 @@ { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_CAN_PARITY_ERROR ) } -#ifdef DEBUG_ENABLED - sprintf( debugStr, "CAN parity error:%5d \n", can1ParityCnt ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); - sendDebugDataToUI( (U08*)debugStr ); -#endif } else if ( notification & canLEVEL_BUS_OFF ) { @@ -194,20 +181,10 @@ { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_CAN_OFF_ERROR ) } -#ifdef DEBUG_ENABLED - sprintf( debugStr, "CAN bus off error:%5d \n", can1BusOffCnt ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); - sendDebugDataToUI( (U08*)debugStr ); -#endif } else if ( notification & canLEVEL_WARNING ) { can1WarningCnt++; -#ifdef DEBUG_ENABLED - sprintf( debugStr, "CAN bus warning:%5d \n", can1WarningCnt ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); - sendDebugDataToUI( (U08*)debugStr ); -#endif } else if ( notification & canLEVEL_PASSIVE ) { @@ -216,11 +193,6 @@ { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_CAN_PASSIVE_WARNING ) } -#ifdef DEBUG_ENABLED - sprintf( debugStr, "CAN passive warning:%5d \n", can1PassiveCnt ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); - sendDebugDataToUI( (U08*)debugStr ); -#endif } else { @@ -241,11 +213,6 @@ *************************************************************************/ void sciNotification(sciBASE_t *sci, uint32 flags) { -#ifdef DEBUG_ENABLED - // TODO - temporary debug code - remove later - char debugStr[ 256 ]; -#endif - if ( sci == scilinREG ) { if ( ( flags & SCI_FE_INT ) != 0 ) @@ -256,11 +223,6 @@ { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_FPGA_UART_FRAME_ERROR ) } -#ifdef DEBUG_ENABLED - sprintf( debugStr, "FPGA UART FR err:%5d \n", sci2FrameErrorCnt ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); - sendDebugDataToUI( (U08*)debugStr ); -#endif } if ( ( flags & SCI_OE_INT ) != 0 ) { @@ -270,34 +232,8 @@ { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_FPGA_UART_OVERRUN_ERROR ) } -#ifdef DEBUG_ENABLED - sprintf( debugStr, "FPGA UART OR err:%5d \n", sci2OverrunErrorCnt ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); - sendDebugDataToUI( (U08*)debugStr ); -#endif } } -#ifdef DEBUG_ENABLED - else if ( sci == sciREG ) - { - if ( ( flags & SCI_FE_INT ) != 0 ) - { - sci1FrameErrorCnt++; - clearSCI1CommErrors(); - sprintf( debugStr, "Debug UART FR err:%5d \n", sci1FrameErrorCnt ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); - sendDebugDataToUI( (U08*)debugStr ); - } - if ( ( flags & SCI_OE_INT ) != 0 ) - { - sci1OverrunErrorCnt++; - clearSCI1CommErrors(); - sprintf( debugStr, "Debug UART OR err:%5d \n", sci1OverrunErrorCnt ); - sendDebugData( (U08*)debugStr, strlen(debugStr) ); - sendDebugDataToUI( (U08*)debugStr ); - } - } -#endif } /*********************************************************************//** Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r3eb7c2e62c727be195cd937d49957db9d4ba83b4 -r8467f8ff09e382e0991f14d02683080dc811e24e --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 3eb7c2e62c727be195cd937d49957db9d4ba83b4) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 8467f8ff09e382e0991f14d02683080dc811e24e) @@ -567,13 +567,12 @@ else { signalCANXmitsCompleted(); - // TODO - shouldn't get here, but let's see if we do - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, (U32)mBox ) + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_CAN_TX_FAULT, (U32)mBox ) } } else - { // TODO - shouldn't get here - just testing - set first data to new s/w fault enum later - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, (U32)buffer, (U32)dataSize ) + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_CAN_MESSAGE_SIZE, (U32)dataSize ) } } @@ -839,9 +838,7 @@ if ( TRUE == didTimeout( timeOfLastHDCheckIn, HD_COMM_TIMEOUT_IN_MS ) ) { hdIsCommunicating = FALSE; -#ifndef DEBUG_ENABLED - activateAlarmNoData( ALARM_ID_HD_COMM_TIMEOUT ); // TODO - add this alarm if we're in middle of a treatment? or if in a mode that comm loss would impact badly? -#endif + activateAlarmNoData( ALARM_ID_HD_COMM_TIMEOUT ); } }