running demo
This commit is contained in:
parent
c224aba193
commit
b5806498ea
10 changed files with 58 additions and 11 deletions
|
@ -2,13 +2,35 @@
|
|||
|
||||
|
||||
void InternalDisplay::begin(ESPMegaIoT *iot, std::function<rtctime_t()> getRtcTime) {
|
||||
Serial.println("Assigning IoT Module and RTC Time Getter");
|
||||
this->iot = iot;
|
||||
this->getRtcTime = getRtcTime;
|
||||
Serial.println("Aqquring Network and MQTT Configs");
|
||||
this->mqttConfig = this->iot->getMqttConfig();
|
||||
this->networkConfig = this->iot->getNetworkConfig();
|
||||
// Register callbacks
|
||||
this->inputCard->registerCallback(std::bind(&InternalDisplay::handleInputStateChange, this, std::placeholders::_1, std::placeholders::_2));
|
||||
this->outputCard->registerChangeCallback(std::bind(&InternalDisplay::handlePwmStateChange, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
Serial.println("Registering Callbacks");
|
||||
Serial.println("Binding Page Change Callback");
|
||||
auto bindedInputStateChangeCallback = std::bind(&InternalDisplay::handleInputStateChange, this, std::placeholders::_1, std::placeholders::_2);
|
||||
Serial.println("Binding Input State Change Callback");
|
||||
auto bindedPwmStateChangeCallback = std::bind(&InternalDisplay::handlePwmStateChange, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
||||
Serial.println("Registering inputCard Callbacks");
|
||||
this->inputCard->registerCallback(bindedInputStateChangeCallback);
|
||||
Serial.println("Registering outputCard Callbacks");
|
||||
this->outputCard->registerChangeCallback(bindedPwmStateChangeCallback);
|
||||
// Initialize the display
|
||||
Serial.println("Initializing DisplayAdapter");
|
||||
this->displayAdapter->begin(115200);
|
||||
Serial.println("Setting DisplayAdapter Timeout");
|
||||
this->displayAdapter->setTimeout(100);
|
||||
Serial.println("Flushing DisplayAdapter");
|
||||
this->displayAdapter->flush();
|
||||
Serial.println("Resetting Display");
|
||||
this->reset();
|
||||
delay(500);
|
||||
Serial.println("Jumping to Page 1");
|
||||
this->jumpToPage(1);
|
||||
Serial.println("Display Initialization Complete");
|
||||
}
|
||||
|
||||
void InternalDisplay::loop() {
|
||||
|
@ -177,4 +199,12 @@ void InternalDisplay::setInputMarker(uint8_t pin, bool state) {
|
|||
|
||||
InternalDisplay::InternalDisplay(HardwareSerial *displayAdapter) : ESPMegaDisplay(displayAdapter) {
|
||||
this->currentPage = INTERNAL_DISPLAY_DASHBOARD_PAGE;
|
||||
}
|
||||
|
||||
void InternalDisplay::bindInputCard(DigitalInputCard *inputCard) {
|
||||
this->inputCard = inputCard;
|
||||
}
|
||||
|
||||
void InternalDisplay::bindOutputCard(DigitalOutputCard *outputCard) {
|
||||
this->outputCard = outputCard;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue