From 47828b2100a013bafca01153672434c5844a1090 Mon Sep 17 00:00:00 2001 From: maidnl Date: Thu, 3 Oct 2024 12:16:04 +0200 Subject: [PATCH] removed compilation warnings --- src/Modulino.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Modulino.h b/src/Modulino.h index fbda065..cfe420b 100644 --- a/src/Modulino.h +++ b/src/Modulino.h @@ -46,8 +46,9 @@ extern ModulinoClass Modulino; class Module : public Printable { public: - Module(uint8_t address = 0xFF, char* name = "") - : address(address), name(name) {} + Module(uint8_t address = 0xFF, const char* name = "") + : address(address), name((char *)name) {} + virtual ~Module() {} bool begin() { if (address == 0xFF) { address = discover() / 2; // divide by 2 to match address in fw main.c @@ -141,7 +142,7 @@ class ModulinoButtons : public Module { return; } virtual uint8_t discover() { - for (int i = 0; i < sizeof(match)/sizeof(match[0]); i++) { + for (unsigned int i = 0; i < sizeof(match)/sizeof(match[0]); i++) { if (scan(match[i])) { return match[i]; } @@ -170,7 +171,7 @@ class ModulinoBuzzer : public Module { write(buf, 8); } virtual uint8_t discover() { - for (int i = 0; i < sizeof(match)/sizeof(match[0]); i++) { + for (unsigned int i = 0; i < sizeof(match)/sizeof(match[0]); i++) { if (scan(match[i])) { return match[i]; } @@ -217,7 +218,7 @@ class ModulinoPixels : public Module { write((uint8_t*)data, NUMLEDS * 4); } virtual uint8_t discover() { - for (int i = 0; i < sizeof(match)/sizeof(match[0]); i++) { + for (unsigned int i = 0; i < sizeof(match)/sizeof(match[0]); i++) { if (scan(match[i])) { return match[i]; } @@ -274,7 +275,7 @@ class ModulinoKnob : public Module { return _pressed; } virtual uint8_t discover() { - for (int i = 0; i < sizeof(match)/sizeof(match[0]); i++) { + for (unsigned int i = 0; i < sizeof(match)/sizeof(match[0]); i++) { if (scan(match[i])) { return match[i]; } @@ -480,7 +481,7 @@ class ModulinoDistance : public Module { if (api == nullptr) { return false; } - float ret = internal; + uint8_t NewDataReady = 0; api->checkForDataReady(&NewDataReady); if (NewDataReady) { @@ -504,4 +505,4 @@ class ModulinoDistance : public Module { //VL53L4ED_ResultsData_t results; float internal = NAN; _distance_api* api = nullptr; -}; \ No newline at end of file +};