mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
esp32 fix
This commit is contained in:
@@ -6,7 +6,8 @@
|
|||||||
-DMODBUS_DISABLE
|
-DMODBUS_DISABLE
|
||||||
#-DMBUS_DISABLE
|
#-DMBUS_DISABLE
|
||||||
-DCOUNTER_DISABLE
|
-DCOUNTER_DISABLE
|
||||||
#-DSYSLOG_ENABLE - udp errors
|
-DSYSLOG_ENABLE
|
||||||
|
# - udp errors
|
||||||
-DOTA
|
-DOTA
|
||||||
-DMCP23017
|
-DMCP23017
|
||||||
-DMODBUS_TX_PIN=13
|
-DMODBUS_TX_PIN=13
|
||||||
|
|||||||
Binary file not shown.
@@ -259,6 +259,12 @@ bool isNotRetainingStatus() {
|
|||||||
return (lanStatus != RETAINING_COLLECTING);
|
return (lanStatus != RETAINING_COLLECTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int httpHandler(Client& client, String request, long contentLength)
|
||||||
|
{
|
||||||
|
debugSerial<<request<<endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void mqttCallback(char *topic, byte *payload, unsigned int length) {
|
void mqttCallback(char *topic, byte *payload, unsigned int length) {
|
||||||
debugSerial<<F("\n[")<<topic<<F("] ");
|
debugSerial<<F("\n[")<<topic<<F("] ");
|
||||||
if (!payload) return;
|
if (!payload) return;
|
||||||
@@ -384,15 +390,17 @@ if (element && element->type == aJson_String) return element->valuestring;
|
|||||||
{
|
{
|
||||||
|
|
||||||
ArduinoOTA.begin(Ethernet.localIP(), "Lighthub", "password", InternalStorage);
|
ArduinoOTA.begin(Ethernet.localIP(), "Lighthub", "password", InternalStorage);
|
||||||
|
ArduinoOTA.setCustomHandler(httpHandler);
|
||||||
infoSerial<<F("OTA initialized\n");
|
infoSerial<<F("OTA initialized\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
#elif defined (ARDUINO_ARCH_AVR)
|
#elif defined (ARDUINO_ARCH_AVR)
|
||||||
InternalStorageAVRClass flashStorage;
|
InternalStorageAVRClass flashStorage(EEPROM_offsetJSON);
|
||||||
void setupOTA(void)
|
void setupOTA(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
ArduinoOTA.begin(Ethernet.localIP(), "Lighthub", "password", flashStorage);
|
ArduinoOTA.begin(Ethernet.localIP(), "Lighthub", "password", flashStorage);
|
||||||
|
ArduinoOTA.setCustomHandler(httpHandler);
|
||||||
infoSerial<<F("OTA initialized\n");
|
infoSerial<<F("OTA initialized\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -402,6 +410,7 @@ if (element && element->type == aJson_String) return element->valuestring;
|
|||||||
{
|
{
|
||||||
|
|
||||||
ArduinoOTA.begin(Ethernet.localIP(), "Lighthub", "password", flashStorage);
|
ArduinoOTA.begin(Ethernet.localIP(), "Lighthub", "password", flashStorage);
|
||||||
|
ArduinoOTA.setCustomHandler(httpHandler);
|
||||||
infoSerial<<F("OTA initialized\n");
|
infoSerial<<F("OTA initialized\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -756,6 +765,9 @@ void ip_ready_config_loaded_connecting_to_broker() {
|
|||||||
|
|
||||||
deviceName = getStringFromConfig(mqttArr, 0);
|
deviceName = getStringFromConfig(mqttArr, 0);
|
||||||
infoSerial<<F("Device Name:")<<deviceName<<endl;
|
infoSerial<<F("Device Name:")<<deviceName<<endl;
|
||||||
|
#ifdef OTA
|
||||||
|
ArduinoOTA.setDeviceName(deviceName);
|
||||||
|
#endif
|
||||||
//debugSerial<<F("N:")<<n<<endl;
|
//debugSerial<<F("N:")<<n<<endl;
|
||||||
|
|
||||||
char *servername = getStringFromConfig(mqttArr, 1);
|
char *servername = getStringFromConfig(mqttArr, 1);
|
||||||
@@ -1541,11 +1553,12 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
|
|||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) //|| defined (NRF5)
|
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) //|| defined (NRF5)
|
||||||
HTTPClient httpClient;
|
HTTPClient httpClient;
|
||||||
WiFiClient wifiClient;
|
// WiFiClient wifiClient;
|
||||||
String fullURI = "http://";
|
String fullURI = "http://";
|
||||||
fullURI+=configServer;
|
fullURI+=configServer;
|
||||||
fullURI+=URI;
|
fullURI+=URI;
|
||||||
httpClient.begin(wifiClient,fullURI);
|
//httpClient.begin(wifiClient,fullURI);
|
||||||
|
httpClient.begin(fullURI);
|
||||||
int httpResponseCode = httpClient.GET();
|
int httpResponseCode = httpClient.GET();
|
||||||
if (httpResponseCode > 0) {
|
if (httpResponseCode > 0) {
|
||||||
infoSerial.printf("[HTTP] GET... code: %d\n", httpResponseCode);
|
infoSerial.printf("[HTTP] GET... code: %d\n", httpResponseCode);
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ int out_UARTbridge::Poll(short cause)
|
|||||||
uint8_t chA;
|
uint8_t chA;
|
||||||
uint8_t chB;
|
uint8_t chB;
|
||||||
|
|
||||||
while (MODULE_UATRBRIDGE_UARTA.available() || MODULE_UATRBRIDGE_UARTB.available())
|
// while (MODULE_UATRBRIDGE_UARTA.available() || MODULE_UATRBRIDGE_UARTB.available())
|
||||||
{
|
{
|
||||||
|
|
||||||
if (MODULE_UATRBRIDGE_UARTA.available())
|
if (MODULE_UATRBRIDGE_UARTA.available())
|
||||||
|
|||||||
Reference in New Issue
Block a user