compilation test A

This commit is contained in:
Siwat Sirichai 2023-12-30 14:42:52 +07:00
parent 4c04a135ac
commit b633b6cbb7
7 changed files with 23 additions and 5 deletions

View File

@ -264,3 +264,7 @@ void AnalogIoT::publishDACValue(uint8_t pin) {
delete[] topic; delete[] topic;
delete[] payload; delete[] payload;
} }
void AnalogIoT::handleDACChange(uint8_t pin, uint16_t value) {
this->publishDAC(pin);
}

View File

@ -15,6 +15,7 @@ bool ClimateIoT::begin(uint8_t card_id, ExpansionCard *card, PubSubClient *mqtt,
this->card->registerSensorCallback(bindedSensorCallback); this->card->registerSensorCallback(bindedSensorCallback);
auto bindedAirConditionerCallback = std::bind(&ClimateIoT::handleAirConditionerUpdate, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); auto bindedAirConditionerCallback = std::bind(&ClimateIoT::handleAirConditionerUpdate, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
this->card->registerChangeCallback(bindedAirConditionerCallback); this->card->registerChangeCallback(bindedAirConditionerCallback);
return true;
} }
void ClimateIoT::handleMqttMessage(char *topic, char *payload) { void ClimateIoT::handleMqttMessage(char *topic, char *payload) {

View File

@ -88,10 +88,15 @@ void ESPMegaIoT::registerCard(uint8_t card_id)
// Create the respective IoT component // Create the respective IoT component
switch (card_type) switch (card_type)
{ {
// case CARD_TYPE_ANALOG: case CARD_TYPE_ANALOG:
// components[card_id] = new AnalogIoT(); components[card_id] = new AnalogIoT();
// components[card_id]->begin(card_id, cards[card_id], &mqtt, base_topic); components[card_id]->begin(card_id, cards[card_id], &mqtt, base_topic);
// break; if (mqtt_connected)
{
components[card_id]->subscribe();
components[card_id]->publishReport();
}
break;
case CARD_TYPE_DIGITAL_INPUT: case CARD_TYPE_DIGITAL_INPUT:
components[card_id] = new DigitalInputIoT(); components[card_id] = new DigitalInputIoT();
components[card_id]->begin(card_id, cards[card_id], &mqtt, base_topic); 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(); components[card_id]->publishReport();
} }
break; 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: default:
Serial.println("Unsupported card type"); Serial.println("Unsupported card type");
return; return;

View File

@ -2,7 +2,6 @@
#include <ExpansionCard.hpp> #include <ExpansionCard.hpp>
#include <DigitalInputCard.hpp> #include <DigitalInputCard.hpp>
#include <DigitalOutputCard.hpp> #include <DigitalOutputCard.hpp>
#include <ClimateCard.hpp>
#include <ESPMegaIoT.hpp> #include <ESPMegaIoT.hpp>
#include <Arduino.h> #include <Arduino.h>
#include <Wire.h> #include <Wire.h>