fix bug regarding analog card call error

This commit is contained in:
Siwat Sirichai 2024-03-10 00:52:56 +07:00
parent 03d8dc9c8b
commit fe75c3aceb
2 changed files with 5 additions and 3 deletions

View file

@ -14,6 +14,4 @@ board = wt32-eth01
framework = arduino
lib_deps = siwats/ESPMegaPROR3@^2.3.7
monitor_speed = 115200
build_flags = -DCORE_DEBUG_LEVEL=0
upload_port = COM32
monitor_port = COM32
build_flags = -DCORE_DEBUG_LEVEL=5

View file

@ -121,6 +121,7 @@ void setup()
espmega.enableWebServer(80);
espmega.inputs.registerCallback(on_pin_change);
espmega.outputs.setAutoSaveToFRAM(true);
analogCard.begin();
// Set value of pin 0-12 to 4095
for (uint8_t i = 0; i < 13; i++)
{
@ -128,17 +129,20 @@ 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);
ESP_LOGD("ISE OS", "Installing current transformer cards");
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);
ESP_LOGD("ISE OS", "Registering Current Transformer Cards with IoT Module");
espmega.iot->registerCard(4);
espmega.iot->registerCard(5);
espmega.iot->registerCard(6);