refactor for integration of InternalDisplay
This commit is contained in:
parent
d0e4825c2d
commit
c224aba193
5 changed files with 33 additions and 43 deletions
|
@ -26,7 +26,7 @@ void ESPMegaPRO::loop() {
|
|||
cards[i]->loop();
|
||||
}
|
||||
}
|
||||
iot.loop();
|
||||
iot->loop();
|
||||
}
|
||||
bool ESPMegaPRO::installCard(uint8_t slot, ExpansionCard* card) {
|
||||
if (slot > 255) return false;
|
||||
|
@ -88,11 +88,27 @@ void ESPMegaPRO::setTime(int hours, int minutes, int seconds, int day, int month
|
|||
}
|
||||
|
||||
void ESPMegaPRO::enableIotModule() {
|
||||
iot.intr_begin(cards);
|
||||
if (iotEnabled) return;
|
||||
this->iot = new ESPMegaIoT();
|
||||
this->iot->intr_begin(cards);
|
||||
iotEnabled = true;
|
||||
}
|
||||
|
||||
ExpansionCard* ESPMegaPRO::getCard(uint8_t slot) {
|
||||
if (slot > 255) return nullptr;
|
||||
if (!cardInstalled[slot]) return nullptr;
|
||||
return cards[slot];
|
||||
}
|
||||
|
||||
void ESPMegaPRO::enableInternalDisplay(HardwareSerial *serial) {
|
||||
if (internalDisplayEnabled) return;
|
||||
if (!iotEnabled) {
|
||||
Serial.println("Cannot Enable Internal Display without IoT Module being enabled!");
|
||||
return;
|
||||
}
|
||||
display = new InternalDisplay(serial);
|
||||
auto bindedGetTime = std::bind(&ESPMegaPRO::getTime, this);
|
||||
display->begin(this->iot,bindedGetTime);
|
||||
internalDisplayEnabled = true;
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue