Change frequency to 400kHz without improvments

This commit is contained in:
Ollo 2024-12-04 20:01:57 +01:00
parent c8e81310cc
commit 0795dfa0dd
2 changed files with 14 additions and 9 deletions

View File

@ -17,9 +17,9 @@
#define GPIO_DS18B20 D2 /**< One-Wire used for Dallas temperature sensor */
#define WS2812SINGLE_GPIO_PIN D3
#define WS2812SINGLE_LEDS 1
#define WS2812SINGLE_LEDS 3
#define WS2812STRIP_GPIO_PIN D4
#define WS2812STRIP_LEDS 10
#define WS2812STRIP_LEDS 13
#endif /* End FANLEDCTL_PINS */

View File

@ -6,7 +6,7 @@
/******************************************************************************
* MAKROS
******************************************************************************/
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
/******************************************************************************
* DEFINES
@ -23,7 +23,8 @@
/******************************************************************************
* LOCAL VARIABLES
******************************************************************************/
Adafruit_NeoPixel pixels(MAX(WS2812SINGLE_LEDS, WS2812STRIP_GPIO_PIN), 0, NEO_RGB + NEO_KHZ800);
Adafruit_NeoPixel pixels(WS2812STRIP_LEDS, WS2812STRIP_GPIO_PIN, NEO_RGB + NEO_KHZ400);
Adafruit_NeoPixel singleLed(WS2812SINGLE_LEDS, WS2812SINGLE_GPIO_PIN, NEO_RGB + NEO_KHZ400);
OneWire oneWire(GPIO_DS18B20);
DallasTemperature sensors(&oneWire);
@ -40,7 +41,6 @@ void setup() {
pinMode(SIGNAL_PIN, INPUT);
pixels.setPin(WS2812SINGLE_GPIO_PIN);
pixels.begin();
pixels.clear();
pixels.setBrightness(100);
@ -60,6 +60,9 @@ void setup() {
pixels.fill(pixels.Color(0,255,0));
pixels.setBrightness(50);
pixels.show();
/* prepare LED strip pin */
singleLed.begin();
singleLed.clear();
}
/**
@ -123,13 +126,15 @@ void loop() {
fanSpeedPercent = (100 - MIN_FAN_SPEED_PERCENT) * (temp - MIN_TEMP) / (MAX_TEMP - MIN_TEMP) + MIN_FAN_SPEED_PERCENT;
}
pixels.setPin(WS2812STRIP_GPIO_PIN);
pixels.begin();
pixels.clear();
pixels.fill(pixels.Color(0,255,0));
pixels.fill(pixels.Color(255, 255,0));
pixels.setBrightness(fanSpeedPercent);
pixels.show();
singleLed.fill(pixels.Color(0,255,0));
singleLed.setBrightness((fanSpeedPercent / 10) % 100);
singleLed.show();
Serial.print(fanSpeedPercent);
Serial.print("%;");
setFanSpeedPercent(fanSpeedPercent);