mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
WIP: touch operation on numeric input area
This commit is contained in:
parent
b64826b76a
commit
e0197b8381
2
main.c
2
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;
|
||||
|
|
|
|||
48
ui.c
48
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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue