-
Notifications
You must be signed in to change notification settings - Fork 168
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
[Feature request] Specifying pauses in macros #359 #437
base: testing
Are you sure you want to change the base?
Changes from all commits
dfacdf5
0358f71
47fddda
09e8ff6
a5fd205
e2fcb13
5b1cf99
5ee2d40
2eed137
ee23e01
bfd3d49
ed08836
ca9eb63
652b3ba
99ffd3e
d6aa207
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ typedef struct { | |
short scan; // Key scancode, OR | ||
short rel_x, rel_y; // Mouse movement | ||
char down; // 0 for keyup, 1 for keydown (ignored if rel_x != 0 || rel_y != 0) | ||
uint delay; // us delay after action; UINT_MAX for use global delay | ||
} macroaction; | ||
|
||
// Key macro | ||
|
@@ -247,7 +248,7 @@ typedef struct { | |
// Color dithering in use | ||
char dither; | ||
// Flag to check, if large macros should be sent delayed | ||
char delay; | ||
uint delay; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This var is used by the GUI element "Settings -> More Settings -> Use delay for very long macros. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, on two accounts, the other changes use this as a uint, and the syntax the GUI uses works with the these changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, thanks. I have done some testing today. First I merged your d6aa207 and my macrotime0.1. That gives a string "Das wird ein Text mit Delay", which means "That gets a text with delay". Trying this macro runs well. The logging says something about usb disconnected (there is an unformmated file at the end of this post):
Running the ckb-daemon with gdb brings following output:`(gdb) run Here is the crash: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm on a Mac, using Xcode's gcc to compile, UINT_MAX was 4-billion something. I did try recording a delayed macro, on my version, not yours, and hitting the key a few times. There was a long delay but the macro played back and the keys afterwards were queued and played. The macro was not as long as yours, and I think I hit it maybe 3 to 4 times, not 10 to 20. I suspect the key buffer is getting overflowed causing the disconnect. Perhaps there should be a limit to the delay time? I think this would only make the problem harder to reproduce rather than fixing it though. The question is, what to do when this happens? Queue up more macro keys (make the queue larger), drop some of them (at the start or end of the queue), limit the queue size, or ignore it and pretend it doesn't happen, pretend it doesn't crash.
I'm leaning towards limiting the queue size as being the right answer here (4). Figuring out when the queue is full and ignoring new input. Maybe there should there be command that cancels macro playback? One you could bind to another key or in a sequence. This is getting tricky. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The macro-killing key should flush (empty) out the keyboard buffer and ignore any to-be sent keys as well as cancelling any macro playback. #including limits.h worked fine in my environment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe there is another possible reason for the crashes: the Firmware in the KB itself. My suggestion: Let's implement the rest of the UI, bring it to the testing stage and wait for comments. Maybe this is a problem only on debian / ubuntu based systems with older kernels and with mint18 the effect is gone - who knows... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I sort of agree, option 4. Perhaps add a warning somewhere in the README about really long delays and keyboard overflows. I have not yet tested your branch on my Mac. Keyboard is on a different machine than I've been at since last week. Hope to just double check and see if there's a crash or just a really long playback. |
||
} usbdevice; | ||
|
||
#endif // STRUCTURES_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's my bug, sorry for it. You may change the logic behind it that no more delay is used with the last keycode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do this as a separate pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephenhouser Hi, the last days I had some time to change the ckb client.
Please feel free to test it: fdf73e2 (Branch macrotime.0.3 at https://github.com/frickler24/ckb.git).
The wrong handling of the last delay is fixed also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephenhouser I Added some GUI repairs in f7f8ce9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent. I'll give it a try but likely not for a few days. Code on!