Skip to content

Commit

Permalink
chore: resolve merge
Browse files Browse the repository at this point in the history
  • Loading branch information
MrUnzO committed Dec 24, 2023
1 parent 4d9a40f commit 394e7c7
Show file tree
Hide file tree
Showing 3 changed files with 235 additions and 214 deletions.
18 changes: 6 additions & 12 deletions Arduino/Esp32/Main/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,34 @@ static const int16_t JOYSTICK_RANGE = JOYSTICK_MAX_VALUE - JOYSTICK_MIN_VALUE;
char ssid[23];
uint64_t chipid = ESP.getEfuseMac(); // The chip ID is essentially its MAC address(length: 6 bytes).
unsigned int chip = (unsigned int)(chipid >> 32);
std::string bluetoothName_lcl = "DiyFfbPedal_" + std::to_string( chip );
std::string bluetoothName_lcl = "DiyActivePedal_" + std::to_string( chip );
BleGamepad bleGamepad(bluetoothName_lcl, bluetoothName_lcl, 100);


void SetupController() {
BleGamepadConfiguration bleGamepadConfig;
bleGamepadConfig.setControllerType(CONTROLLER_TYPE_MULTI_AXIS); // CONTROLLER_TYPE_JOYSTICK, CONTROLLER_TYPE_GAMEPAD (DEFAULT), CONTROLLER_TYPE_MULTI_AXIS
bleGamepadConfig.setControllerType(CONTROLLER_TYPE_GAMEPAD); // CONTROLLER_TYPE_JOYSTICK, CONTROLLER_TYPE_GAMEPAD (DEFAULT), CONTROLLER_TYPE_MULTI_AXIS
bleGamepadConfig.setAxesMin(JOYSTICK_MIN_VALUE); // 0 --> int16_t - 16 bit signed integer - Can be in decimal or hexadecimal
bleGamepadConfig.setAxesMax(JOYSTICK_MAX_VALUE); // 32767 --> int16_t - 16 bit signed integer - Can be in decimal or hexadecimal
//bleGamepadConfig.setWhichSpecialButtons(false, false, false, false, false, false, false, false);
bleGamepadConfig.setWhichAxes(true, true, true, true, true, true, true, true);
//bleGamepadConfig.setWhichSimulationControls(true, true, true, true, true); // only brake active
//bleGamepadConfig.setWhichAxes(false, false, false, false, false, false, false, false);
bleGamepadConfig.setWhichSimulationControls(false, false, false, true, false); // only brake active
bleGamepadConfig.setButtonCount(0);
bleGamepadConfig.setHatSwitchCount(0);
bleGamepadConfig.setAutoReport(false);
bleGamepadConfig.setPid(chip); // product id

bleGamepad.begin(&bleGamepadConfig);

//bleGamepad.deviceManufacturer = "DiyFfbPedal";
//bleGamepad.deviceName = chip;
}

bool IsControllerReady() { return bleGamepad.isConnected(); }

void SetControllerOutputValue(int32_t value) {
//bleGamepad.setBrake(value);

if (bleGamepad.isConnected() )
{
//bleGamepad.setAxes(value, 0, 0, 0, 0, 0, 0, 0);
bleGamepad.setX(value);
//bleGamepad.setSimulationControls(value, 0, 0, 0, 0);
//bleGamepad.setSliders(value,0);
// bleGamepad.setBrake(value);
bleGamepad.setAxes(0, 0, 0, 0, value, 0, 0, 0);
bleGamepad.sendReport();
}
else
Expand Down
2 changes: 1 addition & 1 deletion Arduino/Esp32/Main/Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/********************************************************************/
/* Loadcell defines */
/********************************************************************/
#define LOADCELL_WEIGHT_RATING_KG 300.0
#define LOADCELL_WEIGHT_RATING_KG 200.0
#define LOADCELL_EXCITATION_V 5.0
#define LOADCELL_SENSITIVITY_MV_V 2.0

Expand Down
Loading

0 comments on commit 394e7c7

Please sign in to comment.