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)
|
REVISION=$(shell git rev-parse HEAD)
|
||||||
|
|
||||||
OUT = out
|
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) >$@
|
echo "ok" | cat $(WINDOWS_BOOT) - | $< boot $(VERSION) $(REVISION) >$@
|
||||||
|
|
||||||
ESP32_BOOT = common/boot.fs common/conditionals.fs common/vocabulary.fs \
|
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 \
|
esp32/bindings.fs common/highlevel.fs \
|
||||||
common/filetools.fs common/utils.fs common/locals.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/registers.fs esp32/timers.fs \
|
||||||
esp32/bterm.fs esp32/telnetd.fs \
|
esp32/bterm.fs esp32/telnetd.fs \
|
||||||
esp32/camera.fs common/blocks.fs \
|
esp32/camera.fs common/blocks.fs \
|
||||||
|
|||||||
@ -10,7 +10,7 @@ esp_bt_dev_get_address hex 6 dump cr
|
|||||||
: bt-key
|
: bt-key
|
||||||
begin bt SerialBT.available until 0 >r rp@ 1 bt SerialBT.readBytes drop r> ;
|
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-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
|
only forth definitions
|
||||||
bterm 500 ms bt-on
|
bterm 500 ms bt-on
|
||||||
| evaluate ;
|
| 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 )
|
( Set up Basic I/O )
|
||||||
internals definitions
|
internals definitions
|
||||||
: arduino-bye 0 terminate ;
|
: esp32-bye 0 terminate ;
|
||||||
' arduino-bye is bye
|
' esp32-bye is bye
|
||||||
: arduino-type ( a n -- ) Serial.write drop ;
|
: serial-type ( a n -- ) Serial.write drop ;
|
||||||
' arduino-type is type
|
' serial-type is type
|
||||||
: arduino-key ( -- n )
|
: serial-key ( -- n )
|
||||||
begin Serial.available until 0 >r rp@ 1 Serial.readBytes drop r> ;
|
begin pause Serial.available until 0 >r rp@ 1 Serial.readBytes drop r> ;
|
||||||
' arduino-key is key
|
' serial-key is key
|
||||||
: arduino-key? ( -- n ) Serial.available ;
|
: serial-key? ( -- n ) Serial.available ;
|
||||||
' arduino-key? is key?
|
' serial-key? is key?
|
||||||
forth definitions
|
forth definitions
|
||||||
|
|
||||||
( Map Arduino / ESP32 things to shorter names. )
|
( Map Arduino / ESP32 things to shorter names. )
|
||||||
|
|||||||
@ -25,8 +25,8 @@ defer broker
|
|||||||
: broker-connection
|
: broker-connection
|
||||||
rp0 rp! sp0 sp!
|
rp0 rp! sp0 sp!
|
||||||
begin
|
begin
|
||||||
['] arduino-key is key
|
['] serial-key is key
|
||||||
['] arduino-type is type
|
['] serial-type is type
|
||||||
-1 echo !
|
-1 echo !
|
||||||
." Listening on port " port . cr
|
." Listening on port " port . cr
|
||||||
sockfd client client-len accept
|
sockfd client client-len accept
|
||||||
|
|||||||
@ -91,7 +91,8 @@
|
|||||||
Y(ledcWriteNote, \
|
Y(ledcWriteNote, \
|
||||||
tos = (cell_t) (1000000 * ledcWriteNote(n2, (note_t) n1, n0)); NIPn(2)) \
|
tos = (cell_t) (1000000 * ledcWriteNote(n2, (note_t) n1, n0)); NIPn(2)) \
|
||||||
/* General System */ \
|
/* General System */ \
|
||||||
Y(MS, delay(n0); DROP) \
|
X("MS-TICKS", MS_TICKS, PUSH millis()) \
|
||||||
|
X("RAW-YIELD", RAW_YIELD, yield()) \
|
||||||
Y(TERMINATE, exit(n0)) \
|
Y(TERMINATE, exit(n0)) \
|
||||||
/* File words */ \
|
/* File words */ \
|
||||||
X("R/O", R_O, PUSH O_RDONLY) \
|
X("R/O", R_O, PUSH O_RDONLY) \
|
||||||
|
|||||||
@ -15,6 +15,7 @@ body {
|
|||||||
padding: 5px;
|
padding: 5px;
|
||||||
background-color: #111;
|
background-color: #111;
|
||||||
color: #2cf;
|
color: #2cf;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
#prompt {
|
#prompt {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -26,12 +27,14 @@ body {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 80%;
|
height: 80%;
|
||||||
resize: none;
|
resize: none;
|
||||||
|
overflow-y: scroll;
|
||||||
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
|
||||||
<h2>ESP32forth v7</h2>
|
|
||||||
<link rel="icon" href="data:,">
|
<link rel="icon" href="data:,">
|
||||||
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<h2>ESP32forth v7</h2>
|
||||||
Upload File: <input id="filepick" type="file" name="files[]"></input><br/>
|
Upload File: <input id="filepick" type="file" name="files[]"></input><br/>
|
||||||
<button onclick="ask('hex')">hex</button>
|
<button onclick="ask('hex')">hex</button>
|
||||||
<button onclick="ask('decimal')">decimal</button>
|
<button onclick="ask('decimal')">decimal</button>
|
||||||
@ -82,7 +85,7 @@ filepick.onchange = function(event) {
|
|||||||
if (event.target.files.length > 0) {
|
if (event.target.files.length > 0) {
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onload = function(e) {
|
reader.onload = function(e) {
|
||||||
var parts = e.target.result.split('\n');
|
var parts = e.target.result.replace(/[\r]/g, '').split('\n');
|
||||||
function upload() {
|
function upload() {
|
||||||
if (parts.length === 0) { filepick.value = ''; return; }
|
if (parts.length === 0) { filepick.value = ''; return; }
|
||||||
ask(parts.shift(), upload);
|
ask(parts.shift(), upload);
|
||||||
@ -130,8 +133,7 @@ create out-string out-size 1+ allot align
|
|||||||
webserver @ WebServer.begin
|
webserver @ WebServer.begin
|
||||||
begin
|
begin
|
||||||
webserver @ WebServer.handleClient
|
webserver @ WebServer.handleClient
|
||||||
1 ms
|
pause
|
||||||
yield
|
|
||||||
again
|
again
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user