mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
FPS clock fix.
* Resetting the counter makes the FPS count jump up.
This commit is contained in:
parent
45e7f055ec
commit
4dec480f83
@ -33,11 +33,6 @@ mp_obj_t py_clock_fps(mp_obj_t clock_obj)
|
|||||||
clock->t_frame++;
|
clock->t_frame++;
|
||||||
clock->t_ticks += (systick_current_millis()-clock->t_start);
|
clock->t_ticks += (systick_current_millis()-clock->t_start);
|
||||||
float fps = 1000.0f / (clock->t_ticks/(float)clock->t_frame);
|
float fps = 1000.0f / (clock->t_ticks/(float)clock->t_frame);
|
||||||
if (clock->t_ticks >= 2000) {
|
|
||||||
// Reset the FPS clock every 2s
|
|
||||||
clock->t_frame = 0;
|
|
||||||
clock->t_ticks = 0;
|
|
||||||
}
|
|
||||||
return mp_obj_new_float(fps);
|
return mp_obj_new_float(fps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user