EdgeTX / edgetx

EdgeTX is the cutting edge open source firmware for your R/C radio
https://edgetx.org
GNU General Public License v2.0
1.56k stars 332 forks source link

Make the LUA PRINT command output on the radio LCD, instead of the debug window #86

Open lshems opened 3 years ago

lshems commented 3 years ago

Make the PRINT command working on a dedicated screen

After every print command shift the lines down one row, and keep them in the 'print buffer'. Every line that 'falls off the screen" get's removed from the buffer.

raphaelcoeffic commented 3 years ago

@lshems so basically like a "logging" window, right?

lshems commented 3 years ago

Yes, just force it over any other lcd commands.

It is for logging, but also for very simple user scripts, such as:

if getValue("input3")==-1024 then print("throttle off") end

it would just put a line on top of the screen and shift all others down on every pass.

So for this simple script, as soon as the condition becomes true, it would print the text on the first pass on the first line, shifting any other existing lines down, and keep doing that until the condition becomes false again.

But it would allow to create VERY simple script for people starting with LUA, that may encourage more people to start using LUA.

JimB40 commented 3 years ago

As a quick solution redirecting LUA print output to any file would be really great dev improvement. Now we have to debug using different code than in Companion. If companion supports firmware :) simple print with file output would be such a relief cause lcd error formating is kind of disaster. I'm using xpcall but with more data browsing on lcd is cumbersome.

lshems commented 3 years ago

Do understand I dont want to mix up things here. I was referring to use print() as an effective command piping the output to the lcd for use in simple user scripts. Not for debugging purposes.

It would indeed mean that we would need to have an alternative for the current print command pushing the output into the debug window in the simulator, where it gets mixed with the radio debug info. This should be done with io.stderr:write(message), which is meant exactly for that purpose: mix an error message in the standard C debug output.

The only thing you need extra, is to be able to define the standard error output to be a file rather than the debug window.

lshems commented 3 years ago

changed the title, as it seemd confusing. I suggest to open a new issue for the io.stderr:write(message) request.

lshems commented 3 years ago

logged a new suggestion #90