From b633b6cbb7a696facbff95ccb57cd9bd5a544a13 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Sat, 30 Dec 2023 14:42:52 +0700 Subject: [PATCH] compilation test A --- Template Project/lib/ESPMegaPRO/AnalogIoT.cpp | 4 ++++ .../{ClimateCard.cpp => ClimateCard.cpp.d} | 0 .../{ClimateCard.hpp => ClimateCard.hpp.d} | 0 .../{ClimateIoT.cpp => ClimateIoT.cpp.d} | 1 + .../{ClimateIoT.hpp => ClimateIoT.hpp.d} | 0 .../lib/ESPMegaPRO/ESPMegaIoT.cpp | 22 +++++++++++++++---- .../lib/ESPMegaPRO/ESPMegaPRO_OOP.hpp | 1 - 7 files changed, 23 insertions(+), 5 deletions(-) rename Template Project/lib/ESPMegaPRO/{ClimateCard.cpp => ClimateCard.cpp.d} (100%) rename Template Project/lib/ESPMegaPRO/{ClimateCard.hpp => ClimateCard.hpp.d} (100%) rename Template Project/lib/ESPMegaPRO/{ClimateIoT.cpp => ClimateIoT.cpp.d} (99%) rename Template Project/lib/ESPMegaPRO/{ClimateIoT.hpp => ClimateIoT.hpp.d} (100%) diff --git a/Template Project/lib/ESPMegaPRO/AnalogIoT.cpp b/Template Project/lib/ESPMegaPRO/AnalogIoT.cpp index 358bb3e..8c4324f 100644 --- a/Template Project/lib/ESPMegaPRO/AnalogIoT.cpp +++ b/Template Project/lib/ESPMegaPRO/AnalogIoT.cpp @@ -264,3 +264,7 @@ void AnalogIoT::publishDACValue(uint8_t pin) { delete[] topic; delete[] payload; } + +void AnalogIoT::handleDACChange(uint8_t pin, uint16_t value) { + this->publishDAC(pin); +} \ No newline at end of file diff --git a/Template Project/lib/ESPMegaPRO/ClimateCard.cpp b/Template Project/lib/ESPMegaPRO/ClimateCard.cpp.d similarity index 100% rename from Template Project/lib/ESPMegaPRO/ClimateCard.cpp rename to Template Project/lib/ESPMegaPRO/ClimateCard.cpp.d diff --git a/Template Project/lib/ESPMegaPRO/ClimateCard.hpp b/Template Project/lib/ESPMegaPRO/ClimateCard.hpp.d similarity index 100% rename from Template Project/lib/ESPMegaPRO/ClimateCard.hpp rename to Template Project/lib/ESPMegaPRO/ClimateCard.hpp.d diff --git a/Template Project/lib/ESPMegaPRO/ClimateIoT.cpp b/Template Project/lib/ESPMegaPRO/ClimateIoT.cpp.d similarity index 99% rename from Template Project/lib/ESPMegaPRO/ClimateIoT.cpp rename to Template Project/lib/ESPMegaPRO/ClimateIoT.cpp.d index 2484f9a..52ff878 100644 --- a/Template Project/lib/ESPMegaPRO/ClimateIoT.cpp +++ b/Template Project/lib/ESPMegaPRO/ClimateIoT.cpp.d @@ -15,6 +15,7 @@ bool ClimateIoT::begin(uint8_t card_id, ExpansionCard *card, PubSubClient *mqtt, this->card->registerSensorCallback(bindedSensorCallback); auto bindedAirConditionerCallback = std::bind(&ClimateIoT::handleAirConditionerUpdate, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); this->card->registerChangeCallback(bindedAirConditionerCallback); + return true; } void ClimateIoT::handleMqttMessage(char *topic, char *payload) { diff --git a/Template Project/lib/ESPMegaPRO/ClimateIoT.hpp b/Template Project/lib/ESPMegaPRO/ClimateIoT.hpp.d similarity index 100% rename from Template Project/lib/ESPMegaPRO/ClimateIoT.hpp rename to Template Project/lib/ESPMegaPRO/ClimateIoT.hpp.d diff --git a/Template Project/lib/ESPMegaPRO/ESPMegaIoT.cpp b/Template Project/lib/ESPMegaPRO/ESPMegaIoT.cpp index 8e8a93e..fb27a09 100644 --- a/Template Project/lib/ESPMegaPRO/ESPMegaIoT.cpp +++ b/Template Project/lib/ESPMegaPRO/ESPMegaIoT.cpp @@ -88,10 +88,15 @@ void ESPMegaIoT::registerCard(uint8_t card_id) // Create the respective IoT component switch (card_type) { - // case CARD_TYPE_ANALOG: - // components[card_id] = new AnalogIoT(); - // components[card_id]->begin(card_id, cards[card_id], &mqtt, base_topic); - // break; + case CARD_TYPE_ANALOG: + components[card_id] = new AnalogIoT(); + components[card_id]->begin(card_id, cards[card_id], &mqtt, base_topic); + if (mqtt_connected) + { + components[card_id]->subscribe(); + components[card_id]->publishReport(); + } + break; case CARD_TYPE_DIGITAL_INPUT: components[card_id] = new DigitalInputIoT(); components[card_id]->begin(card_id, cards[card_id], &mqtt, base_topic); @@ -110,6 +115,15 @@ void ESPMegaIoT::registerCard(uint8_t card_id) components[card_id]->publishReport(); } break; + // case CARD_TYPE_CLIMATE: + // components[card_id] = new ClimateIoT(); + // components[card_id]->begin(card_id, cards[card_id], &mqtt, base_topic); + // if (mqtt_connected) + // { + // components[card_id]->subscribe(); + // components[card_id]->publishReport(); + // } + // break; default: Serial.println("Unsupported card type"); return; diff --git a/Template Project/lib/ESPMegaPRO/ESPMegaPRO_OOP.hpp b/Template Project/lib/ESPMegaPRO/ESPMegaPRO_OOP.hpp index fe21abd..99b0c7d 100644 --- a/Template Project/lib/ESPMegaPRO/ESPMegaPRO_OOP.hpp +++ b/Template Project/lib/ESPMegaPRO/ESPMegaPRO_OOP.hpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include