CoolTerm ... Pls support ESC CursorHome :)

If you have specific questions or problems with any of my Freeware applications, post them here.
jmuhammad
Posts: 14
Joined: Wed Aug 17, 2022 10:21 pm

Re: CoolTerm ... Pls support ESC CursorHome :)

Post by jmuhammad »

roger wrote:I'm afraid CoolTerm will not be able to do exactly what you would like it to do. The plain text display is merely a container that displays the contents of the received buffer in human readable form. New data is always appended to the end of the receive buffer, after which the display is updated. This implementation doesn't lend itself to move the cursor around in the display and thereby changing the point where new data is inserted. The only way to get the cursor (and thus the point where new data is added) to the top left corner is to clear the buffer. In that regard it's very different from the display you would find in a proper terminal emulation application.
So, "clear screen" is something I was able to implement given these constraints. However, "goto 1,1" is not something I'm going to be able to do.
I have created an acceptable workaround where the uC ends its transmission to CT with a specific character or sequence of characters to the end of its report (for now it's the string "EORPT"). The GUI that requested the report then searches for that sequence in the CT text window and when it finds it (or timeout) it then sends CTRL+HOME to CT. It works exceedingly well! I will later experiment with using ASCII 3 as the CTRL-HOME trigger. I can now use this for any interface that can make CT active window and can sendkey.
jmuhammad
Posts: 14
Joined: Wed Aug 17, 2022 10:21 pm

Re: CoolTerm ... Pls support ESC CursorHome :)

Post by jmuhammad »

I can now detect when CT has ASCII 3 on screen and send CTRL+HOME to CT where it scrolls to upper left corner. ASCII 3 I will probably never use / have used for any other purpose so safe choice.
Image
I'm happy! CoolTerm is really working out for me.

Now I just have to figure out how to get Windows to reliably/predictably release the serial port esp. when I switch between programmer app and monitoring app. May have to do with fact I am programming over Bluetooth COM (Standard Serial over Bluetooth link). Even my iPhone won't let go of my BT KVM unless I toggle BT off/on :x
jmuhammad
Posts: 14
Joined: Wed Aug 17, 2022 10:21 pm

Re: CoolTerm ... Pls support ESC CursorHome :)

Post by jmuhammad »

jmuhammad wrote:
roger wrote:New data is always appended to the end of the receive buffer, after which the display is updated. This implementation doesn't lend itself to move the cursor around in the display and thereby changing the point where new data is inserted.
Roger, I understand that. I also understand if offering this could lead to the impression that CT is not 'acting right'. What I was suggesting was that it be offered with the understanding that if you scroll to the top while data is still coming in that it could either overwrite what is there or, IIRC if I CTRL+HOME while data is coming in the screen would just jump back to the bottom where I issued it and finish displaying incoming data; for me it did not start typing at 1,1...somehow CT remembered where it left off (maybe my settings).

So previously what I did was, since I was sending a fixed length report...in my case I displayed the contents of a 1kb EEPROM so the report with its header could be 9 rows up to 212 rows on CT. When the report was sent the uC STOPPED sending anymore data until the user typed a 'continuation' key on CT terminal. I had a fixed 5 second wait before it issued CTRL+HOME because I had no way feedback from CT when the report had ended. I waited because I too knew if I CTRL+HOME too early then it would just falcon dive to the bottom, finish, then I'd have to manually scroll to the top. 5 seconds isn't too long but someday I will send much larger memory maps...so instead of a large one-size-fits-all buffer e.g. 20 seconds for a 16kb memory but same 20 seconds for a little 512b part :o , I wanted to precisely know when it was done and then CTRL-HOME. So yes, it would be up to the user to not use it if data is still incoming. But since they control what is sent nobody would not tell their transmitter to send 'ASCII 3' or 'ESC[1;1H' unless it was at the end of the transmission.

Now my GUI commands the uC via CT serial port to send EE report back to CT, the last character is ASCII 3, then wait in while(). The GUI then continually checks every 500mS (up to 10 seconds) for the ASCII 3 character; if it sees it then it knows that it is at the end of the report and no more data is coming so CTRL+HOME is OK. The result is I am at the top of the 213 line report and I can, at my leisure manually scroll down or up and review, print, copy, etc. the data. When I am done, I just press my 'continuation' key into CT which sends it to a waiting uC, who in turn starts sending new data (BTW, I clear screen just before this so it starts anew).

It works really well. Well, I have a path for CTRL home which I will use with every project where CT is monitoring. 'ASCII 3' or 'ESC[1;1H' could work natively for CT if, again CT states that this is not PAUSE (CTRL+SHIFT+A), this is CTRL+HOME. The method I now use, all I have to do is make sure the CT Receive Buffer Size is large enough for the report I am expecting (right now I have it set to 20000 because my 1kb report now is 18,832 characters); if not my report gets cutoff at the top :oops: .
User avatar
roger
Site Admin
Posts: 431
Joined: Fri Apr 24, 2009 12:41 am
Contact:

