Merge branch 'add-climate-card'

This commit is contained in:
reaw55 2024-03-09 12:19:16 +07:00
commit 2cbd94bd17

View file

@ -27,7 +27,7 @@ const uint8_t light_array[4][2] = {
{LIGHT_ROW4_COLUMN1, LIGHT_ROW4_COLUMN2}};
AirConditioner ac = {
AirConditioner ac_daikin = {
.max_temperature = 32,
.min_temperature = 16,
.modes = 4,
@ -35,6 +35,15 @@ AirConditioner ac = {
.fan_speeds = 4,
.fan_speed_names = fan_speed_names,
.getInfraredCode = &getInfraredCode};
AirConditioner ac_york = {
.max_temperature = 30,
.min_temperature = 18,
.modes = 3,
.mode_names = mode_names,
.fan_speeds = 4,
.fan_speed_names = fan_speed_names,
.getInfraredCode = &getInfraredCode};
/***********************************************
* End Configuration *
***********************************************/
@ -42,7 +51,11 @@ AirConditioner ac = {
ESPMegaPRO espmega = ESPMegaPRO();
ISEDisplay iseDisplay = ISEDisplay(&iseDisplayAdapter, &light_array[0][0], row, column);
ClimateCard climateCard = ClimateCard(AIR_CONDITIONER_IR_PIN, ac,
ClimateCard climateCard_daikin = ClimateCard(AIR_CONDITIONER_IR_PIN, ac_daikin,
AIR_CONDITIONER_SENSOR_TYPE, AIR_CONDITIONER_SENSOR_PIN,
AIR_CONDITIONER_RMT_CHANNEL);
ClimateCard climateCard_york = ClimateCard(AIR_CONDITIONER_IR_PIN, ac_york,
AIR_CONDITIONER_SENSOR_TYPE, AIR_CONDITIONER_SENSOR_PIN,
AIR_CONDITIONER_RMT_CHANNEL);
@ -128,11 +141,11 @@ void setup()
}
espmega.outputs.setState(12, true);
espmega.outputs.setValue(12,4095);
espmega.installCard(2, &climateCard);
climateCard.bindFRAM(&espmega.fram, 5000);
climateCard.loadStateFromFRAM();
climateCard.setFRAMAutoSave(true);
espmega.display->bindClimateCard(&climateCard);
espmega.installCard(2, &climateCard_daikin);
climateCard_daikin.bindFRAM(&espmega.fram, 5000);
climateCard_daikin.loadStateFromFRAM();
climateCard_daikin.setFRAMAutoSave(true);
espmega.display->bindclimateCard_daikin(&climateCard_daikin);
espmega.installCard(4, &ct_light_phase1);
espmega.installCard(5, &ct_light_phase2);
espmega.installCard(6, &ct_socket);
@ -189,7 +202,7 @@ void setup()
espmega.iot->registerCard(1); // Register the Output Card
espmega.iot->registerCard(2); // Register the Climate Card
auto bindedGetTime = std::bind(&ESPMegaPRO::getTime, &espmega);
iseDisplay.begin(&espmega.inputs, &espmega.outputs, &climateCard, &pm_switch, &pm_fan_speed);
iseDisplay.begin(&espmega.inputs, &espmega.outputs, &climateCard_daikin, &pm_switch, &pm_fan_speed);
espmega.iot->registerRelativeMqttCallback(&handleMqttMessage);
iseDisplay.registerPageChangeCallback(&handlePageChange);