diff --git a/firmware/config/engines/dodge_neon.cpp b/firmware/config/engines/dodge_neon.cpp index 62f4bc9157..e113d8eaf9 100644 --- a/firmware/config/engines/dodge_neon.cpp +++ b/firmware/config/engines/dodge_neon.cpp @@ -371,8 +371,10 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat engineConfiguration->isJoystickEnabled = true; boardConfiguration->joystickCenterPin = GPIOD_10; - boardConfiguration->joystickCenterA = GPIOD_8; - boardConfiguration->joystickCenterC = GPIOD_9; + boardConfiguration->joystickAPin = GPIOD_8; + boardConfiguration->joystickBPin = GPIO_UNASSIGNED; + boardConfiguration->joystickCPin = GPIOD_9; + boardConfiguration->joystickDPin = GPIOD_11; // engineConfiguration->isCanEnabled = true; boardConfiguration->canTxPin = GPIOB_6; diff --git a/firmware/controllers/algo/engine_configuration.h b/firmware/controllers/algo/engine_configuration.h index baf2a30b26..0106a81b9f 100644 --- a/firmware/controllers/algo/engine_configuration.h +++ b/firmware/controllers/algo/engine_configuration.h @@ -259,12 +259,18 @@ typedef struct { brain_pin_e spi3misoPin; brain_pin_e spi3sckPin; + // offset 6228 float hip9011Gain; + // offset 6232 brain_pin_e joystickCenterPin; - brain_pin_e joystickCenterA; - brain_pin_e joystickCenterB; - brain_pin_e joystickCenterC; - brain_pin_e joystickCenterD; + // offset 6236 + brain_pin_e joystickAPin; + // offset 6240 + brain_pin_e joystickBPin; + // offset 6244 + brain_pin_e joystickCPin; + // offset 6248 + brain_pin_e joystickDPin; int unusedbs[7]; le_formula_t le_formulas[LE_COMMAND_COUNT]; diff --git a/firmware/hw_layer/joystick.cpp b/firmware/hw_layer/joystick.cpp index 11935610e0..d624086c19 100644 --- a/firmware/hw_layer/joystick.cpp +++ b/firmware/hw_layer/joystick.cpp @@ -15,9 +15,11 @@ EXTERN_ENGINE; static int joyTotal = 0; +static int joyCenter; static int joyA = 0; static int joyB = 0; static int joyC = 0; +static int joyD = 0;; static Logging *sharedLogger; @@ -25,7 +27,7 @@ static Logging *sharedLogger; static void extCallback(EXTDriver *extp, expchannel_t channel) { joyTotal++; - if (channel == 8) { + if (channel == getHwPin(boardConfiguration->joystickAPin)) { joyA++; } else if (channel == 9) { joyB++; @@ -35,8 +37,12 @@ static void extCallback(EXTDriver *extp, expchannel_t channel) { } static void joystickInfo(void) { - scheduleMsg(sharedLogger, "total %d a %d b %d c %d", joyTotal, joyA, joyB, - joyC); + scheduleMsg(sharedLogger, "total %d center=%d@%s", joyTotal, + joyCenter, hwPortname(boardConfiguration->joystickCenterPin)); + scheduleMsg(sharedLogger, "a=%d@%s", joyA, hwPortname(boardConfiguration->joystickAPin)); + scheduleMsg(sharedLogger, "b=%d@%s", joyB, hwPortname(boardConfiguration->joystickBPin)); + scheduleMsg(sharedLogger, "c=%d@%s", joyC, hwPortname(boardConfiguration->joystickCPin)); + scheduleMsg(sharedLogger, "d=%d@%s", joyD, hwPortname(boardConfiguration->joystickDPin)); } /** @@ -89,7 +95,7 @@ void initJoystick(Logging *shared) { | EXT_MODE_GPIOD; // PD11 extcfg.channels[11].cb = extCallback; - mySetPadMode("joy center", GPIOD, 10, PAL_MODE_INPUT_PULLUP); + mySetPadMode2("joy center", boardConfiguration->joystickCenterPin, PAL_MODE_INPUT_PULLUP); mySetPadMode("joy B", GPIOC, 8, PAL_MODE_INPUT_PULLUP); mySetPadMode("joy D", GPIOD, 11, PAL_MODE_INPUT_PULLUP);