Shop OBEX P1 Docs P2 Docs Learn Events
Fastspin Terminal - ESC TO EXIT — Parallax Forums

Fastspin Terminal - ESC TO EXIT

Hi @ersmith ,

Houston we have a problem here.

If you use @Cluso99 debugger/monitor you need the ESC key to go back to TAQOZ. But you can't do that because the terminal window is closing.

is it possible to change the 'close' key to say shift-esc or ctrl-esc? or just use the close button of the window?

Enjoy!

Mike

Comments

  • ElectrodudeElectrodude Posts: 1,657
    edited 2019-01-15 21:28
    Most other terminal programs (picocom, minicom, screen, tmux, etc.) have a prefix key, such as ^A, that you have to press before it will listen to a command (such as quit, suspend, reset the P2, send a file, reconfigure, etc.). If you want to actually send the prefix, you push it twice. Something like this would probably be best, since it allows you to send any key.
  • Can i suggest we use ctrl-]

    ctrl-] is standard on every keyboard and will gives 29 decimal (1D hex) and is know as GS or Group Seperator
    ESC produces 27 decimal (1B hex)

    Shift-esc and control-esc have no standard mapping on keyboards, and can only be done with scan codes,
    and its likely different keyboards will NOT produce the same result.

    I modify loadp2 or any other terminal program to do this.
  • loadp2 isn't my program, but obviously it would be possible to change the exit key to any other ASCII character. I'm not sure about non-ASCII characters, but that would be a good solution if it's possible.

    OTOH you can always use another terminal program.
  • I use screen, it's in almost every linux already and is available for windows (or linux subsystem in Windows)

    screen /dev/ttyUSB0 115200

    To disconnect, ^Ak

  • Dave HeinDave Hein Posts: 6,347
    edited 2019-01-16 01:25
    I use ctrl-] in spinsim, and I was actually thinking of changing it to ESC to match loadp2. I like using ESC because it is a single key. However, I have had a concern that it might conflict with the user wanting to use ESC. I'll change loadp2 to ctrl-] instead when I get home on Friday.
  • The "screen" terminal emulator is not present in Ubuntu or Linux Mint although it is very simple to add. However I find minicom far more useful since you can open a menu within minicom to change parameters or simply free the serial port while it is in the menu, which is very useful for downloading new code with loadp2 and then cancelling the menu (^AP to open Comm Parameters, use loadp2, then esc to return to terminal).

  • Dave Hein wrote: »
    I use ctrl-] in spinsim, and I was actually thinking of changing it to ESC to match loadp2. I like using ESC because it is a single key. However, I have had a concern that it might conflict with the user wanting to use ESC. I'll change loadp2 to ctrl-] instead when I get home on Friday.

    Thank you @"Dave Hein", I really like the terminal provided, but need the ESC button...

    Enjoy!

    Mike
  • I checked the change into GitHub. loadp2 now uses Ctrl-] to exit the terminal mode.
  • perfect, thank you, I will update immediately.

    I currently use your terminal to test my ROM hijacking and can talk to TAQOZ then press ctrl-D to get to @Cluso99 's monitor, but it requires ESC to get back to TAQOZ.

    Enjoy!

    Mike
  • Dave Hein wrote: »
    I checked the change into GitHub. loadp2 now uses Ctrl-] to exit the terminal mode.
    But... Version 0.008 seems to have broken loading on macOS. I get an "Unsupported baudrate" error no matter what "-b" option (or no -b option, at all) I use.

    And, it seems that maybe the findp2 code, which has never worked on macOS, is no longer even able to pass through when the port description is given on the command line. macOS, does not use a Linux-style iterative port naming convention (like: "/dev/ttyUSBn", where 'n' is a number. It names the port like this: "/dev/cu.usbserial-P2EEI8V", with no number iteration), so the findp2 code was not able to find a macOS port. It was getting-by with version 0.007, by taking the port name from the command line. Not sure if 0.008 can handle macOS portnames at all (I could be wrong but have tested extensively and not found a 'cure').

    With version 0.007, I also received "Unsupported baudrate" errors unless I use "-b 115200", which has always worked. There's something in the code about the 'B20000000' definition that does not work on macOS. And, since that is the loading default, it gets a failure. Perhaps there's a header file in Linux that differs from macOS in defining those baudrate constants.

    Just my best guesses as to some issues...

    dgately
  • Have you tried symlinking com1 to /dev/cu.usbserial-P2EEI8V in .wine/dosdevices after starting up spin2gui ?
  • I'll try reverting loadp2.c and osint_linux.c back to the code from version 0.007, and then I'll re-integrate some of the minor changes that I've made. Hopefully that will work for the Mac.

    Should I add an option to set the loading baud rate? This is currently fixed at 2 MBaud. Maybe a different loading rate would cure some of the problems with the Mac.
  • Dave Hein wrote: »
    I'll try reverting loadp2.c and osint_linux.c back to the code from version 0.007, and then I'll re-integrate some of the minor changes that I've made. Hopefully that will work for the Mac.
    Thanks! I'm looking at several sources (SimpleIDE's, propLoader, etc...) for examples of how to scan for USB serial on macOS. I think it's basically the same as Linux with a few minor tweaks. I think Jazzed had it figured out...
    Should I add an option to set the loading baud rate? This is currently fixed at 2 MBaud. Maybe a different loading rate would cure some of the problems with the Mac.
    Maybe, but it's a shame that it can't behave like Linux and just use 2 MBaud. Do you know which header file defines the baud rates in Linux (i.e. B20000000, B115200, etc...)? I'm not finding the USB Serial C example code that Apple used to publish, so I'm at a loss as to why B2000000 is not defined. Maybe an #ifdef _macosx_ and define of the missing baud rates will work? I will try to test that idea.

    dgately

  • I not familiar with the Mac, so I don't know where the baud rates are defined. I checked version 0.009 into GitHub. I only changed loadp2.c so that it matches the January 9th version. I then incorporated the Ctrl-] change. I also changed the default value for the user baud rate to 115200. I noticed that the default value was -1, which caused the baud rate to scale with the clock frequency by default.

    I added a "-l" option that allows setting the loader baud rate. So you can now specify a loader baud rate other than 2 Mbaud.

    I did not change osint_linux.c. There are a couple of recent changes in there that might be affecting the Mac, but if I back those out it would break Linux. If need be, I could create an osint_macos.c so that the Mac and Linux would no longer conflict.
Sign In or Register to comment.