From 99d65f674d1f5baff08a0827836238c52c31a243 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 10 Sep 2026 23:48:11 +0100 Subject: [PATCH] Fix text running off screen in Sub-GHz and GATT Server screens Sub-GHz Scanner: shorten the peak readout and the hint line. Sub-GHz Spectrum: shorten the centre/span header and show only peak dBm on the right so the two no longer overlap. GATT Server: put the service state on its own line (was overlapping the title), shorten "Serial GATT service (RX/TX)", and cap the last-received text so none of it exceeds 128 px. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01LEaD4ZeAfvWLBUxXp8G11r --- ble_gattsrv/ble_gattsrv.c | 18 +++++++++--------- subghz_scan/subghz_scan.c | 4 ++-- subghz_spectrum/subghz_spectrum.c | 6 ++---- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ble_gattsrv/ble_gattsrv.c b/ble_gattsrv/ble_gattsrv.c index e5fd28e..8e5948e 100644 --- a/ble_gattsrv/ble_gattsrv.c +++ b/ble_gattsrv/ble_gattsrv.c @@ -65,20 +65,20 @@ static void draw_cb(Canvas* c, void* ctx) { canvas_set_font(c, FontPrimary); canvas_draw_str(c, 2, 9, "GATT Server"); canvas_set_font(c, FontSecondary); + canvas_draw_line(c, 0, 11, 127, 11); const char* st = app->status == BtStatusConnected ? "connected" : app->status == BtStatusAdvertising ? "advertising" : app->status == BtStatusOff ? "off" : "unavailable"; - canvas_draw_str_aligned(c, 126, 9, AlignRight, AlignBottom, st); - canvas_draw_line(c, 0, 11, 127, 11); - canvas_draw_str(c, 2, 22, "Serial GATT service (RX/TX)"); - snprintf(buf, sizeof(buf), "RX %lu B TX %lu B", (unsigned long)app->rx_bytes, (unsigned long)app->tx_bytes); - canvas_draw_str(c, 2, 34, buf); - snprintf(buf, sizeof(buf), "Echo: %s (OK toggles)", app->echo ? "on" : "off"); - canvas_draw_str(c, 2, 45, buf); + snprintf(buf, sizeof(buf), "Serial: %s", st); + canvas_draw_str(c, 2, 22, buf); + snprintf(buf, sizeof(buf), "RX %lu B TX %lu B", (unsigned long)app->rx_bytes, (unsigned long)app->tx_bytes); + canvas_draw_str(c, 2, 33, buf); + snprintf(buf, sizeof(buf), "Echo %s OK=toggle", app->echo ? "on" : "off"); + canvas_draw_str(c, 2, 44, buf); if(app->last[0]) { - snprintf(buf, sizeof(buf), "last: %s", app->last); - canvas_draw_str(c, 2, 57, buf); + snprintf(buf, sizeof(buf), "last: %.14s", app->last); + canvas_draw_str(c, 2, 58, buf); } furi_mutex_release(app->mutex); } diff --git a/subghz_scan/subghz_scan.c b/subghz_scan/subghz_scan.c index f57b84b..df7870b 100644 --- a/subghz_scan/subghz_scan.c +++ b/subghz_scan/subghz_scan.c @@ -146,7 +146,7 @@ static void draw_cb(Canvas* c, void* ctx) { (unsigned long)(m->range_end / 1000 % 1000)); canvas_draw_str(c, 2, 20, buf); snprintf( - buf, sizeof(buf), "peak %lu.%03lu MHz %d dBm", (unsigned long)(m->peak_freq / 1000000), + buf, sizeof(buf), "pk %lu.%03luM %ddBm", (unsigned long)(m->peak_freq / 1000000), (unsigned long)(m->peak_freq / 1000 % 1000), (int)m->peak_rssi); canvas_draw_str(c, 2, 29, buf); @@ -159,7 +159,7 @@ static void draw_cb(Canvas* c, void* ctx) { int h = (int)((r + 110) / 70.0f * gh); canvas_draw_line(c, i, gy + gh - h, i, gy + gh); } - canvas_draw_str(c, 2, 63, "OK pause <>band Back exit"); + canvas_draw_str(c, 2, 63, "OK:pause <>:band"); furi_mutex_release(app->mutex); } diff --git a/subghz_spectrum/subghz_spectrum.c b/subghz_spectrum/subghz_spectrum.c index 699fe10..323bebd 100644 --- a/subghz_spectrum/subghz_spectrum.c +++ b/subghz_spectrum/subghz_spectrum.c @@ -95,12 +95,10 @@ static void draw_cb(Canvas* c, void* ctx) { canvas_clear(c); canvas_set_font(c, FontSecondary); snprintf( - buf, sizeof(buf), "%lu.%03lu MHz +-%lu kHz", (unsigned long)(m->center / 1000000), + buf, sizeof(buf), "%lu.%03lu +-%luk", (unsigned long)(m->center / 1000000), (unsigned long)(m->center / 1000 % 1000), (unsigned long)(m->span / 2000)); canvas_draw_str(c, 1, 8, buf); - snprintf( - buf, sizeof(buf), "pk %lu.%03lu %d", (unsigned long)(m->peak_freq / 1000000), - (unsigned long)(m->peak_freq / 1000 % 1000), (int)m->peak_rssi); + snprintf(buf, sizeof(buf), "%ddBm", (int)m->peak_rssi); canvas_draw_str_aligned(c, 127, 8, AlignRight, AlignBottom, buf); // spectrum, top band 10..30