Skip to content

Commit d00538d

Browse files
committed
DEFINES for different devices added
1 parent 05ad1a8 commit d00538d

File tree

3 files changed

+139
-115
lines changed

3 files changed

+139
-115
lines changed

platformio.ini

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ build_flags =
8888
; -D WLED_DISABLE_ALEXA
8989
-D WLED_DISABLE_BLYNK
9090
-D WLED_DISABLE_CRONIXIE
91-
; -D WLED_DISABLE_HUESYNC
92-
-D WLED_DISABLE_INFRARED
91+
-D WLED_DISABLE_HUESYNC
92+
; -D WLED_DISABLE_INFRARED
9393

9494
[common:esp32]
9595
@@ -123,7 +123,21 @@ build_flags =
123123
lib_deps =
124124
${common.lib_deps_external}
125125

126-
[env:esp8285]
126+
[env:esp8285_4CH_H801]
127+
board = esp8285
128+
platform = ${common:esp8266_1M.platform}
129+
monitor_speed = ${common.monitor_speed}
130+
upload_speed = ${common.upload_speed}
131+
framework = ${common.framework}
132+
build_flags =
133+
${common.build_flags}
134+
${common:esp8266_1M.build_flags}
135+
-D WLED_USE_ANALOG_LEDS
136+
-D WLED_USE_H801
137+
lib_deps =
138+
${common.lib_deps_external}
139+
140+
[env:esp8285_4CH_MagicHome]
127141
board = esp8285
128142
platform = ${common:esp8266_1M.platform}
129143
monitor_speed = ${common.monitor_speed}
@@ -133,11 +147,10 @@ build_flags =
133147
${common.build_flags}
134148
${common:esp8266_1M.build_flags}
135149
-D WLED_USE_ANALOG_LEDS
136-
-D WLED_DEBUG
137150
lib_deps =
138151
${common.lib_deps_external}
139152

140-
[env:esp8285_5CH]
153+
[env:esp8285_5CH_H801]
141154
board = esp8285
142155
platform = ${common:esp8266_1M.platform}
143156
monitor_speed = ${common.monitor_speed}
@@ -147,8 +160,8 @@ build_flags =
147160
${common.build_flags}
148161
${common:esp8266_1M.build_flags}
149162
-D WLED_USE_ANALOG_LEDS
150-
-D WLED_USE_5CH_LEDS
151-
-D WLED_DEBUG
163+
-D WLED_USE_5CH_LEDS
164+
-D WLED_USE_H801
152165
lib_deps =
153166
${common.lib_deps_external}
154167

@@ -175,6 +188,7 @@ framework = ${common.framework}
175188
build_flags =
176189
${common.build_flags}
177190
${common:esp8266_512k.build_flags}
191+
-D WLED_DISABLE_INFRARED
178192
lib_deps =
179193
${common.lib_deps_external}
180194

wled00/NpbWrapper.h

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55
//PIN CONFIGURATION
66
#define LEDPIN 2 //strip pin. Any for ESP32, gpio2 or 3 is recommended for ESP8266 (gpio2/3 are labeled D4/RX on NodeMCU and Wemos)
77
//#define USE_APA102 // Uncomment for using APA102 LEDs.
8-
#define BTNPIN -1 //button pin. Needs to have pullup (gpio0 recommended)
9-
#define IR_PIN 0 //infrared pin (-1 to disable) MagicHome: 4, H801 Wifi: 0
8+
#ifdef WLED_USE_H801
9+
#define BTNPIN -1 //button pin. Needs to have pullup (gpio0 recommended)
10+
#define IR_PIN 0 //infrared pin (-1 to disable) MagicHome: 4, H801 Wifi: 0
11+
#else
12+
#define BTNPIN 0 //button pin. Needs to have pullup (gpio0 recommended)
13+
#define IR_PIN 4 //infrared pin (-1 to disable) MagicHome: 4, H801 Wifi: 0
14+
#endif
1015
#define RLYPIN -1 //pin for relay, will be set HIGH if LEDs are on (-1 to disable). Also usable for standby leds, triggers,...
1116
#define AUXPIN -1 //debug auxiliary output pin (-1 to disable)
1217

