1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-28 13:43:54 +00:00

modbus_controller: bugfix: enable overriding calculated register size (#2845)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Martin
2021-12-02 03:45:11 +01:00
committed by GitHub
parent 1b88b7a166
commit 9ca4e8f32a
4 changed files with 12 additions and 6 deletions

View File

@@ -13,7 +13,7 @@ void ModbusTextSensor::dump_config() { LOG_TEXT_SENSOR("", "Modbus Controller Te
void ModbusTextSensor::parse_and_publish(const std::vector<uint8_t> &data) {
std::ostringstream output;
uint8_t max_items = this->response_bytes_;
uint8_t max_items = this->response_bytes;
char buffer[4];
bool add_comma = false;
for (auto b : data) {

View File

@@ -17,7 +17,7 @@ class ModbusTextSensor : public Component, public text_sensor::TextSensor, publi
this->register_type = register_type;
this->start_address = start_address;
this->offset = offset;
this->response_bytes_ = response_bytes;
this->response_bytes = response_bytes;
this->register_count = register_count;
this->encode_ = encode;
this->skip_updates = skip_updates;
@@ -38,7 +38,6 @@ class ModbusTextSensor : public Component, public text_sensor::TextSensor, publi
protected:
RawEncoding encode_;
uint16_t response_bytes_;
};
} // namespace modbus_controller