move internal display init

This commit is contained in:
Siwat Sirichai 2024-03-16 23:19:35 +07:00
parent 5cf8c70483
commit 97de79456a
2 changed files with 9 additions and 4 deletions

View file

@ -148,6 +148,10 @@ void setup()
espmega.enableWebServer(80); espmega.enableWebServer(80);
// ------------ End IoT Module Initialization Routine ------------ // ------------ End IoT Module Initialization Routine ------------
// ------------ Display Post Initialization Routine ------------
espmega.enableInternalDisplay(&Serial);
// ------------ End Display Post Initialization Routine ------------
// ------------ Inputs and Outputs Initialization Routine ------------ // ------------ Inputs and Outputs Initialization Routine ------------
espmega.inputs.registerCallback(on_pin_change); espmega.inputs.registerCallback(on_pin_change);
espmega.outputs.setAutoSaveToFRAM(true); espmega.outputs.setAutoSaveToFRAM(true);
@ -163,6 +167,7 @@ void setup()
ESP_LOGD("ISE OS", "Setting up climate cards"); ESP_LOGD("ISE OS", "Setting up climate cards");
// Daikin Climate Card // Daikin Climate Card
ESP_LOGD("ISE OS", "Installing daikin climate card");
espmega.installCard(2, &climateCard_daikin); espmega.installCard(2, &climateCard_daikin);
climateCard_daikin.bindFRAM(&espmega.fram, 5000); climateCard_daikin.bindFRAM(&espmega.fram, 5000);
climateCard_daikin.loadStateFromFRAM(); climateCard_daikin.loadStateFromFRAM();
@ -171,6 +176,7 @@ void setup()
espmega.display->bindClimateCard(&climateCard_daikin); espmega.display->bindClimateCard(&climateCard_daikin);
// York Climate Card // York Climate Card
ESP_LOGD("ISE OS", "Installing york climate card");
espmega.installCard(10, &climateCard_york); espmega.installCard(10, &climateCard_york);
climateCard_york.bindFRAM(&espmega.fram, 5005); climateCard_york.bindFRAM(&espmega.fram, 5005);
climateCard_york.loadStateFromFRAM(); climateCard_york.loadStateFromFRAM();
@ -249,13 +255,12 @@ void setup()
// ------------ End IoT Card Registration Routine ------------ // ------------ End IoT Card Registration Routine ------------
// ------------ Display Initialization Routine ------------ // ------------ External Display Initialization Routine ------------
espmega.enableInternalDisplay(&Serial);
auto bindedGetTime = std::bind(&ESPMegaPRO::getTime, &espmega); auto bindedGetTime = std::bind(&ESPMegaPRO::getTime, &espmega);
iseDisplay.begin(&espmega.inputs, &espmega.outputs, &climateCard_daikin, &climateCard_york, &pm_switch, &pm_fan_speed); iseDisplay.begin(&espmega.inputs, &espmega.outputs, &climateCard_daikin, &climateCard_york, &pm_switch, &pm_fan_speed);
espmega.iot->registerRelativeMqttCallback(&handleMqttMessage); espmega.iot->registerRelativeMqttCallback(&handleMqttMessage);
iseDisplay.registerPageChangeCallback(&handlePageChange); iseDisplay.registerPageChangeCallback(&handlePageChange);
// ------------ End Display Initialization Routine ------------ // ------------ End External Display Initialization Routine ------------
} }
void pm25outupdatedisplay(char *value) void pm25outupdatedisplay(char *value)

View file

@ -21,7 +21,7 @@ SET_LOOP_TASK_STACK_SIZE(32*1024);
#define AIR_CONDITIONER_SENSOR_TYPE AC_SENSOR_TYPE_DHT22 #define AIR_CONDITIONER_SENSOR_TYPE AC_SENSOR_TYPE_DHT22
#define AIR_CONDITIONER_SENSOR_PIN 32 #define AIR_CONDITIONER_SENSOR_PIN 32
#define AIR_CONDITIONER_DAIKIN_IR_PIN 5 #define AIR_CONDITIONER_DAIKIN_IR_PIN 5
#define AIR_CONDITIONER_YORK_IR_PIN 8 #define AIR_CONDITIONER_YORK_IR_PIN 12
#define AIR_CONDITIONER_RMT_CHANNEL0 RMT_CHANNEL_0 #define AIR_CONDITIONER_RMT_CHANNEL0 RMT_CHANNEL_0
#define AIR_CONDITIONER_RMT_CHANNEL1 RMT_CHANNEL_1 #define AIR_CONDITIONER_RMT_CHANNEL1 RMT_CHANNEL_1