fix aircon and other
This commit is contained in:
parent
c99348bb72
commit
742027acf0
4 changed files with 93 additions and 74 deletions
68
src/main.cpp
68
src/main.cpp
|
|
@ -28,7 +28,6 @@ ClimateCard climateCard = ClimateCard(AIR_CONDITIONER_IR_PIN, ac,
|
|||
|
||||
void handleMqttMessage(char *topic, char *payload)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void sendStopBytes()
|
||||
|
|
@ -122,19 +121,18 @@ 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 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;
|
||||
// }
|
||||
|
||||
|
||||
// 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();
|
||||
|
|
@ -168,12 +166,10 @@ void loop()
|
|||
// iseDisplay.updateWeather(weather_value);
|
||||
// last_weather_update = millis();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
void on_pin_change(uint8_t pin, uint8_t value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// uint16_t get_pm25_out()
|
||||
|
|
@ -191,22 +187,36 @@ void on_pin_change(uint8_t pin, uint8_t value)
|
|||
// return temp_out_value;
|
||||
// }
|
||||
|
||||
void handlePageChange(uint8_t page) {
|
||||
void handlePageChange(uint8_t page)
|
||||
{
|
||||
|
||||
// Which already send the time
|
||||
//printESP_LOGI the page have changed
|
||||
// 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(); */
|
||||
}
|
||||
switch (page)
|
||||
{
|
||||
case PAGE_STANDBY:
|
||||
iseDisplay.updateLightGroupStatePageStandby();
|
||||
iseDisplay.updateAirPurifierStateStandby();
|
||||
break;
|
||||
case PAGE_DASHBOARD:
|
||||
iseDisplay.updateLightGroupStatePageDashboard();
|
||||
iseDisplay.updateAirPurifierState();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// 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