]> www.fi.muni.cz Git - bike-lights.git/commitdiff
Ability to quickly build testing firmware
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sat, 8 Dec 2012 19:36:27 +0000 (20:36 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sat, 8 Dec 2012 19:36:27 +0000 (20:36 +0100)
Testing is actually development,
and non-testing is "safe" for production use, even with some
features disabled. At least for now :-)

firmware/control.c
firmware/lights.h
firmware/pwmled.c

index 0b842a74dc794f980d0dc2ced63792cb7e009cb0..eb35aca947ba3be71a0b2b53bb58d96e5e7ad7cd 100644 (file)
@@ -54,9 +54,9 @@ static pattern_t normal2_pattern[] = {
 };
 
 static pattern_t normal3_pattern[] = {
-       { 2, 0x1 },
+       { 3, 0x1 },
        { 0, 0x1 },
-       { 2, 0x1 },
+       { 3, 0x1 },
        { 0, 0x8 },
        { 1, 0x1 },
        { 0, 0x1 },
@@ -66,9 +66,9 @@ static pattern_t normal3_pattern[] = {
 };
 
 static pattern_t normal4_pattern[] = {
-       { 2, 0x1 },
+       { 4, 0x1 },
        { 0, 0x1 },
-       { 2, 0x1 },
+       { 4, 0x1 },
        { 0, 0x8 },
        { 1, 0x1 },
        { 0, 0x1 },
@@ -123,6 +123,10 @@ pattern_t *pwmled0_pattern_select()
 {
        // TODO: battery critical
 
+#ifndef TESTING_FW
+       return normal3_pattern;
+#endif
+
        if (towbar_mode)
                return NULL;
 
@@ -139,6 +143,9 @@ pattern_t *pwmled1_pattern_select()
 {
        // TODO: battery critical
 
+#ifndef TESTING_FW
+       return off_pattern;
+#endif
        if (towbar_mode) {
                switch (ambient_zone) {
                case 0:
@@ -163,6 +170,9 @@ pattern_t *pwmled2_pattern_select()
 {
        // TODO: battery critical
 
+#ifndef TESTING_FW
+       return on3_pattern;
+#endif
        switch (ambient_zone) {
        case 0: return dim_mode ? on2_pattern : on3_pattern;
        case 1: return dim_mode ? slow1_pattern : normal2_pattern;
@@ -179,7 +189,7 @@ pattern_t *status_led_pattern_select()
                return buttons_setup_status0_pattern_select();
 
        // FIXME: do something sane
-       return number_pattern(1 + ambient_zone, 1);
+       return number_pattern(1 + ambient_zone, 0);
 }
 
 pattern_t *illumination_led_pattern_select()
index 16f262e1d159bac7278ee3ee22b6193f7cd13f6f..15e86b88df84c5b5e3f5cde6460d846cfd1446fd 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef LIGHTS_H__
 #define LIGHTS_H__ 1
 
+#define TESTING_FW 1
+
 #define N_LEDS 7
 #define N_PWMLEDS 3
 #define N_PWMLED_MODES 4
index 7cc300641a5fe3fe2cf536ae32945814721aa44b..fcde84a35a3f103968441a1a9663ee28f6bc3ecb 100644 (file)
@@ -27,10 +27,8 @@ pwmled_t pwmleds[N_PWMLEDS];
        * 1024 \
        / (1100000/(gain))))
 
-#define PWMLED_TESTING 1
-
 static uint16_t adc_max[N_PWMLEDS] = {
-#ifdef PWMLED_TESTING
+#ifdef TESTING_FW
        MA_GAIN_TO_ADC( 400, 20),
        MA_GAIN_TO_ADC(  30, 20),
        MA_GAIN_TO_ADC( 800,  1)
@@ -42,22 +40,22 @@ static uint16_t adc_max[N_PWMLEDS] = {
 };
 
 static uint16_t adc_vals[N_PWMLEDS*N_PWMLED_MODES] = {
-#ifdef PWMLED_TESTING
+#ifdef TESTING_FW
        /* pwmled0 */
        MA_GAIN_TO_ADC(  50, 20),
-       MA_GAIN_TO_ADC( 150, 20),
-       MA_GAIN_TO_ADC( 250, 20),
-       MA_GAIN_TO_ADC( 350, 20),
+       MA_GAIN_TO_ADC( 100, 20),
+       MA_GAIN_TO_ADC( 200, 20),
+       MA_GAIN_TO_ADC( 300, 20),
        /* pwmled1 */
        MA_GAIN_TO_ADC(   5, 20),
        MA_GAIN_TO_ADC(  10, 20),
        MA_GAIN_TO_ADC(  15, 20),
        MA_GAIN_TO_ADC(  20, 20),
        /* pwmled2 */
+       MA_GAIN_TO_ADC(  50,  1),
        MA_GAIN_TO_ADC( 100,  1),
-       MA_GAIN_TO_ADC( 200,  1),
-       MA_GAIN_TO_ADC( 300,  1),
-       MA_GAIN_TO_ADC( 400,  1)
+       MA_GAIN_TO_ADC( 150,  1),
+       MA_GAIN_TO_ADC( 200,  1)
 #else
        /* pwmled0 */
        MA_GAIN_TO_ADC( 100, 20),