Commit a775dc71d70617cd1c5ad006861f892a51eb9351

Authored by Jeroen88
1 parent 31356f11

Change time_t into uint32_t for correct unsigned roll over of intervals

examples/Advanced_Thermostat/Advanced_Thermostat.ino
... ... @@ -116,12 +116,12 @@ void loop() {
116 116 static OpenTherm thermostat(OT_RX_PIN, OT_TX_PIN);
117 117  
118 118 // static variables used by the PID controller
119   - static time_t previousTimestamp = millis(); // Previous timestamp
  119 + static uint32_t previousTimestamp = millis(); // Previous timestamp
120 120 static float previousTemperature = bme.readTemperature(); // Previous temperature
121 121 static float ierr = 0; // Integral error
122 122  
123 123  
124   - time_t timestamp = millis();
  124 + uint32_t timestamp = millis();
125 125 if(timestamp - previousTimestamp >= 1000) {
126 126 float roomTemperature = bme.readTemperature(); // Read the sensor to get the current room temperature
127 127 Serial.printf("Room temperature is %.02f *C, room temperature setpoint is %.02f *C\n", roomTemperature, ROOM_TEMPERATURE_SETPOINT);
... ...
examples/Basic_Thermostat_Commands/Basic_Thermostat_Commands.ino
... ... @@ -58,9 +58,9 @@ void loop() {
58 58 // Create an OpenTherm thermostat (boiler is secondary) with OT_RX_PIN to receive data from boiler and OT_TX_PIN to send data to boiler
59 59 // Only one OpenTherm object may be created!
60 60 static OpenTherm thermostat(OT_RX_PIN, OT_TX_PIN);
61   - static time_t previousTimestamp = millis(); // Previous timestamp
  61 + static uint32_t previousTimestamp = millis(); // Previous timestamp
62 62  
63   - time_t timestamp = millis();
  63 + uint32_t timestamp = millis();
64 64 if(timestamp - previousTimestamp >= 1000) {
65 65  
66 66 // primaryFlags is used to tell the secondary device (boiler) what available services (Central heating, cooling, domestic hot water) it wants to make use of, if present
... ...
src/EasyOpenTherm.cpp
... ... @@ -186,7 +186,7 @@ OpenTherm::ERROR_CODES OpenTherm::error() {
186 186 bool OpenTherm::_execute(OTDataLinkLayer & data) {
187 187 _lastError = ERROR_CODES::OK;
188 188  
189   - time_t startMillis = millis();
  189 + uint32_t startMillis = millis();
190 190 for(;;) {
191 191 if(millis() - startMillis >= _timeoutMs) {
192 192 _lastError = ERROR_CODES::SEND_TIMEOUT;
... ...