From 2015f1725c63c035cfe1511e06ec04c3639aa8ee Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Tue, 22 Dec 2020 10:52:12 +0100 Subject: [PATCH] Added high output level slider --- sa_core.c | 11 ++++++++--- ui.c | 31 ++++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/sa_core.c b/sa_core.c index 6c4dc59..dc7cb68 100644 --- a/sa_core.c +++ b/sa_core.c @@ -470,7 +470,7 @@ static pureRSSI_t get_signal_path_loss(void){ static const int drive_dBm [16] = {-38,-35,-33,-30,-27,-24,-21,-19,-7,-4,-2, 1, 4, 7, 10, 13}; -void set_level(float v) // Set the drive level of the LO +void set_level(float v) // Set the output level in dB in high/low output { if (setting.mode == M_GENHIGH) { int d = 0; @@ -486,7 +486,7 @@ void set_level(float v) // Set the drive level of the LO dirty = true; } -void set_attenuation(float a) // Is used both in output mode and input mode +void set_attenuation(float a) // Is used both in low output mode and high/low input mode { if (setting.mode == M_GENLOW) { a = a + POWER_OFFSET; @@ -1781,8 +1781,13 @@ modulation_again: local_IF = DEFAULT_IF; if (setting.mode == M_LOW) { if (tracking) { // VERY SPECIAL CASE!!!!! Measure BPF +#if 0 // Isolation test + local_IF = lf; + lf = 0; +#else local_IF += lf - reffer_freq[setting.refer]; // Offset so fundamental of reffer is visible lf = reffer_freq[setting.refer]; +#endif } else { if(!in_selftest && avoid_spur(lf)) { // check if alternate IF is needed to avoid spur. local_IF = spur_alternate_IF; @@ -1848,7 +1853,7 @@ modulation_again: #endif { // Else set LO ('s) uint32_t target_f; - if (setting.mode == M_LOW && !setting.tracking && S_STATE(setting.below_IF)) // if in low input mode and below IF + if (setting.mode == M_LOW && !setting.tracking && S_STATE(setting.below_IF)) // if in low input mode and below IF target_f = local_IF-lf; // set LO SI4432 to below IF frequency else target_f = local_IF+lf; // otherwise to above IF diff --git a/ui.c b/ui.c index 7ef4597..5b47534 100644 --- a/ui.c +++ b/ui.c @@ -1831,10 +1831,22 @@ draw_menu_buttons(const menuitem_t *menu) blit8BitWidthBitmap(button_start+MENU_FORM_WIDTH- FORM_ICON_WIDTH-8,y+(button_height-FORM_ICON_HEIGHT)/2,FORM_ICON_WIDTH,FORM_ICON_HEIGHT,&right_icons[((menu[i].data >>0)&0xf)*2*FORM_ICON_HEIGHT]); } #endif - if (menu[i].type && MT_KEYPAD && menu[i].data == KM_CENTER) - blit8BitWidthBitmap(LCD_WIDTH/2+slider_position - 4, y, 7, 6, slider_bitmap); - if (menu[i].type && MT_KEYPAD && menu[i].data == KM_LOWOUTLEVEL) - blit8BitWidthBitmap(LCD_WIDTH/2+volume_slider_position - 4, y, 7, 6, slider_bitmap); + if (MT_MASK(menu[i].type) == MT_KEYPAD) { + if (menu[i].data == KM_CENTER) { + volume_slider_position = LCD_WIDTH/2+slider_position; + goto draw_slider; +// blit8BitWidthBitmap(LCD_WIDTH/2+slider_position - 4, y, 7, 6, slider_bitmap); + } else if (menu[i].data == KM_LOWOUTLEVEL) { + volume_slider_position = (get_attenuation() + 76 ) * MENU_FORM_WIDTH / 70 + OFFSETX; + goto draw_slider; +// blit8BitWidthBitmap(volume_slider_position - 4, y, 7, 6, slider_bitmap); + } + } + if (MT_MASK(menu[i].type) == MT_ADV_CALLBACK && menu[i].reference == menu_sdrive_acb) { + volume_slider_position = (menu_drive_value[setting.lo_drive] + 38 ) * MENU_FORM_WIDTH / 51 + OFFSETX; + draw_slider: + blit8BitWidthBitmap(volume_slider_position - 4, y, 7, 6, slider_bitmap); + } // ili9341_line(LCD_WIDTH/2+slider_position, y, LCD_WIDTH/2+slider_position,y+button_height); } else { int button_width = MENU_BUTTON_WIDTH; @@ -1957,15 +1969,16 @@ menu_select_touch(int i) while (pw-->0) slider_delta *=10; #endif - }else if (menu_is_form(menu) && MT_MASK(menu[i].type) == MT_KEYPAD && keypad == KM_LOWOUTLEVEL) { -// if (touch_x != prev_touch_x /* - 1 || prev_touch_x + 1 < touch_x */ ) { - uistat.value = setting.offset + touch_x *( -6 - -76) / MENU_FORM_WIDTH + -76; - volume_slider_position = new_slider; + } else if (menu_is_form(menu) && MT_MASK(menu[i].type) == MT_KEYPAD && keypad == KM_LOWOUTLEVEL) { + uistat.value = setting.offset + (touch_x - OFFSETX) *( -6 - -76) / MENU_FORM_WIDTH + -76; set_keypad_value(keypad); + apply: perform(false, 0, get_sweep_frequency(ST_CENTER), false); draw_menu(); // } - + } else if (MT_MASK(menu[i].type) == MT_ADV_CALLBACK && menu[i].reference == menu_sdrive_acb) { + set_level( (touch_x - OFFSETX) *( 13 - -38) / MENU_FORM_WIDTH + -38 ); + goto apply; } keypad_mode = old_keypad_mode; }