-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Live script: loopState + create and delete file triggers
SysModFiles: FilesTbl.onDelete: trigger Live scripts to delete file SysModWeb: serveUpload: trigger Live scripts to run file UserModLive: - add loopState and use in loop() - add functions triangle, time, sliders, millis - script.onChange set lastFileUpdated instead of run - loop20ms: kill if lastFileUpdated contains from onDelete - run: force by default - script: add main code to file
- Loading branch information
1 parent
0886757
commit bef8479
Showing
11 changed files
with
646 additions
and
627 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,10 +171,11 @@ lib_deps = | |
[env:lolin_s2_mini] | ||
board = lolin_s2_mini ;https://github.com/platformio/platform-espressif32/blob/develop/boards/lolin_s2_mini.json | ||
; platform = [email protected] ; WLED default framework version | ||
platform = [email protected] ; this one behaves better for debugging | ||
platform = [email protected] ; this one behaves better for debugging 6.5.0 is latest | ||
upload_speed = 256000 | ||
build_flags = | ||
${env.build_flags} | ||
-mtext-section-literals ;otherwise [UserModLive::setup()]+0xa17): dangerous relocation: l32r: literal target out of range (try using text-section-literals) | ||
; -DARDUINO_ARCH_ESP32 ; no proof of necessity yet... | ||
-D CONFIG_IDF_TARGET_ESP32S2=1 | ||
-D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_DFU_ON_BOOT=1 -D ARDUINO_USB_MSC_ON_BOOT=0 ; for debugging over USB | ||
|
@@ -185,6 +186,8 @@ build_flags = | |
lib_deps = | ||
${env.lib_deps} | ||
|
||
; using framework-arduinoespressif32 @ 3.20009.0 (2.0.9) | ||
|
||
; attention! : manual action needed to select CLedDriver | ||
; uncomment last 4 lines in the env description | ||
; comment the following lines in the CLD-S3 repo (workaround), otherwise compile error: | ||
|
@@ -194,7 +197,7 @@ lib_deps = | |
; [env:lolin_c3_mini] | ||
; board = lolin_c3_mini ;https://github.com/platformio/platform-espressif32/blob/develop/boards/lolin_c3_mini.json | ||
; ; platform = [email protected] ; WLED default framework version | ||
; platform = [email protected] ; this one behaves better for debugging | ||
; platform = [email protected] ; this one behaves better for debugging 6.5.0 is latest | ||
; upload_speed = 256000 | ||
; build_unflags = | ||
; ${env.build_unflags} | ||
|
@@ -216,7 +219,7 @@ lib_deps = | |
; for Waveshare ESP32-S3 Mini/Zero https://www.waveshare.com/esp32-s3-zero.htm | ||
; --> 4MB Flash, has PSRAM, memory type "qio_qspi", USB-CDC only | ||
[env:lolin_s3_mini] | ||
platform = [email protected] ; this one behaves better for debugging | ||
platform = [email protected] ; this one behaves better for debugging 6.5.0 is latest | ||
board = lolin_s3_mini ;https://github.com/platformio/platform-espressif32/blob/develop/boards/lolin_s3_mini.json | ||
build_flags = | ||
${env.build_flags} | ||
|
@@ -249,7 +252,7 @@ lib_deps = | |
; https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html | ||
; https://github.com/platformio/platform-espressif32/blob/develop/boards/esp32-s3-devkitc-1.json | ||
[env:esp32-s3-devkitc-1-n16r8v] | ||
platform = espressif32 ;default is Espressif 32 (6.5.0) | ||
platform = espressif32@6.5.0 ;default is Espressif 32 (6.5.0) | ||
; WLEDMM: espressif32@ ~6.3.2 | ||
; TroyHacks: platformio/espressif32@^6.7.0 | ||
; platform_packages ;default is framework-arduinoespressif32 @ 3.20014.231204 (2.0.14) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,9 +222,9 @@ void SysModWeb::connectedChanged() { | |
|
||
server.addHandler(new AsyncCallbackJsonWebHandler("/json", [this](WebRequest *request, JsonVariant &json){jsonHandler(request, json);})); | ||
|
||
server.on("/update", HTTP_POST, [](WebRequest *) {}, [this](WebRequest *request, const String& filename, size_t index, byte *data, size_t len, bool final) {serveUpdate(request, filename, index, data, len, final);}); | ||
server.on("/update", HTTP_POST, [](WebRequest *) {}, [this](WebRequest *request, const String& fileName, size_t index, byte *data, size_t len, bool final) {serveUpdate(request, fileName, index, data, len, final);}); | ||
server.on("/file", HTTP_GET, [this](WebRequest *request) {serveFiles(request);}); | ||
server.on("/upload", HTTP_POST, [](WebRequest *) {}, [this](WebRequest *request, const String& filename, size_t index, byte *data, size_t len, bool final) {serveUpload(request, filename, index, data, len, final);}); | ||
server.on("/upload", HTTP_POST, [](WebRequest *) {}, [this](WebRequest *request, const String& fileName, size_t index, byte *data, size_t len, bool final) {serveUpload(request, fileName, index, data, len, final);}); | ||
|
||
server.onNotFound([this](AsyncWebServerRequest *request) { | ||
ppf("Not-Found HTTP call: URI: %s\n", request->url().c_str()); ///hotspot-detect.html | ||
|
@@ -491,16 +491,16 @@ void SysModWeb::serveNewUI(WebRequest *request) { | |
ppf("!\n"); | ||
} | ||
|
||
void SysModWeb::serveUpload(WebRequest *request, const String& filename, size_t index, byte *data, size_t len, bool final) { | ||
void SysModWeb::serveUpload(WebRequest *request, const String& fileName, size_t index, byte *data, size_t len, bool final) { | ||
|
||
// curl -F '[email protected]' 192.168.8.213/upload | ||
ppf("serveUpload r:%s f:%s i:%d l:%d f:%d\n", request->url().c_str(), filename.c_str(), index, len, final); | ||
ppf("serveUpload r:%s f:%s i:%d l:%d f:%d\n", request->url().c_str(), fileName.c_str(), index, len, final); | ||
|
||
mdl->setValue("upload", index/10000); | ||
sendResponseObject(); //otherwise not send in asyn_tcp thread | ||
|
||
if (!index) { | ||
String finalname = filename; | ||
String finalname = fileName; | ||
if (finalname.charAt(0) != '/') { | ||
finalname = '/' + finalname; // prepend slash if missing | ||
} | ||
|
@@ -526,7 +526,10 @@ void SysModWeb::serveUpload(WebRequest *request, const String& filename, size_t | |
//if sc files send command to live | ||
#ifdef STARBASE_USERMOD_LIVE | ||
|
||
strcpy(lastFileUpdated, filename.c_str()); //workaround | ||
if (fileName.indexOf(".sc") > 0) { | ||
ppf("sc file added %s\n", fileName.c_str()); | ||
strcpy(lastFileUpdated, ("/"+fileName).c_str()); //workaround | ||
} | ||
|
||
// got multiple definition error here ??? | ||
// if (filename.indexOf(".sc") > 0) | ||
|
@@ -535,10 +538,10 @@ void SysModWeb::serveUpload(WebRequest *request, const String& filename, size_t | |
} | ||
} | ||
|
||
void SysModWeb::serveUpdate(WebRequest *request, const String& filename, size_t index, byte *data, size_t len, bool final) { | ||
void SysModWeb::serveUpdate(WebRequest *request, const String& fileName, size_t index, byte *data, size_t len, bool final) { | ||
|
||
// curl -F '[email protected]' 192.168.8.213/upload | ||
// ppf("serveUpdate r:%s f:%s i:%d l:%d f:%d\n", request->url().c_str(), filename.c_str(), index, len, final); | ||
// ppf("serveUpdate r:%s f:%s i:%d l:%d f:%d\n", request->url().c_str(), fileName.c_str(), index, len, final); | ||
|
||
mdl->setValue("update", index/10000); | ||
sendResponseObject(); //otherwise not send in asyn_tcp thread | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,9 +87,9 @@ class SysModWeb:public SysModule { | |
|
||
|
||
// curl -F '[email protected]' 192.168.8.213/upload | ||
void serveUpload(WebRequest *request, const String& filename, size_t index, byte *data, size_t len, bool final); | ||
void serveUpload(WebRequest *request, const String& fileName, size_t index, byte *data, size_t len, bool final); | ||
// curl -s -F "update=@/Users/ewoudwijma/Developer/GitHub/ewowi/StarBase/.pio/build/esp32dev/firmware.bin" 192.168.8.102/update /dev/null & | ||
void serveUpdate(WebRequest *request, const String& filename, size_t index, byte *data, size_t len, bool final); | ||
void serveUpdate(WebRequest *request, const String& fileName, size_t index, byte *data, size_t len, bool final); | ||
void serveFiles(WebRequest *request); | ||
|
||
//processJsonUrl handles requests send in javascript using fetch and from a browser or curl | ||
|
Oops, something went wrong.