Compare commits
3 Commits
948cf6b047
...
aa9f3effcb
Author | SHA1 | Date |
---|---|---|
interfisch | aa9f3effcb | |
interfisch | 1cc242c76b | |
interfisch | d1b05816d5 |
|
@ -29,8 +29,8 @@ lib_deps =
|
|||
|
||||
build_flags =
|
||||
-D DUALCOLOR
|
||||
-D LED_WW=14 ;D5 = GPIO14 (pin5)
|
||||
-D LED_CW=12 ;D6 = GPIO12 (pin6)
|
||||
-D LED_WW=12 ;D6 = GPIO12 (pin6)
|
||||
-D LED_CW=14 ;D5 = GPIO14 (pin5)
|
||||
-D BTN_A=13 ;D7 = GPIO13 (pin 7)
|
||||
-D BTN_B=15 ;D8 = GPIO15 (pin 10)
|
||||
-D PWM_FREQUENCY=500 ;default: 1000 Hz
|
||||
|
@ -38,7 +38,6 @@ build_flags =
|
|||
-D BRIGHTNESSCURVE=1.4
|
||||
-D TEMPERATURE_MIN=2760 ;temperature of warm white leds
|
||||
-D TEMPERATURE_MAX=5640 ;temperature of cold white leds
|
||||
-D FW_NAME=\"tischlicht\"
|
||||
|
||||
|
||||
#Kuechenlicht
|
||||
|
@ -59,5 +58,4 @@ build_flags =
|
|||
-D PWM_FREQUENCY=1000 ;default: 1000 Hz
|
||||
-D PWM_MAX=1023 ;10 bit dac
|
||||
-D PWM_MINDIMMED=PWM_MAX/3
|
||||
-D BRIGHTNESSCURVE=2
|
||||
-D FW_NAME=\"kuechenlicht\"
|
||||
-D BRIGHTNESSCURVE=2
|
10
src/main.cpp
10
src/main.cpp
|
@ -6,7 +6,7 @@
|
|||
#include <Arduino.h>
|
||||
#include <Homie.h>
|
||||
|
||||
|
||||
#define FW_NAME "esplight"
|
||||
#define FW_VERSION "1.0.0"
|
||||
|
||||
bool enableHandler(const HomieRange& range, const String& value);
|
||||
|
@ -90,6 +90,7 @@ void setup() {
|
|||
Serial.begin(115200);
|
||||
Serial.println("Hello");
|
||||
|
||||
analogWriteRange(PWM_MAX);
|
||||
analogWriteFreq(PWM_FREQUENCY);
|
||||
#ifdef DUALCOLOR
|
||||
pinMode(LED_WW, OUTPUT);
|
||||
|
@ -318,7 +319,6 @@ void loopHandler() {
|
|||
if (enable_fadevalue<0) { enable_fadevalue=0; } //limit
|
||||
flag_updatePWM=true; //force update
|
||||
}
|
||||
|
||||
//calculate and update pwm
|
||||
#ifdef DUALCOLOR
|
||||
if (brightness != set_brightness || temperature != set_temperature || flag_updatePWM) { //if target not reached
|
||||
|
@ -335,6 +335,8 @@ void loopHandler() {
|
|||
pwmWW=pow((brightness*enable_fadevalue)/2.0, BRIGHTNESSCURVE) *2.0 *(1-temp) *PWM_MAX;
|
||||
if (pwmCW>PWM_MAX) { pwmCW=PWM_MAX; } //limit
|
||||
if (pwmWW>PWM_MAX) { pwmWW=PWM_MAX; } //limit
|
||||
Serial.print("brightness"); Serial.println(brightness);
|
||||
Serial.print("CW="); Serial.print(pwmCW); Serial.print(", WW="); Serial.println(pwmWW);
|
||||
|
||||
analogWrite(LED_WW, PWM_MAX-pwmWW); //full pwm is led off
|
||||
analogWrite(LED_CW, PWM_MAX-pwmCW); //full pwm is led off
|
||||
|
@ -351,10 +353,6 @@ void loopHandler() {
|
|||
analogWrite(LED_PWM, PWM_MAX-pwm); //full pwm is led off
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue