diff --git a/ueforth/Makefile b/ueforth/Makefile index d251365..11a5f7b 100644 --- a/ueforth/Makefile +++ b/ueforth/Makefile @@ -1,4 +1,4 @@ -VERSION=7.0.3 +VERSION=7.0.4 REVISION=$(shell git rev-parse HEAD) OUT = out @@ -141,10 +141,10 @@ $(GEN)/windows_boot.h: common/source_to_string.js $(WINDOWS_BOOT) | $(GEN) echo "ok" | cat $(WINDOWS_BOOT) - | $< boot $(VERSION) $(REVISION) >$@ ESP32_BOOT = common/boot.fs common/conditionals.fs common/vocabulary.fs \ - esp32/platform.fs esp32/highlevel.fs \ + common/tasks.fs esp32/platform.fs esp32/highlevel.fs \ esp32/bindings.fs common/highlevel.fs \ common/filetools.fs common/utils.fs common/locals.fs \ - common/tasks.fs common/streams.fs esp32/web_interface.fs \ + common/streams.fs esp32/web_interface.fs \ esp32/registers.fs esp32/timers.fs \ esp32/bterm.fs esp32/telnetd.fs \ esp32/camera.fs common/blocks.fs \ diff --git a/ueforth/esp32/bterm.fs b/ueforth/esp32/bterm.fs index 9669c52..57a90b5 100644 --- a/ueforth/esp32/bterm.fs +++ b/ueforth/esp32/bterm.fs @@ -10,7 +10,7 @@ esp_bt_dev_get_address hex 6 dump cr : bt-key begin bt SerialBT.available until 0 >r rp@ 1 bt SerialBT.readBytes drop r> ; : bt-on ['] bt-type is type ['] bt-key is key ; -: bt-off ['] arduino-type is type ['] arduino-key is key ; +: bt-off ['] serial-type is type ['] serial-key is key ; only forth definitions bterm 500 ms bt-on | evaluate ; diff --git a/ueforth/esp32/platform.fs b/ueforth/esp32/platform.fs index ed57aa3..9bf6920 100644 --- a/ueforth/esp32/platform.fs +++ b/ueforth/esp32/platform.fs @@ -1,14 +1,21 @@ +( Add a yielding task so pause yields ) +internals definitions +transfer{ yield raw-yield }transfer +' raw-yield 100 100 task yield-task +yield-task start-task +forth definitions + ( Set up Basic I/O ) internals definitions -: arduino-bye 0 terminate ; -' arduino-bye is bye -: arduino-type ( a n -- ) Serial.write drop ; -' arduino-type is type -: arduino-key ( -- n ) - begin Serial.available until 0 >r rp@ 1 Serial.readBytes drop r> ; -' arduino-key is key -: arduino-key? ( -- n ) Serial.available ; -' arduino-key? is key? +: esp32-bye 0 terminate ; +' esp32-bye is bye +: serial-type ( a n -- ) Serial.write drop ; +' serial-type is type +: serial-key ( -- n ) + begin pause Serial.available until 0 >r rp@ 1 Serial.readBytes drop r> ; +' serial-key is key +: serial-key? ( -- n ) Serial.available ; +' serial-key? is key? forth definitions ( Map Arduino / ESP32 things to shorter names. ) diff --git a/ueforth/esp32/telnetd.fs b/ueforth/esp32/telnetd.fs index 1011014..363ca49 100644 --- a/ueforth/esp32/telnetd.fs +++ b/ueforth/esp32/telnetd.fs @@ -25,8 +25,8 @@ defer broker : broker-connection rp0 rp! sp0 sp! begin - ['] arduino-key is key - ['] arduino-type is type + ['] serial-key is key + ['] serial-type is type -1 echo ! ." Listening on port " port . cr sockfd client client-len accept diff --git a/ueforth/esp32/template.ino b/ueforth/esp32/template.ino index 1332f66..1a4d546 100644 --- a/ueforth/esp32/template.ino +++ b/ueforth/esp32/template.ino @@ -91,7 +91,8 @@ Y(ledcWriteNote, \ tos = (cell_t) (1000000 * ledcWriteNote(n2, (note_t) n1, n0)); NIPn(2)) \ /* General System */ \ - Y(MS, delay(n0); DROP) \ + X("MS-TICKS", MS_TICKS, PUSH millis()) \ + X("RAW-YIELD", RAW_YIELD, yield()) \ Y(TERMINATE, exit(n0)) \ /* File words */ \ X("R/O", R_O, PUSH O_RDONLY) \ diff --git a/ueforth/esp32/web_interface.fs b/ueforth/esp32/web_interface.fs index 70ba354..601fa52 100644 --- a/ueforth/esp32/web_interface.fs +++ b/ueforth/esp32/web_interface.fs @@ -15,6 +15,7 @@ body { padding: 5px; background-color: #111; color: #2cf; + overflow: hidden; } #prompt { width: 100%; @@ -26,12 +27,14 @@ body { width: 100%; height: 80%; resize: none; + overflow-y: scroll; + word-break: break-all; } - -

ESP32forth v7

+ +

ESP32forth v7

Upload File:
@@ -82,7 +85,7 @@ filepick.onchange = function(event) { if (event.target.files.length > 0) { var reader = new FileReader(); reader.onload = function(e) { - var parts = e.target.result.split('\n'); + var parts = e.target.result.replace(/[\r]/g, '').split('\n'); function upload() { if (parts.length === 0) { filepick.value = ''; return; } ask(parts.shift(), upload); @@ -130,8 +133,7 @@ create out-string out-size 1+ allot align webserver @ WebServer.begin begin webserver @ WebServer.handleClient - 1 ms - yield + pause again ;