Index: firmware/App/Drivers/FlowSensor.c =================================================================== diff -u -ra0c144ed9f72066d7a7b1d047b01fb76ca56d667 -rbef932558c7e8e50ab60c5f8c0c1967b8d7d4ca4 --- firmware/App/Drivers/FlowSensor.c (.../FlowSensor.c) (revision a0c144ed9f72066d7a7b1d047b01fb76ca56d667) +++ firmware/App/Drivers/FlowSensor.c (.../FlowSensor.c) (revision bef932558c7e8e50ab60c5f8c0c1967b8d7d4ca4) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. +* Copyright (c) 2025-2026 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file FlowSensor.c * -* @author (last) Sean Nash -* @date (last) 21-Nov-2024 +* @author (last) “rkallala” +* @date (last) 19-Jan-2026 * -* @author (original) Sean Nash -* @date (original) 21-Nov-2024 +* @author (original) Michael Garthwaite +* @date (original) 08-Sep-2025 * ***************************************************************************/ @@ -33,6 +33,7 @@ static OVERRIDE_S32_T currentFlowReadings[ NUM_OF_FLOW_SENSORS ]; ///< Current flow sensor pressure readings (overrideable). static OVERRIDE_F32_T currentFlowTempReadings[ NUM_OF_FLOW_SENSORS ]; ///< Current flow sensor temperature readings (overrideable). +static F32 currentFlowInternalTempReadings[ NUM_OF_FLOW_SENSORS ]; ///< Current flow sensor internal temperature readings. // ********** private function prototypes ********** @@ -59,6 +60,8 @@ currentFlowTempReadings[ sensor ].ovData = 0.0F; currentFlowTempReadings[ sensor ].ovInitData = 0.0F; currentFlowTempReadings[ sensor ].override = OVERRIDE_RESET; + + currentFlowInternalTempReadings[ sensor ] = 0.0F; } } @@ -81,6 +84,10 @@ // Update and convert raw flow sensor temperatures to deg C currentFlowTempReadings[ P16_FLOW ].data = (F32)( (S16)getFPGAFlowP16Temp() ) / FLOW_TEMPERATURE_DIVIDER; currentFlowTempReadings[ P7_FLOW ].data = (F32)( (S16)getFPGAFlowP7Temp() ) / FLOW_TEMPERATURE_DIVIDER; + + // Update and convert raw flow sensor internal temperatures to deg C + currentFlowInternalTempReadings[ P16_FLOW ] = (F32)( (S16)getFPGAFlowP16InternalTemp() ) / FLOW_TEMPERATURE_DIVIDER; + currentFlowInternalTempReadings[ P7_FLOW ] = (F32)( (S16)getFPGAFlowP7InternalTemp() ) / FLOW_TEMPERATURE_DIVIDER; } /*********************************************************************//** @@ -143,7 +150,33 @@ return result; } +/*********************************************************************//** + * @brief + * The getFlowInternalTemperature function gets the current + * internal temperature (in deg C) for a given flow sensor. + * @details \b Alarm: ALARM_ID_RO_SOFTWARE_FAULT if given flow sensor is invalid. + * @details \b Inputs: currentFlowInternalTempReadings + * @details \b Outputs: none + * @param sensor ID of flow sensor to get internal temperature for. + * @return The current flow sensor internal temperature (in deg C) of the given flow sensor. + *************************************************************************/ +F32 getFlowInternalTemperature( FLOW_SENSORS_T sensor ) +{ + F32 result = 0.0F; + if ( sensor < NUM_OF_FLOW_SENSORS ) + { + result = currentFlowInternalTempReadings[ sensor ]; + } + else + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_FP_SOFTWARE_FAULT, FP_FAULT_ID_FLOW_SENSOR_INVALID_SENSOR2, (U32)sensor ) + } + + return result; +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/