fix adc range

This commit is contained in:
interfisch 2021-10-07 21:23:19 +02:00
parent 1cc242c76b
commit aa9f3effcb
2 changed files with 3 additions and 7 deletions

View File

@ -29,8 +29,8 @@ lib_deps =
build_flags = build_flags =
-D DUALCOLOR -D DUALCOLOR
-D LED_CW=12 ;D6 = GPIO12 (pin6) -D LED_WW=12 ;D6 = GPIO12 (pin6)
-D LED_WW=14 ;D5 = GPIO14 (pin5) -D LED_CW=14 ;D5 = GPIO14 (pin5)
-D BTN_A=13 ;D7 = GPIO13 (pin 7) -D BTN_A=13 ;D7 = GPIO13 (pin 7)
-D BTN_B=15 ;D8 = GPIO15 (pin 10) -D BTN_B=15 ;D8 = GPIO15 (pin 10)
-D PWM_FREQUENCY=500 ;default: 1000 Hz -D PWM_FREQUENCY=500 ;default: 1000 Hz

View File

@ -90,6 +90,7 @@ void setup() {
Serial.begin(115200); Serial.begin(115200);
Serial.println("Hello"); Serial.println("Hello");
analogWriteRange(PWM_MAX);
analogWriteFreq(PWM_FREQUENCY); analogWriteFreq(PWM_FREQUENCY);
#ifdef DUALCOLOR #ifdef DUALCOLOR
pinMode(LED_WW, OUTPUT); pinMode(LED_WW, OUTPUT);
@ -318,7 +319,6 @@ void loopHandler() {
if (enable_fadevalue<0) { enable_fadevalue=0; } //limit if (enable_fadevalue<0) { enable_fadevalue=0; } //limit
flag_updatePWM=true; //force update flag_updatePWM=true; //force update
} }
//calculate and update pwm //calculate and update pwm
#ifdef DUALCOLOR #ifdef DUALCOLOR
if (brightness != set_brightness || temperature != set_temperature || flag_updatePWM) { //if target not reached if (brightness != set_brightness || temperature != set_temperature || flag_updatePWM) { //if target not reached
@ -353,10 +353,6 @@ void loopHandler() {
analogWrite(LED_PWM, PWM_MAX-pwm); //full pwm is led off analogWrite(LED_PWM, PWM_MAX-pwm); //full pwm is led off
#endif #endif
} }
} }