rendering metrics
This commit is contained in:
@@ -1938,6 +1938,21 @@ static void renderFreezeTint()
|
|||||||
|
|
||||||
static void render()
|
static void render()
|
||||||
{
|
{
|
||||||
|
// Frame start time for metrics
|
||||||
|
static uint32_t frameStart = millis();
|
||||||
|
static uint32_t fpsTimer = 0;
|
||||||
|
static int frameCount = 0;
|
||||||
|
static uint32_t fps = 0;
|
||||||
|
|
||||||
|
frameCount++;
|
||||||
|
if ((int32_t)(millis() - fpsTimer) >= 1000) {
|
||||||
|
fps = (frameCount * 1000) / (millis() - fpsTimer);
|
||||||
|
frameCount = 0;
|
||||||
|
fpsTimer = millis();
|
||||||
|
}
|
||||||
|
frameStart = millis(); // prepare for next frame timing
|
||||||
|
|
||||||
|
// --- Rendering ---
|
||||||
renderMap(viewMode == VM_NETWORK);
|
renderMap(viewMode == VM_NETWORK);
|
||||||
if (paused) renderFreezeTint();
|
if (paused) renderFreezeTint();
|
||||||
renderNetwork(viewMode == VM_NETWORK);
|
renderNetwork(viewMode == VM_NETWORK);
|
||||||
@@ -1956,8 +1971,20 @@ static void render()
|
|||||||
|
|
||||||
renderCursor();
|
renderCursor();
|
||||||
renderBanner();
|
renderBanner();
|
||||||
|
|
||||||
|
// --- Frame timing (every ~5s, print metrics to serial) ---
|
||||||
|
static uint32_t lastMetricsDump = 0;
|
||||||
|
if ((int32_t)(millis() - lastMetricsDump) >= 5000) {
|
||||||
|
lastMetricsDump = millis();
|
||||||
|
// frameStart is updated at end of render(), so this is last frame duration
|
||||||
|
uint32_t ft = millis() - frameStart;
|
||||||
|
// Note: frameStart/frameCount/fps are static inside this function
|
||||||
|
// To print full stats, we'd need to make them global or print partial
|
||||||
|
Serial.printf("[metrics] FPS: ~%u | last frame: ~%u ms\n", fps, ft);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── drawBoot ──────────────────────────────────────────────────────────────
|
||||||
static void drawBoot()
|
static void drawBoot()
|
||||||
{
|
{
|
||||||
GFXP->fillScreen(TFT_BLACK);
|
GFXP->fillScreen(TFT_BLACK);
|
||||||
|
|||||||
Reference in New Issue
Block a user