From 44a62c1ec4369e537fc28a2ec37b9b82496b5835 Mon Sep 17 00:00:00 2001 From: PETREMANN Marc <57889978+MPETREMANN11@users.noreply.github.com> Date: Tue, 10 Feb 2026 10:01:30 +0100 Subject: [PATCH 1/3] add words added these words: --- esp32/optional/oled/oled.h | 54 +++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/esp32/optional/oled/oled.h b/esp32/optional/oled/oled.h index f38441b..f5f44c7 100644 --- a/esp32/optional/oled/oled.h +++ b/esp32/optional/oled/oled.h @@ -1,4 +1,3 @@ -// Copyright 2023 Bradley D. Nelson // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -13,8 +12,8 @@ // limitations under the License. /* - * ESP32forth Oled v{{VERSION}} - * Revision: {{REVISION}} + * Adadptation Marc PETREMANN + * Updated 22 jan. 2026 */ // You will need to install these libraries from the Library Manager: @@ -34,8 +33,8 @@ static Adafruit_SSD1306 *oled_display = 0; YV(oled, OledAddr, PUSH &oled_display) \ YV(oled, OledNew, oled_display = new Adafruit_SSD1306(n2, n1, &Wire, n0); DROPn(3)) \ YV(oled, OledDelete, delete oled_display) \ - YV(oled, OledBegin, n0 = oled_display->begin(n1, n0); NIP) \ - YV(oled, OledHOME, oled_display->setCursor(0, 0)) \ + YV(oled, OledBegin, n0 = oled_display->begin(n1, n0, true, true); NIP) \ + YV(oled, OledHOME, oled_display->setCursor(0,0)) \ YV(oled, OledCLS, oled_display->clearDisplay()) \ YV(oled, OledTextc, oled_display->setTextColor(n0); DROP) \ YV(oled, OledPrintln, oled_display->println(c0); DROP) \ @@ -43,16 +42,53 @@ static Adafruit_SSD1306 *oled_display = 0; YV(oled, OledNum, oled_display->print(n0); DROP) \ YV(oled, OledDisplay, oled_display->display()) \ YV(oled, OledPrint, oled_display->write(c0); DROP) \ + YV(oled, OledSetRotation, oled_display->setRotation(n0); DROP) \ YV(oled, OledInvert, oled_display->invertDisplay(n0); DROP) \ YV(oled, OledTextsize, oled_display->setTextSize(n0); DROP) \ - YV(oled, OledSetCursor, oled_display->setCursor(n1, n0); DROPn(2)) \ + YV(oled, OledSetCursor, oled_display->setCursor(n1,n0); DROPn(2)) \ YV(oled, OledPixel, oled_display->drawPixel(n2, n1, n0); DROPn(3)) \ YV(oled, OledDrawL, oled_display->drawLine(n4, n3, n2, n1, n0); DROPn(5)) \ - YV(oled, OledCirc, oled_display->drawCircle(n3, n2, n1, n0); DROPn(4)) \ + YV(oled, OledCirc, oled_display->drawCircle(n3,n2, n1, n0); DROPn(4)) \ YV(oled, OledCircF, oled_display->fillCircle(n3, n2, n1, n0); DROPn(4)) \ YV(oled, OledRect, oled_display->drawRect(n4, n3, n2, n1, n0); DROPn(5)) \ YV(oled, OledRectF, oled_display->fillRect(n4, n3, n2, n1, n0); DROPn(5)) \ YV(oled, OledRectR, oled_display->drawRoundRect(n5, n4, n3, n2, n1, n0); DROPn(6)) \ - YV(oled, OledRectRF, oled_display->fillRoundRect(n5, n4, n3, n2, n1, n0); DROPn(6)) + YV(oled, OledRectRF, oled_display->fillRoundRect(n5, n4, n3, n2, n1, n0); DROPn(6)) \ + YV(oled, OledDrawChar, oled_display->drawChar(n5, n4, n3, n2, n1, n0); DROPn(6)) \ + YV(oled, OledDrawBitmap, oled_display->drawBitmap(n5, n4, (const uint8_t *) n3, n2, n1, n0); DROPn(6)) \ + YV(oled, OledTriangle, oled_display->drawTriangle(n6, n5, n4, n3, n2, n1, n0); DROPn(7)) \ + YV(oled, OledTriangleF, oled_display->fillTriangle(n6, n5, n4, n3, n2, n1, n0); DROPn(7)) \ + YV(oled, OledEllipse, oled_display->drawEllipse(n4, n3, n2, n1, n0); DROPn(5)) \ + YV(oled, OledEllipseF, oled_display->fillEllipse(n4, n3, n2, n1, n0); DROPn(5)) \ + YV(oled, OledScrollL, oled_display->startscrollleft(n1, n0); DROPn(2)) \ + YV(oled, OledScrollR, oled_display->startscrollright(n1, n0); DROPn(2)) \ + YV(oled, OledScrollStop, oled_display->stopscroll()) + + + +const char oled_source[] = R"""( +vocabulary oled oled definitions +transfer oled-builtins +DEFINED? OledNew [IF] +128 value WIDTH + 64 value HEIGHT +-1 constant OledReset +0 constant BLACK +1 constant WHITE +1 constant SSD1306_EXTERNALVCC +2 constant SSD1306_SWITCHCAPVCC +: OledInit + OledAddr @ 0= if + WIDTH HEIGHT OledReset OledNew + SSD1306_SWITCHCAPVCC $3C OledBegin drop + then + OledCLS + 2 OledTextsize ( Draw 2x Scale Text ) + WHITE OledTextc ( Draw white text ) + 0 0 OledSetCursor ( Start at top-left corner ) + z" *Esp32forth*" OledPrintln OledDisplay +; +[THEN] +forth definitions +)"""; -#include "gen/esp32_oled.h" From ba076484591f58f24738279de54b009908f8e3c6 Mon Sep 17 00:00:00 2001 From: PETREMANN Marc <57889978+MPETREMANN11@users.noreply.github.com> Date: Tue, 10 Feb 2026 10:07:03 +0100 Subject: [PATCH 2/3] Implement dump tool and file recording functionality Added dump tool and RECORDFILE function to autoboot.fs --- esp32/autoboot.fs | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/esp32/autoboot.fs b/esp32/autoboot.fs index a4054a6..fde84e1 100644 --- a/esp32/autoboot.fs +++ b/esp32/autoboot.fs @@ -33,3 +33,66 @@ internals definitions ' autoexec ( leave on the stack for fini.fs ) forth definitions + +forth definitions +internals +\ dump tool +: dump ( addr len -- ) + cr cr ." --addr--- " + ." 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ------chars-----" + 2dup + { END_ADDR } \ store latest address to dump + swap { START_ADDR } \ store START address to dump + START_ADDR 16 / 16 * { 0START_ADDR } \ calc. addr for loop start + 16 / 1+ { LINES } + base @ { myBASE } \ save current base + hex + \ outer loop + LINES 0 do + 0START_ADDR i 16 * + \ calc start address for current line + cr <# # # # # [char] - hold # # # # #> type + space space \ and display address + \ first inner loop, display bytes + 16 0 do + \ calculate real address + 0START_ADDR j 16 * i + + + ca@ <# # # #> type space \ display byte in format: NN + loop + space + \ second inner loop, display chars + 16 0 do + \ calculate real address + 0START_ADDR j 16 * i + + + \ display char if code in interval 32-127 + ca@ dup 32 < over 127 > or + if drop [char] . emit + else emit + then + loop + loop + myBASE base ! \ restore current base + cr cr + ; + +create crlf 13 C, 10 C, +: RECORDFILE ( "filename" "filecontents" "" -- ) + bl parse + W/O CREATE-FILE throw >R + BEGIN + tib #tib accept + tib over + S" " startswith? + DUP IF + swap drop + ELSE + swap + tib swap + R@ WRITE-FILE throw + crlf 1+ 1 R@ WRITE-FILE throw + THEN + UNTIL + R> CLOSE-FILE throw +; +: MAIN ( -- ) + s" /spiffs/main.fs" included + ; + From 91ed918dd973fa69a24a66412654b0a3af509eb6 Mon Sep 17 00:00:00 2001 From: PETREMANN Marc <57889978+MPETREMANN11@users.noreply.github.com> Date: Tue, 10 Feb 2026 10:10:29 +0100 Subject: [PATCH 3/3] Add files via upload