c3d / db48x

RPL runtime for the DM42 calculator, in the spirit of HP48/49/50
http://48calc.org
GNU Lesser General Public License v3.0
90 stars 11 forks source link

Screen refresh broken? #992

Closed mahi2003 closed 3 months ago

mahi2003 commented 4 months ago

I know the calculator slows down screen refreshes after inactivity — power savings. Initially it updates the screen every second, after a short while every 3 seconds, somewhat later every 10 seconds and then only once a minute.

I think it's supposed to reset the refresh timer to update every second after a key press, but that does not seem to work in all cases. In fact, it seems that quite often pressing a key can disable the screen refresh entirely until the next key press.

  1. Turn on seconds in the status bar. I do not recommend that, but it gives much faster feedback of screen updates.

  2. While the clock is ticking, press the Up arrow button. The clock freezes (if it doesn't, try again). You can wait for minutes, it stays frozen. Inserting or removing the USB cable does not update the battery/voltage either. There's nothing special about the Up button - you can reproduce it with other buttons - but the Up button does not yet have a function assigned when on the stack, so it is very consistent.

  3. Press 1. The clock starts ticking again. If you wait refreshes will slow down again, but you don't have to wait that long.

  4. Press ENTER. The clock is frozen again.

  5. Press and hold EXIT for about a second. You may have to try a few times, but eventually the clock will start ticking again.

If you play a bit with the calculator, you'll find that it's easier to freeze the clock than to keep it running.

Note that entry mode seems to be immune for the issue.

One could argue that the calculator does not really need screen updates outside entry mode, but that renders the clock a bit useless (even without seconds) and it's a bit annoying the battery/voltage status does not update when inserting/removing the USB cable.

c3d commented 4 months ago

Thanks for the report, @mahi2003.

Screen refresh is a delicate balance between avoiding consuming power when not needed and providing useful feedback.

Refreshing when USB power changes state is a good idea. I'll try to find a way to do that. That being said, I am not sure if the calculator even wakes up when the power changes state and nothing else does. I'll need to check that.

The "Up" scenario is interesting. You hear a beep when you do that, indicating that there is no action associated with the key in that context. I think that there is a path where the refresh timer is not restarted in that case.

This appears somewhat independent from the right shift refresh issue you reported in #991, but the two might be indirectly related. I'll tell you more when I investigate in depth.

c3d commented 4 months ago

The problem does not reproduce on simulator, so there is a discrepancy between the simulator's implementation of timers and what happens on DMCP.

mahi2003 commented 3 months ago

✔️ Confirmed fixed in 0.7.9!