PicoEdit: Screen editor for PicoCalc - ported


#1

Ported the LispBox/LispDeck screen editor to the PicoCalc:

https://github.com/ErsatzMoco/ulisp-picoedit

Please note: The pre-compiled UF2 file in the repo applies to the Pico 2 / 2W only. (Other versions may follow, but currently please compile the repo yourself for use with different boards.)

It seems stable, but please report any bugs. The amber color scheme requires pushing the screen backlight a bit. Please take a look at the notes in README, this editor version is somewhat different from the original LispBox version (and a little more capable since it supports umlauts/special characters).

Have fun!


#2

I tried compiling it on the Pico 1 and runs fine. The header seems weird tho, are the F1 and F3 labels supposed to overlap?


#3

That’s not a bug, it’s a feature! :) Actually I decided to omit the hint for F1/F2 altogether to gain some space for displaying the symbol or file one is working on at the right side of the header which I considered more important.

But that’s a totally arbitrary decision, of course - if you like to change what’s displayed as hints in the header, please see function se:info-line in file “PicoEditLispLibrary.h”. It’s the only place now where the hint line gets printed.

Let me mention another small change I consider one of the most useful things: After pressing F5 you may omit an answer to the request “Symbol name:” and just press ENTER. Then, the program currently in the editor is executed with immediate effect. You can’t see outputs directed to the REPL that way, but apart from that you can test your code while staying within the editor. I think I originally intended to implement F5 that way but then somehow forgot to simply use “eval” without binding the code to a symbol.


#4

Added suitable version of the help system (CTRL-h/ALT-h, please see README on Github).

[Edit]
… and possibility to run the code of a single line in the editor (as opposed to the whole buffer): CTRL-r/ALT-r. Also applies to files/symbols open in “read only” (view) mode.

[Edit 2]
… sorry to bother you again, but you might like it: Added a search function and a selection range mechanism. It’s now possible to copy, paste, delete or execute whole ranges of lines. Please see the README at Github for details. I think we have a useful tiny uLisp IDE now. I will port these features back to the original LispDeck/LispBox editor as well. >>> DONE, see https://github.com/ErsatzMoco/ulisp-lispbox


#5

Some major additions:

I’ve added the possibility to send a line or a marked region via serial TX/RX pins and receive an answer, please see the README file for detailed information. I wanted this to utilize any other board running uLisp as a kind of co-processor or to remote control it from the PicoCalc.

To receive commands from PicoEdit on another uLisp machine and send the outcome back, add something like this to a LispLibrary on that other board:

(defun serial-receive ()
  (let ((rline nil))
    (with-serial (str [your serial port number here] 96)
      (loop
        (setf rline (read-line str))
    	(when rline 
    	  (ignore-errors (princ (eval (read-from-string rline)) str) (terpri str) (setf rline nil)))))))

(progn
  (delay 1000)
  (serial-receive))

(The progn block will be invoked directly at startup.)
To implement the serial send feature I slightly modified uLisp and tied the functions for Serial2 to software serial (SerialPIO) on GP2/GP3 at the PicoCalc’s port because the pins marked “UART0” interfere with the USB chip of the PicoCalc (tied in parallel).

I’ve included the awesome GIF library into the PicoEdit extension file as well, thanks a lot to David! Another addition are a bunch of OLED commands (default: disabled) for communication with a display via I2C, please see the extension file.
There’s a dedicated UF2 for the Pico2W now as well.
I will make serial send available to the LispDeck/LispBox version, but since I want to update it to the latest uLisp release as well this will take some time.