mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-17 08:16:34 +00:00
Small changes
This commit is contained in:
parent
1a435fd094
commit
e5e118575d
@ -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
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ bool networkEverySecond(void)
|
||||
#if HASP_USE_WIFI > 0
|
||||
// return wifiEverySecond();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user