Fix "AUTO" button

pull/42/head
erikkaashoek 3 years ago
parent e2a33788bb
commit 70ebdddedf

@ -302,7 +302,7 @@ clean:
rm -f -rf build/tinySA4.* build/lst/*.* build/obj/*.* rm -f -rf build/tinySA4.* build/lst/*.* build/obj/*.*
else else
clean: clean:
rm -f -rf build/$(PROJECT).* rm -f -rf build/$(PROJECT).* build/lst/*.* build/obj/*.*
endif endif
flash: build/$(PROJECT).bin flash: build/$(PROJECT).bin

@ -1201,6 +1201,8 @@ draw_menu_buttons(const menuitem_t *menu, uint32_t mask)
ui_button_t button; ui_button_t button;
const menuitem_t *m = menu; const menuitem_t *m = menu;
int sub_item = 0; int sub_item = 0;
// while (menuDisabled(m->type))
// m = menu_next_item(m, &sub_item); // Just in case the first item is disabled
for (i = 0, y = 0; m; m = menu_next_item(m, &sub_item), i++, y += menu_button_height) { for (i = 0, y = 0; m; m = menu_next_item(m, &sub_item), i++, y += menu_button_height) {
if ((mask&(1<<i)) == 0) if ((mask&(1<<i)) == 0)
continue; continue;
@ -1513,6 +1515,8 @@ menu_apply_touch(int touch_x, int touch_y)
// active_button_stop = LCD_WIDTH; // active_button_stop = LCD_WIDTH;
} }
int sub_item = 0; int sub_item = 0;
// while (menuDisabled(m->type))
// m = menu_next_item(m, &sub_item); // Just in case the first item is disabled
for (i = 0; m; m = menu_next_item(m,&sub_item), i++, y+= menu_button_height) { for (i = 0; m; m = menu_next_item(m,&sub_item), i++, y+= menu_button_height) {
if (MT_MASK(m->type) == MT_TITLE) continue; if (MT_MASK(m->type) == MT_TITLE) continue;
if (y < touch_y && touch_y < y+menu_button_height && touch_x > active_button_start) { if (y < touch_y && touch_y < y+menu_button_height && touch_x > active_button_start) {

@ -1840,9 +1840,20 @@ static UI_FUNCTION_ADV_CALLBACK(menu_atten_acb)
(void)item; (void)item;
(void)data; (void)data;
if(b){ if(b){
if (MODE_HIGH(setting.mode)) {
b->param_1.text = "0dB";
b->icon = (setting.atten_step*30 == data) ? BUTTON_ICON_GROUP_CHECKED : BUTTON_ICON_GROUP;
}
else {
b->param_1.text = "AUTO";
b->icon = setting.auto_attenuation ? BUTTON_ICON_GROUP_CHECKED : BUTTON_ICON_GROUP; b->icon = setting.auto_attenuation ? BUTTON_ICON_GROUP_CHECKED : BUTTON_ICON_GROUP;
}
return; return;
} }
if (MODE_HIGH(setting.mode)) {
setting.auto_attenuation = false;
set_attenuation(0);
} else
set_auto_attenuation(); set_auto_attenuation();
menu_move_back(true); menu_move_back(true);
} }
@ -2866,9 +2877,9 @@ static const menuitem_t menu_reffer[] = {
}; };
static const menuitem_t menu_atten[] = { static const menuitem_t menu_atten[] = {
{ MT_ADV_CALLBACK | MT_LOW, 0, "AUTO", menu_atten_acb}, { MT_ADV_CALLBACK, 0, "%s", menu_atten_acb},
{ MT_KEYPAD | MT_LOW, KM_ATTENUATION, "MANUAL\n\b%s", "0 - 30dB"}, { MT_KEYPAD | MT_LOW, KM_ATTENUATION, "MANUAL\n\b%s", "0 - 30dB"},
{ MT_ADV_CALLBACK | MT_HIGH,0, "0dB", menu_atten_high_acb}, // { MT_ADV_CALLBACK | MT_HIGH,0, "0dB", menu_atten_high_acb},
{ MT_ADV_CALLBACK | MT_HIGH,30, "22.5 - 40dB", menu_atten_high_acb}, { MT_ADV_CALLBACK | MT_HIGH,30, "22.5 - 40dB", menu_atten_high_acb},
{ MT_FORM | MT_NONE, 0, NULL, menu_back} // next-> menu_back { MT_FORM | MT_NONE, 0, NULL, menu_back} // next-> menu_back
}; };

Loading…
Cancel
Save

Powered by TurnKey Linux.