From 290816be11016699c9413d2c62fb92149f201bb4 Mon Sep 17 00:00:00 2001 From: Anton Viktorov Date: Sun, 16 Jun 2024 09:50:00 +0200 Subject: [PATCH] VEML7700 Fix GCC build warnings (#6881) --- esphome/components/veml7700/veml7700.cpp | 2 +- esphome/components/veml7700/veml7700.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/esphome/components/veml7700/veml7700.cpp b/esphome/components/veml7700/veml7700.cpp index 68550811a1..a8c1411c68 100644 --- a/esphome/components/veml7700/veml7700.cpp +++ b/esphome/components/veml7700/veml7700.cpp @@ -243,7 +243,7 @@ ErrorCode VEML7700Component::configure_() { } PSMRegister psm{0}; - psm.PSM = PSM::PSM_MODE_1; + psm.PSM = PSMMode::PSM_MODE_1; psm.PSM_EN = false; ESP_LOGV(TAG, "Setting PSM to 0x%04X", psm.raw); err = this->write_register((uint8_t) CommandRegisters::PWR_SAVING, psm.raw_bytes, VEML_REG_SIZE); diff --git a/esphome/components/veml7700/veml7700.h b/esphome/components/veml7700/veml7700.h index fe5e1158e3..17fee6b851 100644 --- a/esphome/components/veml7700/veml7700.h +++ b/esphome/components/veml7700/veml7700.h @@ -24,7 +24,7 @@ enum class CommandRegisters : uint8_t { ALS_INT = 0x06 // R: ALS INT trigger event }; -enum Gain : uint8_t { +enum Gain : uint16_t { X_1 = 0, X_2 = 1, X_1_8 = 2, @@ -32,7 +32,7 @@ enum Gain : uint8_t { }; const uint8_t GAINS_COUNT = 4; -enum IntegrationTime : uint8_t { +enum IntegrationTime : uint16_t { INTEGRATION_TIME_25MS = 0b1100, INTEGRATION_TIME_50MS = 0b1000, INTEGRATION_TIME_100MS = 0b0000, @@ -42,14 +42,14 @@ enum IntegrationTime : uint8_t { }; const uint8_t INTEGRATION_TIMES_COUNT = 6; -enum Persistence : uint8_t { +enum Persistence : uint16_t { PERSISTENCE_1 = 0, PERSISTENCE_2 = 1, PERSISTENCE_4 = 2, PERSISTENCE_8 = 3, }; -enum PSM : uint8_t { +enum PSMMode : uint16_t { PSM_MODE_1 = 0, PSM_MODE_2 = 1, PSM_MODE_3 = 2, @@ -92,7 +92,7 @@ union PSMRegister { uint8_t raw_bytes[2]; struct { bool PSM_EN : 1; - uint8_t PSM : 2; + PSMMode PSM : 2; uint16_t reserved : 13; } __attribute__((packed)); };