3-phase PV router
Loading...
Searching...
No Matches
Temperature sensing feature

Functions used for temperature monitoring and processing. More...

Files

file  ds18b20.h
 The checks of a DS18B20 reading: CRC, conversion to hundredths of °C, range, power-on value.
 
file  onewire_search.h
 The ROM search of a 1-Wire bus, on the bit primitives of the bus.
 
file  temp_schedule.h
 Which 1-Wire transaction of the temperature sensors runs on which mains cycle.
 

Classes

struct  DeviceAddress
 Structure representing the address of a device. More...
 
class  TempSensors< N >
 Implements temperature sensing functionality for multiple sensors. More...
 

Functions

void processTemperatureData (const bool bStartNow)
 Processes temperature data from DS18B20 sensors.
 
void runTemperatureTransaction (const bool onTime)
 Runs the 1-Wire transaction of this mains cycle, if any.
 

Detailed Description

Functions used for temperature monitoring and processing.

This group contains functions that handle temperature sensing using DS18B20 sensors. It includes reading temperature data, filtering invalid readings, and updating telemetry with valid temperature values. The temperature data can also influence load diversion decisions.

Note
The system supports multiple sensors and stores temperature values as integers multiplied by 100 for precision.

Function Documentation

◆ processTemperatureData()

void processTemperatureData ( const bool bStartNow)

Processes temperature data from DS18B20 sensors.

At the end of each datalog period: the readings of the period's round (runTemperatureTransaction()), converted 750 ms or more before they were read, filtered and copied for the datalog output. Invalid readings are identified as 85.00°C (encoded as 8500) with a delta greater than 5.00°C (encoded as 500) from the previous reading. The next round starts at once if the loop handles the end of the period on time, so that its conversion runs before the datalog output (the UART interrupts would add to the delay of the ADC interrupt after a 1-Wire slot); otherwise with the next mains cycle.

Note
This function assumes that temperature values are stored as integers multiplied by 100 for precision.
Precondition
The temperatureSensing object must be initialized and configured with the connected DS18B20 sensors.
Postcondition
The tx_data.temperature_x100 array is updated with the latest valid temperature readings.
Parameters
bStartNowWhether the end of the period is handled on time, soon after its mains cycle was flagged

Definition at line 468 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ runTemperatureTransaction()

void runTemperatureTransaction ( const bool onTime)

Runs the 1-Wire transaction of this mains cycle, if any.

Called at the top of the loop pass that sees the new mains cycle, before any other work: the cycle's work in the ADC interrupt (processStartNewCycle()) is done by then (Shared::b_newMainsCycle), and the long slots of the transaction (its resets and 0s written, which keep interrupts off for 65 to 70 µs) end long before the next one, a mains cycle later (temp_schedule.h).

Parameters
onTimeWhether the loop was idle when the cycle began: the flag is fresh

Definition at line 422 of file main.cpp.

Here is the caller graph for this function: