diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2014-05-13 07:58:19 +0200 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2014-11-09 22:56:50 +0100 |
commit | 25f7034e1d09d3c64c8a262b385c72508d8e7795 (patch) | |
tree | 88f9fcc0ed1de124b5fcb162f1397056e9939eae | |
parent | afb3e6cdd24191d6cc2aa813dda646f2c1f19ee2 (diff) |
Added a minimum movement threshold to QE buttons.
-rw-r--r-- | main.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -619,27 +619,33 @@ int main() { int8_t rx = qe1_count - last_x; int8_t ry = qe2_count - last_y; - last_x = qe1_count; - last_y = qe2_count; - if(rx > 0) { + if(rx > 1) { state_x = 100; - } else if(rx < 0) { + last_x = qe1_count; + } else if(rx < -1) { state_x = -100; + last_x = qe1_count; } else if(state_x > 0) { state_x--; + last_x = qe1_count; } else if(state_x < 0) { state_x++; + last_x = qe1_count; } - if(ry > 0) { + if(ry > 1) { state_y = 100; - } else if(ry < 0) { + last_y = qe2_count; + } else if(ry < -1) { state_y = -100; + last_y = qe2_count; } else if(state_y > 0) { state_y--; + last_y = qe2_count; } else if(state_y < 0) { state_y++; + last_y = qe2_count; } if(state_x > 0) { |