patch to avoid connection breaks because slow tcp processing
This commit is contained in:
parent
dc024a7e37
commit
c5c0daf5e9
3
HCPBridge/extra_script.py
Normal file
3
HCPBridge/extra_script.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from distutils import dir_util
|
||||||
|
Import("env")
|
||||||
|
dir_util.copy_tree("patch",".")
|
@ -15,3 +15,4 @@ framework = arduino
|
|||||||
lib_deps =
|
lib_deps =
|
||||||
ottowinter/ESPAsyncWebServer-esphome@^1.2.7
|
ottowinter/ESPAsyncWebServer-esphome@^1.2.7
|
||||||
bblanchon/ArduinoJson@^6.17.2
|
bblanchon/ArduinoJson@^6.17.2
|
||||||
|
extra_scripts = pre:extra_script.py
|
||||||
|
@ -34,6 +34,10 @@ HCIEmulator emulator(&RS485);
|
|||||||
// webserver on port 80
|
// webserver on port 80
|
||||||
AsyncWebServer server(80);
|
AsyncWebServer server(80);
|
||||||
|
|
||||||
|
// called by ESPAsyncTCP-esphome:SyncClient.cpp (see patch) instead of delay to avoid connection breaks
|
||||||
|
void DelayHandler(void){
|
||||||
|
emulator.poll();
|
||||||
|
}
|
||||||
|
|
||||||
// switch GPIO4 und GPIO2 sync to the lamp
|
// switch GPIO4 und GPIO2 sync to the lamp
|
||||||
void onStatusChanged(const SHCIState& state){
|
void onStatusChanged(const SHCIState& state){
|
||||||
@ -57,6 +61,8 @@ void switchLamp(bool on){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// setup mcu
|
// setup mcu
|
||||||
void setup(){
|
void setup(){
|
||||||
|
|
||||||
@ -71,7 +77,7 @@ void setup(){
|
|||||||
WiFi.begin(ssid, password);
|
WiFi.begin(ssid, password);
|
||||||
WiFi.setAutoReconnect(true);
|
WiFi.setAutoReconnect(true);
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
emulator.poll();
|
emulator.poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup http server
|
// setup http server
|
||||||
@ -158,6 +164,6 @@ void setup(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// mainloop
|
// mainloop
|
||||||
void loop(){
|
void loop(){
|
||||||
emulator.poll();
|
emulator.poll();
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user