Skip to content

Commit

Permalink
0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
DxBang committed Jan 19, 2024
1 parent e0dcc9f commit 7f08790
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 92 deletions.
29 changes: 20 additions & 9 deletions src/Bang.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,19 @@ unsigned long timer = 0;
unsigned long debugTimer = 0;
unsigned long loopCount = 0;

bool pulseState = false;

bool pulseBlink = false;
unsigned long pulseTimer = 0;
unsigned short pulseInterval = 250;


bool blinkState = false;
unsigned long blinkTimer = 0;
unsigned char blinkInterval = 100;
unsigned char blinkCount = 0;
unsigned char blinkLimit = 10;
bool feedbackBlink = false;
unsigned long feedbackTimer = 0;
unsigned char feedbackInterval = 100;
unsigned char feedbackCount = 0;
unsigned char feedbackLimit = 10;

bool bangedState = false;
bool bangedBlink = false;
unsigned long bangedTimer = 0;
unsigned short bangedInterval = 500;
unsigned long bangedDuration = 3000;
Expand All @@ -87,6 +88,7 @@ unsigned short prepareChangeProfileDuration = 2000;
unsigned long activateChangeProfileTimer = 0;
unsigned short activateChangeProfileInterval = 250;
unsigned short activateChangeProfileDuration = 2000;
bool activateChangeProfileBlink = false;

unsigned char sleeping = 0;
unsigned long sleepTimer = 0;
Expand Down Expand Up @@ -199,7 +201,7 @@ class Game {
int longerDelay = 200;
int longestDelay = 500;
int tapDelay = 50;
int recurrenceDelay = 100;
int recurrenceDelay = 50;
// Joystick_ *joystick;
Game() {};
virtual void button(unsigned char button, bool pressed) {};
Expand Down Expand Up @@ -232,7 +234,7 @@ class Game {
this->enhanced = true;
enhancedEncoderTimer = millis();
pulseTimer = millis();
blinkTimer = 0;
feedbackTimer = 0;
};
virtual void deEnhance() {
this->enhanced = false;
Expand Down Expand Up @@ -284,6 +286,15 @@ class Game {
}
*/
for (unsigned char i = 0; i < times; i++) {
Serial.print("TAP: ");
Serial.print(key);
Serial.print(" ");
Serial.print(i);
Serial.print(" ");
Serial.println(times);



Keyboard.press(key);
delay(this->tapDelay);
Keyboard.release(key);
Expand Down
110 changes: 72 additions & 38 deletions src/Game/AssettoCorsaCompetizione.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,70 +71,104 @@ class AssettoCorsaCompetizione : public Game {




case B_ENCODER_M_PH:
case B_ENCODER_L_PH:
case B_ENCODER_R_PH:
case BANGED + B_ENCODER_M_PH:
case BANGED + B_ENCODER_L_PH:
case BANGED + B_ENCODER_R_PH:
if (pressed) {
this->enhance();
}
break;

case R_ENCODER_M_UP:
this->engineMapUp(pressed);
this->engineMapUp(!pressed);
if (this->enhanced) {
this->engineMapUp(pressed, 3);
}
else {
this->engineMapUp(pressed, 1);
}
break;
case R_ENCODER_M_DN:
this->engineMapDown(pressed);
this->engineMapDown(!pressed);
if (this->enhanced) {
this->engineMapDown(pressed, 3);
}
else {
this->engineMapDown(pressed, 1);
}
break;
case R_ENCODER_L_UP:
this->brakeBiasUp(pressed);
this->brakeBiasUp(!pressed);
if (this->enhanced) {
this->brakeBiasUp(pressed, 10);
}
else {
this->brakeBiasUp(pressed, 5);
}

break;
case R_ENCODER_L_DN:
this->brakeBiasDown(pressed);
this->brakeBiasDown(!pressed);
if (this->enhanced) {
this->brakeBiasDown(pressed, 10);
}
else {
this->brakeBiasDown(pressed, 5);
}
break;
case R_ENCODER_R_UP:
this->tractionControlUp(pressed);
this->tractionControlUp(!pressed);
break;
case R_ENCODER_R_DN:
this->tractionControlDown(pressed);
this->tractionControlDown(!pressed);
break;

case B_ENCODER_M_PH:
if (pressed) {
this->enhance();
if (this->enhanced) {
this->tractionControlUp(pressed, 3);
}
break;
case B_ENCODER_L_PH:
if (pressed) {
this->enhance();
else {
this->tractionControlUp(pressed, 1);
}
break;
case B_ENCODER_R_PH:
if (pressed) {
this->enhance();
case R_ENCODER_R_DN:
if (this->enhanced) {
this->tractionControlDown(pressed, 3);
}
else {
this->tractionControlDown(pressed, 1);
}
break;
case BANGED + R_ENCODER_L_UP:
this->antilockBrakingSystemUp(pressed);
this->antilockBrakingSystemUp(!pressed);
if (this->enhanced) {
this->antilockBrakingSystemUp(pressed, 3);
}
else {
this->antilockBrakingSystemUp(pressed, 1);
}
break;
case BANGED + R_ENCODER_L_DN:
this->antilockBrakingSystemDown(pressed);
this->antilockBrakingSystemDown(!pressed);
if (this->enhanced) {
this->antilockBrakingSystemDown(pressed, 3);
}
else {
this->antilockBrakingSystemDown(pressed, 1);
}
break;
case BANGED + R_ENCODER_R_UP:
this->tractionControlCutUp(pressed);
this->tractionControlCutUp(!pressed);
if (this->enhanced) {
this->tractionControlCutUp(pressed, 3);
}
else {
this->tractionControlCutUp(pressed, 1);
}
break;
case BANGED + R_ENCODER_R_DN:
this->tractionControlCutDown(pressed);
this->tractionControlCutDown(!pressed);
if (this->enhanced) {
this->tractionControlCutDown(pressed, 3);
}
else {
this->tractionControlCutDown(pressed, 1);
}
break;
case BANGED + R_ENCODER_M_UP:
this->volumeUp(pressed);
this->volumeUp(!pressed);
this->volumeUp(pressed, 5);
break;
case BANGED + R_ENCODER_M_DN:
this->volumeDown(pressed);
this->volumeDown(!pressed);
this->volumeDown(pressed, 5);
break;


Expand Down
8 changes: 4 additions & 4 deletions src/Smurf.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#define ROTARY_ENCODER_M_CL_PIN 8
#define ROTARY_ENCODER_M_DT_PIN 16

#define ROTARY_ENCODER_L_CL_PIN 0
#define ROTARY_ENCODER_L_DT_PIN 1
#define ROTARY_ENCODER_L_CL_PIN 7
#define ROTARY_ENCODER_L_DT_PIN 2

#define ROTARY_ENCODER_R_CL_PIN 7
#define ROTARY_ENCODER_R_DT_PIN 2
#define ROTARY_ENCODER_R_CL_PIN 0
#define ROTARY_ENCODER_R_DT_PIN 1

#define ROTARY_ENCODER_M_SWT_PIN 12
#define ROTARY_ENCODER_L_SWT_PIN 15
Expand Down
Loading

0 comments on commit 7f08790

Please sign in to comment.