Skip to content

Commit

Permalink
SysModWeb: serveUpload
Browse files Browse the repository at this point in the history
- if upload succes set lastFileUpdated

UserModLive: loop20ms
- if lastFileUpdated constains .sc run file
  • Loading branch information
ewoudwijma committed Jul 11, 2024
1 parent a88675c commit e0cdeb1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Sys/SysModWeb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "SysModPins.h"

#include "User/UserModMDNS.h"
// got multiple definition error here ??? see workaround below
// #ifdef STARBASE_USERMOD_LIVE
// #include "../User/UserModLive.h"
// #endif
Expand Down Expand Up @@ -505,10 +506,14 @@ void SysModWeb::serveUpload(WebRequest *request, const String& filename, size_t
files->filesChanged = true;

//if sc files send command to live
// #ifdef STARBASE_USERMOD_LIVE
// if (filename.indexOf(".sc") > 0)
// liveM->run(filename.c_str());
// #endif
#ifdef STARBASE_USERMOD_LIVE

strcpy(lastFileUpdated, filename.c_str()); //workaround

// got multiple definition error here ???
// if (filename.indexOf(".sc") > 0)
// liveM->run(filename.c_str());
#endif
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/Sys/SysModWeb.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ class SysModWeb:public SysModule {
unsigned8 recvUDPCounter = 0;
unsigned16 recvUDPBytes = 0;

#ifdef STARBASE_USERMOD_LIVE
char lastFileUpdated[30] = ""; //workaround!
#endif

SysModWeb();

void setup();
Expand Down
8 changes: 8 additions & 0 deletions src/User/UserModLive.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ class UserModLive:public SysModule {
time1 = ESP.getCycleCount();
}

void loop20ms() {
//workaround
if (strstr(web->lastFileUpdated, ".sc") != nullptr) {
run(web->lastFileUpdated);
strcpy(web->lastFileUpdated, "");
}
}

void loop1s() {
mdl->setUIValueV("fps1", "%.0f /s", fps);
mdl->setUIValueV("fps2", "%d /s", frameCounter);
Expand Down

0 comments on commit e0cdeb1

Please sign in to comment.