diff --git a/main.c b/main.c index 890981d..d4dcc2d 100644 --- a/main.c +++ b/main.c @@ -687,7 +687,7 @@ get_sweep_frequency(int type) } else { switch (type) { case ST_START: return frequency0 + frequency1/2; - case ST_STOP: return frequency1 - frequency1/2; + case ST_STOP: return frequency0 - frequency1/2; case ST_CENTER: return frequency0; case ST_SPAN: return -frequency1; case ST_CW: return frequency0; diff --git a/ui.c b/ui.c index 59d2235..81e9e8f 100644 --- a/ui.c +++ b/ui.c @@ -1487,11 +1487,41 @@ keypad_apply_touch(void) return -1; } +void +numeric_apply_touch(void) +{ + int touch_x, touch_y; + int i = 0; + + touch_position(&touch_x, &touch_y); + + if (touch_x < 64) { + ui_mode_normal(); + return; + } + if (touch_y < 240-32) { + ui_mode_normal(); + return; + } + if (touch_x > 64+9*20+8+8) { + ui_mode_keypad(keypad_mode); + ui_process_keypad(); + return; + } + + i = 9 - (touch_x - 64) / 20; + if (uistat.digit != i) { + uistat.digit = i; + draw_numeric_area(); + } + return; +} void ui_process_numeric(void) { int status = btn_check(); + if (status != 0) { if (status == EVT_BUTTON_SINGLE_CLICK) { status = btn_wait_release(); @@ -1517,9 +1547,7 @@ ui_process_numeric(void) uistat.digit++; draw_numeric_area(); } else { - // cancel operation - ui_mode_normal(); - break; + goto exit; } } if (status & EVT_UP) { @@ -1527,9 +1555,7 @@ ui_process_numeric(void) uistat.digit--; draw_numeric_area(); } else { - // cancel operation - ui_mode_normal(); - break; + goto exit; } } } else { @@ -1550,6 +1576,12 @@ ui_process_numeric(void) } while (status != 0); } } + + return; + + exit: + // cancel operation + ui_mode_normal(); } void @@ -1716,6 +1748,10 @@ void ui_process_touch(void) case UI_MENU: menu_apply_touch(); break; + + case UI_NUMERIC: + numeric_apply_touch(); + break; } } touch_start_watchdog();