From b15d59f012e70946b8cbc8097091ec32122af096 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Fri, 1 May 2020 12:24:52 +0200 Subject: [PATCH] compiler warnings sanitizations --- src/led.cpp | 1 - src/power.cpp | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/led.cpp b/src/led.cpp index 4936eff4..64d33d2e 100644 --- a/src/led.cpp +++ b/src/led.cpp @@ -63,7 +63,6 @@ RGBColor rgb_hsl2rgb(float h, float s, float l) { } void rgb_set_color(uint16_t hue) { - int i = RGB_LED_COUNT; if (hue == COLOR_NONE) { // set Off for (int i = 0; i < RGB_LED_COUNT; i++) diff --git a/src/power.cpp b/src/power.cpp index 4506a6eb..062bbcb8 100644 --- a/src/power.cpp +++ b/src/power.cpp @@ -266,7 +266,7 @@ bool batt_sufficient() { uint8_t ip5306_get_bits(uint8_t reg, uint8_t index, uint8_t bits) { uint8_t value; - if (i2c_readBytes(0x75, reg, &value, 1) == 0xff) { + if (i2c_readBytes(IP5306_PRIMARY_ADDRESS, reg, &value, 1) == 0xff) { ESP_LOGW(TAG, "IP5306 get bits fail: 0x%02x", reg); return 0; } @@ -275,23 +275,23 @@ uint8_t ip5306_get_bits(uint8_t reg, uint8_t index, uint8_t bits) { void ip5306_set_bits(uint8_t reg, uint8_t index, uint8_t bits, uint8_t value) { uint8_t mask = (1 << bits) - 1, v; - if (i2c_readBytes(0x75, reg, &v, 1) == 0xff) { + if (i2c_readBytes(IP5306_PRIMARY_ADDRESS, reg, &v, 1) == 0xff) { ESP_LOGW(TAG, "IP5306 register read fail: 0x%02x", reg); return; } v &= ~(mask << index); v |= ((value & mask) << index); - if (i2c_writeBytes(0x75, reg, &v, 1) == 0xff) + if (i2c_writeBytes(IP5306_PRIMARY_ADDRESS, reg, &v, 1) == 0xff) ESP_LOGW(TAG, "IP5306 register write fail: 0x%02x", reg); } uint8_t IP5306_GetPowerSource(void) { - ip5306_get_bits(IP5306_REG_READ_0, 3, 1); // 0:BAT, 1:VIN + return ip5306_get_bits(IP5306_REG_READ_0, 3, 1); // 0:BAT, 1:VIN } uint8_t IP5306_GetBatteryFull(void) { - ip5306_get_bits(IP5306_REG_READ_1, 3, 1); // 0:CHG/DIS, 1:FULL + return ip5306_get_bits(IP5306_REG_READ_1, 3, 1); // 0:CHG/DIS, 1:FULL } uint8_t IP5306_GetBatteryLevel(void) {