SHOW BANDS: the band table is highlighted with its names when multi band is off (issue #169)

main
erikkaashoek 1 week ago
parent a62fa7ddc5
commit ee691b49f2

@ -1912,7 +1912,6 @@ extern int current_index;
extern uint16_t actual_rbw_x10;
void toggle_tracking(void);
void toggle_hambands(void);
void reset_calibration(void);
void set_reflevel(float);
void set_external_gain(float);

@ -255,7 +255,16 @@ const int ham_band_max = 18;
int ham_band(int x) // Search which index in the frequency tabled matches with frequency f using actual_rbw
{
freq_t f = getFrequency(x) + (setting.frequency_offset - FREQUENCY_SHIFT);
freq_t f = getFrequency(x);
#ifdef __BANDS__
if ((config.hambands & 2) && !setting.multi_band) // band table
for (int i = 0; i < BANDS_MAX; i++)
if (setting.bands[i].enabled && setting.bands[i].start <= f && f <= setting.bands[i].end)
return true;
if (!(config.hambands & 1))
return false;
#endif
f += (setting.frequency_offset - FREQUENCY_SHIFT);
int L = 0;
int R = ham_band_max - 1;
while (L <= R) {
@ -1235,6 +1244,20 @@ draw_cell(int m, int n)
// PULSE;
#endif
#ifdef __BANDS__
// Band table highlights (ham_band): name at the bottom left of each band
if ((config.hambands & 2) && !setting.multi_band && y0 + h >= HEIGHT - 12) {
ili9341_set_foreground(LCD_FG_COLOR);
for (int band = 0; band < BANDS_MAX; band++) {
band_t *b = &setting.bands[band];
if (!b->enabled || b->start > getFrequency(sweep_points - 1) || b->end < getFrequency(0)) continue;
i = 0;
while (getFrequency(i) < b->start) i++;
cell_printf(trace_index_x[i] + 2 - x0, HEIGHT - 12 - y0, "%s", b->name);
}
}
#endif
// Draw trigger and band splitter lines
bool draw_trigger = (setting.trigger != T_AUTO
#ifdef __TRIGGER_TRACE__

@ -1115,12 +1115,6 @@ void toggle_mute(void)
dirty = true;
}
void toggle_hambands(void)
{
config.hambands = !config.hambands;
dirty = true;
}
void toggle_below_IF(void)
{
if (S_IS_AUTO(setting.below_IF ))

11
ui.c

@ -4134,14 +4134,14 @@ static UI_FUNCTION_ADV_CALLBACK(menu_settings_draw_line_acb){
}
#endif
#ifdef __HAM_BAND__
// data: 1 = HAM bands, 2 = band table (multi band off)
static UI_FUNCTION_ADV_CALLBACK(menu_settings_ham_bands){
(void)item;
(void)data;
if(b){
b->icon = config.hambands ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
b->icon = config.hambands & data ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
return;
}
toggle_hambands();
config.hambands ^= data;
redraw_request|= REDRAW_AREA;
}
#endif
@ -5268,7 +5268,8 @@ static const menuitem_t menu_settings[] =
{ MT_CALLBACK, FMT_BIN_FILE, "DUMP\nFIRMWARE", menu_sdcard_cb},
#endif
#ifdef __HAM_BAND__
{ MT_ADV_CALLBACK, 0, "HAM\nBANDS", menu_settings_ham_bands},
{ MT_ADV_CALLBACK, 1, "HAM\nBANDS", menu_settings_ham_bands},
{ MT_ADV_CALLBACK, 2, "SHOW\nBANDS", menu_settings_ham_bands},
#endif
#ifdef __SD_CARD_LOAD__
{ MT_CALLBACK, 0 , "LOAD\nCONFIG.INI", menu_load_config_cb},
@ -5442,7 +5443,7 @@ static const menuitem_t menu_config2[] =
{ MT_SUBMENU, 0, "EXPERT\nCONFIG", menu_settings},
#else
#ifdef __HAM_BAND__
{ MT_ADV_CALLBACK, 0, "HAM\nBANDS", menu_settings_ham_bands},
{ MT_ADV_CALLBACK, 1, "HAM\nBANDS", menu_settings_ham_bands},
#endif
{ MT_SUBMENU, 0, "EXPERT\nCONFIG", menu_settings2},
#endif

Loading…
Cancel
Save

Powered by TurnKey Linux.