Shop OBEX P1 Docs P2 Docs Learn Events
mcurses ported to P2 with FlexC — Parallax Forums

mcurses ported to P2 with FlexC

RaymanRayman Posts: 13,893
edited 2020-12-02 19:18 in Propeller 2
Was able to get this Arduino code, mcurses, from GitHub to work with FlexC. "Porting" might be too strong a word... Just had to change a few lines...
https://github.com/ChrisMicro/mcurses

There is a lot of C code out there that uses ncurses and I'm hopeful that this will let them work.
The attached code runs the hexadecimal memory editor example, screenshot attached.

But, the downside is that it doesn't run right in the loadp2 terminal window, nor in Parallax Serial Terminal.
It does run in both Putty and Teraterm. But, the issue there is that it resets the P2 on startup. So, you have to load the code into flash in order for it to work with these.
Update: See next post for how to fix reset issue.

However, maybe I can use the P2 with VGA and USB keyboard as the terminal and use these codes directly on P2.

Comments

  • It doesn't reset for me. I have the com port advanced setting set like this:

    ComPort.png

    If you uncheck the top item "Serial Enumeration" it won't reset when you plug and unplug a device from the system.

    Mike
    637 x 455 - 17K
  • RaymanRayman Posts: 13,893
    edited 2020-12-02 21:14
    That worked! Thanks.
    Update: Well, it seemed to work, but now doesn't.. Oh, well.
  • Dave HeinDave Hein Posts: 6,347
    edited 2020-12-02 19:04
    mcurses is set up to work with an ANSI screen. The control characters are defined in mcurses.c, such as "#define SEQ_CLEAR PSTR("\033[2J") " to clear the screen. I recall something about issuing a command in Windows to make the loadp2 terminal emulator work correctly with ANSI commands. If you want to use mcurses with PST you would have to define the control sequences that PST uses. However, PST doesn't support all of the ANSI commands that mcurses uses, so you would have to make code changes as well to get it to work.
  • RaymanRayman Posts: 13,893
    I was sorta able to get the temperature demo working, but it's not exactly right...

    Biggest issue is the special line drawing characters... It seems something is wrong in translation.
    This page is trying to tell me something about this, but I don't get it yet: https://invisible-island.net/ncurses/man/curs_addch.3x.html#h3-Line-Graphics
    661 x 418 - 11K
  • In PuTTY configuration, look at the Window->Translation category, and make sure that the character encoding selected there is same as in mcurses. PuTTY defaults to UTF-8, and you'd expect any sane piece of modern communicating software to do the same, but I guess mcurses lives in some other era :/

    FqjVtXY.png
  • RaymanRayman Posts: 13,893
    Ru saying it works better with something else selected? What’s the right setting?
  • I don't know what is the right setting. mcurses should specify what encoding it uses on the terminal output.
Sign In or Register to comment.