From fbe444c2a7616054465def48e95cbf625f5df37a Mon Sep 17 00:00:00 2001 From: "Jan \"Yenya\" Kasprzak" Date: Thu, 22 Nov 2012 23:00:00 +0100 Subject: [PATCH] pwmled: more logging --- firmware/pwmled.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/firmware/pwmled.c b/firmware/pwmled.c index 8c61964..d5d947b 100644 --- a/firmware/pwmled.c +++ b/firmware/pwmled.c @@ -4,9 +4,9 @@ static uint16_t pwm_vals[N_PWMLEDS*N_PWMLED_MODES]; static uint16_t pwm_max[N_PWMLEDS] = { - PWM_MAX/2, + 2*PWM_MAX/3, PWM_MAX - (PWM_MAX >> 4), // step-up - PWM_MAX/2 + 2*PWM_MAX/3 }; #define PWMLED2_TESTING_WITH_350MA_LED @@ -137,7 +137,7 @@ static void inline probing_adc(unsigned char n, uint16_t adcval) #endif if (adcval > adc_max[n] // Too high - || (pwm == 0 && adcval > 0) // non-zero voltage with zero PWM + || (pwm == 0 && adcval > 2) // non-zero voltage with zero PWM ) { pwm_off(n); pwmled_state[n] = ST_DISABLED; @@ -230,7 +230,14 @@ static void inline on_adc(unsigned char n, uint16_t adcval) if (new_pwm > (int16_t)pwm_max[n]) { // FIXME: disconnected? - new_pwm = pwm_max[n]; + log_byte(0xE1); + log_byte(n); + log_word(new_pwm); + log_word(adcval); + log_word(jiffies); + pwmled_state[n] = ST_DISABLED; + pwm_off(n); + return; } if (new_pwm < 1) { @@ -261,6 +268,8 @@ void pwmled_adc(unsigned char n, uint16_t adcval) probing = 1; if (!probing) { + log_word(0x5555); + log_word(jiffies); for (i = 0; i < N_PWMLEDS; i++) log_byte(pwmled_state[i]); @@ -268,6 +277,8 @@ void pwmled_adc(unsigned char n, uint16_t adcval) log_word(pwm_vals[i]); log_flush(); log_set_state(4); + for (i = 0; i < N_PWMLEDS; i++) + led_set_pattern(i, mode1_pattern); } #endif -- 2.43.5