Skip to content

Commit 971a39a

Browse files
authored
fix 2-button mode for Stardust
[BUGFIX]: 2 button mode for Stardust works now, problem was that the D11 used for aux switch was pulled low in the rogrammable kill key and also the switch pins needs to be declared as inputs with pullup
1 parent c947d73 commit 971a39a

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed

Config_HW.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
// If your saber has only a single button to interact with the electronics, uncomment the next line
3737
// in case you have 2 buttons (referred to as main and aux buttons) leave this line commented out
3838

39-
#define SINGLEBUTTON
39+
//#define SINGLEBUTTON
4040

4141
#ifdef DIYINO_PRIME
4242
#define MAIN_BUTTON 12
@@ -60,8 +60,8 @@
6060
* blocks from compile
6161
*************************************/
6262
//#define LEDSTRINGS
63-
#define STAR_LED
64-
//#define PIXELBLADE
63+
//#define STAR_LED
64+
#define PIXELBLADE
6565
//#define ADF_PIXIE_BLADE
6666

6767
/************************************/

FX-SaberOS.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ Serial.println(configAdress);
417417
/***** BUTTONS INITIALISATION *****/
418418

419419
// link the Main button functions.
420+
pinMode(MAIN_BUTTON, INPUT_PULLUP);
420421
mainButton.setClickTicks(CLICK);
421422
mainButton.setPressTicks(PRESS_CONFIG);
422423
mainButton.attachClick(mainClick);
@@ -427,6 +428,7 @@ Serial.println(configAdress);
427428

428429
#ifndef SINGLEBUTTON
429430
// link the Lockup button functions.
431+
pinMode(AUX_BUTTON, INPUT_PULLUP);
430432
lockupButton.setClickTicks(CLICK);
431433
lockupButton.setPressTicks(PRESS_CONFIG);
432434
lockupButton.attachClick(lockupClick);

Light.cpp

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extern struct StoreStruct {
4141
}storage;
4242

4343
extern SoundFont soundFont;
44-
44+
extern uint8_t ledPins[];
4545
# if defined ACCENT_LED
4646
unsigned long lastAccent = millis();
4747
#endif
@@ -881,12 +881,20 @@ void lightBlasterEffect(uint8_t ledPins[], uint8_t pixel, uint8_t range, cRGB Sn
881881
void pixelblade_KillKey_Enable() {
882882
#if defined PIXELBLADE or defined ADF_PIXIE_BLADE
883883
// cut power to the neopixels stripes by disconnecting their GND signal using the LS pins
884-
digitalWrite(3, LOW);
885-
digitalWrite(5, LOW);
886-
digitalWrite(6, LOW);
887-
digitalWrite(9, LOW);
888-
digitalWrite(10, LOW);
889-
digitalWrite(11, LOW);
884+
#ifdef DIYINO_STARDUST
885+
for (uint8_t j = 0; j < 3; j++) {
886+
#endif
887+
#ifdef DIYINO_PRIME
888+
for (uint8_t j = 0; j < 6; j++) {
889+
#endif
890+
digitalWrite(ledPins[j], LOW);
891+
}
892+
//digitalWrite(3, LOW);
893+
//digitalWrite(5, LOW);
894+
//digitalWrite(6, LOW);
895+
//digitalWrite(9, LOW);
896+
//digitalWrite(10, LOW);
897+
//digitalWrite(11, LOW);
890898
#ifdef PIXELBLADE
891899
digitalWrite(DATA_PIN,HIGH); // in order not to back-connect GND over the Data pin to the stripes when the Low-Sides disconnect it
892900
#else if ADF_PIXIE_BLADE
@@ -898,12 +906,20 @@ void pixelblade_KillKey_Enable() {
898906
void pixelblade_KillKey_Disable() {
899907
#if defined PIXELBLADE or defined ADF_PIXIE_BLADE
900908
// cut power to the neopixels stripes by disconnecting their GND signal using the LS pins
901-
digitalWrite(3, HIGH);
902-
digitalWrite(5, HIGH);
903-
digitalWrite(6, HIGH);
904-
digitalWrite(9, HIGH);
905-
digitalWrite(10, HIGH);
906-
digitalWrite(11, HIGH);
909+
#ifdef DIYINO_STARDUST
910+
for (uint8_t j = 0; j < 3; j++) {
911+
#endif
912+
#ifdef DIYINO_PRIME
913+
for (uint8_t j = 0; j < 6; j++) {
914+
#endif
915+
digitalWrite(ledPins[j], HIGH);
916+
}
917+
//digitalWrite(3, HIGH);
918+
//digitalWrite(5, HIGH);
919+
//digitalWrite(6, HIGH);
920+
//digitalWrite(9, HIGH);
921+
//digitalWrite(10, HIGH);
922+
//digitalWrite(11, HIGH);
907923
#endif
908924
}
909925

0 commit comments

Comments
 (0)