mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
Merge pull request #364 from proddy:dev
fix static code analysis warnings
This commit is contained in:
2
Makefile
2
Makefile
@@ -73,8 +73,8 @@ CPPFLAGS += -Os
|
|||||||
|
|
||||||
CFLAGS += $(CPPFLAGS)
|
CFLAGS += $(CPPFLAGS)
|
||||||
CFLAGS += -Wall
|
CFLAGS += -Wall
|
||||||
CFLAGS += -Wno-unused -Wno-restrict
|
|
||||||
CFLAGS += -Wextra
|
CFLAGS += -Wextra
|
||||||
|
CFLAGS += -Wno-unused-parameter
|
||||||
|
|
||||||
CXXFLAGS += $(CFLAGS) -MMD
|
CXXFLAGS += $(CFLAGS) -MMD
|
||||||
|
|
||||||
|
|||||||
@@ -147,10 +147,6 @@ class DallasSensor {
|
|||||||
|
|
||||||
static uuid::log::Logger logger_;
|
static uuid::log::Logger logger_;
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
OneWire bus_;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool temperature_convert_complete();
|
bool temperature_convert_complete();
|
||||||
int16_t get_temperature_c(const uint8_t addr[]);
|
int16_t get_temperature_c(const uint8_t addr[]);
|
||||||
uint64_t get_id(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_info(const char * value, const int8_t id, JsonObject & output);
|
||||||
bool command_commands(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
|
std::vector<Sensor> sensors_; // our list of active sensors
|
||||||
|
|
||||||
|
#ifndef EMSESP_STANDALONE
|
||||||
|
OneWire bus_;
|
||||||
|
uint32_t last_activity_ = uuid::get_uptime();
|
||||||
|
State state_ = State::IDLE;
|
||||||
int8_t scancnt_ = SCAN_START;
|
int8_t scancnt_ = SCAN_START;
|
||||||
uint8_t firstscan_ = 0;
|
uint8_t firstscan_ = 0;
|
||||||
|
int8_t scanretry_ = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t dallas_gpio_ = 0;
|
uint8_t dallas_gpio_ = 0;
|
||||||
bool parasite_ = false;
|
bool parasite_ = false;
|
||||||
bool changed_ = false;
|
bool changed_ = false;
|
||||||
uint32_t sensorfails_ = 0;
|
uint32_t sensorfails_ = 0;
|
||||||
uint32_t sensorreads_ = 0;
|
uint32_t sensorreads_ = 0;
|
||||||
int8_t scanretry_ = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -177,7 +177,6 @@ class Boiler : public EMSdevice {
|
|||||||
uint8_t hpCoolingOn_;
|
uint8_t hpCoolingOn_;
|
||||||
uint8_t hpWwOn_;
|
uint8_t hpWwOn_;
|
||||||
uint8_t hpPoolOn_;
|
uint8_t hpPoolOn_;
|
||||||
uint8_t hpHeatingOn;
|
|
||||||
int16_t hpTc0_;
|
int16_t hpTc0_;
|
||||||
int16_t hpTc1_;
|
int16_t hpTc1_;
|
||||||
int16_t hpTc3_;
|
int16_t hpTc3_;
|
||||||
|
|||||||
@@ -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
|
// 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) {
|
char * Helpers::render_value(char * result, uint8_t value, int8_t format, const uint8_t fahrenheit) {
|
||||||
// special check if its a boolean
|
// special check if its a boolean
|
||||||
if (format == EMS_VALUE_BOOL) {
|
if ((uint8_t)format == EMS_VALUE_BOOL) {
|
||||||
if (value == EMS_VALUE_BOOL_OFF) {
|
if (value == EMS_VALUE_BOOL_OFF) {
|
||||||
render_boolean(result, false);
|
render_boolean(result, false);
|
||||||
} else if (value == EMS_VALUE_BOOL_NOTSET) {
|
} else if (value == EMS_VALUE_BOOL_NOTSET) {
|
||||||
|
|||||||
10
src/mqtt.cpp
10
src/mqtt.cpp
@@ -62,11 +62,11 @@ MAKE_PSTR(iconpercent, "mdi:percent-outline") // DeviceValueUOM::PERCENT
|
|||||||
MAKE_PSTR(icontime, "mdi:clock-outline") // DeviceValueUOM::SECONDS MINUTES & HOURS
|
MAKE_PSTR(icontime, "mdi:clock-outline") // DeviceValueUOM::SECONDS MINUTES & HOURS
|
||||||
MAKE_PSTR(iconkb, "mdi:memory") // DeviceValueUOM::KB
|
MAKE_PSTR(iconkb, "mdi:memory") // DeviceValueUOM::KB
|
||||||
MAKE_PSTR(iconlmin, "mdi:water-boiler") // DeviceValueUOM::LMIN
|
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(iconua, "mdi:lightning-bolt-circle") // DeviceValueUOM::UA
|
||||||
MAKE_PSTR(iconbar, "mdi:gauge") // DeviceValueUOM::BAR
|
// MAKE_PSTR(iconbar, "mdi:gauge") // DeviceValueUOM::BAR
|
||||||
MAKE_PSTR(iconkw, "mdi:omega") // DeviceValueUOM::KW & W
|
// MAKE_PSTR(iconkw, "mdi:omega") // DeviceValueUOM::KW & W
|
||||||
MAKE_PSTR(icondbm, "mdi:wifi-strength-2") // DeviceValueUOM::DBM
|
// MAKE_PSTR(icondbm, "mdi:wifi-strength-2") // DeviceValueUOM::DBM
|
||||||
MAKE_PSTR(iconnum, "mdi:counter") // DeviceValueUOM::NONE
|
MAKE_PSTR(iconnum, "mdi:counter") // DeviceValueUOM::NONE
|
||||||
MAKE_PSTR(icondevice, "mdi:home-automation") // for devices in HA
|
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) {
|
void Mqtt::on_message(const char * topic, const char * payload, size_t len) {
|
||||||
// sometimes the payload is not terminated correctly, so make a copy
|
// sometimes the payload is not terminated correctly, so make a copy
|
||||||
// convert payload to a null-terminated char string
|
// convert payload to a null-terminated char string
|
||||||
char message[len + 2] = {'\0'};
|
char message[len + 2];
|
||||||
if (payload != nullptr) {
|
if (payload != nullptr) {
|
||||||
strlcpy(message, payload, len + 1);
|
strlcpy(message, payload, len + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -252,7 +252,9 @@ void System::format(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void System::syslog_init() {
|
void System::syslog_init() {
|
||||||
|
#ifndef EMSESP_STANDALONE
|
||||||
bool was_enabled = syslog_enabled_;
|
bool was_enabled = syslog_enabled_;
|
||||||
|
#endif
|
||||||
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
||||||
syslog_enabled_ = settings.syslog_enabled;
|
syslog_enabled_ = settings.syslog_enabled;
|
||||||
syslog_level_ = settings.syslog_level;
|
syslog_level_ = settings.syslog_level;
|
||||||
|
|||||||
Reference in New Issue
Block a user