summaryrefslogtreecommitdiff
path: root/dim.c
diff options
context:
space:
mode:
Diffstat (limited to 'dim.c')
-rw-r--r--dim.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/dim.c b/dim.c
index 21ea528..424615a 100644
--- a/dim.c
+++ b/dim.c
@@ -3,11 +3,13 @@ struct switchcfg {
uint8_t targets1[2];
uint8_t lastclick;
int8_t dir;
- uint8_t tgt1active;
+ __extension__ uint8_t tgt1active : 1;
+ __extension__ uint8_t enabled : 1;
+ __extension__ uint8_t unused : 6;
};
#define T_DOUBLECLICK 75
-struct switchcfg sw;
+static struct switchcfg sw;
static uint8_t tast_curstate(void)
{
@@ -27,6 +29,9 @@ static uint8_t tast_curstate(void)
static void tast_applystate(uint8_t all, uint8_t target)
{
+ if (!sw.enabled)
+ return;
+
target_set(sw.targets0[0], target);
target_set(sw.targets0[1], target);
if (all) {
@@ -120,4 +125,5 @@ static void dim_init(void)
sw.lastclick = 0xff;
sw.dir = 1;
sw.tgt1active = 0;
+ sw.enabled = 1;
}