Merge branch 'add-climate-card-y'
This commit is contained in:
commit
6f44a68ba3
12 changed files with 414 additions and 82 deletions
59
src/main.cpp
59
src/main.cpp
|
|
@ -9,16 +9,8 @@ RemoteVariable weather = RemoteVariable();
|
|||
RemoteVariable pm_switch = RemoteVariable();
|
||||
RemoteVariable pm_fan_speed = RemoteVariable();
|
||||
|
||||
AnalogCard analogCard = AnalogCard();
|
||||
float voltage = CT_RMS_VOLTAGE;
|
||||
CurrentTransformerCard ct_light_phase1 = CurrentTransformerCard(&analogCard, CT_PIN_AC_PHASE1, &voltage, &adcToCurrent, 1000);
|
||||
CurrentTransformerCard ct_light_phase2 = CurrentTransformerCard(&analogCard, CT_PIN_AC_PHASE2, &voltage, &adcToCurrent, 1000);
|
||||
CurrentTransformerCard ct_socket = CurrentTransformerCard(&analogCard, CT_PIN_SOCKET, &voltage, &adcToCurrent, 1000);
|
||||
CurrentTransformerCard ct_ac_phase1 = CurrentTransformerCard(&analogCard, CT_PIN_AC_PHASE1, &voltage, &adcToCurrent, 1000);
|
||||
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;
|
||||
|
|
@ -33,10 +25,19 @@ AirConditioner ac = {
|
|||
.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_york,
|
||||
.fan_speeds = 4,
|
||||
.fan_speed_names = fan_speed_names,
|
||||
.getInfraredCode = &getInfraredCode_york};
|
||||
/***********************************************
|
||||
* End Configuration *
|
||||
***********************************************/
|
||||
|
|
@ -44,9 +45,14 @@ 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_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_YORK_IR_PIN, ac_york,
|
||||
AC_SENSOR_TYPE_NONE, 0,
|
||||
AIR_CONDITIONER_RMT_CHANNEL1);
|
||||
|
||||
|
||||
float adcToCurrent(uint16_t adc_value)
|
||||
{
|
||||
|
|
@ -130,12 +136,22 @@ void setup()
|
|||
}
|
||||
espmega.outputs.setState(12, true);
|
||||
espmega.outputs.setValue(12,4095);
|
||||
|
||||
|
||||
|
||||
ESP_LOGD("ISE OS", "Setting up climate cards");
|
||||
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(&climateCard_daikin);
|
||||
|
||||
espmega.installCard(10, &climateCard_daikin);
|
||||
climateCard_york.bindFRAM(&espmega.fram, 5000);
|
||||
climateCard_york.loadStateFromFRAM();
|
||||
climateCard_york.setFRAMAutoSave(true);
|
||||
espmega.display->bindClimateCard(&climateCard_york);
|
||||
|
||||
ESP_LOGD("ISE OS", "Installing current transformer cards");
|
||||
analogCardAvailable = espmega.installCard(4, &analogCard);
|
||||
if (analogCardAvailable || CT_FORCE_ENABLE) {
|
||||
|
|
@ -205,9 +221,10 @@ void setup()
|
|||
pm_fan_speed.enableSetValue("/pm/set_fan_speed");
|
||||
espmega.iot->registerCard(0); // Register the Input Card
|
||||
espmega.iot->registerCard(1); // Register the Output Card
|
||||
espmega.iot->registerCard(2); // Register the Climate Card
|
||||
espmega.iot->registerCard(2); // Register the Climate Card Daikin
|
||||
espmega.iot->registerCard(10); // Register the Climate Card York
|
||||
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, &climateCard_york, &pm_switch, &pm_fan_speed);
|
||||
espmega.iot->registerRelativeMqttCallback(&handleMqttMessage);
|
||||
iseDisplay.registerPageChangeCallback(&handlePageChange);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue