fenugrec / freediag

OBD2 scantool
GNU General Public License v3.0
338 stars 75 forks source link

850 : non-scrolling continuous live data display #92

Closed aaeegg closed 10 months ago

aaeegg commented 1 year ago

This adds a mode that continuously reads live data and updates the on-screen values without scrolling additional lines onto the screen. This is initiated by the keyword "live" at the end of a read or peek command. Previously, this keyword continuously read live data and scrolled new data onto the screen with each read. The keyword for that functionality is now "stream".

This works on Linux. I included code for Windows which I believe is correct, but I don't have a toolchain so I don't know if it even compiles.

This is an example of the old functionality, now accessed by the "stream" keyword:

freediag> set interface carsim
interface is now CARSIM
freediag> set simfile scantool/freediag_carsim_d2.db
simfile set to: scantool/freediag_carsim_d2.db
freediag> 850 connect m44
diag_l2_d2.c:244:  _startcomms : L0 didn't return keybytes, continuing anyway
Connected to Motronic M4.4 engine management.
freediag> 850 read 2 stream
02: 00 75
Engine Coolant Temperature: 37C (98F)
02: 00 5D
Engine Coolant Temperature: 13C (55F)
02: 00 3A
Engine Coolant Temperature: -22C (-7F)
...continues scrolling new values until enter is pressed...

This is the new functionality, accessed by the "live" keyword:

freediag> set interface carsim
interface is now CARSIM
freediag> set simfile scantool/freediag_carsim_d2.db
simfile set to: scantool/freediag_carsim_d2.db
freediag> 850 connect m44
diag_l2_d2.c:244:  _startcomms : L0 didn't return keybytes, continuing anyway
Connected to Motronic M4.4 engine management.
freediag> 850 read 2 live
02: 00 84
Engine Coolant Temperature: 52C (125F)
...above 2 lines are continuously updated until enter is pressed, but screen does not scroll...
fenugrec commented 1 year ago

will check this later, but if you're just refreshing a single line, simply appending a \r should work ? like you already do elsewhere in e.g. cmd_850_dumpram

aaeegg commented 1 year ago

Refreshing at least two lines (hex dump and interpreted data), per parameter; some parameters have multiple lines of output; it's possible to display multiple parameters at once (as in "850 read 2 3 live").

fenugrec commented 1 year ago

Tested that it does compile with mingw-x64. Next, will need to try with the carsim db

aaeegg commented 10 months ago

Any news?

fenugrec commented 10 months ago

Any news?

apologies. This project is low priority and I easily forget stuff that I can't immediately address. Have a bit of time right now to test

fenugrec commented 10 months ago

With a (small ? TBD) tangent; my distro decided to break cppcheck, and the way these cmakelists are written, it's not easy to temporarily disable. Just what I wanted to work on tonight

fenugrec commented 10 months ago

Ok, tested on archlin and winXP with read 2 stream and read 2 live. Nice.

Next time we need to add more fancy console handling, we might consider ncurses.

Two more requests before merging if you don't mind -

if you don't have time in the next day or two, I might be able to. And if this falls of the table again, ping me every few days...

aaeegg commented 10 months ago

OK, I split the commit and made lines unsigned.

fenugrec commented 10 months ago

Thanks for your continued patience. Merged ! I also removed some duplciation in the .db files, added a (disabled) test for further reference. Will try to address #93 maybe later today