Did you test it that it works? I just meant that the terminal / shell you are executing miniterm inside from must support these ANSI escape codes.
See my previous answer (I was updating it while you were answering)
Ok I did this in config vscode json file with this command platformio device monitor --raw
{
“terminal.integrated.shell.windows”: “C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe”
}
But nothing changed
i tryind without this command as well but no changes
This means
platformio device monitor -f colorize
should display the ansi colors? This doesn’t work though.
Under windows you have to enable your console (cmd.exe or powershell) to be able to display those ANSI codes with a setting. One way to do this is by creating or setting the registry key VirtualTerminalLevel
(DWORD) at [HKEY_CURRENT_USER\Console]
to value 1
.
See: Colored text output in PowerShell console using ANSI / VT100 codes
After that you can call the monitor with pio device monitor --raw
and the coloring should work.
I have managed to enable the colors and if I run platformio device monitor --raw
I get the nice colors in the log.
Is there any way to make this the default, so when I click on the serial monitor icon in the toolbar I also get the colored output?
I don’t think there is a way to do that at the moment. It would be awesome to have the possibility to enable this via a setting in the platformio.ini
.
Has anyone tried, just for fun, to say monitor_port = --raw /dev/ttyACM0
? If it’s just a copy-paste thing from this option line, that might actually construct the correct command string…
I have just tried that unsuccessfully in a few different combinations with different options (monitor-speed
, monitor-port
, etc.). When PIO parses the ini
-file it always catches those “injection” attempts.
could not open port '--raw COM3': could not open port '--raw COM3':
or
ValueError: invalid literal for int() with base 10: '--raw'
Thank’s for trying, too bad it doesn’t work . Then let’s wait how Add user-definable monitor options to platformio.ini · Issue #2165 · platformio/platformio-core · GitHub is perceived.
Hello!
I was glad when I found out about the support for displaying colored text on the monitor.
Followed the recommendation above (I have Windows 10) created key the VirtualTerminalLevel (DWORD) at [HKEY_CURRENT_USER \ Console] with a value of 1.
Inserted to platformio.ini:
monitor_flags=
--echo
--raw
Rebooted the system. To when I activate the monitor, I see this:
> Executing task: C:\Users\Alexander\.platformio\penv\Scripts\platformio.exe device monitor <
Looking for advanced Serial Monitor with UI? Check http://bit.ly/pio-advanced-monitor
If I execute the command in the terminal:
platformio device monitor --raw
monitor is displayed normally
If when I activate the “Upload and Monitor”:
all displayed normally
What have I done wrong?
I haven’t tried setting the flags via monitor_flags
yet, but why do you have listed --echo
there? It also seems kinda weird to me, that the executed command doesn’t show the additional flags.
My English is only through Google translator. Please explain what do you mean?
What data still needs to be provided to prove that when the “ONLY MONITOR” is activated, it does not work properly (even if all the monitor flags are turned off).
What exactly is the environment you are using this in? Are you using VSCode? What are you doing exactly, when you say
and
?
I can’t reproduce this error using VSCode + PIO IDE. Manually starting the monitor with pio device monitor --raw
results in the same output as launching the Serial Monitor with the “PlatformIO: Serial Monitor” button at the bottom of the VSCode window with monitor_flags beeing
set to --raw
.
I noticed another strange output of non-printable characters to the serial port
For verification, I received normal output in MINGW32
# python C:/msys32/home/Alexander/esp/esp-idf/tools/idf_monitor.py --port com5 --baud 115200 build/KaRadio32.elf
as well in PuTTY
What could be the problem?
Thanks.
What character encoding does the firmware use when sending out this string?
All character in UTF-8
fwiw, I used “monitor_filters = direct” in platformio.ini.
After setting platformio.ini
…
monitor_filters = colorize, log2file
…
I got this:
(67434) J2S: Body read binaryFileLengtn 987115
[0;32mI (67452) J2S: Body read binaryFileLengtn 987970
[0;32mI (67472) J2S: Body read binaryFileLengtn 988995
I (67492) J2S: Body read binaryFileLengtn 990020
[0;32mI (67512) J2S: Body read binaryFileLengtn 991045
I (67530) J2S: Body read binaryFileLengtn 992070
I (67549) J2S: Body read binaryFileLengtn 993095
[0;32mI (67562) J2S: Body read binaryFileLengtn 993730
I (67582) J2S: Body read binaryFileLengtn 994755
Some lines are Ok with colors, others still get the ANSI esc.
Of course, before the monitor_filters I got always the Esc chars.
I am on WIN10
any ideas?
Thanks