mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
WIP: up/down touch operation on numeric area
This commit is contained in:
parent
e0197b8381
commit
63d19f3f6f
10
main.c
10
main.c
|
|
@ -1477,6 +1477,7 @@ static void cmd_touchtest(BaseSequentialStream *chp, int argc, char *argv[])
|
|||
touch_draw_test();
|
||||
} while(argc);
|
||||
chMtxUnlock(&mutex);
|
||||
|
||||
}
|
||||
|
||||
static void cmd_frequencies(BaseSequentialStream *chp, int argc, char *argv[])
|
||||
|
|
@ -1540,9 +1541,12 @@ static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[])
|
|||
//chprintf(chp, "adc: %d %d\r\n", touch_x, touch_y);
|
||||
#endif
|
||||
|
||||
int x, y;
|
||||
touch_position(&x, &y);
|
||||
chprintf(chp, "touch: %d %d\r\n", x, y);
|
||||
while (argc > 1) {
|
||||
int x, y;
|
||||
touch_position(&x, &y);
|
||||
chprintf(chp, "touch: %d %d\r\n", x, y);
|
||||
chThdSleepMilliseconds(200);
|
||||
}
|
||||
}
|
||||
|
||||
static void cmd_gain(BaseSequentialStream *chp, int argc, char *argv[])
|
||||
|
|
|
|||
30
ui.c
30
ui.c
|
|
@ -273,10 +273,10 @@ int touch_check(void)
|
|||
chThdSleepMilliseconds(10);
|
||||
int x = touch_measure_x();
|
||||
int y = touch_measure_y();
|
||||
if (touch_status()) {
|
||||
//if (touch_status()) {
|
||||
last_touch_x = x;
|
||||
last_touch_y = y;
|
||||
}
|
||||
//}
|
||||
touch_prepare_sense();
|
||||
}
|
||||
|
||||
|
|
@ -1492,14 +1492,14 @@ numeric_apply_touch(void)
|
|||
{
|
||||
int touch_x, touch_y;
|
||||
int i = 0;
|
||||
|
||||
int step;
|
||||
touch_position(&touch_x, &touch_y);
|
||||
|
||||
if (touch_x < 64) {
|
||||
ui_mode_normal();
|
||||
return;
|
||||
}
|
||||
if (touch_y < 240-32) {
|
||||
if (touch_y < 240-40) {
|
||||
ui_mode_normal();
|
||||
return;
|
||||
}
|
||||
|
|
@ -1508,12 +1508,24 @@ numeric_apply_touch(void)
|
|||
ui_process_keypad();
|
||||
return;
|
||||
}
|
||||
if (touch_y < 240-20) {
|
||||
step = 1;
|
||||
} else {
|
||||
step = -1;
|
||||
}
|
||||
|
||||
i = 9 - (touch_x - 64) / 20;
|
||||
if (uistat.digit != i) {
|
||||
uistat.digit = i;
|
||||
draw_numeric_area();
|
||||
}
|
||||
uistat.digit = i;
|
||||
uistat.digit_mode = TRUE;
|
||||
for (i = uistat.digit; i > 0; i--)
|
||||
step *= 10;
|
||||
uistat.value += step;
|
||||
draw_numeric_area();
|
||||
|
||||
touch_wait_release();
|
||||
uistat.digit_mode = FALSE;
|
||||
draw_numeric_area();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1730,7 +1742,7 @@ void ui_process_touch(void)
|
|||
adc_stop(ADC1);
|
||||
|
||||
int status = touch_check();
|
||||
if (status == EVT_TOUCH_PRESSED) {
|
||||
if (status == EVT_TOUCH_PRESSED || status == EVT_TOUCH_DOWN) {
|
||||
switch (ui_mode) {
|
||||
case UI_NORMAL:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue