both light in standby and dashboard work now
This commit is contained in:
parent
4ef84309dd
commit
b01540a4ce
6 changed files with 151 additions and 31 deletions
37
src/main.cpp
37
src/main.cpp
|
|
@ -104,7 +104,7 @@ void setup()
|
|||
auto bindedGetTime = std::bind(&ESPMegaPRO::getTime, &espmega);
|
||||
iseDisplay.begin(&espmega.inputs, &espmega.outputs, &climateCard);
|
||||
espmega.iot->registerRelativeMqttCallback(&handleMqttMessage);
|
||||
|
||||
iseDisplay.registerPageChangeCallback(&handlePageChange);
|
||||
// placeholder
|
||||
// PM2.5 PPM Remote Variable
|
||||
// 12 bytes remote variable, 11 characters + null terminator
|
||||
|
|
@ -122,10 +122,25 @@ void loop()
|
|||
iseDisplay.loop();
|
||||
|
||||
// Update the time every 15 seconds
|
||||
//static bool run_when_init = false; // No static ? , this shit will reset to 0 every loop
|
||||
static uint32_t last_time_updated = 0;
|
||||
//rtctime_t time = espmega.getTime();
|
||||
//when init update once then update every 15 seconds
|
||||
// You don't need this, when it go from page 0 to 1 it call handlePageChange
|
||||
// if(!run_when_init){
|
||||
// time = espmega.getTime();
|
||||
// iseDisplay.updateDateTimeText(time);
|
||||
// last_time_updated = millis();
|
||||
// run_when_init = true;
|
||||
// }
|
||||
|
||||
|
||||
if (millis() - last_time_updated > 15000)
|
||||
{
|
||||
rtctime_t time = espmega.getTime();
|
||||
// log time
|
||||
ESP_LOGI("time", "Time: %d:%d:%d", time.hours, time.minutes, time.seconds);
|
||||
ESP_LOGI("Date", "Date: %d/%d/%d", time.day, time.month, time.year);
|
||||
iseDisplay.updateDateTimeText(time);
|
||||
last_time_updated = millis();
|
||||
}
|
||||
|
|
@ -174,4 +189,24 @@ float get_temp_out()
|
|||
// Read temperature from sensor
|
||||
temp_out_value = atof(temp_out.getValue());
|
||||
return temp_out_value;
|
||||
}
|
||||
|
||||
void handlePageChange(uint8_t page) {
|
||||
|
||||
// Which already send the time
|
||||
//printESP_LOGI the page have changed
|
||||
ESP_LOGI("Page", "Page change to: %d", page);
|
||||
rtctime_t time = espmega.getTime();
|
||||
iseDisplay.updateDateTimeText(time);
|
||||
iseDisplay.updateLightGroupStatePageDashboard();
|
||||
//iseDisplay.updatePMinside();
|
||||
/* iseDisplay.updatePMoutside(get_pm25_out());
|
||||
iseDisplay.updateWeather(weather.getValue());
|
||||
iseDisplay.updateTempOutside(get_temp_out()); */
|
||||
/* iseDisplay.updateACState();
|
||||
iseDisplay.updateAirPurifierState();
|
||||
iseDisplay.updateLightGroupStatePageStandby();
|
||||
iseDisplay.updateLightGroupStatePageDashboard();
|
||||
iseDisplay.updateuserACmode();
|
||||
iseDisplay.updateAirPurifierStateStandby(); */
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue