Catch REPL data in a text file

57 views
Skip to first unread message

eric mueller

unread,
Nov 25, 2020, 9:12:15 AM11/25/20
to thonny

Hi !

I work with ESP32 devices. For several weeks Thonny is my best friend :)

Is there an easy way to catch the REPL text data that the ESP32 send back
through serial USB port to Thonny application ?

I mean, as usual in a REPL loop, every time micropython is writting to stdout (or after an user print() function), the data is sent back via usb, and Thonny shows it in the shell part of the window after the >>> symbols.

Is this data available in a log file ? I'd like to read and work on it dynamically from an external process in a separated terminal.

I hope my poor english is understandable :) and and thank you in advance !

Eric

Aivar Annamaa

unread,
Nov 25, 2020, 9:41:31 AM11/25/20
to thonny
Hi Eric,

No, Thonny does not log this.

Can you tell us what do you want to achieve? Maybe it makes sense to bypass Thonny altogether and have your own program communicate with the device using PySerial?

Best regards,
Aivar

eric mueller

unread,
Nov 25, 2020, 4:38:48 PM11/25/20
to thonny
Hi Aivar,

Thank a lot for your answer !

I come from hardware ASIC world, and I used a lot of super simulators like Modelsim VHDL/Verilog in which every command, actions done and reply was reported in a rough text file. It was very useful
to replay same sequences using part of these file, by mean of command called "redo" or "replay", only specifying simple text logfile that we called (dofile).
 
I'd like to extend monitoring and to do a private front panel for viewing states and variables of  my remote
ESP32 device, while I'm working and developping using REPL in Thonny.

For example, a simple concurrent program spying all data sent back from ESP32 to the PC during the REPL loop, could plot the data in a separated window (or store in a file) without implementing any sophisticated things... (See this plot example with Mu)


When we're developping application with microcontroler etc. we also have to develop some graphical interface tools or monitoring panel to debug and  test the all system. But often we do not have it at
the beginning of the project!

It could be cool if Thonny would provide facilities for basic data sampling of remote devices, to do easy monitoring/recording of data for some Labs experiments during development, and that before to have implemented the final monitoring application !

For me a simple "echo" in a text file would be perfect, but I understand that maybe
there is no interest for most part of users ?

Thanks

Eric

Aivar Annamaa

unread,
Nov 26, 2020, 7:07:36 AM11/26/20
to thonny
I'm afraid this feature wouldn't find much use. What I can do, is making Thonny's diagnostic logging customizable and logging stdin/stdout/stderr on TRACE level (ie. you would need to filter out certain log events from the diagnostic log).

Did you know that Thonny also has plotter? Right click in the Shell and select "Plotter". Also, doesn't the "Variables" view suffice for exploring the program state?

Best regards,
Aivar
Reply all
Reply to author
Forward
0 new messages