]> www.fi.muni.cz Git - bike-lights.git/blobdiff - firmware/control.c
patterns: 3 bits for duration, 5 bits for mode
[bike-lights.git] / firmware / control.c
index 4de03ab4a0a7751e9ba5922a96989507043fc7c7..a90bb713dfa846f9df2775b347180f8a6290d7f4 100644 (file)
@@ -30,23 +30,23 @@ static pattern_t panic_pattern[] = {
 };
 
 pattern_t on1_pattern [] = {
-       { 1, 0x10 },
+       { 1, 0x7 },
        PATTERN_END
 };
 
 static pattern_t on2_pattern [] = {
-       { 2, 0x10 },
+       { 2, 0x7 },
        PATTERN_END
 };
 
 static pattern_t on3_pattern [] = {
-       { 3, 0x10 },
+       { 3, 0x7 },
        PATTERN_END
 };
 
 static pattern_t brake_pattern [] = {
        { 4, 0x2 },
-       { 3, 0x8 },
+       { 3, 0x7 },
        PATTERN_END
 };
 
@@ -54,11 +54,11 @@ static pattern_t normal2_pattern[] = {
        { 2, 0x1 },
        { 0, 0x1 },
        { 2, 0x1 },
-       { 0, 0x8 },
+       { 0, 0x7 },
        { 1, 0x1 },
        { 0, 0x1 },
        { 1, 0x1 },
-       { 0, 0x8 },
+       { 0, 0x7 },
        PATTERN_END
 };
 
@@ -66,11 +66,11 @@ static pattern_t normal3_pattern[] = {
        { 3, 0x1 },
        { 0, 0x1 },
        { 3, 0x1 },
-       { 0, 0x8 },
+       { 0, 0x7 },
        { 1, 0x1 },
        { 0, 0x1 },
        { 1, 0x1 },
-       { 0, 0x8 },
+       { 0, 0x7 },
        PATTERN_END
 };
 
@@ -78,29 +78,32 @@ static pattern_t normal4_pattern[] = {
        { 4, 0x1 },
        { 0, 0x1 },
        { 4, 0x1 },
-       { 0, 0x8 },
+       { 0, 0x7 },
        { 1, 0x1 },
        { 0, 0x1 },
        { 1, 0x1 },
-       { 0, 0x8 },
+       { 0, 0x7 },
        PATTERN_END
 };
 
 static pattern_t slow1_pattern[] = {
        { 1, 0x01 },
-       { 0, 0x10 },
+       { 0, 0x7 },
+       { 0, 0x7 },
        PATTERN_END
 };
 
 static pattern_t slow2_pattern[] = {
        { 2, 0x01 },
-       { 0, 0x10 },
+       { 0, 0x7 },
+       { 0, 0x7 },
        PATTERN_END
 };
 
 static pattern_t slow3_pattern[] = {
        { 3, 0x01 },
-       { 0, 0x10 },
+       { 0, 0x7 },
+       { 0, 0x7 },
        PATTERN_END
 };
 
@@ -158,8 +161,8 @@ pattern_t *pwmled0_pattern_select()
 
        switch (ambient_zone) {
        case 0: return dim_mode ? NULL : number_pattern(2, 1);
-       case 1: return dim_mode ? NULL : normal3_pattern;
-       case 2: return dim_mode ? slow3_pattern : normal3_pattern;
+       case 1: return dim_mode ? slow1_pattern : normal2_pattern;
+       case 2: return dim_mode ? slow2_pattern : normal3_pattern;
        case 3:
        default: return dim_mode ? slow3_pattern : normal4_pattern;
        }