Skip to content

Commit

Permalink
From AirCoookie to esphome ESPAsyncWebServer.git
Browse files Browse the repository at this point in the history
showtest1/2.sc : rename show functions

pio.ini
- change to MoonModules/ESPAsyncWebServer.git @ 3.2.2 - MM adds queueLength only (WIP)
- update to latest arduinojson

UserModLive: rename show functions
  • Loading branch information
ewoudwijma committed Jul 2, 2024
1 parent a372d80 commit c3141e7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
4 changes: 2 additions & 2 deletions misc/showtest1.sc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
external void show1();
external void show();

void main()
{
Expand All @@ -8,7 +8,7 @@ void main()
for(int i=0;i<10;i++)
{
}
show1();
show();
h++;
}
}
4 changes: 2 additions & 2 deletions misc/showtest2.sc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
external void show2();
external void showM();

void main()
{
Expand All @@ -8,7 +8,7 @@ void main()
for(int i=0;i<10;i++)
{
}
show2();
showM();
h++;
}
}
18 changes: 11 additions & 7 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@

[ESPAsyncWebServer]
build_flags =
-D CONFIG_ASYNC_TCP_USE_WDT=0 ;why? tbd: experiment without
-D WS_MAX_QUEUED_MESSAGES=64
-D CONFIG_ASYNC_TCP_RUNNING_CORE=1 ;tbd experiment without
lib_deps =
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 ; WLEDMM this must be first in the list, otherwise Aircoookie/ESPAsyncWebServer pulls in an older version of AsyncTCP !!
https://github.com/ewoudwijma/ESPAsyncWebServer.git ;aircoookie + getClients + 64
; https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 ; WLEDMM this must be first in the list, otherwise Aircoookie/ESPAsyncWebServer pulls in an older version of AsyncTCP !!
; https://github.com/ewoudwijma/ESPAsyncWebServer.git#v2.0.7
; https://github.com/aircoookie/ESPAsyncWebServer.git @ 2.2.1
; https://github.com/ewowi/ESPAsyncWebServer.git ;me-no-dev + 64 + queueLength - alternative
; https://github.com/lost-hope/ESPAsyncWebServer.git#master ;artifx on <ip>/edit

; https://github.com/esphome/ESPAsyncWebServer.git @ 3.2.2
https://github.com/MoonModules/ESPAsyncWebServer.git @ 3.2.2 ; + queueLength


;Work in progress - not compiling yet
Expand Down Expand Up @@ -60,17 +65,16 @@ build_flags =
-D APP=StarBase
-D PIOENV=$PIOENV
-D VERSION=24062015 ; Date and time (GMT!), update at every commit!!
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D LFS_THREADSAFE ; enables use of semaphores in LittleFS driver
-D STARBASE_DEVMODE
${ESPAsyncWebServer.build_flags}
${ESPAsyncWebServer.build_flags} ;alternatively PsychicHttp
${STARBASE_USERMOD_E131.build_flags}
${STARBASE_USERMOD_MPU6050.build_flags}
; ${STARBASE_USERMOD_HA.build_flags}
; ${STARBASE_USERMOD_LIVE.build_flags}
lib_deps =
${ESPAsyncWebServer.lib_deps}
https://github.com/bblanchon/ArduinoJson.git#v7.0.3
${ESPAsyncWebServer.lib_deps} ;alternatively PsychicHttp
https://github.com/bblanchon/ArduinoJson.git @ 7.1.0 ;#v7.0.3
; https://github.com/Jason2866/ESP32_Show_Info.git
${STARBASE_USERMOD_E131.lib_deps}
${STARBASE_USERMOD_MPU6050.lib_deps}
Expand Down
4 changes: 2 additions & 2 deletions src/Sys/SysModSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ void SysModSystem::setup() {
default: return false;
}});

ui->initProgress(parentVar, "tcpStack", sysTools_get_webserver_maxStackUsage(), 0, CONFIG_ASYNC_TCP_TASK_STACK_SIZE, true, [this](JsonObject var, unsigned8 rowNr, unsigned8 funType) { switch (funType) { //varFun
ui->initProgress(parentVar, "tcpStack", sysTools_get_webserver_maxStackUsage(), 0, CONFIG_ASYNC_TCP_STACK_SIZE, true, [this](JsonObject var, unsigned8 rowNr, unsigned8 funType) { switch (funType) { //varFun
case onUI:
ui->setLabel(var, "TCP stack");
return true;
case onChange:
web->addResponseV(var["id"], "comment", "%d of %d B", sysTools_get_webserver_maxStackUsage(), CONFIG_ASYNC_TCP_TASK_STACK_SIZE);
web->addResponseV(var["id"], "comment", "%d of %d B", sysTools_get_webserver_maxStackUsage(), CONFIG_ASYNC_TCP_STACK_SIZE);
return true;
default: return false;
}});
Expand Down
2 changes: 1 addition & 1 deletion src/Sys/SysModWeb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ void SysModWeb::sendDataWs(std::function<void(AsyncWebSocketMessageBuffer *)> fi
for (auto loopClient:ws.getClients()) {
if (!client || client == loopClient) {
if (loopClient->status() == WS_CONNECTED && !loopClient->queueIsFull()) { //WS_MAX_QUEUED_MESSAGES / ws.count() / 2)) { //binary is lossy
if ((!isBinary || loopClient->queueLength() <= 3)) {
if (!isBinary || loopClient->queueLength() <= 3) {
isBinary?loopClient->binary(wsBuf): loopClient->text(wsBuf);
sendWsCounter++;
if (isBinary)
Expand Down
8 changes: 4 additions & 4 deletions src/User/UserModLive.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static float _totfps;
static float fps = 0; //integer?
static unsigned long frameCounter = 0;

static void show1()
static void show()
{
// SKIPPED: check nargs (must be 3 because arg[0] is self)
long time2 = ESP.getCycleCount();
Expand Down Expand Up @@ -117,13 +117,13 @@ class UserModLive:public SysModule {

// ui->initButton

addExternal("show1", externalType::function, (void *)&show1);
addExternal("show2", externalType::function, (void *)&UserModLive::show2); // warning: converting from 'void (UserModLive::*)()' to 'void*' [-Wpmf-conversions]
addExternal("show", externalType::function, (void *)&show);
addExternal("showM", externalType::function, (void *)&UserModLive::showM); // warning: converting from 'void (UserModLive::*)()' to 'void*' [-Wpmf-conversions]

}

//testing class functions instead of static
void show2() {
void showM() {
long time2 = ESP.getCycleCount();
// driver.showPixels(WAIT);
frameCounter++;
Expand Down

0 comments on commit c3141e7

Please sign in to comment.