Add high mode specific attenuation menu

pull/4/head
erikkaashoek 6 years ago
parent e2bbfe8b13
commit acf2e93401

@ -66,7 +66,7 @@ void reset_settings(int m)
setting.average = 0;
setting.harmonic = 0;
setting.show_stored = 0;
setting.auto_attenuation = true;
setting.auto_attenuation = false;
setting.subtract_stored = 0;
setting.drive=13;
setting.atten_step = 0; // Only used in low output mode
@ -105,6 +105,7 @@ void reset_settings(int m)
set_sweep_frequency(ST_START, (uint32_t) 0);
set_sweep_frequency(ST_STOP, (uint32_t) 350000000);
setting.attenuate = 30.0;
setting.auto_attenuation = true;
setting.sweep_time_us = 0;
break;
#ifdef __ULTRA__
@ -854,13 +855,13 @@ void setupSA(void)
PE4302_Write_Byte(0);
setting.sweep_time_us = 0;
START_PROFILE
START_PROFILE // measure 90 points to get overhead
SI4432_Fill(0,200);
int t1 = DELTA_TIME;
RESTART_PROFILE
RESTART_PROFILE // measure 290 points to get real added time for 200 points
SI4432_Fill(0,0);
int t2 = DELTA_TIME;
t = (t2 - t1) * 100 * 290 / 200;
t = (t2 - t1) * 100 * POINTS_COUNT / 200; // And calculate real time excluding overhead for all points
}
extern int SI4432_frequency_changed;
extern int SI4432_offset_changed;

11
ui.c

@ -444,6 +444,7 @@ enum {
MT_CLOSE,
MT_KEYPAD,
MT_ICON = 0x10,
MT_HIGH = 0x20, // Only applicable to high mode
MT_LOW = 0x40, // Only applicable to low mode
MT_FORM = 0x80, // Large button menu
};
@ -1576,6 +1577,8 @@ draw_menu_buttons(const menuitem_t *menu)
const char *l1, *l2;
if ((menu[i].type & MT_LOW) && !MODE_LOW(setting.mode)) //not applicable to mode
continue;
if ((menu[i].type & MT_HIGH) && !MODE_HIGH(setting.mode)) //not applicable to mode
continue;
if (MT_MASK(menu[i].type) == MT_NONE)
break;
if (MT_MASK(menu[i].type) == MT_BLANK)
@ -1678,6 +1681,8 @@ menu_apply_touch(void)
for (i = 0; i < MENU_BUTTON_MAX; i++) {
if ((menu[i].type & MT_LOW) && !MODE_LOW(setting.mode)) //not applicable to mode
continue;
if ((menu[i].type & MT_HIGH) && !MODE_HIGH(setting.mode)) //not applicable to mode
continue;
if (MT_MASK(menu[i].type) == MT_NONE)
break;
if (MT_MASK(menu[i].type == MT_BLANK) || MT_MASK(menu[i].type) == MT_TITLE) {
@ -2074,7 +2079,8 @@ ui_process_menu(void)
do {
if (status & EVT_UP) {
// close menu if next item is sentinel
while ((menu_stack[menu_current_level][selection+1].type & MT_LOW) && !MODE_LOW(setting.mode))
while (((menu_stack[menu_current_level][selection+1].type & MT_LOW) && !MODE_LOW(setting.mode) ) ||
((menu_stack[menu_current_level][selection+1].type & MT_HIGH) && !MODE_HIGH(setting.mode)))
selection++;
if (menu_stack[menu_current_level][selection+1].type == MT_NONE)
goto menuclose;
@ -2082,7 +2088,8 @@ ui_process_menu(void)
selection++;
}
if (status & EVT_DOWN) {
while ((menu_stack[menu_current_level][selection+1].type & MT_LOW) && !MODE_LOW(setting.mode))
while (((menu_stack[menu_current_level][selection+1].type & MT_LOW) && !MODE_LOW(setting.mode) ) ||
((menu_stack[menu_current_level][selection+1].type & MT_HIGH) && !MODE_HIGH(setting.mode)))
selection--;
if (! ( selection == 0 && menu_stack[menu_current_level][0].type & MT_FORM))
selection--;

@ -870,6 +870,15 @@ static void menu_atten_cb(int item, uint8_t data)
ui_mode_normal();
}
static void menu_atten_high_cb(int item, uint8_t data)
{
(void)item;
setting.auto_attenuation = false;
set_attenuation(data);
menu_move_back();
ui_mode_normal();
}
static void menu_reflevel_cb(int item, uint8_t data)
{
(void)item;
@ -1286,13 +1295,14 @@ static const menuitem_t menu_reffer[] = {
};
static const menuitem_t menu_atten[] = {
{ MT_CALLBACK,0, "AUTO", menu_atten_cb},
{ MT_KEYPAD, KM_ATTENUATION, "MANUAL", "0..30"},
{ MT_CALLBACK | MT_LOW, 0, "AUTO", menu_atten_cb},
{ MT_KEYPAD | MT_LOW, KM_ATTENUATION, "MANUAL", "0..30"},
{ MT_CALLBACK | MT_HIGH,0, "0dB", menu_atten_high_cb},
{ MT_CALLBACK | MT_HIGH,30, "30dB", menu_atten_high_cb},
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_FORM | MT_NONE, 0, NULL, NULL } // sentinel
};
static const menuitem_t menu_reflevel[] = {
{ MT_CALLBACK,0, "AUTO", menu_reflevel_cb},
{ MT_KEYPAD, KM_REFLEVEL, "MANUAL", NULL},
@ -1723,8 +1733,16 @@ static void menu_item_modify_attribute(
if ((item == 0 && setting.auto_reflevel) || (item == 1 && !setting.auto_reflevel))
mark = true;
} else if (menu == menu_atten) {
if ((item == 0 && setting.auto_attenuation ) || (item == 1 && !setting.auto_attenuation))
if ((item == 0 && setting.auto_attenuation ))
mark = true;
if (!setting.auto_attenuation) {
if (item == 1)
mark = true;
if (item == 2 && !setting.atten_step)
mark = true;
if (item == 3 && setting.atten_step)
mark = true;
}
}
if (m_auto) {
*bg = LIGHT_GREY;

Loading…
Cancel
Save

Powered by TurnKey Linux.