[multiple] Fix uninitialized members and error constant types (#15235)

This commit is contained in:
Jonathan Swoboda
2026-03-27 14:58:41 -04:00
committed by GitHub
parent f0db0c1054
commit 7532e1f957
4 changed files with 18 additions and 18 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -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};
};