Skip to content

Commit 05d9967

Browse files
authored
Merge pull request #49 from dmadison/dj-unsigned
Unsigned DJ Crossfade
2 parents bff0f6a + fd6379d commit 05d9967

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

examples/DJ/DJ_Demo/DJ_Demo.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void loop() {
4848
delay(1000);
4949
}
5050
else {
51-
// Read the turntable, basic (-30-29. Clockwise = positive, faster = larger)
51+
// Read the turntable, basic (-30-29. Clockwise = positive, faster = larger). ~900 ticks per revolution.
5252
int turntable = dj.turntable();
5353

5454
Serial.print("The turntable is ");
@@ -108,19 +108,19 @@ void loop() {
108108
Serial.print("The effect dial is at ");
109109
Serial.println(fx);
110110

111-
// Read the crossfade slider (-8-7, negative to the left)
111+
// Read the crossfade slider (0-15, left to right)
112112
int cross = dj.crossfadeSlider();
113113

114114
Serial.print("The crossfade slider is ");
115115

116-
if (cross <= -2) {
116+
if (cross <= 6) {
117117
Serial.println("left");
118118
}
119-
else if (cross >= 1) {
119+
else if (cross >= 9) {
120120
Serial.println("right");
121121
}
122122
else {
123-
Serial.println("center");
123+
Serial.println("centered");
124124
}
125125

126126
// Read the joystick axis (0-63 XY)

src/controllers/DJTurntable.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ uint8_t DJTurntableController_Shared::effectDial() const {
6969
return getControlData(Maps::EffectDial);
7070
}
7171

72-
int8_t DJTurntableController_Shared::crossfadeSlider() const {
73-
return getControlData(Maps::CrossfadeSlider) - 8; // Shifted to signed int
72+
uint8_t DJTurntableController_Shared::crossfadeSlider() const {
73+
return getControlData(Maps::CrossfadeSlider);
7474
}
7575

7676
boolean DJTurntableController_Shared::buttonEuphoria() const {
@@ -154,7 +154,7 @@ void DJTurntableController_Shared::printDebug(Print& output) {
154154
char euphoriaPrint = buttonEuphoria() ? 'E' : fillCharacter;
155155

156156
sprintf(buffer,
157-
" Joy:(%2u, %2u) | %c | %c%c | FX: %2u | Fade: %2d",
157+
" Joy:(%2u, %2u) | %c | %c%c | FX: %2u | Fade: %2u",
158158
joyX(), joyY(),
159159
euphoriaPrint,
160160
minusPrint, plusPrint,

src/controllers/DJTurntable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ namespace NintendoExtensionCtrl {
6868
Both,
6969
};
7070

71-
int8_t turntable() const; // 6 bits, -30-29. Clockwise = positive, faster = larger.
71+
int8_t turntable() const; // 6 bits, -30-29. Clockwise = positive, faster = larger. ~900 ticks per revolution.
7272

7373
boolean buttonGreen() const;
7474
boolean buttonRed() const;
7575
boolean buttonBlue() const;
7676

7777
uint8_t effectDial() const; // 5 bits, 0-31. One rotation per rollover.
78-
int8_t crossfadeSlider() const; // 4 bits, -8-7. Negative to the left.
78+
uint8_t crossfadeSlider() const; // 4 bits, 0-15. Left to right.
7979

8080
boolean buttonEuphoria() const;
8181

0 commit comments

Comments
 (0)