diff --git a/misc/blink.sc b/misc/blink.sc new file mode 100644 index 00000000..120b6271 --- /dev/null +++ b/misc/blink.sc @@ -0,0 +1,37 @@ +external void show(); +external void pinMode(uint8_t pin, uint8_t mode); +external void digitalWrite(uint8_t pin, uint8_t val); +external void delay(uint32_t ms); +//external void pinsM->allocatePin(unsigned8 pinNr, const char * owner, const char * details); //classes supported? + +//how to deal with external defines? +define OUTPUT 0x03 +define LOW 0x0 +define HIGH 0x1 + +uint8_t blinkPin; //tbd: assigment here + +void setup() +{ + blinkPin = 5; //tbd make blinkPin an ui control + + //pinsM->allocatePin(2, "Blink", "On board led"); //class methods and strings supported? + pinMode(blinkPin, OUTPUT); //tbd: part of allocatePin? +} + +void loop() { + digitalWrite(blinkPin, HIGH); // turn the LED on (HIGH is the voltage level) + delay(1000); // wait for a second + digitalWrite(blinkPin, LOW); // turn the LED off by making the voltage LOW + delay(1000); // wait for a second +} + +void main() +{ + setup(); + while (0==0) + { + loop(); + show(); + } +} \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index f3050d00..faa4cdbf 100644 --- a/platformio.ini +++ b/platformio.ini @@ -8,21 +8,29 @@ ; @license For non GPL-v3 usage, commercial licenses must be purchased. Contact moonmodules@icloud.com - +; ESPAsyncWebServer ESPHome version [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 + ;-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE ; 8192*2 here as default !!! 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#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 /edit - ; https://github.com/esphome/ESPAsyncWebServer.git @ 3.2.2 https://github.com/MoonModules/ESPAsyncWebServer.git @ 3.2.2 ; + queueLength +; ESPAsyncWebServer AirCoookie v2.0.7 version (2.2.1 is latest) +; [ESPAsyncWebServer] +; build_flags = +; -D CONFIG_ASYNC_TCP_USE_WDT=0 ;why? tbd: experiment without +; ; -D WS_MAX_QUEUED_MESSAGES=64 ;not supported to set here in AirCoookie version +; -D CONFIG_ASYNC_TCP_STACK_SIZE=CONFIG_ASYNC_TCP_TASK_STACK_SIZE ; ESPHome uses CONFIG_ASYNC_TCP_STACK_SIZE (used in SysModSystem) +; lib_deps = +; ; https://github.com/lost-hope/ESPAsyncWebServer.git#master ;aircoookie + artifx on /edit +; ; https://github.com/ewowi/ESPAsyncWebServer.git ;me-no-dev + 64 + queueLength - alternative +; 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 ;aircoookie + getClients + 64 +; ; https://github.com/ewoudwijma/ESPAsyncWebServer.git#v2.2.1 ;crashes on ws refererence in sendDataWs !! + ;Work in progress - not compiling yet [PsychicHttp] @@ -57,14 +65,14 @@ lib_deps = build_flags = -D STARBASE_USERMOD_LIVE lib_deps = - https://github.com/hpwit/ASMParser.git + https://github.com/hpwit/ASMParser.git#memory ; about 1% / 19KB flash [STARBASE] build_flags = ; -D APP=StarBase -D PIOENV=$PIOENV - -D VERSION=24062015 ; Date and time (GMT!), update at every commit!! + -D VERSION=24070509 ; Date and time (GMT!), update at every commit!! -D LFS_THREADSAFE ; enables use of semaphores in LittleFS driver -D STARBASE_DEVMODE ${ESPAsyncWebServer.build_flags} ;alternatively PsychicHttp diff --git a/src/User/UserModLive.h b/src/User/UserModLive.h index ac883da4..6a68fd6e 100644 --- a/src/User/UserModLive.h +++ b/src/User/UserModLive.h @@ -45,6 +45,7 @@ static void show() // RETURN_VALUE(VALUE_FROM_INT(0), rindex); } + class UserModLive:public SysModule { public: @@ -120,6 +121,10 @@ class UserModLive:public SysModule { addExternal("show", externalType::function, (void *)&show); addExternal("showM", externalType::function, (void *)&UserModLive::showM); // warning: converting from 'void (UserModLive::*)()' to 'void*' [-Wpmf-conversions] + addExternal("pinMode", externalType::function, (void *)&pinMode); + addExternal("digitalWrite", externalType::function, (void *)&digitalWrite); + addExternal("delay", externalType::function, (void *)&delay); + } //testing class functions instead of static