mirror of
https://github.com/esphome/esphome.git
synced 2025-10-26 20:53:50 +00:00
Force braces around multi-line statements (#3094)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -19,10 +19,11 @@ class ModbusBinarySensor : public Component, public binary_sensor::BinarySensor,
|
||||
this->skip_updates = skip_updates;
|
||||
this->force_new_range = force_new_range;
|
||||
|
||||
if (register_type == ModbusRegisterType::COIL || register_type == ModbusRegisterType::DISCRETE_INPUT)
|
||||
if (register_type == ModbusRegisterType::COIL || register_type == ModbusRegisterType::DISCRETE_INPUT) {
|
||||
this->register_count = offset + 1;
|
||||
else
|
||||
} else {
|
||||
this->register_count = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void parse_and_publish(const std::vector<uint8_t> &data) override;
|
||||
|
||||
@@ -230,10 +230,11 @@ class SensorItem {
|
||||
|
||||
void set_custom_data(const std::vector<uint8_t> &data) { custom_data = data; }
|
||||
size_t virtual get_register_size() const {
|
||||
if (register_type == ModbusRegisterType::COIL || register_type == ModbusRegisterType::DISCRETE_INPUT)
|
||||
if (register_type == ModbusRegisterType::COIL || register_type == ModbusRegisterType::DISCRETE_INPUT) {
|
||||
return 1;
|
||||
else // if CONF_RESPONSE_BYTES is used override the default
|
||||
} else { // if CONF_RESPONSE_BYTES is used override the default
|
||||
return response_bytes > 0 ? response_bytes : register_count * 2;
|
||||
}
|
||||
}
|
||||
// Override register size for modbus devices not using 1 register for one dword
|
||||
void set_register_size(uint8_t register_size) { response_bytes = register_size; }
|
||||
|
||||
Reference in New Issue
Block a user