This commit is contained in:
reaw55 2024-03-13 10:58:21 +07:00
commit d859d61462
4 changed files with 42 additions and 21 deletions

View file

@ -1,5 +1,7 @@
#include <main.hpp>
bool analogCardAvailable = false;
RemoteVariable pm25_in = RemoteVariable();
RemoteVariable pm25_out = RemoteVariable();
RemoteVariable temp_out = RemoteVariable();
@ -128,23 +130,39 @@ 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(4, &ct_light_phase1);
espmega.installCard(5, &ct_light_phase2);
espmega.installCard(6, &ct_socket);
espmega.installCard(7, &ct_ac_phase1);
espmega.installCard(8, &ct_ac_phase2);
espmega.installCard(9, &ct_ac_phase3);
espmega.iot->registerCard(4);
espmega.iot->registerCard(5);
espmega.iot->registerCard(6);
espmega.iot->registerCard(7);
espmega.iot->registerCard(8);
espmega.iot->registerCard(9);
ESP_LOGD("ISE OS", "Installing current transformer cards");
analogCardAvailable = espmega.installCard(4, &analogCard);
if (analogCardAvailable || CT_FORCE_ENABLE) {
ESP_LOGV("ISE OS", "Analog card available, installing current transformer cards");
espmega.installCard(5, &ct_light_phase1);
ct_light_phase1.bindFRAM(&espmega.fram, 5010);
espmega.installCard(6, &ct_light_phase2);
ct_light_phase2.bindFRAM(&espmega.fram, 5020);
espmega.installCard(7, &ct_socket);
ct_socket.bindFRAM(&espmega.fram, 5030);
espmega.installCard(8, &ct_ac_phase1);
ct_ac_phase1.bindFRAM(&espmega.fram, 5040);
espmega.installCard(9, &ct_ac_phase2);
ct_ac_phase2.bindFRAM(&espmega.fram, 5050);
espmega.installCard(10, &ct_ac_phase3);
ct_ac_phase3.bindFRAM(&espmega.fram, 5060);
espmega.iot->registerCard(4);
espmega.iot->registerCard(5);
espmega.iot->registerCard(6);
espmega.iot->registerCard(7);
espmega.iot->registerCard(8);
espmega.iot->registerCard(9);
} else {
ESP_LOGE("ISE OS", "Analog card not available, current transformer cards cannot and will not be installed.");
}
ESP_LOGD("ISE OS", "Registering Current Transformer Cards with IoT Module");
// 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);