add york to display

This commit is contained in:
reaw55 2024-03-09 16:19:41 +07:00
parent 90fb35aeb4
commit c07fd62bba
10 changed files with 329 additions and 159 deletions

View file

@ -16,7 +16,8 @@ CurrentTransformerCard ct_ac_phase1 = CurrentTransformerCard(&analogCard, CT_PIN
CurrentTransformerCard ct_ac_phase2 = CurrentTransformerCard(&analogCard, CT_PIN_AC_PHASE2, &voltage, &adcToCurrent, 1000);
CurrentTransformerCard ct_ac_phase3 = CurrentTransformerCard(&analogCard, CT_PIN_AC_PHASE3, &voltage, &adcToCurrent, 1000);
const char *mode_names[] = {"off", "cool", "fan_only", "dry"};
const char *mode_names_daikin[] = {"off", "cool", "fan_only", "dry"};
const char *mode_names_york[] = {"off", "cool", "fan_only"};
const char *fan_speed_names[] = {"auto", "high", "medium", "low"};
uint8_t row = 4;
uint8_t column = 2;
@ -31,19 +32,19 @@ AirConditioner ac_daikin = {
.max_temperature = 32,
.min_temperature = 16,
.modes = 4,
.mode_names = mode_names,
.mode_names = mode_names_daikin,
.fan_speeds = 4,
.fan_speed_names = fan_speed_names,
.getInfraredCode = &getInfraredCode};
.getInfraredCode = &getInfraredCode_daikin};
AirConditioner ac_york = {
.max_temperature = 30,
.min_temperature = 18,
.modes = 3,
.mode_names = mode_names,
.mode_names = mode_names_york,
.fan_speeds = 4,
.fan_speed_names = fan_speed_names,
.getInfraredCode = &getInfraredCode};
.getInfraredCode = &getInfraredCode_york};
/***********************************************
* End Configuration *
***********************************************/
@ -51,13 +52,13 @@ AirConditioner ac_york = {
ESPMegaPRO espmega = ESPMegaPRO();
ISEDisplay iseDisplay = ISEDisplay(&iseDisplayAdapter, &light_array[0][0], row, column);
ClimateCard climateCard_daikin = ClimateCard(AIR_CONDITIONER_IR_PIN, ac_daikin,
ClimateCard climateCard_daikin = ClimateCard(AIR_CONDITIONER_DAIKIN_IR_PIN, ac_daikin,
AIR_CONDITIONER_SENSOR_TYPE, AIR_CONDITIONER_SENSOR_PIN,
AIR_CONDITIONER_RMT_CHANNEL);
AIR_CONDITIONER_RMT_CHANNEL0);
ClimateCard climateCard_york = ClimateCard(AIR_CONDITIONER_IR_PIN, ac_york,
AIR_CONDITIONER_SENSOR_TYPE, AIR_CONDITIONER_SENSOR_PIN,
AIR_CONDITIONER_RMT_CHANNEL);
ClimateCard climateCard_york = ClimateCard(AIR_CONDITIONER_YORK_IR_PIN, ac_york,
AC_SENSOR_TYPE_NONE, 0,
AIR_CONDITIONER_RMT_CHANNEL1);
float adcToCurrent(uint16_t adc_value)
{
@ -141,11 +142,12 @@ void setup()
}
espmega.outputs.setState(12, true);
espmega.outputs.setValue(12,4095);
espmega.installCard(2, &climateCard_daikin);
climateCard_daikin.bindFRAM(&espmega.fram, 5000);
climateCard_daikin.loadStateFromFRAM();
climateCard_daikin.setFRAMAutoSave(true);
espmega.display->bindclimateCard(&climateCard_daikin);
//espmega.display->bindclimateCard(&climateCard_daikin);
espmega.installCard(4, &ct_light_phase1);
espmega.installCard(5, &ct_light_phase2);
@ -153,19 +155,19 @@ void setup()
espmega.installCard(7, &ct_ac_phase1);
espmega.installCard(8, &ct_ac_phase2);
espmega.installCard(9, &ct_ac_phase3);
espmega.installCard(10, &climateCard_york);
climateCard_york.bindFRAM(&espmega.fram, 5000);
climateCard_york.loadStateFromFRAM();
climateCard_york.setFRAMAutoSave(true);
espmega.display->bindclimateCard(&climateCard_york);
espmega.iot->registerCard(4);
espmega.iot->registerCard(5);
espmega.iot->registerCard(6);
espmega.iot->registerCard(7);
espmega.iot->registerCard(8);
espmega.iot->registerCard(9);
espmega.installCard(10, &climateCard_daikin);
climateCard_york.bindFRAM(&espmega.fram, 5000);
climateCard_york.loadStateFromFRAM();
climateCard_york.setFRAMAutoSave(true);
espmega.display->bindClimateCard(&climateCard_york);
// auto binded_display_update_on_pm25_out = std::bind(&display_update,0,std::placeholders::_1);
// auto binded_display_update_on_pm25_in = std::bind(&display_update,1,std::placeholders::_1);
// auto binded_display_update_on_temp_out = std::bind(&display_update,2,std::placeholders::_1);
@ -209,9 +211,9 @@ void setup()
espmega.iot->registerCard(0); // Register the Input Card
espmega.iot->registerCard(1); // Register the Output Card
espmega.iot->registerCard(2); // Register the Climate Card Daikin
espmega.iot_>registerCard(10); // Register the Climate Card York
espmega.iot->registerCard(10); // Register the Climate Card York
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);
iseDisplay.registerPageChangeCallback(&handlePageChange);