Improved Smeter rendering in MACRO menu
This commit is contained in:
parent
6fdb6b8890
commit
7e0500d3a5
|
|
@ -246,7 +246,8 @@ void gfx_drawBattery(point_t start, uint16_t width, uint16_t height, float perce
|
||||||
* @param height: Smeter height
|
* @param height: Smeter height
|
||||||
* @param rssi: rssi level in dBm
|
* @param rssi: rssi level in dBm
|
||||||
* @param squelch: squelch level in percentage
|
* @param squelch: squelch level in percentage
|
||||||
|
* @param color: color of the squelch and smeter bar
|
||||||
*/
|
*/
|
||||||
void gfx_drawSmeter(point_t start, uint16_t width, uint16_t height, float rssi, float squelch);
|
void gfx_drawSmeter(point_t start, uint16_t width, uint16_t height, float rssi, float squelch, color_t color);
|
||||||
|
|
||||||
#endif /* GRAPHICS_H */
|
#endif /* GRAPHICS_H */
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ void gfx_drawBattery(point_t start, uint16_t width, uint16_t height, float perce
|
||||||
* Width (px)
|
* Width (px)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void gfx_drawSmeter(point_t start, uint16_t width, uint16_t height, float rssi, float squelch) {
|
void gfx_drawSmeter(point_t start, uint16_t width, uint16_t height, float rssi, float squelch, color_t color) {
|
||||||
color_t white = {255, 255, 255, 255};
|
color_t white = {255, 255, 255, 255};
|
||||||
color_t yellow = {250, 180, 19 , 255};
|
color_t yellow = {250, 180, 19 , 255};
|
||||||
color_t red = {255, 0, 0 , 255};
|
color_t red = {255, 0, 0 , 255};
|
||||||
|
|
@ -483,11 +483,11 @@ void gfx_drawSmeter(point_t start, uint16_t width, uint16_t height, float rssi,
|
||||||
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);
|
||||||
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, color, true);
|
||||||
|
|
||||||
// Squelch bar
|
// Squelch bar
|
||||||
uint16_t squelch_height = height / 3 - 1;
|
uint16_t squelch_height = height / 3 - 1;
|
||||||
uint16_t squelch_width = width * squelch;
|
uint16_t squelch_width = width * squelch;
|
||||||
point_t squelch_pos = { start.x, start.y + 1 + rssi_height };
|
point_t squelch_pos = { start.x, start.y + 1 + rssi_height };
|
||||||
gfx_drawRect(squelch_pos, squelch_width, squelch_height, white, true);
|
gfx_drawRect(squelch_pos, squelch_width, squelch_height, color, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ void _ui_drawBottom()
|
||||||
layout.status_v_pad +
|
layout.status_v_pad +
|
||||||
layout.text_v_offset -
|
layout.text_v_offset -
|
||||||
layout.bottom_h };
|
layout.bottom_h };
|
||||||
gfx_drawSmeter(smeter_pos, SCREEN_WIDTH, layout.bottom_h - 1, rssi, squelch);
|
gfx_drawSmeter(smeter_pos, SCREEN_WIDTH, layout.bottom_h - 1, rssi, squelch, color_white);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ui_drawMainVFO()
|
void _ui_drawMainVFO()
|
||||||
|
|
|
||||||
|
|
@ -410,12 +410,19 @@ bool _ui_drawMacroMenu() {
|
||||||
yellow_fab413);
|
yellow_fab413);
|
||||||
gfx_print(layout.line3_pos, "Sav", layout.top_font, TEXT_ALIGN_RIGHT,
|
gfx_print(layout.line3_pos, "Sav", layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
color_white);
|
color_white);
|
||||||
// Squelch bar
|
// Smeter bar
|
||||||
uint16_t squelch_width = SCREEN_WIDTH / 16 * last_state.sqlLevel;
|
float rssi = last_state.rssi;
|
||||||
point_t squelch_pos = { layout.bottom_pos.x, layout.bottom_pos.y +
|
float squelch = last_state.sqlLevel / 16.0f;
|
||||||
layout.status_v_pad +
|
point_t smeter_pos = { 0, layout.bottom_pos.y +
|
||||||
layout.text_v_offset -
|
layout.status_v_pad +
|
||||||
layout.bottom_h };
|
layout.text_v_offset -
|
||||||
gfx_drawRect(squelch_pos, squelch_width, layout.bottom_h, color_white, true);
|
layout.bottom_h };
|
||||||
|
gfx_drawSmeter(smeter_pos,
|
||||||
|
SCREEN_WIDTH,
|
||||||
|
layout.bottom_h - 1,
|
||||||
|
rssi,
|
||||||
|
squelch,
|
||||||
|
yellow_fab413);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue