Skip to content

Commit

Permalink
fix 2-button mode for Stardust
Browse files Browse the repository at this point in the history
[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
  • Loading branch information
Protonerd authored Dec 22, 2017
1 parent c947d73 commit 971a39a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
6 changes: 3 additions & 3 deletions Config_HW.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
// If your saber has only a single button to interact with the electronics, uncomment the next line
// in case you have 2 buttons (referred to as main and aux buttons) leave this line commented out

#define SINGLEBUTTON
//#define SINGLEBUTTON

#ifdef DIYINO_PRIME
#define MAIN_BUTTON 12
Expand All @@ -60,8 +60,8 @@
* blocks from compile
*************************************/
//#define LEDSTRINGS
#define STAR_LED
//#define PIXELBLADE
//#define STAR_LED
#define PIXELBLADE
//#define ADF_PIXIE_BLADE

/************************************/
Expand Down
2 changes: 2 additions & 0 deletions FX-SaberOS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ Serial.println(configAdress);
/***** BUTTONS INITIALISATION *****/

// link the Main button functions.
pinMode(MAIN_BUTTON, INPUT_PULLUP);
mainButton.setClickTicks(CLICK);
mainButton.setPressTicks(PRESS_CONFIG);
mainButton.attachClick(mainClick);
Expand All @@ -427,6 +428,7 @@ Serial.println(configAdress);

#ifndef SINGLEBUTTON
// link the Lockup button functions.
pinMode(AUX_BUTTON, INPUT_PULLUP);
lockupButton.setClickTicks(CLICK);
lockupButton.setPressTicks(PRESS_CONFIG);
lockupButton.attachClick(lockupClick);
Expand Down
42 changes: 29 additions & 13 deletions Light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extern struct StoreStruct {
}storage;

extern SoundFont soundFont;

extern uint8_t ledPins[];
# if defined ACCENT_LED
unsigned long lastAccent = millis();
#endif
Expand Down Expand Up @@ -881,12 +881,20 @@ void lightBlasterEffect(uint8_t ledPins[], uint8_t pixel, uint8_t range, cRGB Sn
void pixelblade_KillKey_Enable() {
#if defined PIXELBLADE or defined ADF_PIXIE_BLADE
// cut power to the neopixels stripes by disconnecting their GND signal using the LS pins
digitalWrite(3, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
#ifdef DIYINO_STARDUST
for (uint8_t j = 0; j < 3; j++) {
#endif
#ifdef DIYINO_PRIME
for (uint8_t j = 0; j < 6; j++) {
#endif
digitalWrite(ledPins[j], LOW);
}
//digitalWrite(3, LOW);
//digitalWrite(5, LOW);
//digitalWrite(6, LOW);
//digitalWrite(9, LOW);
//digitalWrite(10, LOW);
//digitalWrite(11, LOW);
#ifdef PIXELBLADE
digitalWrite(DATA_PIN,HIGH); // in order not to back-connect GND over the Data pin to the stripes when the Low-Sides disconnect it
#else if ADF_PIXIE_BLADE
Expand All @@ -898,12 +906,20 @@ void pixelblade_KillKey_Enable() {
void pixelblade_KillKey_Disable() {
#if defined PIXELBLADE or defined ADF_PIXIE_BLADE
// cut power to the neopixels stripes by disconnecting their GND signal using the LS pins
digitalWrite(3, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
#ifdef DIYINO_STARDUST
for (uint8_t j = 0; j < 3; j++) {
#endif
#ifdef DIYINO_PRIME
for (uint8_t j = 0; j < 6; j++) {
#endif
digitalWrite(ledPins[j], HIGH);
}
//digitalWrite(3, HIGH);
//digitalWrite(5, HIGH);
//digitalWrite(6, HIGH);
//digitalWrite(9, HIGH);
//digitalWrite(10, HIGH);
//digitalWrite(11, HIGH);
#endif
}

Expand Down

0 comments on commit 971a39a

Please sign in to comment.