Skip to content

Commit 3a03bc4

Browse files
author
Louis Beaudoin
committed
Fix bus_wrapper.h bugs:
- missing breaks in switch(busType identifying SPI LEDs) - set correct pin order for begin()
1 parent 331844f commit 3a03bc4

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

wled00/bus_wrapper.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,15 @@ class PolyBus {
328328
case I_32_I0_TM1_4: busPtr = new B_32_I0_TM1_4(len, pins[0]); break;
329329
case I_32_I1_TM1_4: busPtr = new B_32_I1_TM1_4(len, pins[0]); break;
330330
#endif
331-
case I_HS_DOT_3: busPtr = new B_HS_DOT_3(len, pins[0], pins[1]); break;
332-
case I_SS_DOT_3: busPtr = new B_SS_DOT_3(len, pins[0], pins[1]); break;
333-
case I_HS_LPD_3: busPtr = new B_HS_LPD_3(len, pins[0], pins[1]); break;
334-
case I_SS_LPD_3: busPtr = new B_SS_LPD_3(len, pins[0], pins[1]); break;
335-
case I_HS_WS1_3: busPtr = new B_HS_WS1_3(len, pins[0], pins[1]); break;
336-
case I_SS_WS1_3: busPtr = new B_SS_WS1_3(len, pins[0], pins[1]); break;
337-
case I_HS_P98_3: busPtr = new B_HS_P98_3(len, pins[0], pins[1]); break;
338-
case I_SS_P98_3: busPtr = new B_SS_P98_3(len, pins[0], pins[1]); break;
331+
// for 2-wire: pins[1] is clk, pins[0] is dat. begin expects (len, clk, dat)
332+
case I_HS_DOT_3: busPtr = new B_HS_DOT_3(len, pins[1], pins[0]); break;
333+
case I_SS_DOT_3: busPtr = new B_SS_DOT_3(len, pins[1], pins[0]); break;
334+
case I_HS_LPD_3: busPtr = new B_HS_LPD_3(len, pins[1], pins[0]); break;
335+
case I_SS_LPD_3: busPtr = new B_SS_LPD_3(len, pins[1], pins[0]); break;
336+
case I_HS_WS1_3: busPtr = new B_HS_WS1_3(len, pins[1], pins[0]); break;
337+
case I_SS_WS1_3: busPtr = new B_SS_WS1_3(len, pins[1], pins[0]); break;
338+
case I_HS_P98_3: busPtr = new B_HS_P98_3(len, pins[1], pins[0]); break;
339+
case I_SS_P98_3: busPtr = new B_SS_P98_3(len, pins[1], pins[0]); break;
339340
}
340341
begin(busPtr, busType);
341342
return busPtr;
@@ -835,10 +836,11 @@ class PolyBus {
835836
#endif
836837
uint8_t t = I_NONE;
837838
switch (busType) {
838-
case TYPE_APA102: t = I_SS_DOT_3;
839-
case TYPE_LPD8806: t = I_SS_LPD_3;
840-
case TYPE_WS2801: t = I_SS_WS1_3;
841-
case TYPE_P9813: t = I_SS_P98_3;
839+
case TYPE_APA102: t = I_SS_DOT_3; break;
840+
case TYPE_LPD8806: t = I_SS_LPD_3; break;
841+
case TYPE_WS2801: t = I_SS_WS1_3; break;
842+
case TYPE_P9813: t = I_SS_P98_3; break;
843+
default: t=I_NONE;
842844
}
843845
if (t > I_NONE && isHSPI) t--; //hardware SPI has one smaller ID than software
844846
return t;

0 commit comments

Comments
 (0)