   /* Update the swipe measurements, on release perform action */
   if (!LCD_isTouchedAny()) {
     /* Handle releases, evaluate previously measured swipe speed */
-    if (swipe_speed > SWIPE_THRESHOLD) {
-      sketch_icon_dirty[touchedIndex] = 1;
-      touchedIndex = MENU_IDX_DOWN;
-    }
-    if (swipe_speed < -SWIPE_THRESHOLD) {
-      sketch_icon_dirty[touchedIndex] = 1;
-      touchedIndex = MENU_IDX_UP;
+    /* First check if the swipe distance is long enough */
+    if (abs(swipe_last_pos-swipe_start_pos) > SWIPE_MIN_DIST) {
+      if (swipe_speed > SWIPE_THRESHOLD) {
+        sketch_icon_dirty[touchedIndex] = 1;
+        touchedIndex = MENU_IDX_DOWN;
+      }
+      if (swipe_speed < -SWIPE_THRESHOLD) {
+        sketch_icon_dirty[touchedIndex] = 1;
+        touchedIndex = MENU_IDX_UP;
+      }
     }
     swipe_speed = 0.0F;
   } else if (swipe_last_pos != 0xFFFF) {

boolean touch_waitup;      /* Whether we are waiting a cycle */
uint32_t swipe_last_time;  /* Last known time while swiping */
uint16_t swipe_last_pos;   /* Last known position while swiping */
float swipe_speed;         /* Speed of swiping in pixels/ms */

/* Sketch information buffer */


uint8_t LCD_isTouched(uint16_t x, uint16_t y, uint8_t w, uint8_t h) {
  return touch_x >= x && touch_y >= y && touch_x < (x + w) && touch_y < (y + h);
}
