Posible bug with Terminal::KeyPressed()

Post Reply
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Posible bug with Terminal::KeyPressed()

Post by Pete9008 »

Been trying to use Terminal::KeyPressed() to terminate logging but couldn't get it to work (only worked occasionally). It turns out that the UART Rx DMA was still active in the background and grabbing the characters out the UART buffer and clearing the flag before KeyPressed saw it. Might be an issue in other places that the function is used too??

I've added a public Terminal::GetRxNumBytesAvail() function that returns the number of bytes in the DMA buffer and look for a change in value instead.
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Posible bug with Terminal::KeyPressed()

Post by johu »

Yes, I noticed this as well and fixed it but never published it :(

I think I just checked for bytes in DMA buffer as well and returned true if >0
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Post Reply