Adds Button Hold Delay on SINGLE Button Routine#24
Open
cgmckeever wants to merge 2 commits intoworkinghard:masterfrom
Open
Adds Button Hold Delay on SINGLE Button Routine#24cgmckeever wants to merge 2 commits intoworkinghard:masterfrom
cgmckeever wants to merge 2 commits intoworkinghard:masterfrom
Conversation
fixing the device flag fixing the device flag fixing the device flag fixing the device flag fixing the device flag fix listening fix listening fix listening fix listening fix listening fix listening fix listening x x git commit -q -m x
Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press Adds delay to button press
cgmckeever
commented
Jan 4, 2020
| //--------------------------------- | ||
| #define sizearray(a) (sizeof(a) / sizeof((a)[0])) | ||
| #define BUTTON_DEFINED_RANGE -2147483647 // sizeof(long) | ||
| #define BUTTON_UNSET -1 |
Contributor
Author
There was a problem hiding this comment.
This seems clearer for its use case in the conf getter
| unsigned long button3Active; | ||
| long button4; | ||
| int button4Active; | ||
| int activeButtons; |
Contributor
Author
There was a problem hiding this comment.
renamed as hotKeyCount
| long delay; | ||
| long button1; | ||
| int button1Active; | ||
| unsigned long button1Active; |
Contributor
Author
There was a problem hiding this comment.
store timestamp at press
| l = ini_getl(section, str, 0, iniFile); | ||
| syslog(LOG_INFO, "Delay: %ld\n", l); | ||
| myKeys[hotKeyCombos].delay = l * 1000000; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
delay getter - defaults to 0
| //--------------------------------------------- | ||
| // Reset the keys | ||
| //--------------------------------------------- | ||
| void resetHotkeys() { |
Contributor
Author
There was a problem hiding this comment.
moved up front as I called it before definitiion
| syslog (LOG_NOTICE, "Found Device: %s\n", devPath); | ||
| if ((joyFD = open(devPath, O_RDONLY)) < 0) { // Open the file descriptor | ||
| syslog (LOG_INFO, "error: failed to open fd\n"); | ||
| if (joyFD < 0 || strcmp(devPath, myDevPath) == 0) { |
Contributor
Author
There was a problem hiding this comment.
code from device flag PR
| // Non-blocking reading | ||
| struct js_event js; | ||
| int needTrigger; | ||
| int triggerSection; |
Contributor
Author
There was a problem hiding this comment.
renamed to call out this is referencing the macro to call ... which now as I write this section renamed as macro globally may be nice --
|
|
||
| while (1) { | ||
| while (read(joyFD, &js, sizeof(struct js_event)) == sizeof(struct js_event)) { | ||
| while (read(joyFD, &js, sizeof(struct js_event)) == sizeof(struct js_event) || delayedSection >= 0) { |
Contributor
Author
There was a problem hiding this comment.
if delayedSection is true button checker loop continues till either
- delay button is released
- macro/section event triggers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR also has the
device flag fix#22What this PR does:
delaywhich ONLY is currently coded to work with a single button pushint rc = system(myKeys[triggerSection].swFilename);Housekeeping:
Checked that:
Did not check:
--mode holdworksStruggled with:
True equaling 0
https://github.com/workinghard/jslisten/blob/master/src/jslisten.c#L51