Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/Modulino.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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];
}
Expand Down Expand Up @@ -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];
}
Expand Down Expand Up @@ -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];
}
Expand Down Expand Up @@ -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];
}
Expand Down Expand Up @@ -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) {
Expand All @@ -504,4 +505,4 @@ class ModulinoDistance : public Module {
//VL53L4ED_ResultsData_t results;
float internal = NAN;
_distance_api* api = nullptr;
};
};