mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 14:55:05 +00:00
[multiple] Fix uninitialized members and error constant types (#15235)
This commit is contained in:
@@ -8,17 +8,17 @@ namespace max44009 {
|
||||
static const char *const TAG = "max44009.sensor";
|
||||
|
||||
// REGISTERS
|
||||
static const uint8_t MAX44009_REGISTER_CONFIGURATION = 0x02;
|
||||
static const uint8_t MAX44009_LUX_READING_HIGH = 0x03;
|
||||
static const uint8_t MAX44009_LUX_READING_LOW = 0x04;
|
||||
static constexpr uint8_t MAX44009_REGISTER_CONFIGURATION = 0x02;
|
||||
static constexpr uint8_t MAX44009_LUX_READING_HIGH = 0x03;
|
||||
static constexpr uint8_t MAX44009_LUX_READING_LOW = 0x04;
|
||||
// CONFIGURATION MASKS
|
||||
static const uint8_t MAX44009_CFG_CONTINUOUS = 0x80;
|
||||
static constexpr uint8_t MAX44009_CFG_CONTINUOUS = 0x80;
|
||||
// ERROR CODES
|
||||
static const uint8_t MAX44009_OK = 0;
|
||||
static const uint8_t MAX44009_ERROR_WIRE_REQUEST = -10;
|
||||
static const uint8_t MAX44009_ERROR_OVERFLOW = -20;
|
||||
static const uint8_t MAX44009_ERROR_HIGH_BYTE = -30;
|
||||
static const uint8_t MAX44009_ERROR_LOW_BYTE = -31;
|
||||
static constexpr int8_t MAX44009_OK = 0;
|
||||
static constexpr int8_t MAX44009_ERROR_WIRE_REQUEST = -10;
|
||||
static constexpr int8_t MAX44009_ERROR_OVERFLOW = -20;
|
||||
static constexpr int8_t MAX44009_ERROR_HIGH_BYTE = -30;
|
||||
static constexpr int8_t MAX44009_ERROR_LOW_BYTE = -31;
|
||||
|
||||
void MAX44009Sensor::setup() {
|
||||
bool state_ok = false;
|
||||
|
||||
@@ -28,8 +28,8 @@ class MAX44009Sensor : public sensor::Sensor, public PollingComponent, public i2
|
||||
uint8_t read_(uint8_t reg);
|
||||
void write_(uint8_t reg, uint8_t value);
|
||||
|
||||
int error_;
|
||||
MAX44009Mode mode_;
|
||||
int8_t error_{0};
|
||||
MAX44009Mode mode_{MAX44009_MODE_AUTO};
|
||||
};
|
||||
|
||||
} // namespace max44009
|
||||
|
||||
@@ -15,7 +15,7 @@ class ModbusFloatOutput : public output::FloatOutput, public Component, public S
|
||||
this->register_type = ModbusRegisterType::HOLDING;
|
||||
this->start_address = start_address;
|
||||
this->offset = offset;
|
||||
this->bitmask = bitmask;
|
||||
this->bitmask = 0xFFFFFFFF;
|
||||
this->register_count = register_count;
|
||||
this->sensor_value_type = value_type;
|
||||
this->skip_updates = 0;
|
||||
@@ -47,7 +47,7 @@ class ModbusBinaryOutput : public output::BinaryOutput, public Component, public
|
||||
ModbusBinaryOutput(uint16_t start_address, uint8_t offset) {
|
||||
this->register_type = ModbusRegisterType::COIL;
|
||||
this->start_address = start_address;
|
||||
this->bitmask = bitmask;
|
||||
this->bitmask = 0xFFFFFFFF;
|
||||
this->sensor_value_type = SensorValueType::BIT;
|
||||
this->skip_updates = 0;
|
||||
this->register_count = 1;
|
||||
|
||||
@@ -105,8 +105,8 @@ class TuyaClimate : public climate::Climate, public Component {
|
||||
optional<uint8_t> sleep_id_{};
|
||||
optional<float> eco_temperature_{};
|
||||
TuyaDatapointType eco_type_{};
|
||||
uint8_t active_state_;
|
||||
uint8_t fan_state_;
|
||||
uint8_t active_state_{0};
|
||||
uint8_t fan_state_{0};
|
||||
optional<uint8_t> swing_vertical_id_{};
|
||||
optional<uint8_t> swing_horizontal_id_{};
|
||||
optional<uint8_t> fan_speed_id_{};
|
||||
@@ -119,9 +119,9 @@ class TuyaClimate : public climate::Climate, public Component {
|
||||
bool swing_horizontal_{false};
|
||||
bool heating_state_{false};
|
||||
bool cooling_state_{false};
|
||||
float manual_temperature_;
|
||||
bool eco_;
|
||||
bool sleep_;
|
||||
float manual_temperature_{NAN};
|
||||
bool eco_{false};
|
||||
bool sleep_{false};
|
||||
bool reports_fahrenheit_{false};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user