diff --git a/main.c b/main.c index 5327b2f..0cffb98 100644 --- a/main.c +++ b/main.c @@ -1220,6 +1220,7 @@ static void cmd_touchcal(BaseSequentialStream *chp, int argc, char *argv[]) //extern int16_t touch_cal[4]; int i; + chMtxLock(&mutex); chprintf(chp, "first touch upper left, then lower right..."); touch_cal_exec(); chprintf(chp, "done\r\n"); @@ -1229,7 +1230,7 @@ static void cmd_touchcal(BaseSequentialStream *chp, int argc, char *argv[]) chprintf(chp, "%d ", config.touch_cal[i]); } chprintf(chp, "\r\n"); - touch_start_watchdog(); + chMtxUnlock(&mutex); } static void cmd_touchtest(BaseSequentialStream *chp, int argc, char *argv[]) diff --git a/ui.c b/ui.c index 6ee4a94..242f3df 100644 --- a/ui.c +++ b/ui.c @@ -293,7 +293,7 @@ touch_cal_exec(void) do { status = touch_check(); - } while(status != EVT_TOUCH_PRESSED); + } while(status != EVT_TOUCH_RELEASED); x1 = last_touch_x; y1 = last_touch_y; @@ -303,7 +303,7 @@ touch_cal_exec(void) do { status = touch_check(); - } while(status != EVT_TOUCH_PRESSED); + } while(status != EVT_TOUCH_RELEASED); x2 = last_touch_x; y2 = last_touch_y; @@ -312,8 +312,8 @@ touch_cal_exec(void) config.touch_cal[2] = (x2 - x1) * 16 / 320; config.touch_cal[3] = (y2 - y1) * 16 / 240; + //redraw_all(); touch_start_watchdog(); - redraw_all(); } void