fix static analysis warnings

This commit is contained in:
proddy
2022-02-18 20:28:15 +01:00
parent 33835fef7b
commit fb05558ab9
6 changed files with 18 additions and 18 deletions

View File

@@ -73,8 +73,8 @@ CPPFLAGS += -Os
CFLAGS += $(CPPFLAGS)
CFLAGS += -Wall
CFLAGS += -Wno-unused -Wno-restrict
CFLAGS += -Wextra
CFLAGS += -Wno-unused-parameter
CXXFLAGS += $(CFLAGS) -MMD

View File

@@ -147,10 +147,6 @@ class DallasSensor {
static uuid::log::Logger logger_;
#ifndef EMSESP_STANDALONE
OneWire bus_;
#endif
bool temperature_convert_complete();
int16_t get_temperature_c(const uint8_t addr[]);
uint64_t get_id(const uint8_t addr[]);
@@ -159,19 +155,22 @@ class DallasSensor {
bool command_info(const char * value, const int8_t id, JsonObject & output);
bool command_commands(const char * value, const int8_t id, JsonObject & output);
uint32_t last_activity_ = uuid::get_uptime();
State state_ = State::IDLE;
std::vector<Sensor> sensors_; // our list of active sensors
int8_t scancnt_ = SCAN_START;
uint8_t firstscan_ = 0;
#ifndef EMSESP_STANDALONE
OneWire bus_;
uint32_t last_activity_ = uuid::get_uptime();
State state_ = State::IDLE;
int8_t scancnt_ = SCAN_START;
uint8_t firstscan_ = 0;
int8_t scanretry_ = 0;
#endif
uint8_t dallas_gpio_ = 0;
bool parasite_ = false;
bool changed_ = false;
uint32_t sensorfails_ = 0;
uint32_t sensorreads_ = 0;
int8_t scanretry_ = 0;
};
} // namespace emsesp

View File

@@ -177,7 +177,6 @@ class Boiler : public EMSdevice {
uint8_t hpCoolingOn_;
uint8_t hpWwOn_;
uint8_t hpPoolOn_;
uint8_t hpHeatingOn;
int16_t hpTc0_;
int16_t hpTc1_;
int16_t hpTc3_;

View File

@@ -200,7 +200,7 @@ char * Helpers::render_value(char * result, const char * value, const int8_t for
// format: 255(0xFF)=boolean, 0=no formatting, otherwise divide by format
char * Helpers::render_value(char * result, uint8_t value, int8_t format, const uint8_t fahrenheit) {
// special check if its a boolean
if (format == EMS_VALUE_BOOL) {
if ((uint8_t)format == EMS_VALUE_BOOL) {
if (value == EMS_VALUE_BOOL_OFF) {
render_boolean(result, false);
} else if (value == EMS_VALUE_BOOL_NOTSET) {

View File

@@ -62,11 +62,11 @@ MAKE_PSTR(iconpercent, "mdi:percent-outline") // DeviceValueUOM::PERCENT
MAKE_PSTR(icontime, "mdi:clock-outline") // DeviceValueUOM::SECONDS MINUTES & HOURS
MAKE_PSTR(iconkb, "mdi:memory") // DeviceValueUOM::KB
MAKE_PSTR(iconlmin, "mdi:water-boiler") // DeviceValueUOM::LMIN
MAKE_PSTR(iconkwh, "mdi:transmission-tower") // DeviceValueUOM::KWH & WH
// MAKE_PSTR(iconkwh, "mdi:transmission-tower") // DeviceValueUOM::KWH & WH
MAKE_PSTR(iconua, "mdi:lightning-bolt-circle") // DeviceValueUOM::UA
MAKE_PSTR(iconbar, "mdi:gauge") // DeviceValueUOM::BAR
MAKE_PSTR(iconkw, "mdi:omega") // DeviceValueUOM::KW & W
MAKE_PSTR(icondbm, "mdi:wifi-strength-2") // DeviceValueUOM::DBM
// MAKE_PSTR(iconbar, "mdi:gauge") // DeviceValueUOM::BAR
// MAKE_PSTR(iconkw, "mdi:omega") // DeviceValueUOM::KW & W
// MAKE_PSTR(icondbm, "mdi:wifi-strength-2") // DeviceValueUOM::DBM
MAKE_PSTR(iconnum, "mdi:counter") // DeviceValueUOM::NONE
MAKE_PSTR(icondevice, "mdi:home-automation") // for devices in HA
@@ -253,7 +253,7 @@ void Mqtt::incoming(const char * topic, const char * payload) {
void Mqtt::on_message(const char * topic, const char * payload, size_t len) {
// sometimes the payload is not terminated correctly, so make a copy
// convert payload to a null-terminated char string
char message[len + 2] = {'\0'};
char message[len + 2];
if (payload != nullptr) {
strlcpy(message, payload, len + 1);
}

View File

@@ -252,7 +252,9 @@ void System::format(uuid::console::Shell & shell) {
}
void System::syslog_init() {
#ifndef EMSESP_STANDALONE
bool was_enabled = syslog_enabled_;
#endif
EMSESP::webSettingsService.read([&](WebSettings & settings) {
syslog_enabled_ = settings.syslog_enabled;
syslog_level_ = settings.syslog_level;