diff --git a/include/Protocol.h b/include/Protocol.h index e8c7376..a40bec6 100644 --- a/include/Protocol.h +++ b/include/Protocol.h @@ -14,7 +14,7 @@ protected: ProtocolNo no; public: - Protocol(ProtocolNo protocol) : no(protocol) {} + explicit Protocol(ProtocolNo protocol) : no(protocol) {} Protocol& setProtocol(unsigned int p) { no = static_cast(p); diff --git a/include/RcDecoder.h b/include/RcDecoder.h index fd2aa62..1d7286b 100644 --- a/include/RcDecoder.h +++ b/include/RcDecoder.h @@ -16,7 +16,7 @@ struct RcDecoder { } state = RC_STATE(res); - sprintf(group, "%05ld", RC_GROUP(res)); + sprintf(group, "%05lu", RC_GROUP(res)); switch (RC_DEVICE(res)) { case 0b10000: device = 1; diff --git a/include/huzzah.h b/include/huzzah.h index 19abaac..f74e3f6 100644 --- a/include/huzzah.h +++ b/include/huzzah.h @@ -75,11 +75,11 @@ namespace Board { void parseSwitches(JsonDocument& jsonDoc) { JsonObjectConst rcSwitch = jsonDoc["rcSwitch"]; - switch ((unsigned int)rcSwitch["protocol"]) { + switch (static_cast(rcSwitch["protocol"])) { case 1: { - string id = Protocol_1::buildId((const char*)rcSwitch["group"], (int)rcSwitch["channel"]); + string id = Protocol_1::buildId(static_cast(rcSwitch["group"]), static_cast(rcSwitch["channel"])); Ha::Switch* el = p1Switches[id]; - if (el) el->updateState((bool)rcSwitch["state"]); + if (el) el->updateState(static_cast(rcSwitch["state"])); break; } case 2: diff --git a/lib/Tiny/Tiny.h b/lib/Tiny/Tiny.h index 1c5e706..58f14b0 100644 --- a/lib/Tiny/Tiny.h +++ b/lib/Tiny/Tiny.h @@ -33,7 +33,7 @@ class SensorId { char strValue[4]; public: - SensorId(uint8_t id) { + explicit SensorId(uint8_t id) { value = id; snprintf(strValue, 4, "%d", value); } diff --git a/platformio.ini b/platformio.ini index f8264c8..8c108dc 100644 --- a/platformio.ini +++ b/platformio.ini @@ -21,9 +21,8 @@ lib_deps = https://git.hodos.ro/libraries/serial-reader.git@^1.0.0 build_flags = -D DEBUG_RAW=0 check_tool = cppcheck -check_flags = --enable=all +check_flags = --enable=all cppcheck: --suppress=*:*/.pio/* check_skip_packages = yes -check_severity = medium, high [env:huzzah] platform = espressif8266