Multiple fixes.
Switched in KEY and MS which yield to PAUSE on esp32. Added a background task which yield using yield() in place of the event loop. Made some formatting and carriage return handling changes to the web ui.
This commit is contained in:
@ -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 \
|
||||
|
||||
@ -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 ;
|
||||
|
||||
@ -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. )
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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) \
|
||||
|
||||
@ -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;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<h2>ESP32forth v7</h2>
|
||||
<link rel="icon" href="data:,">
|
||||
</head>
|
||||
<body>
|
||||
<h2>ESP32forth v7</h2>
|
||||
Upload File: <input id="filepick" type="file" name="files[]"></input><br/>
|
||||
<button onclick="ask('hex')">hex</button>
|
||||
<button onclick="ask('decimal')">decimal</button>
|
||||
@ -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
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user