diff --git a/Makefile b/Makefile index 6dd1e9f..1a0d46f 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION=7.0.7.2 +VERSION=7.0.7.3 STABLE_VERSION=7.0.6.19 OLD_STABLE_VERSION=7.0.5.4 REVISION=$(shell git rev-parse HEAD | head -c 20) diff --git a/common/utils.fs b/common/utils.fs index cfdcf57..b68336b 100644 --- a/common/utils.fs +++ b/common/utils.fs @@ -28,6 +28,11 @@ internals definitions ( Print address line leaving room ) : dump-line ( a -- a ) cr <# #s #> 20 over - >r type r> spaces ; +( Semi-dangerous word to trim down the system heap ) +DEFINED? realloc [IF] +: relinquish ( n -- ) negate 'heap-size +! 'heap-start @ 'heap-size @ realloc drop ; +[THEN] + forth definitions internals ( Examine Memory ) diff --git a/esp32/bterm.fs b/esp32/bterm.fs index 721e5f4..befd9c1 100644 --- a/esp32/bterm.fs +++ b/esp32/bterm.fs @@ -15,15 +15,22 @@ ( Lazy loaded Bluetooth Serial Terminal ) : bterm r| vocabulary bterm bterm definitions -also bluetooth also internals +also bluetooth also internals also esp +120000 getFreeHeap - 0 max relinquish ( must have 110k for bluetooth ) +z" forth xx:xx:xx:xx:xx:xx" constant name +( Create unique name for device ) +base @ hex getEfuseMac +<# # # char : hold # # #> name 6 + swap cmove +<# # # char : hold # # char : hold # # char : hold # # #> name c + swap cmove +base ! SerialBT.new constant bt -z" forth" 0 bt SerialBT.begin drop -esp_bt_dev_get_address hex 6 dump cr -: bt-type bt SerialBT.write drop ; -: 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 ['] serial-type is type ['] serial-key is key ; +name 0 bt SerialBT.begin drop +." Bluetooth Serial Terminal on: " name z>s type cr +: bt-type ( a n -- ) bt SerialBT.write drop ; +: bt-key? ( -- f ) bt SerialBT.available 0<> pause ; +: bt-key ( -- ch ) begin bt-key? until 0 >r rp@ 1 bt SerialBT.readBytes drop r> ; +: bt-on ['] bt-type is type ['] bt-key is key ['] bt-key? is key? ; +: bt-off ['] default-type is type ['] default-key is key ['] default-key? is key? ; only forth definitions bterm 500 ms bt-on | evaluate ; diff --git a/esp32/builtins.h b/esp32/builtins.h index 3f6f4fe..89eaa5b 100644 --- a/esp32/builtins.h +++ b/esp32/builtins.h @@ -76,7 +76,9 @@ static cell_t ResizeFile(cell_t fd, cell_t size); YV(ESP, getFlashChipSize, PUSH ESP.getFlashChipSize()) \ YV(ESP, getCpuFreqMHz, PUSH ESP.getCpuFreqMHz()) \ YV(ESP, getSketchSize, PUSH ESP.getSketchSize()) \ - YV(ESP, deepSleep, ESP.deepSleep(tos); DROP) + YV(ESP, deepSleep, ESP.deepSleep(tos); DROP) \ + YV(ESP, getEfuseMac, PUSH (cell_t) ESP.getEfuseMac(); PUSH (cell_t) (ESP.getEfuseMac() >> 32)) \ + YV(ESP, esp_log_level_set, esp_log_level_set(c1, (esp_log_level_t) n0); DROPn(2)) #define REQUIRED_SYSTEM_SUPPORT \ X("MS-TICKS", MS_TICKS, PUSH millis()) \ @@ -90,12 +92,14 @@ static cell_t ResizeFile(cell_t fd, cell_t size); XV(serial, "Serial.readBytes", SERIAL_READ_BYTES, n0 = Serial.readBytes(b1, n0); NIP) \ XV(serial, "Serial.write", SERIAL_WRITE, n0 = Serial.write(b1, n0); NIP) \ XV(serial, "Serial.flush", SERIAL_FLUSH, Serial.flush()) \ + XV(serial, "Serial.setDebugOutput", SERIAL_DEBUG_OUTPUT, Serial.setDebugOutput(n0); DROP) \ XV(serial, "Serial2.begin", SERIAL2_BEGIN, Serial2.begin(tos); DROP) \ XV(serial, "Serial2.end", SERIAL2_END, Serial2.end()) \ XV(serial, "Serial2.available", SERIAL2_AVAILABLE, PUSH Serial2.available()) \ XV(serial, "Serial2.readBytes", SERIAL2_READ_BYTES, n0 = Serial2.readBytes(b1, n0); NIP) \ XV(serial, "Serial2.write", SERIAL2_WRITE, n0 = Serial2.write(b1, n0); NIP) \ - XV(serial, "Serial2.flush", SERIAL2_FLUSH, Serial2.flush()) + XV(serial, "Serial2.flush", SERIAL2_FLUSH, Serial2.flush()) \ + XV(serial, "Serial2.setDebugOutput", SERIAL2_DEBUG_OUTPUT, Serial2.setDebugOutput(n0); DROP) #define REQUIRED_ARDUINO_GPIO_SUPPORT \ Y(pinMode, pinMode(n1, n0); DROPn(2)) \