Skip to content

Commit

Permalink
Fix LED test responses
Browse files Browse the repository at this point in the history
The old method didn't consider power sink fourpins, so use the LED update method proper. As a side effect, this will also cause all (non-static) emitters, i.e. NeoPixels, to change color.
  • Loading branch information
SeongGino committed Aug 10, 2024
1 parent 34723af commit 1c1c135
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 additions & 20 deletions SamcoEnhanced/SamcoEnhanced.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3055,26 +3055,35 @@ void SerialProcessingDocked()
// Testing feedback
case 't':
serialInput = Serial.read();
if(serialInput == 's') {
digitalWrite(SamcoPreferences::pins.oSolenoid, HIGH);
delay(SamcoPreferences::settings.solenoidNormalInterval);
digitalWrite(SamcoPreferences::pins.oSolenoid, LOW);
} else if(serialInput == 'r') {
analogWrite(SamcoPreferences::pins.oRumble, SamcoPreferences::settings.rumbleIntensity);
delay(SamcoPreferences::settings.rumbleInterval);
digitalWrite(SamcoPreferences::pins.oRumble, LOW);
} else if(serialInput == 'R') {
digitalWrite(SamcoPreferences::pins.oLedR, HIGH);
digitalWrite(SamcoPreferences::pins.oLedG, LOW);
digitalWrite(SamcoPreferences::pins.oLedB, LOW);
} else if(serialInput == 'G') {
digitalWrite(SamcoPreferences::pins.oLedR, LOW);
digitalWrite(SamcoPreferences::pins.oLedG, HIGH);
digitalWrite(SamcoPreferences::pins.oLedB, LOW);
} else if(serialInput == 'B') {
digitalWrite(SamcoPreferences::pins.oLedR, LOW);
digitalWrite(SamcoPreferences::pins.oLedG, LOW);
digitalWrite(SamcoPreferences::pins.oLedB, HIGH);
switch(serialInput) {
#ifdef USES_SOLENOID
case 's':
digitalWrite(SamcoPreferences::pins.oSolenoid, HIGH);
delay(SamcoPreferences::settings.solenoidNormalInterval);
digitalWrite(SamcoPreferences::pins.oSolenoid, LOW);
break;
#endif // USES_SOLENOID
#ifdef USES_RUMBLE
case 'r':
analogWrite(SamcoPreferences::pins.oRumble, SamcoPreferences::settings.rumbleIntensity);
delay(SamcoPreferences::settings.rumbleInterval);
digitalWrite(SamcoPreferences::pins.oRumble, LOW);
break;
#endif // USES_RUMBLE
#ifdef LED_ENABLE
// meant to be for 4pins, but will update all LED devices anyways.
case 'R':
LedUpdate(255, 0, 0);
break;
case 'G':
LedUpdate(0, 255, 0);
break;
case 'B':
LedUpdate(0, 0, 255);
break;
#endif // LED_ENABLE
default:
break;
}
break;
case 'x':
Expand Down

0 comments on commit 1c1c135

Please sign in to comment.