mirror of
https://github.com/LegitCamper/picocalc-os-rs.git
synced 2025-12-27 07:45:28 +00:00
fix false fps reading
This commit is contained in:
@@ -93,11 +93,6 @@ pub async fn display_handler(mut display: DISPLAY) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "fps")]
|
|
||||||
if unsafe { FPS_COUNTER.should_draw() } {
|
|
||||||
fps::draw_fps(&mut display).await;
|
|
||||||
}
|
|
||||||
|
|
||||||
// small yield to allow other tasks to run
|
// small yield to allow other tasks to run
|
||||||
Timer::after_millis(10).await;
|
Timer::after_millis(10).await;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,6 +175,9 @@ impl<'a> AtomicFrameBuffer<'a> {
|
|||||||
return self.draw(display).await;
|
return self.draw(display).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "fps")]
|
||||||
|
let mut any_drawn = false;
|
||||||
|
|
||||||
for tile_row in 0..NUM_TILE_ROWS {
|
for tile_row in 0..NUM_TILE_ROWS {
|
||||||
let row_start_idx = tile_row * NUM_TILE_COLS;
|
let row_start_idx = tile_row * NUM_TILE_COLS;
|
||||||
let mut col = 0;
|
let mut col = 0;
|
||||||
@@ -215,6 +218,10 @@ impl<'a> AtomicFrameBuffer<'a> {
|
|||||||
&self.batch_tile_buf[..run_len * TILE_SIZE * TILE_SIZE],
|
&self.batch_tile_buf[..run_len * TILE_SIZE * TILE_SIZE],
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
if cfg!(feature = "fps") {
|
||||||
|
any_drawn = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
col += 1;
|
col += 1;
|
||||||
@@ -222,8 +229,8 @@ impl<'a> AtomicFrameBuffer<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "fps")]
|
#[cfg(feature = "fps")]
|
||||||
unsafe {
|
if any_drawn {
|
||||||
crate::display::FPS_COUNTER.measure()
|
unsafe { crate::display::FPS_COUNTER.measure() }
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user