michar71 / Open-DSO-150

An open source firmware for JYE Tech DSO-150 Digital Storage Oscilloscope
223 stars 41 forks source link

Encoder/Button control problematic #2

Open michar71 opened 7 years ago

michar71 commented 7 years ago

Encoder and button performance on DSO-150 is pretty bad. The underlying issue is the dual use of GPIOB for display data output for thw display and encoder/button input.

Toggling IRQ's on/off when the display is using the lines kind of works. (And could be improved by linking it directly to the CS line enable/disable by the display driver). It is also possible to try to just set a flag in the display driver code when accessing the data lines and just branching out of the IRQ routine while the display is using the lines. (HW will trigger IRQ's on GPIO lines if enabled independently if they are set to input or output...)

None of this though will prevent user interactions to get lost.

For the encoder this is not that problematic as the user just continues to operate the encoder until the desired action happens. (Reducing the dead-time will improve loss of signal codes/transitions and response...)

For buttons this is a bigger problem. If the IRQ is disabled while the button is pressed/released the event is lost as all interrupts are edge-triggered. This leads to either lost key events or key presses getting registered as long presses as the short release pulse is missed.

Therefore currently buttons are polled which allows the level of the line to be monitored at the polling time and not rely on edge transitions but this causes issues when the timebase gets longer as the acquisition routine blocks polling. Switching to DMA for the data acquisition might improve this.

jief666 commented 7 years ago

On my current DSO 150 with JYE firmware, the encoder and button works quite well. I think that happens to lose some click but very rarely. I don't know the average time a button stay down when you press it, but if it's longer than a screen access, we might catch them all...

On Tue, Apr 4, 2017 at 8:01 PM, michar71 notifications@github.com wrote:

Encoder and button performance on DSO-150 is pretty bad. The underlying issue is the dual use of GPIOB for display data output and encoder/button input.

Toggling IRQ's on/off when display is using the lines kind of works. (And could be improved by linking it directly to the CS line enable/disable by the display driver). It is also possible to try to just set a flag in the display driver code when accessing the data lines and just branching out of the IRQ routine while the display is using the lines.

None of this though will prevent user interactions to get lost.

For the encoder this is not that problematic as the user just continues to operate the encoder until the desired action happens. (Reducing the dead-time will improve response...)

For buttons this is a bigger problem. If the IRQ is disabled while the button is pressed/released the event is lost. This leads to either lost key events or key presses getting registered as long presses as the short release pulse is missed.

Therefore currently buttons are polled which allows the level of the line to be monitored at the polling time and not rely on edge transitions but this causes issues when the timebase gets longer as the aquisition routine blocks polling. Switching to DMA for the data aquisition might improve this.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/michar71/DLO-138/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AC822RrXmTZvvQ_7KCbAUIekyYecztxjks5rsoWBgaJpZM4MzN-v .

michar71 commented 7 years ago

Buttons work fine (With polling...) right now. But via IRQ if we miss the falling/rising edge because the IRQ is currently disabled due to Display access the event is gone. But polling gets worse with longer time delays in the sampling routine when it starts to take longer. DMA transfer is the solution for that because it won't block the polling.