Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remnants of previous strokes infecting current stroke #3

Open
morinted opened this issue Feb 4, 2019 · 2 comments
Open

Remnants of previous strokes infecting current stroke #3

morinted opened this issue Feb 4, 2019 · 2 comments

Comments

@morinted
Copy link

morinted commented Feb 4, 2019

It seems like strokes can intrude with each other. I'm using the repeatandhold branch, but I tested on master as well.

If you press strokes in sequence, like SK-S THEPL SK-S THEPL… etc., sometimes, the output will be TKHEPL or THEPLS, despite very deliberately not hitting the misstroke.

@morinted
Copy link
Author

morinted commented Feb 4, 2019

Charley helped me look into this and compare it with his Forth code...

Seems like it's a debouncing issue caused by not clearing the bytes in the debounce loop. Additionally, there's a possible issue when setting the pins to INPUT instead of INPUT_PULLUP

diff --git a/stenomod.ino b/stenomod.ino
index 11ee736..d926034 100644
--- a/stenomod.ino
+++ b/stenomod.ino
@@ -45,7 +45,7 @@ void set_output(uint8_t p) {

 // Set to input mode
 void set_input(uint8_t p) {
-  pinMode(pin[p], INPUT);
+  pinMode(pin[p], INPUT_PULLUP);
 }

 // Read the current byte, where
@@ -90,6 +90,7 @@ void scan_keys() {
   b[0] = b[1] = b[2] = b[3] = 0;

   while(key_pressed == false) {
+    b[0] = b[1] = b[2] = b[3] = 0;
     while(look() == false);
     delay(20);
     key_pressed = look();
@@ -121,4 +122,3 @@ void loop() {
     send_stroke();
   }
 }
-

@morinted
Copy link
Author

morinted commented Feb 4, 2019

Okay, that's not quite right, Charley walked me through some of the finer points. This commit outlines the solution/improvements: morinted@230acad

I'd be happy to make PRs to both master and repeatandhold if you'd like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant