Consider adding code device ready check to ANSI term library.
heidnerd opened this issue · 16 comments
One of the problems I've been encountering with many of the little arduino boards that are using native serial connections on the USB, is that some don't reset when a serial monitor such as putty connects. The little Seeed Xiao / Adafruit similar boards, start up the serial connect very quickly. That can result in people thinking the little boards are dead or not working.
The real issue is that they are fast, boot fast, and you just can't see the early text flying by.
There is a simple solution that can help with this -- add a "Device Status Check" to the library such that if the serial monitor supports emulation of a ANSI, VT52, VT100 - the library checks the type... blocking until a device status is returned.
The check is quite simple, it works also for the Arduino IDE serial monitor -- because it repeats the same escape sequence over and over again until there is a response... with the IDE serial monitor, you just simply hit the "SEND" button and it continues - but of course all the "escape" codes are sent as unknown character boxes.
Here is the short code for testing - added into your example for the ANSI library.
Serial.begin(115200);
delay (100);
int read_len = 0;
delay(300);
Serial.setTimeout(500);
do {
Serial.write(27);
Serial.print("[0c");
read_len = Serial.readBytes(buffer,3);
} while (read_len == 0);
ansi.clearScreen();
The delays could possibly be remoted.
If the code is added to a routine that is called say ANSI.deviceType It could block and return simple code 0, for dumb device does not support ANSI codes, 1 = VT52, 2= VT100, 3= VT220, etc.
I have the test sequences for about a dozen different terminal types. And can work with you to provide the list.
Sounds like an excellent addition to the library.
As I am ill at the moment it can rake some weeks before i can dive into this. (Work is piling up).
Definitely interested in examples. These help as test reference for the library implementations
I will make a separate branch to add the new functions so testing them won't interfere with the master.
@heidnerd
update - https://github.com/RobTillaart/ANSI/tree/develop
- added int deviceType(uint32_t timeout) timeout in milliseconds.
Please have a look if it works for you as it should.
I get always the value 2 (Teraterm and Arduino IDE) and -1 (Putty) so I don't know if it works as it should.
Don't have other terminal-emulators
@heidnerd
Any progress to report?
@heidnerd
Any progress to report?
Actually I think I've finally gotten a solution to test with.
I didn't want to test with putty only, incase the implementation and a quirk. I wanted to verify using a couple of other emulators. I'd planned to simply use hyperterm - which used to be distributed with Windows. That changed with the introduction of Windows 8 & 10, hyperterm is now a separate product sold by the original software company. So my next attempt was to test on an older windows XP laptop with hyperterm, Secure92 (Minisoft) product and one other terminal emulator. Those emulators worked find on Windows XP --- but I could not successfully get the USB driver to correctly load for the little XIAO (SAMD21 and RP2040).
I tracked down another emulator from Turbosoft (Australia) TTWIN 4, it does have all of the emulations for the DEC terminals plus many others which supported VT like escape sequences. And I finally got an update for the MInisoft terminal emulator - this should help provide TWO verifications besides putty.
The VT terminals have the ability to send an escape sequence that sends data to a remote printer. I want to test that also, I have verified in putty that I could create a "printing device" that is actually a file. This would make it possible to put info on the screen and also log data to a flat file.
I'm hoping to actually finish the testing of the work you'd done - then confirm the printing sequences and that they work on putty, TTWIN 4, Secure92 and perhaps hypertem...
Sorry for the delay, I'd forgotten how old WinXP is and the issues with trying to use new drivers on it.
I'd gone out and bought a USB floppy drive so I could load the old software on my Win 10 PC, only to discover that the old terminal software - fails to start - because the OS detects it's not compatible....
Wow. You've been very busy
Thanks for the update.
One thing that I've learned -- I have a whole lot of old 5.25 inch floppies that I need to go through while I still have older Windows machines that can read them... and consolidate or transfer to newer media. I have some pictures on an optical WORM - that I may never be able to recover. Iomega zip media which will be a challenge. Some with pictures of kids when they were younger.
One thing that I've learned
Have a similar archive over here, although I have copied most of the data to a NAS server.
I'd gone out and bought a USB floppy drive so I could load the old software on my Win 10 PC, only to discover that the old terminal software - fails to start - because the OS detects it's not compatible....
What I did in a previous job is using VMware to create a virtual PC with XP. Might be a solution?
I have several TB+ NAS servers in my home. Some pictures had already been moved onto them - but I'm also discovering that I'm needing to do more replacement on failed RAID drives over time. I've even use LTO and DAT tapes. It's a challenge.
I do have VMWare on some machines, but I think they're XP. I have ubunto (under Win10) on this laptop. I had looked to see if MS had an older image that they would allow me to install in a Microsoft virtual machine... but hadn't found one. Key is that the terminal emulators were windows based.
Yesterday I received updated demo keys for two of the emulators... so that's where I will focus.
my email is dennis (at) rextorgroup (dot) com, my little test board for trying some of these things is a simple xiao (seeed/adafruit) based with added level shifting and connectors on the PCB. If interested I can send a small PCB - version I created is so that I can use for sniffing or simple testing of sensors - a board with umph behind it but I could also keep simple and protect it with a 3D printed base.
@heidnerd
Any progress?
@heidnerd
I merge the branch as this pull request is open for almost 5 months, which I consider quite long.
Merging will possibly bring some feedback from other users on the new function added.
Feel free to reopen the issue to add your feedback and results as these are still appreciated.