]> www.fi.muni.cz Git - tinyboard.git/blobdiff - projects/step-up/pwmled.c
Deeper sleep when idle
[tinyboard.git] / projects / step-up / pwmled.c
index bc604da70063a0c63ec3528294563128c03308db..485d024d8f0719007113f36b82f903189442c660 100644 (file)
@@ -60,9 +60,11 @@ void pwmled_on_off(unsigned char mode)
        if (mode) {
                state = ST_ON;
                mode_changed = 1;
+               need_pwmled_adc = 1;
                pwm_set(pwm_val);
        } else {
                state = ST_OFF;
+               need_pwmled_adc = 0;
                pwm_off();
        }
 }
@@ -113,6 +115,7 @@ void pwmled_adc(uint16_t adcval)
        if (pwm_val >= PWM_MAX
                || (pwm_val > (2*PWM_MAX/3) && adcval < 0x08)) {
                pwmled_err();
+               need_pwmled_adc = 0;
                return;
        }