Reduced smeter width, fix max RSSI representation

This commit is contained in:
Niccolò Izzo 2021-02-08 23:14:12 +01:00
parent e35870a40f
commit 3017ff1f3a
3 changed files with 20 additions and 12 deletions

View File

@ -551,13 +551,13 @@ void gfx_drawSmeter(point_t start, uint16_t width, uint16_t height, float rssi,
{ {
color_t color = (i % 3 == 0) ? yellow : white; color_t color = (i % 3 == 0) ? yellow : white;
color = (i > 9) ? red : color; color = (i > 9) ? red : color;
point_t pixel_pos = {i * (width - 1) / 11, start.y}; point_t pixel_pos = {start.x + i * (width - 1) / 11, start.y};
gfx_setPixel(pixel_pos, color); gfx_setPixel(pixel_pos, color);
pixel_pos.y += height; pixel_pos.y += height;
gfx_setPixel(pixel_pos, color); gfx_setPixel(pixel_pos, color);
} }
point_t pixel_pos = {width - 1, start.y}; point_t pixel_pos = {start.x + width - 1, start.y};
gfx_setPixel(pixel_pos, red); gfx_setPixel(pixel_pos, red);
pixel_pos.y += height; pixel_pos.y += height;
gfx_setPixel(pixel_pos, red); gfx_setPixel(pixel_pos, red);
@ -566,6 +566,7 @@ void gfx_drawSmeter(point_t start, uint16_t width, uint16_t height, float rssi,
uint16_t rssi_height = height * 2 / 3; uint16_t rssi_height = height * 2 / 3;
float s_level = (127.0f + rssi) / 6.0f; float s_level = (127.0f + rssi) / 6.0f;
uint16_t rssi_width = (s_level < 0.0f) ? 0 : (s_level * (width - 1) / 11); uint16_t rssi_width = (s_level < 0.0f) ? 0 : (s_level * (width - 1) / 11);
rssi_width = (s_level > 10.0f) ? width : rssi_width;
point_t rssi_pos = { start.x, start.y + 1 }; point_t rssi_pos = { start.x, start.y + 1 };
gfx_drawRect(rssi_pos, rssi_width, rssi_height, white, true); gfx_drawRect(rssi_pos, rssi_width, rssi_height, white, true);

View File

@ -156,11 +156,17 @@ void _ui_drawBottom()
// Squelch bar // Squelch bar
float rssi = last_state.rssi; float rssi = last_state.rssi;
float squelch = last_state.sqlLevel / 16.0f; float squelch = last_state.sqlLevel / 16.0f;
point_t smeter_pos = { 0, layout.bottom_pos.y + point_t smeter_pos = { layout.horizontal_pad,
layout.status_v_pad + layout.bottom_pos.y +
layout.text_v_offset - layout.status_v_pad +
layout.bottom_h }; layout.text_v_offset -
gfx_drawSmeter(smeter_pos, SCREEN_WIDTH, layout.bottom_h - 1, rssi, squelch, color_white); layout.bottom_h };
gfx_drawSmeter(smeter_pos,
SCREEN_WIDTH - 2 * layout.horizontal_pad,
layout.bottom_h - 1,
rssi,
squelch,
color_white);
} }
void _ui_drawMainVFO() void _ui_drawMainVFO()

View File

@ -510,12 +510,13 @@ bool _ui_drawMacroMenu() {
// Smeter bar // Smeter bar
float rssi = last_state.rssi; float rssi = last_state.rssi;
float squelch = last_state.sqlLevel / 16.0f; float squelch = last_state.sqlLevel / 16.0f;
point_t smeter_pos = { 0, layout.bottom_pos.y + point_t smeter_pos = { layout.horizontal_pad,
layout.status_v_pad + layout.bottom_pos.y +
layout.text_v_offset - layout.status_v_pad +
layout.bottom_h }; layout.text_v_offset -
layout.bottom_h };
gfx_drawSmeter(smeter_pos, gfx_drawSmeter(smeter_pos,
SCREEN_WIDTH, SCREEN_WIDTH - 2 * layout.horizontal_pad,
layout.bottom_h - 1, layout.bottom_h - 1,
rssi, rssi,
squelch, squelch,