From e5e118575d04e07d24fec2b1a2f6c52edf949b2f Mon Sep 17 00:00:00 2001 From: fvanroie Date: Thu, 10 Dec 2020 22:43:53 +0100 Subject: [PATCH] Small changes --- src/hasp_gpio.cpp | 5 +++-- src/hasp_mqtt.cpp | 7 +++++-- src/hasp_network.cpp | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/hasp_gpio.cpp b/src/hasp_gpio.cpp index adb5c692..85878b8a 100644 --- a/src/hasp_gpio.cpp +++ b/src/hasp_gpio.cpp @@ -21,7 +21,7 @@ static AceButton * button[HASP_NUM_INPUTS]; // An array of button pins, led pins, and the led states. Cannot be const // because ledState is mutable. hasp_gpio_config_t gpioConfig[HASP_NUM_GPIO_CONFIG] = { -// {2, 8, INPUT, LOW}, {3, 9, OUTPUT, LOW}, {4, 10, INPUT, HIGH}, {5, 11, OUTPUT, LOW}, {6, 12, INPUT, LOW}, + // {2, 8, INPUT, LOW}, {3, 9, OUTPUT, LOW}, {4, 10, INPUT, HIGH}, {5, 11, OUTPUT, LOW}, {6, 12, INPUT, LOW}, }; #if defined(ARDUINO_ARCH_ESP32) @@ -379,13 +379,14 @@ bool gpioIsSystemPin(uint8_t gpio) } // if tft_espi pins // To-do: + // Backlight GPIO // Network GPIOs // Serial GPIOs // Tasmota Slave GPIOs #ifdef ARDUINO_ARCH_ESP32 if(psramFound()) { - if((gpio >= 16) && (gpio <= 17)) return true; // PSRAM + if((gpio == 16) || (gpio == 17)) return true; // PSRAM } #endif diff --git a/src/hasp_mqtt.cpp b/src/hasp_mqtt.cpp index cc5dedb2..018f2c24 100644 --- a/src/hasp_mqtt.cpp +++ b/src/hasp_mqtt.cpp @@ -303,7 +303,7 @@ static void mqtt_message_cb(char * topic, byte * payload, unsigned int length) snprintf_P(tmp_topic, sizeof(tmp_topic), PSTR("%sstatus"), mqttNodeTopic); snprintf_P(msg, sizeof(msg), PSTR("ON")); - /*bool res =*/ mqttClient.publish(tmp_topic, msg, true); + /*bool res =*/mqttClient.publish(tmp_topic, msg, true); } } else { @@ -334,6 +334,7 @@ void mqttStart() bool mqttFirstConnect = true; mqttClient.setServer(mqttServer, 1883); + // mqttClient.setSocketTimeout(10); //in seconds /* Construct unique Client ID*/ { @@ -348,6 +349,8 @@ void mqttStart() snprintf_P(buffer, sizeof(buffer), PSTR("%sstatus"), mqttNodeTopic); // lastWillTopic snprintf_P(lastWillPayload, sizeof(lastWillPayload), PSTR("OFF")); // lastWillPayload + haspProgressMsg(F("Connecting MQTT...")); + haspProgressVal(mqttReconnectCount * 5); if(!mqttClient.connect(mqttClientId, mqttUser, mqttPassword, buffer, 2, false, lastWillPayload, true)) { // Retry until we give up and restart after connectTimeout seconds mqttReconnectCount++; @@ -388,7 +391,7 @@ void mqttStart() } Log.warning(TAG_MQTT, buffer); - if(mqttReconnectCount > 50) { + if(mqttReconnectCount > 20) { Log.error(TAG_MQTT, F("Retry count exceeded, rebooting...")); dispatch_reboot(false); } diff --git a/src/hasp_network.cpp b/src/hasp_network.cpp index 4eafd615..baaccd33 100644 --- a/src/hasp_network.cpp +++ b/src/hasp_network.cpp @@ -76,6 +76,7 @@ bool networkEverySecond(void) #if HASP_USE_WIFI > 0 // return wifiEverySecond(); #endif +return true; } #endif \ No newline at end of file