Skip to content

Commit

Permalink
Changed order of sensor values (tglobe_c)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed Feb 9, 2025
1 parent d84afd0 commit cb046f5
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions src/PayloadBresser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,6 @@ void PayloadBresser::encodeWeatherSensor(int idx, uint16_t flags, LoraEncoder &e
encoder.writeUint8(INV_UINT8); // UV
if (flags & PAYLOAD_WS_LIGHT)
encoder.writeRawFloat(INV_UINT32); // Light
if (flags & PAYLOAD_WS_TGLOBE)
encoder.writeTemperature(INV_TEMP); // Globe Thermometer
}
else
{
Expand Down Expand Up @@ -436,19 +434,6 @@ void PayloadBresser::encodeWeatherSensor(int idx, uint16_t flags, LoraEncoder &e
encoder.writeUint32(INV_UINT32);
}
}
if (flags & PAYLOAD_WS_TGLOBE)
{
if (weatherSensor.sensor[idx].w.tglobe_ok)
{
log_i("Globe Thermometer: %3.1f °C", weatherSensor.sensor[idx].w.tglobe_c);
encoder.writeTemperature(weatherSensor.sensor[idx].w.tglobe_c);
}
else
{
log_i("Globe Thermometer: --.- °C");
encoder.writeTemperature(INV_TEMP);
}
}
}

// Rain data statistics
Expand Down Expand Up @@ -506,6 +491,29 @@ void PayloadBresser::encodeWeatherSensor(int idx, uint16_t flags, LoraEncoder &e
}
}
#endif

// Additional sensor (8-in-1)
if (idx == -1)
{
if (flags & PAYLOAD_WS_TGLOBE)
encoder.writeTemperature(INV_TEMP); // Globe Thermometer
}
else
{
if (flags & PAYLOAD_WS_TGLOBE)
{
if (weatherSensor.sensor[idx].w.tglobe_ok)
{
log_i("Globe Thermometer: %3.1f °C", weatherSensor.sensor[idx].w.tglobe_c);
encoder.writeTemperature(weatherSensor.sensor[idx].w.tglobe_c);
}
else
{
log_i("Globe Thermometer: --.- °C");
encoder.writeTemperature(INV_TEMP);
}
}
}
}

void PayloadBresser::encodeThermoHygroSensor(int idx, LoraEncoder &encoder)
Expand Down

0 comments on commit cb046f5

Please sign in to comment.