RobTillaart / ANSI

Arduino library with basic ANSI display codes for simple terminal apps
MIT License
17 stars 6 forks source link

normal does not work #20

Closed d0m1n1qu3 closed 12 months ago

d0m1n1qu3 commented 12 months ago

bug should be here

void ANSI::normal() { _stream->write("\033[0m", 3); }

it should be

void ANSI::normal() { _stream->write("\033[m", 3); }

testet with VSCode and teraterm

d0m1n1qu3 commented 12 months ago

made a pull request ;-)

RobTillaart commented 12 months ago

Merged

RobTillaart commented 12 months ago

after additional testing (for 0.3.0 version) I found that it should be

_stream->write("\033[0m", 4);

Already patched in the develop branch, Thanks for pointing to this bug.

d0m1n1qu3 commented 12 months ago

hey .. you are right .. it works ..

and underline and so on works also with the change from 3 to 4 .. and it is logical because this are 4 signs :-D ..

void ANSI::normal() { _stream->write("\033[0m", 4); }

void ANSI::bold() { _stream->write("\033[1m", 4); }

void ANSI::low() { _stream->write("\033[2m", 4); }

void ANSI::underline() { _stream->write("\033[4m", 4); }

void ANSI::blink() { _stream->write("\033[5m", 4); }

void ANSI::reverse() { _stream->write("\033[7m", 4); }

d0m1n1qu3 commented 12 months ago

i updated my fork if you want to try .. :-)

RobTillaart commented 12 months ago

PR is waiting for merge, I need to run some checks. So expect merge this weekend (0.3.0)

d0m1n1qu3 commented 12 months ago

nice .. have a nice weekend ;-)

RobTillaart commented 12 months ago

@d0m1n1qu3 Tests done, merged into master, build for 0.3.0 is running (unfortunately there are problems with the JSO checker workflow)

d0m1n1qu3 commented 12 months ago

works like a charm :-)

RobTillaart commented 12 months ago

Good to hear, Today I uncommented a number of experimental functions including setPrintingMode(). These new functions do not work with every terminal but can still be interesting if it does. Its now in the develop branch

d0m1n1qu3 commented 12 months ago

for what is setPrintingMode ?

RobTillaart commented 12 months ago

The original terminals connected to servers could work in 2 modi (i know of). Screen mode which we normally use with all the escape codes. They also have printing mode which allowed the terminal to forward the data from the server to be forwarded to a printer connected to the terminal.

TeraTerm and Putty do support a printer mode.

So this allows your Arduino sketch to communicate to e.g. putty and at some moment the arduino can send data to the printer and thereafter it can go to screen mode again.

d0m1n1qu3 commented 12 months ago

uhh thats sounds nice .. thanks for explanation