Update ebyte_lora_component.cpp

This commit is contained in:
Daniël Koek 2024-10-04 12:32:25 +01:00
parent a27a490b2a
commit 954d4c746b

View file

@ -556,12 +556,12 @@ void EbyteLoraComponent::send_data_(bool all) {
for (auto &sensor : this->sensors_) {
if (all || sensor.updated) {
sensor.updated = false;
FuData udata{.f32 = sensor.sensor->get_state()};
uint32_t u32 = sensor.sensor->get_state();
data.push_back(SENSOR_KEY);
data.push_back(udata.u32 & 0xFF);
data.push_back((udata.u32 >> 8) & 0xFF);
data.push_back((udata.u32 >> 16) & 0xFF);
data.push_back((udata.u32 >> 24) & 0xFF);
data.push_back(u32 & 0xFF);
data.push_back((u32 >> 8) & 0xFF);
data.push_back((u32 >> 16) & 0xFF);
data.push_back((u32 >> 24) & 0xFF);
// add all the sensor date info
auto len = strlen(sensor.id);
data.push_back(len);