CT analog avail awareness

This commit is contained in:
Siwat Sirichai 2024-03-10 01:12:00 +07:00
parent 439dc7480e
commit 7f82967f84
4 changed files with 12 additions and 9 deletions

View file

@ -12,6 +12,6 @@
platform = espressif32
board = wt32-eth01
framework = arduino
lib_deps = siwats/ESPMegaPROR3@^2.3.7
lib_deps = siwats/ESPMegaPROR3@^2.3.8
monitor_speed = 115200
build_flags = -DCORE_DEBUG_LEVEL=5

View file

@ -1,13 +1,6 @@
#pragma once
//start definition
#define CT_RMS_VOLTAGE 220.0
#define CT_PIN_LIGHT_PHASE1 0
#define CT_PIN_LIGHT_PHASE2 1
#define CT_PIN_SOCKET 2
#define CT_PIN_AC_PHASE1 3
#define CT_PIN_AC_PHASE2 4
#define CT_PIN_AC_PHASE3 5
/*
tentetive pin mapping

View file

@ -138,7 +138,7 @@ void setup()
espmega.display->bindClimateCard(&climateCard);
ESP_LOGD("ISE OS", "Installing current transformer cards");
analogCardAvailable = espmega.installCard(4, &analogCard);
if (analogCardAvailable) {
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);

View file

@ -22,6 +22,16 @@ SET_LOOP_TASK_STACK_SIZE(32*1024);
#define AIR_CONDITIONER_IR_PIN 5
#define AIR_CONDITIONER_RMT_CHANNEL RMT_CHANNEL_0
// CT Configuration
#define CT_FORCE_ENABLE false
#define CT_RMS_VOLTAGE 220.0
#define CT_PIN_LIGHT_PHASE1 0
#define CT_PIN_LIGHT_PHASE2 1
#define CT_PIN_SOCKET 2
#define CT_PIN_AC_PHASE1 3
#define CT_PIN_AC_PHASE2 4
#define CT_PIN_AC_PHASE3 5
void handleMqttMessage(char *topic, char *payload);
void subscribeToMqttTopics();
void handlePageChange(uint8_t page);