mirror of
https://github.com/esphome/esphome.git
synced 2025-01-18 12:05:41 +00:00
Fix float encoding in modbus server (#6986)
This commit is contained in:
parent
169fb79c97
commit
bbd7c9cf86
@ -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…
x
Reference in New Issue
Block a user