dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Tick accuracy
From: Johan Vromans (
Date: 2003-04-30

Just wondering...

apps/screens.c, usb_screen:

    while(usb_wait_for_disconnect_w_tmo(&button_queue, HZ)) {
        if(usb_inserted()) {

This would call status_draw() once every HZ (100) ticks.

apps/status.c, status_draw:

                if(TIME_AFTER(current_tick, switch_tick)) {
                    switch_tick = current_tick + HZ;

Assuming it is called on tick 0, switch_tick is set to 100.
The next time it is called, current_tick is 100 so battery_charge_step
is not changed.
The next time it is called, current_tick is 200 so this code is
executed, and switch_tick is set to 300.
And so on.

In other words, the code that is assumed to be executed every 100
ticks is only executed every 200 ticks.

Is that correct? Am I overlooking something?
Peculiar thing is I do not _see_ this happening in the pre-build 2.0
version, but I _do_ see it in the CVS versions I build myself.

-- Johan

Page was last modified "Jan 10 2012" The Rockbox Crew