mirror of
https://github.com/esphome/esphome.git
synced 2024-11-13 10:25:03 +01:00
Fix float encoding in modbus server (#6986)
This commit is contained in:
parent
bc26de2d68
commit
cc4f1c667e
@ -116,7 +116,8 @@ void ModbusController::on_modbus_read_registers(uint8_t function_code, uint16_t
|
||||
ESP_LOGD(TAG, "Matched register. Address: 0x%02X. Value type: %zu. Register count: %u. Value: %0.1f.",
|
||||
server_register->address, static_cast<uint8_t>(server_register->value_type),
|
||||
server_register->register_count, value);
|
||||
number_to_payload(sixteen_bit_response, value, server_register->value_type);
|
||||
std::vector<uint16_t> payload = float_to_payload(value, server_register->value_type);
|
||||
sixteen_bit_response.insert(sixteen_bit_response.end(), payload.cbegin(), payload.cend());
|
||||
current_address += server_register->register_count;
|
||||
found = true;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user