1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 22:53:59 +00:00

Fix tm1651 enum (#6248)

This commit is contained in:
Keith Burzinski
2024-02-20 13:12:08 -06:00
committed by GitHub
parent edd1678463
commit 5ef1bab23e
3 changed files with 18 additions and 10 deletions

View File

@@ -12,9 +12,9 @@ static const char *const TAG = "tm1651.display";
static const uint8_t MAX_INPUT_LEVEL_PERCENT = 100;
static const uint8_t TM1651_MAX_LEVEL = 7;
static const uint8_t TM1651_BRIGHTNESS_LOW = 0;
static const uint8_t TM1651_BRIGHTNESS_MEDIUM = 2;
static const uint8_t TM1651_BRIGHTNESS_HIGH = 7;
static const uint8_t TM1651_BRIGHTNESS_LOW_HW = 0;
static const uint8_t TM1651_BRIGHTNESS_MEDIUM_HW = 2;
static const uint8_t TM1651_BRIGHTNESS_HIGH_HW = 7;
void TM1651Display::setup() {
ESP_LOGCONFIG(TAG, "Setting up TM1651...");
@@ -78,14 +78,14 @@ uint8_t TM1651Display::calculate_level_(uint8_t new_level) {
uint8_t TM1651Display::calculate_brightness_(uint8_t new_brightness) {
if (new_brightness <= 1) {
return TM1651_BRIGHTNESS_LOW;
return TM1651_BRIGHTNESS_LOW_HW;
} else if (new_brightness == 2) {
return TM1651_BRIGHTNESS_MEDIUM;
return TM1651_BRIGHTNESS_MEDIUM_HW;
} else if (new_brightness >= 3) {
return TM1651_BRIGHTNESS_HIGH;
return TM1651_BRIGHTNESS_HIGH_HW;
}
return TM1651_BRIGHTNESS_LOW;
return TM1651_BRIGHTNESS_LOW_HW;
}
} // namespace tm1651