Skip to content

Commit

Permalink
feat(wlan): Implement additional wlan operation modes (access point, …
Browse files Browse the repository at this point in the history
…disabled) (#186)
  • Loading branch information
Slider0007 authored Nov 4, 2024
1 parent dbbaae8 commit 498d10a
Show file tree
Hide file tree
Showing 50 changed files with 1,463 additions and 3,024 deletions.
51 changes: 30 additions & 21 deletions code/components/config_handling/cfgDataStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ enum GpioSmartledType {
};


enum NetworkConfig {
NETWORK_CONFIG_DHCP = 0,
NETWORK_CONFIG_STATIC = 1,
enum NetworkWlanIpConfig {
NETWORK_WLAN_IP_CONFIG_DHCP = 0,
NETWORK_WLAN_IP_CONFIG_STATIC = 1,
};


enum WlanOperationMode {
WLAN_OPMODE_OFF = -1,
WLAN_OPMODE_STATION_FULL = 0,
WLAN_OPMODE_STATION_LIMITED = 1,
WLAN_OPMODE_AP_FULL = 2,
WLAN_OPMODE_AP_LIMITED = 3,
enum NetworkOperationMode {
NETWORK_OPMODE_DISABLED = -1,
NETWORK_OPMODE_WLAN_CLIENT = 0,
NETWORK_OPMODE_WLAN_CLIENT_TIMED_OFF = 1,
NETWORK_OPMODE_WLAN_AP = 2,
NETWORK_OPMODE_WLAN_AP_TIMED_OFF = 3,
};


Expand Down Expand Up @@ -377,29 +377,38 @@ struct CfgData {

// Network
struct SectionNetwork {
int opmode = NETWORK_OPMODE_WLAN_CLIENT;
int timedOffDelay = 60; // Minutes
struct Wlan {
int opmode = WLAN_OPMODE_STATION_FULL;
std::string ssid = "";
std::string password = "";
std::string hostname = "watermeter";
struct Ipv4 {
int networkConfig = NETWORK_CONFIG_DHCP;
std::string ipAddress = "";
std::string subnetMask = "";
std::string gatewayAddress = "";
std::string dnsServer = "";
} ipv4;
std::string hostname = "watermeter";
struct Ipv4 {
int networkConfig = NETWORK_WLAN_IP_CONFIG_DHCP;
std::string ipAddress = "";
std::string subnetMask = "";
std::string gatewayAddress = "";
std::string dnsServer = "";
} ipv4;
struct WlanRoaming {
bool enabled = false;
int rssiThreshold = -75;
} wlanRoaming;
} wlan;
struct WlanAp {
std::string ssid = "AI-on-the-Edge Device";
std::string password = "";
int channel = 11;
struct Ipv4 {
std::string ipAddress = "192.168.4.1";
} ipv4;
} wlanAp;
struct Time {
std::string timeZone = "CET-1CEST,M3.5.0,M10.5.0/3";
struct Ntp {
bool timeSyncEnabled = true;
std::string timeServer = ""; // IP-Address or DNS name, e.g. 192.168.x.x OR fritz.box
bool processStartInterlock = true;
bool timeSyncEnabled = true;
std::string timeServer = ""; // IP-Address or DNS name, e.g. 192.168.x.x OR fritz.box
bool processStartInterlock = true;
} ntp;
} time;
} sectionNetwork;
Expand Down
49 changes: 41 additions & 8 deletions code/components/config_handling/configClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1284,10 +1284,13 @@ esp_err_t ConfigClass::parseConfig(httpd_req_t *req, bool init, bool unityTest)


// Network
//@TODO FEATURE. WLAN operation modes not yet implemented
/*objEl = cJSON_GetObjectItem(cJSON_GetObjectItem(cJSON_GetObjectItem(cJsonObject, "network"), "wlan"), "opmode");
objEl = cJSON_GetObjectItem(cJSON_GetObjectItem(cJsonObject, "network"), "opmode");
if (cJSON_IsNumber(objEl))
cfgDataTemp.sectionNetwork.wlan.enabled = objEl->valueint;*/
cfgDataTemp.sectionNetwork.opmode = std::clamp(objEl->valueint, -1, 3);

objEl = cJSON_GetObjectItem(cJSON_GetObjectItem(cJsonObject, "network"), "timedoffdelay");
if (cJSON_IsNumber(objEl))
cfgDataTemp.sectionNetwork.timedOffDelay = std::max(objEl->valueint, 1);

bool ssidEmpty = false;
objEl = cJSON_GetObjectItem(cJSON_GetObjectItem(cJSON_GetObjectItem(cJsonObject, "network"), "wlan"), "ssid");
Expand Down Expand Up @@ -1339,11 +1342,11 @@ esp_err_t ConfigClass::parseConfig(httpd_req_t *req, bool init, bool unityTest)
cfgDataTemp.sectionNetwork.wlan.ipv4.gatewayAddress = objEl->valuestring;

// Static IP config selected, but IP config invalid --> Fallback to DHCP
if (cfgDataTemp.sectionNetwork.wlan.ipv4.networkConfig == NETWORK_CONFIG_STATIC) {
if (cfgDataTemp.sectionNetwork.wlan.ipv4.networkConfig == NETWORK_WLAN_IP_CONFIG_STATIC) {
if (!isValidIpAddress(cfgDataTemp.sectionNetwork.wlan.ipv4.ipAddress.c_str()) ||
!isValidIpAddress(cfgDataTemp.sectionNetwork.wlan.ipv4.subnetMask.c_str()) ||
!isValidIpAddress(cfgDataTemp.sectionNetwork.wlan.ipv4.gatewayAddress.c_str())) {
cfgDataTemp.sectionNetwork.wlan.ipv4.networkConfig = NETWORK_CONFIG_DHCP;
cfgDataTemp.sectionNetwork.wlan.ipv4.networkConfig = NETWORK_WLAN_IP_CONFIG_DHCP;
LogFile.writeToFile(ESP_LOG_WARN, TAG, "parseConfig: Static network config invalid. Use DHCP as fallback");
}
}
Expand All @@ -1360,6 +1363,22 @@ esp_err_t ConfigClass::parseConfig(httpd_req_t *req, bool init, bool unityTest)
if (cJSON_IsNumber(objEl))
cfgDataTemp.sectionNetwork.wlan.wlanRoaming.rssiThreshold = std::clamp(objEl->valueint, -100, 0);

objEl = cJSON_GetObjectItem(cJSON_GetObjectItem(cJSON_GetObjectItem(cJsonObject, "network"), "wlanap"), "ssid");
if (cJSON_IsString(objEl))
cfgDataTemp.sectionNetwork.wlanAp.ssid = objEl->valuestring;

objEl = cJSON_GetObjectItem(cJSON_GetObjectItem(cJSON_GetObjectItem(cJsonObject, "network"), "wlanap"), "password");
if (cJSON_IsString(objEl) && (strlen(objEl->valuestring) == 0 || strlen(objEl->valuestring) >= 8))
cfgDataTemp.sectionNetwork.wlanAp.password = objEl->valuestring;

objEl = cJSON_GetObjectItem(cJSON_GetObjectItem(cJSON_GetObjectItem(cJsonObject, "network"), "wlanap"), "channel");
if (cJSON_IsNumber(objEl))
cfgDataTemp.sectionNetwork.wlanAp.channel = std::clamp(objEl->valueint, 1, 14);

objEl = cJSON_GetObjectItem(cJSON_GetObjectItem(cJSON_GetObjectItem(cJSON_GetObjectItem(cJsonObject, "network"), "wlanap"), "ipv4"), "ipaddress");
if (cJSON_IsString(objEl) && isValidIpAddress(objEl->valuestring))
cfgDataTemp.sectionNetwork.wlanAp.ipv4.ipAddress = objEl->valuestring;

objEl = cJSON_GetObjectItem(cJSON_GetObjectItem(cJSON_GetObjectItem(cJSON_GetObjectItem(cJsonObject, "network"), "time"), "ntp"), "timesyncenabled");
if (cJSON_IsBool(objEl))
cfgDataTemp.sectionNetwork.time.ntp.timeSyncEnabled = objEl->valueint;
Expand Down Expand Up @@ -1949,13 +1968,15 @@ esp_err_t ConfigClass::serializeConfig(bool unityTest)

// Network
// ***************************
cJSON *network, *networkIpv4, *networkWlan, *networkWlanRoaming, *networkTime, *networkTimeNtp;
cJSON *network, *networkWlan, *networkIpv4, *networkWlanRoaming, *networkWlanAp, *networkApIpv4, *networkTime, *networkTimeNtp;
if (!cJSON_AddItemToObject(cJsonObject, "network", network = cJSON_CreateObject()))
retVal = ESP_FAIL;
if (cJSON_AddNumberToObject(network, "opmode", cfgDataTemp.sectionNetwork.opmode) == NULL)
retVal = ESP_FAIL;
if (cJSON_AddNumberToObject(network, "timedoffdelay", cfgDataTemp.sectionNetwork.timedOffDelay) == NULL)
retVal = ESP_FAIL;
if (!cJSON_AddItemToObject(network, "wlan", networkWlan = cJSON_CreateObject()))
retVal = ESP_FAIL;
/*if (cJSON_AddNumberToObject(networkWlan, "opmode", cfgDataTemp.sectionNetwork.wlan.opmode) == NULL) //@TODO FEATURE. Not yet implemented
retVal = ESP_FAIL;*/
if (cJSON_AddStringToObject(networkWlan, "ssid", cfgDataTemp.sectionNetwork.wlan.ssid.c_str()) == NULL)
retVal = ESP_FAIL;
if (cJSON_AddStringToObject(networkWlan, "password", cfgDataTemp.sectionNetwork.wlan.password.empty() ? "" : "******") == NULL)
Expand All @@ -1980,6 +2001,18 @@ esp_err_t ConfigClass::serializeConfig(bool unityTest)
retVal = ESP_FAIL;
if (cJSON_AddNumberToObject(networkWlanRoaming, "rssithreshold", cfgDataTemp.sectionNetwork.wlan.wlanRoaming.rssiThreshold) == NULL)
retVal = ESP_FAIL;
if (!cJSON_AddItemToObject(network, "wlanap", networkWlanAp = cJSON_CreateObject()))
retVal = ESP_FAIL;
if (cJSON_AddStringToObject(networkWlanAp, "ssid", cfgDataTemp.sectionNetwork.wlanAp.ssid.c_str()) == NULL)
retVal = ESP_FAIL;
if (cJSON_AddStringToObject(networkWlanAp, "password", cfgDataTemp.sectionNetwork.wlanAp.password.c_str()) == NULL)
retVal = ESP_FAIL;
if (cJSON_AddNumberToObject(networkWlanAp, "channel", cfgDataTemp.sectionNetwork.wlanAp.channel) == NULL)
retVal = ESP_FAIL;
if (!cJSON_AddItemToObject(networkWlanAp, "ipv4", networkApIpv4 = cJSON_CreateObject()))
retVal = ESP_FAIL;
if (cJSON_AddStringToObject(networkApIpv4, "ipaddress", cfgDataTemp.sectionNetwork.wlanAp.ipv4.ipAddress.c_str()) == NULL)
retVal = ESP_FAIL;
if (!cJSON_AddItemToObject(network, "time", networkTime = cJSON_CreateObject()))
retVal = ESP_FAIL;
if (cJSON_AddStringToObject(networkTime, "timezone", cfgDataTemp.sectionNetwork.time.timeZone.c_str()) == NULL)
Expand Down
2 changes: 1 addition & 1 deletion code/components/config_handling/configMigration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ void migrateWlanIni()
!ConfigClass::getInstance()->cfgTmp()->sectionNetwork.wlan.ipv4.subnetMask.empty() &&
!ConfigClass::getInstance()->cfgTmp()->sectionNetwork.wlan.ipv4.gatewayAddress.empty())
{
ConfigClass::getInstance()->cfgTmp()->sectionNetwork.wlan.ipv4.networkConfig = NETWORK_CONFIG_STATIC;
ConfigClass::getInstance()->cfgTmp()->sectionNetwork.wlan.ipv4.networkConfig = NETWORK_WLAN_IP_CONFIG_STATIC;
}

deleteFile(CONFIG_WIFI_FILE_BACKUP_LEGACY);
Expand Down
4 changes: 2 additions & 2 deletions code/components/fileserver_ota/server_ota.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ void task_reboot(void *DeleteMainFlow)

/* Stop service tasks */
#ifdef ENABLE_MQTT
MQTTdestroy_client(true);
deinitMqttClient(true);
#endif //ENABLE_MQTT

gpio_handler_destroy();
Expand All @@ -630,7 +630,7 @@ void task_reboot(void *DeleteMainFlow)
httpd_stop(server);

vTaskDelay(3000 / portTICK_PERIOD_MS);
wifiDestroy();
deinitWifi();

vTaskDelay(1000 / portTICK_PERIOD_MS);
esp_restart(); // Reset type: CPU reset (Reset both CPUs)
Expand Down
14 changes: 10 additions & 4 deletions code/components/gpio_ctrl/gpioControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ void GpioHandler::gpioInputStatePolling()
if (gpioMap != NULL) {
for(std::map<gpio_num_t, GpioPin*>::iterator it = gpioMap->begin(); it != gpioMap->end(); ++it) {
if (it->second->getMode() == GPIO_PIN_MODE_INPUT || it->second->getMode() == GPIO_PIN_MODE_INPUT_PULLUP ||
it->second->getMode() == GPIO_PIN_MODE_INPUT_PULLDOWN || it->second->getMode() == GPIO_PIN_MODE_TRIGGER_CYCLE_START)
it->second->getMode() == GPIO_PIN_MODE_INPUT_PULLDOWN || it->second->getMode() == GPIO_PIN_MODE_TRIGGER_CYCLE_START ||
it->second->getMode() == GPIO_PIN_MODE_RESUME_WLAN_CONNECTION)
{
it->second->updatePinState();
}
Expand Down Expand Up @@ -203,7 +204,8 @@ bool GpioHandler::init()

// Handler task is only needed to maintain input pin state (interrupt or polling)
if (it->second->getMode() == GPIO_PIN_MODE_INPUT || it->second->getMode() == GPIO_PIN_MODE_INPUT_PULLUP ||
it->second->getMode() == GPIO_PIN_MODE_INPUT_PULLDOWN || it->second->getMode() == GPIO_PIN_MODE_TRIGGER_CYCLE_START)
it->second->getMode() == GPIO_PIN_MODE_INPUT_PULLDOWN || it->second->getMode() == GPIO_PIN_MODE_TRIGGER_CYCLE_START ||
it->second->getMode() == GPIO_PIN_MODE_RESUME_WLAN_CONNECTION)
{
initHandlerTask = true;
}
Expand All @@ -212,7 +214,7 @@ bool GpioHandler::init()

#ifdef ENABLE_MQTT
std::function<void()> f = std::bind(&GpioHandler::handleMQTTconnect, this);
MQTTregisterConnectFunction("gpioHandler", f);
registerMqttConnectFunction("gpioHandler", f);
#endif //ENABLE_MQTT

// Handler task is only needed to maintain input pin state (interrupt or polling)
Expand Down Expand Up @@ -366,7 +368,7 @@ void GpioHandler::clearData()
void GpioHandler::deinit()
{
#ifdef ENABLE_MQTT
MQTTunregisterConnectFunction("gpioHandler");
unregisterMqttConnectFunction("gpioHandler");
#endif //ENABLE_MQTT

clearData();
Expand Down Expand Up @@ -506,6 +508,8 @@ gpio_pin_mode_t GpioHandler::resolvePinMode(std::string input)
}
else if (input == "trigger-cycle-start")
return GPIO_PIN_MODE_TRIGGER_CYCLE_START;
else if (input == "resume-wlan-connection")
return GPIO_PIN_MODE_RESUME_WLAN_CONNECTION;

return GPIO_PIN_MODE_DISABLED;
}
Expand Down Expand Up @@ -534,6 +538,8 @@ std::string GpioHandler::getPinModeDecription(gpio_pin_mode_t _mode)
return FLASHLIGHT_DIGITAL;
case 9:
return "trigger-cycle-start";
case 10:
return "resume-wlan-connection";
default:
return "disabled";
}
Expand Down
34 changes: 22 additions & 12 deletions code/components/gpio_ctrl/gpioPin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "ClassLogFile.h"
#include "helper.h"
#include "MainFlowControl.h"
#include "connect_wlan.h"

#ifdef ENABLE_MQTT
#include "interface_mqtt.h"
Expand All @@ -29,8 +30,10 @@ GpioPin::GpioPin(gpio_num_t _gpio, const char* _name, gpio_pin_mode_t _mode, gpi
gpioISR.gpio = gpio = _gpio;
name = _name;
mode = _mode;
interruptType = mode == GPIO_PIN_MODE_TRIGGER_CYCLE_START ? GPIO_INTR_ANYEDGE : _interruptType;
gpioISR.debounceTime = mode == GPIO_PIN_MODE_TRIGGER_CYCLE_START ? 1000 : _debounceTime;
interruptType = mode == GPIO_PIN_MODE_TRIGGER_CYCLE_START ||
mode == GPIO_PIN_MODE_RESUME_WLAN_CONNECTION ? GPIO_INTR_ANYEDGE : _interruptType;
gpioISR.debounceTime = mode == GPIO_PIN_MODE_TRIGGER_CYCLE_START ||
mode == GPIO_PIN_MODE_RESUME_WLAN_CONNECTION? 1000 : _debounceTime;
frequency = _frequency;

httpAccess = _httpAccess;
Expand Down Expand Up @@ -88,8 +91,8 @@ void GpioPin::init()

//set interrupt
io_conf.intr_type = mode == GPIO_PIN_MODE_INPUT || mode == GPIO_PIN_MODE_INPUT_PULLUP ||
mode == GPIO_PIN_MODE_INPUT_PULLDOWN || mode == GPIO_PIN_MODE_TRIGGER_CYCLE_START ?
interruptType : GPIO_INTR_DISABLE;
mode == GPIO_PIN_MODE_INPUT_PULLDOWN || mode == GPIO_PIN_MODE_TRIGGER_CYCLE_START ||
mode == GPIO_PIN_MODE_RESUME_WLAN_CONNECTION ? interruptType : GPIO_INTR_DISABLE;

//set input / output mode
io_conf.mode = mode == GPIO_PIN_MODE_OUTPUT || mode == GPIO_PIN_MODE_OUTPUT_PWM ||
Expand All @@ -101,11 +104,11 @@ void GpioPin::init()

//set pull-down mode
io_conf.pull_down_en = mode == GPIO_PIN_MODE_INPUT_PULLDOWN ?
gpio_pulldown_t::GPIO_PULLDOWN_ENABLE : gpio_pulldown_t::GPIO_PULLDOWN_DISABLE;
gpio_pulldown_t::GPIO_PULLDOWN_ENABLE : gpio_pulldown_t::GPIO_PULLDOWN_DISABLE;

//set pull-up mode
io_conf.pull_up_en = mode == GPIO_PIN_MODE_INPUT_PULLUP || mode == GPIO_PIN_MODE_TRIGGER_CYCLE_START ?
gpio_pullup_t::GPIO_PULLUP_ENABLE : gpio_pullup_t::GPIO_PULLUP_DISABLE;
io_conf.pull_up_en = mode == GPIO_PIN_MODE_INPUT_PULLUP || mode == GPIO_PIN_MODE_TRIGGER_CYCLE_START ||
mode == GPIO_PIN_MODE_RESUME_WLAN_CONNECTION ? gpio_pullup_t::GPIO_PULLUP_ENABLE : gpio_pullup_t::GPIO_PULLUP_DISABLE;

//configure GPIO with the given settings
gpio_config(&io_conf);
Expand All @@ -123,7 +126,7 @@ void GpioPin::init()
// Subcribe to [mainTopic]/device/gpio/[GpioName]/ctrl
std::function<bool(std::string, char*, int)> func = std::bind(&GpioPin::mqttControlPinState, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
MQTTregisterSubscribeFunction(mqttTopic + "/ctrl", func);
registerMqttSubscribeFunction(mqttTopic + "/ctrl", func);
}
#endif //ENABLE_MQTT
}
Expand All @@ -141,8 +144,15 @@ void GpioPin::updatePinState(int _state)
LogFile.writeToFile(ESP_LOG_DEBUG, TAG, "updatePinState: GPIO" + std::to_string((int)gpio) +
", State: " + std::to_string(pinState));

if (mode == GPIO_PIN_MODE_TRIGGER_CYCLE_START && pinState == 0) // Pullup enabled, trigger with falling edge / low level
triggerFlowStartByGpio();
// Handle special modes
if (pinState == 0) { // Pullup enabled, trigger with falling edge / low level
if (mode == GPIO_PIN_MODE_TRIGGER_CYCLE_START) {
triggerFlowStartByGpio();
}
else if (mode == GPIO_PIN_MODE_RESUME_WLAN_CONNECTION) {
resumeWifiConnection("GPIO" + std::to_string((int)gpio));
}
}

#ifdef ENABLE_MQTT
mqttPublishPinState();
Expand Down Expand Up @@ -202,7 +212,7 @@ int GpioPin::getPinState()
#ifdef ENABLE_MQTT
bool GpioPin::mqttPublishPinState(int _pwmDuty)
{
if (getMQTTisConnected() && mqttAccess) {
if (getMqttIsConnected() && mqttAccess) {
cJSON *cJSONObject = cJSON_CreateObject();
if (cJSONObject == NULL) {
LogFile.writeToFile(ESP_LOG_ERROR, TAG, "Failed to create JSON object");
Expand All @@ -224,7 +234,7 @@ bool GpioPin::mqttPublishPinState(int _pwmDuty)
cJSON_Delete(cJSONObject);

if (jsonChar != NULL) {
retVal &= MQTTPublish(mqttTopic + "/state", std::string(jsonChar), 1);
retVal &= publishMqttData(mqttTopic + "/state", std::string(jsonChar), 1);
cJSON_free(jsonChar);
}

Expand Down
3 changes: 2 additions & 1 deletion code/components/gpio_ctrl/gpioPin.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ typedef enum {
GPIO_PIN_MODE_FLASHLIGHT_SMARTLED = 7,
GPIO_PIN_MODE_FLASHLIGHT_DIGITAL = 8,
GPIO_PIN_MODE_TRIGGER_CYCLE_START = 9,
GPIO_PIN_MODE_MAX = 10
GPIO_PIN_MODE_RESUME_WLAN_CONNECTION = 10,
GPIO_PIN_MODE_MAX = 11
} gpio_pin_mode_t;


Expand Down
2 changes: 1 addition & 1 deletion code/components/mainprocess_ctrl/ClassFlowAlignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ bool ClassFlowAlignment::doFlow(std::string time)

if (imageTemp == NULL) {
imageTemp = new CImageBasis("imageTemp", ImageBasis, 1);
if (imageTemp == NULL) {
if (imageTemp == NULL || imageTemp->rgb_image == NULL) {
LogFile.writeToFile(ESP_LOG_ERROR, TAG, "Failed to allocate imageTemp");
LogFile.writeHeapInfo("ClassFlowAlignment-doFlow");
return false;
Expand Down
6 changes: 3 additions & 3 deletions code/components/mainprocess_ctrl/ClassFlowControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ bool ClassFlowControl::doFlowImageEvaluation(std::string time)
setActualProcessState(translateActualProcessState(FlowControlImage[i]->name()));
LogFile.writeToFile(ESP_LOG_INFO, TAG, "Process state: " + getActualProcessState());
#ifdef ENABLE_MQTT
MQTTPublish(mqttServer_getMainTopic() + "/process/status/process_state", getActualProcessState(), 1, false);
publishMqttData(mqttServer_getMainTopic() + "/process/status/process_state", getActualProcessState(), 1, false);
#endif //ENABLE_MQTT

if (!FlowControlImage[i]->doFlow(time)) {
Expand Down Expand Up @@ -360,7 +360,7 @@ bool ClassFlowControl::doFlowPublishData(std::string time)
setActualProcessState(translateActualProcessState(FlowControlPublish[i]->name()));
LogFile.writeToFile(ESP_LOG_INFO, TAG, "Process state: " + getActualProcessState());
#ifdef ENABLE_MQTT
MQTTPublish(mqttServer_getMainTopic() + "/process/status/process_state", getActualProcessState(), 1, false);
publishMqttData(mqttServer_getMainTopic() + "/process/status/process_state", getActualProcessState(), 1, false);
#endif //ENABLE_MQTT

if (!FlowControlPublish[i]->doFlow(time)) {
Expand Down Expand Up @@ -583,7 +583,7 @@ bool ClassFlowControl::initMqttService()
return true;
}

return flowMQTT->initMqtt(cfgClassPtr->get()->sectionOperationMode.automaticProcessInterval);
return flowMQTT->initMqttService(cfgClassPtr->get()->sectionOperationMode.automaticProcessInterval);
}
#endif //ENABLE_MQTT

Expand Down
Loading

0 comments on commit 498d10a

Please sign in to comment.