@@ -20,20 +25,21 @@
2025
#endif
2126
#endif
2227

23-
#ifndef WLED_DISABLE_ANALOG_LEDS
28+
#ifdef WLED_USE_ANALOG_LEDS
2429
//PWM pins - PINs 15,13,12,14 (W2 = 04)are used with H801 Wifi LED Controller
25-
#define RPIN 15 //R pin for analog LED strip
26-
#define GPIN 13 //G pin for analog LED strip
27-
#define BPIN 12 //B pin for analog LED strip
28-
#define WPIN 14 //W pin for analog LED strip (W1: 14, W2: 04)
29-
#define W2PIN 04 //W2 pin for analog LED strip
30-
//
31-
/*PWM pins - PINs 5,12,13,15 are used with Magic Home LED Controller
32-
#define RPIN 5 //R pin for analog LED strip
33-
#define GPIN 12 //G pin for analog LED strip
34-
#define BPIN 13 //B pin for analog LED strip
35-
#define WPIN 15 //W pin for analog LED strip (W1: 14, W2: 04)
36-
*/
30+
#ifdef WLED_USE_H801
31+
#define RPIN 15 //R pin for analog LED strip
32+
#define GPIN 13 //G pin for analog LED strip
33+
#define BPIN 12 //B pin for analog LED strip
34+
#define WPIN 14 //W pin for analog LED strip (W1: 14, W2: 04)
35+
#define W2PIN 04 //W2 pin for analog LED strip
36+
#else
37+
//PWM pins - PINs 5,12,13,15 are used with Magic Home LED Controller
38+
#define RPIN 5 //R pin for analog LED strip
39+
#define GPIN 12 //G pin for analog LED strip
40+
#define BPIN 15 //B pin for analog LED strip
41+
#define WPIN 13 //W pin for analog LED strip (W1: 14, W2: 04)
42+
#endif
3743
#endif
3844

3945
//automatically uses the right driver method for each platform
@@ -120,7 +126,7 @@ class NeoPixelWrapper
120126
_pGrbw->Begin();
121127
break;
122128

123-
#ifndef WLED_DISABLE_ANALOG_LEDS
129+
#ifdef WLED_USE_ANALOG_LEDS
124130
//init PWM pins - PINs 5,12,13,15 are used with Magic Home LED Controller
125131
pinMode(RPIN, OUTPUT);
126132
pinMode(GPIN, OUTPUT);
@@ -140,7 +146,7 @@ class NeoPixelWrapper
140146
}
141147
}
142148

143-
#ifndef WLED_DISABLE_ANALOG_LEDS
149+
#ifdef WLED_USE_ANALOG_LEDS
144150
void SetRgbwPwm(uint8_t r, uint8_t g, uint8_t b, uint8_t w, uint8_t w2=0)
145151
{
146152
analogWrite(RPIN, r);
@@ -164,7 +170,7 @@ class NeoPixelWrapper
164170
{
165171
case NeoPixelType_Grb: {
166172
_pGrb->Show();
167-
#ifndef WLED_DISABLE_ANALOG_LEDS
173+
#ifdef WLED_USE_ANALOG_LEDS
168174
RgbColor color = _pGrb->GetPixelColor(0);
169175
b = _pGrb->GetBrightness();
170176
SetRgbwPwm(color.R * b / 255, color.G * b / 255, color.B * b / 255, 0);
@@ -173,7 +179,7 @@ class NeoPixelWrapper
173179
break;
174180
case NeoPixelType_Grbw: {
175181
_pGrbw->Show();
176-
#ifndef WLED_DISABLE_ANALOG_LEDS
182+
#ifdef WLED_USE_ANALOG_LEDS
177183
RgbwColor colorW = _pGrbw->GetPixelColor(0);
178184
b = _pGrbw->GetBrightness();
179185
// check color values for Warm / COld white mix (for RGBW) // EsplanexaDevice.cpp

0 commit comments

Comments
 (0)