aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2017-08-27 01:58:07 -0600
committerSelene ToyKeeper2017-08-27 01:58:07 -0600
commitc2b995167d2f523f13187d5ca39c9343cf62a702 (patch)
tree3cb3d800158b4492a7663acaf2e29ed5c46e3b4c /spaghetti-monster
parentRevert DarkHorse back to no wear-levelling. (diff)
downloadanduril-c2b995167d2f523f13187d5ca39c9343cf62a702.tar.gz
anduril-c2b995167d2f523f13187d5ca39c9343cf62a702.tar.bz2
anduril-c2b995167d2f523f13187d5ca39c9343cf62a702.zip
Made it easier to configure the maximum number of clicks it'll try to count in one sequence.
(use #define MAX_CLICKS 5, for example) Keeps data sizes from being excessively large without having to edit FSM sources per UI.
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/fsm-events.h58
1 files changed, 57 insertions, 1 deletions
diff --git a/spaghetti-monster/fsm-events.h b/spaghetti-monster/fsm-events.h
index 90dcbd6..114ccc4 100644
--- a/spaghetti-monster/fsm-events.h
+++ b/spaghetti-monster/fsm-events.h
@@ -35,7 +35,11 @@ typedef struct Emission {
#define MISCHIEF_MANAGED EVENT_HANDLED
#define MISCHIEF_NOT_MANAGED EVENT_NOT_HANDLED
-#define EV_MAX_LEN 16
+#ifndef MAX_CLICKS
+#define MAX_CLICKS 4
+#endif
+
+#define EV_MAX_LEN ((MAX_CLICKS*2)+3)
uint8_t current_event[EV_MAX_LEN];
// at 0.016 ms per tick, 255 ticks = 4.08 s
// TODO: 16 bits?
@@ -116,6 +120,7 @@ Event EV_click1_hold_release[] = {
A_HOLD,
A_RELEASE,
0 };
+#if MAX_CLICKS >= 2
Event EV_click2_press[] = {
A_PRESS,
A_RELEASE,
@@ -148,6 +153,8 @@ Event EV_click2_complete[] = {
A_RELEASE,
A_RELEASE_TIMEOUT,
0 };
+#endif // MAX_CLICKS >= 2
+#if MAX_CLICKS >= 3
Event EV_click3_press[] = {
A_PRESS,
A_RELEASE,
@@ -173,6 +180,8 @@ Event EV_click3_complete[] = {
A_RELEASE,
A_RELEASE_TIMEOUT,
0 };
+#endif // MAX_CLICKS >= 3
+#if MAX_CLICKS >= 4
#define EV_4clicks EV_click4_complete
Event EV_click4_complete[] = {
A_PRESS,
@@ -185,6 +194,41 @@ Event EV_click4_complete[] = {
A_RELEASE,
A_RELEASE_TIMEOUT,
0 };
+#endif
+#if MAX_CLICKS >= 5
+#define EV_5clicks EV_click5_complete
+Event EV_click5_complete[] = {
+ A_PRESS,
+ A_RELEASE,
+ A_PRESS,
+ A_RELEASE,
+ A_PRESS,
+ A_RELEASE,
+ A_PRESS,
+ A_RELEASE,
+ A_PRESS,
+ A_RELEASE,
+ A_RELEASE_TIMEOUT,
+ 0 };
+#endif
+#if MAX_CLICKS >= 6
+#define EV_6clicks EV_click6_complete
+Event EV_click6_complete[] = {
+ A_PRESS,
+ A_RELEASE,
+ A_PRESS,
+ A_RELEASE,
+ A_PRESS,
+ A_RELEASE,
+ A_PRESS,
+ A_RELEASE,
+ A_PRESS,
+ A_RELEASE,
+ A_PRESS,
+ A_RELEASE,
+ A_RELEASE_TIMEOUT,
+ 0 };
+#endif
// ... and so on
// A list of button event types for easy iteration
@@ -195,15 +239,27 @@ EventPtr event_sequences[] = {
EV_click1_complete,
EV_click1_hold,
EV_click1_hold_release,
+ #if MAX_CLICKS >= 2
EV_click2_press,
EV_click2_hold,
EV_click2_hold_release,
EV_click2_release,
EV_click2_complete,
+ #endif
+ #if MAX_CLICKS >= 3
EV_click3_press,
EV_click3_release,
EV_click3_complete,
+ #endif
+ #if MAX_CLICKS >= 4
EV_click4_complete,
+ #endif
+ #if MAX_CLICKS >= 5
+ EV_click5_complete,
+ #endif
+ #if MAX_CLICKS >= 6
+ EV_click6_complete,
+ #endif
// ...
};
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.