From d3f4ef5dc1791f0c93d23c16bf43dee075f246ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D1=88=D0=AB=D0=B4=D1=89=D0=BA=D0=B2?= Date: Sun, 26 Jan 2020 09:09:11 +0300 Subject: [PATCH] Fix my tupo on frequency string --- plot.c | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/plot.c b/plot.c index 371907b..fe167ea 100644 --- a/plot.c +++ b/plot.c @@ -1841,31 +1841,29 @@ frequency_string_short(char *b, size_t len, int32_t freq, char prefix) void draw_frequencies(void) { - char buf1[24];buf1[0]=' '; - char buf2[24]; - if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) { - if (frequency0 < frequency1) { - frequency_string(buf1+1, sizeof(buf1)-1, frequency0, "START "); - frequency_string(buf2, sizeof buf2, frequency1, "STOP "); - } else if (frequency0 > frequency1) { - frequency_string(buf1+1, sizeof(buf1)-1, frequency0/2 + frequency1/2, "CENTER "); - frequency_string(buf2, sizeof buf2, frequency0 - frequency1, "SPAN "); - } else { - frequency_string(buf1+1, sizeof(buf1)-1, frequency0, "CW "); - } - - } else { - chsnprintf(buf1+1, sizeof(buf1)-1, "START 0s"); - chsnprintf(buf2, sizeof buf2, "%s%dns (%.2fm)", "STOP ", (uint16_t)(time_of_index(POINTS_COUNT-1) * 1e9), distance_of_index(POINTS_COUNT-1)); - } - setForegroundColor(DEFAULT_FG_COLOR); - setBackgroundColor(DEFAULT_BG_COLOR); - ili9341_fill(0, 232, 320, 8, DEFAULT_BG_COLOR); - if (uistat.lever_mode == LM_SPAN || uistat.lever_mode == LM_CENTER) - buf1[0] = S_SARROW[0]; - ili9341_drawstring(buf1, OFFSETX, 232); - ili9341_drawstring(buf2, 205, 232); - + char buf1[24];buf1[0]=' '; + char buf2[24];buf2[0]=0; + if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) { + if (frequency0 < frequency1) { + frequency_string(buf1+1, sizeof(buf1)-1, frequency0, "START "); + frequency_string(buf2, sizeof buf2, frequency1, "STOP "); + } else if (frequency0 > frequency1) { + frequency_string(buf1+1, sizeof(buf1)-1, frequency0/2 + frequency1/2, "CENTER "); + frequency_string(buf2, sizeof buf2, frequency0 - frequency1, "SPAN "); + } else { + frequency_string(buf1+1, sizeof(buf1)-1, frequency0, "CW "); + } + } else { + chsnprintf(buf1+1, sizeof(buf1)-1, "START 0s"); + chsnprintf(buf2, sizeof buf2, "%s%dns (%.2fm)", "STOP ", (uint16_t)(time_of_index(POINTS_COUNT-1) * 1e9), distance_of_index(POINTS_COUNT-1)); + } + setForegroundColor(DEFAULT_FG_COLOR); + setBackgroundColor(DEFAULT_BG_COLOR); + ili9341_fill(0, 232, 320, 8, DEFAULT_BG_COLOR); + if (uistat.lever_mode == LM_SPAN || uistat.lever_mode == LM_CENTER) + buf1[0] = S_SARROW[0]; + ili9341_drawstring(buf1, OFFSETX, 232); + ili9341_drawstring(buf2, 205, 232); } void