mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 02:04:13 +01:00
Change variable "skip_updates" and "skip_updates_counter" type from "uint8_t" to "uint16_t" (#4487)
* change 'skip_updates'from 'uint8' to 'uint16_t' * Delete modbus_controller_fix.md * Update modbus_controller.h --------- Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
parent
eceb79ceab
commit
86407b9f6f
7 changed files with 10 additions and 10 deletions
|
@ -12,7 +12,7 @@ namespace modbus_controller {
|
||||||
class ModbusBinarySensor : public Component, public binary_sensor::BinarySensor, public SensorItem {
|
class ModbusBinarySensor : public Component, public binary_sensor::BinarySensor, public SensorItem {
|
||||||
public:
|
public:
|
||||||
ModbusBinarySensor(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask,
|
ModbusBinarySensor(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask,
|
||||||
uint8_t skip_updates, bool force_new_range) {
|
uint16_t skip_updates, bool force_new_range) {
|
||||||
this->register_type = register_type;
|
this->register_type = register_type;
|
||||||
this->start_address = start_address;
|
this->start_address = start_address;
|
||||||
this->offset = offset;
|
this->offset = offset;
|
||||||
|
|
|
@ -246,7 +246,7 @@ class SensorItem {
|
||||||
uint8_t offset;
|
uint8_t offset;
|
||||||
uint8_t register_count;
|
uint8_t register_count;
|
||||||
uint8_t response_bytes{0};
|
uint8_t response_bytes{0};
|
||||||
uint8_t skip_updates;
|
uint16_t skip_updates;
|
||||||
std::vector<uint8_t> custom_data{};
|
std::vector<uint8_t> custom_data{};
|
||||||
bool force_new_range{false};
|
bool force_new_range{false};
|
||||||
};
|
};
|
||||||
|
@ -288,9 +288,9 @@ struct RegisterRange {
|
||||||
uint16_t start_address;
|
uint16_t start_address;
|
||||||
ModbusRegisterType register_type;
|
ModbusRegisterType register_type;
|
||||||
uint8_t register_count;
|
uint8_t register_count;
|
||||||
uint8_t skip_updates; // the config value
|
uint16_t skip_updates; // the config value
|
||||||
SensorSet sensors; // all sensors of this range
|
SensorSet sensors; // all sensors of this range
|
||||||
uint8_t skip_updates_counter; // the running value
|
uint16_t skip_updates_counter; // the running value
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModbusCommandItem {
|
class ModbusCommandItem {
|
||||||
|
|
|
@ -14,7 +14,7 @@ using value_to_data_t = std::function<float>(float);
|
||||||
class ModbusNumber : public number::Number, public Component, public SensorItem {
|
class ModbusNumber : public number::Number, public Component, public SensorItem {
|
||||||
public:
|
public:
|
||||||
ModbusNumber(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask,
|
ModbusNumber(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask,
|
||||||
SensorValueType value_type, int register_count, uint8_t skip_updates, bool force_new_range) {
|
SensorValueType value_type, int register_count, uint16_t skip_updates, bool force_new_range) {
|
||||||
this->register_type = register_type;
|
this->register_type = register_type;
|
||||||
this->start_address = start_address;
|
this->start_address = start_address;
|
||||||
this->offset = offset;
|
this->offset = offset;
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace modbus_controller {
|
||||||
|
|
||||||
class ModbusSelect : public Component, public select::Select, public SensorItem {
|
class ModbusSelect : public Component, public select::Select, public SensorItem {
|
||||||
public:
|
public:
|
||||||
ModbusSelect(SensorValueType sensor_value_type, uint16_t start_address, uint8_t register_count, uint8_t skip_updates,
|
ModbusSelect(SensorValueType sensor_value_type, uint16_t start_address, uint8_t register_count, uint16_t skip_updates,
|
||||||
bool force_new_range, std::vector<int64_t> mapping) {
|
bool force_new_range, std::vector<int64_t> mapping) {
|
||||||
this->register_type = ModbusRegisterType::HOLDING; // not configurable
|
this->register_type = ModbusRegisterType::HOLDING; // not configurable
|
||||||
this->sensor_value_type = sensor_value_type;
|
this->sensor_value_type = sensor_value_type;
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace modbus_controller {
|
||||||
class ModbusSensor : public Component, public sensor::Sensor, public SensorItem {
|
class ModbusSensor : public Component, public sensor::Sensor, public SensorItem {
|
||||||
public:
|
public:
|
||||||
ModbusSensor(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask,
|
ModbusSensor(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask,
|
||||||
SensorValueType value_type, int register_count, uint8_t skip_updates, bool force_new_range) {
|
SensorValueType value_type, int register_count, uint16_t skip_updates, bool force_new_range) {
|
||||||
this->register_type = register_type;
|
this->register_type = register_type;
|
||||||
this->start_address = start_address;
|
this->start_address = start_address;
|
||||||
this->offset = offset;
|
this->offset = offset;
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace modbus_controller {
|
||||||
class ModbusSwitch : public Component, public switch_::Switch, public SensorItem {
|
class ModbusSwitch : public Component, public switch_::Switch, public SensorItem {
|
||||||
public:
|
public:
|
||||||
ModbusSwitch(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask,
|
ModbusSwitch(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask,
|
||||||
uint8_t skip_updates, bool force_new_range) {
|
uint16_t skip_updates, bool force_new_range) {
|
||||||
this->register_type = register_type;
|
this->register_type = register_type;
|
||||||
this->start_address = start_address;
|
this->start_address = start_address;
|
||||||
this->offset = offset;
|
this->offset = offset;
|
||||||
|
|
|
@ -14,7 +14,7 @@ enum class RawEncoding { NONE = 0, HEXBYTES = 1, COMMA = 2 };
|
||||||
class ModbusTextSensor : public Component, public text_sensor::TextSensor, public SensorItem {
|
class ModbusTextSensor : public Component, public text_sensor::TextSensor, public SensorItem {
|
||||||
public:
|
public:
|
||||||
ModbusTextSensor(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint8_t register_count,
|
ModbusTextSensor(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint8_t register_count,
|
||||||
uint16_t response_bytes, RawEncoding encode, uint8_t skip_updates, bool force_new_range) {
|
uint16_t response_bytes, RawEncoding encode, uint16_t skip_updates, bool force_new_range) {
|
||||||
this->register_type = register_type;
|
this->register_type = register_type;
|
||||||
this->start_address = start_address;
|
this->start_address = start_address;
|
||||||
this->offset = offset;
|
this->offset = offset;
|
||||||
|
|
Loading…
Reference in a new issue