Re: CoolTerm ... Pls support ESC CursorHome :)

Post by roger »

So, you're saying it would suffice if CoolTerm simply scrolled the contents in the plain text window all the way to the top upon receiving a 'ESC[1;1H' (or 'ESC[H' something like that)?
jmuhammad
Posts: 14
Joined: Wed Aug 17, 2022 10:21 pm

Re: CoolTerm ... Pls support ESC CursorHome :)

Post by jmuhammad »

roger wrote:So, you're saying it would suffice if CoolTerm simply scrolled the contents in the plain text window all the way to the top upon receiving a 'ESC[1;1H' (or 'ESC[H' something like that)?
Yes.

Because everyone doesn't know how to make their application search the CT display and then emulate a keyboard sending CTRL+HOME. But by simply checking a box, CT will do it automagically when it receives the sequence. A feature they did not know they'd appreciate!

An option just like any other option CT has in "Data Handling"; if someone misuses it oh well... but unlike backspaces :shock: , CTRL+HOME on CT in my experience does not goof the data up. Try it...when data is coming in give CT display area the focus then take the keyboard and press CTRL+HOME; it will go to 1,1 and stay until/unless new data comes in then it goes back to end.

I recommend 'ASCII 3' aka "ETX" or 'ESC[1;1H' for CTRL+HOME. "The End-of-Text character (ETX) (hex value of 0x03...) is an ASCII control character. Its function is to let the receiving computer know that the end of the data stream has been reached."

Keep 'ESC[;H' for "Clear on Display".
Last edited by jmuhammad on Mon Sep 19, 2022 12:13 pm, edited 1 time in total.
User avatar
roger
Site Admin
Posts: 431
Joined: Fri Apr 24, 2009 12:41 am
Contact:

Re: CoolTerm ... Pls support ESC CursorHome :)

Post by roger »

Thanks.

I was actually thinking of replacing ESC[;H with ESC[2J to clear the display. I think that would conform with the standard a bit more. That would free up ESC[;H to home the screen. Intuitively, these would make more sense and do something somewhat related of what they are intended for in proper terminal emulations.

Along those lines, I wonder if perhaps ASCII 2 (Start of Text) would make more sense than ASCII 3 to home the screen?
jmuhammad
Posts: 14
Joined: Wed Aug 17, 2022 10:21 pm

Re: CoolTerm ... Pls support ESC CursorHome :)

Post by jmuhammad »

roger wrote:Thanks.

I was actually thinking of replacing ESC[;H with ESC[2J to clear the display. I think that would conform with the standard a bit more. That would free up ESC[;H to home the screen. Intuitively, these would make more sense and do something somewhat related of what they are intended for in proper terminal emulations.
Oh sorry Roger, yes I agree. I never paid attention to the string sequence except with TeraTerm I think we had to use that...otherwise it is far easier to send Chr(12). But for the home we had to use ESC[1;1H (I just made a goto(x,y) macro to populate it)

vt100 Cursor Home: <ESC>[{ROW};{COLUMN}H
Sets the cursor position where subsequent text will begin. If no row/column parameters are provided (ie. <ESC>[H), the cursor will move to the home position, at the upper left of the screen.
roger wrote:Along those lines, I wonder if perhaps ASCII 2 (Start of Text) would make more sense than ASCII 3 to home the screen?
I see what you mean. But if I want text to appear at the top I have the uC send clear the screen (ASCII 12) then send the data. If I want to scroll to the top after I know the text is done so I won't get jerked back to the bottom of the screen, I place that indicator at the end of the text hence I think ETX (ASCII 3) is better choice. ATEOTD it doesn't matter what you pick, we'd use it :D I'd maybe use ASCII 2 maybe as a counter marker or something e.g. the app could count (or capture just the) characters between ASCII 2 and ASCII 3 markers.
User avatar
roger
Site Admin
Posts: 431
Joined: Fri Apr 24, 2009 12:41 am
Contact:

Re: CoolTerm ... Pls support ESC CursorHome :)

Post by roger »

I should be able to get a proof of concept up and running relatively quickly. I'll reach out via e-mail once I have something ready for testing.
User avatar
roger
Site Admin
Posts: 431
Joined: Fri Apr 24, 2009 12:41 am
Contact:

Re: CoolTerm ... Pls support ESC CursorHome :)

Post by roger »

roger wrote:I should be able to get a proof of concept up and running relatively quickly. I'll reach out via e-mail once I have something ready for testing.
I sent you an e-mail (to the address you used to create the forums account) with the link to a test build that supports display homing via ESC[;H or ASCII 3.
Post Reply