diff --git a/proto/config.proto b/proto/config.proto index 26e51a14f..34b4caac8 100644 --- a/proto/config.proto +++ b/proto/config.proto @@ -192,7 +192,7 @@ message AlternativePinMappings message ProfileOptions { - repeated AlternativePinMappings deprecatedAlternativePinMappings = 1 [(nanopb).max_count = 3]; + repeated AlternativePinMappings deprecatedAlternativePinMappings = 1 [(nanopb).max_count = 3, deprecated = true]; repeated GpioMappings gpioMappingsSets = 2 [(nanopb).max_count = 3]; } @@ -201,10 +201,10 @@ message DisplayOptions optional bool enabled = 1; optional int32 i2cBlock = 2; - optional int32 i2cSDAPin = 3; - optional int32 i2cSCLPin = 4; + optional int32 deprecatedI2cSDAPin = 3 [deprecated = true]; + optional int32 deprecatedI2cSCLPin = 4 [deprecated = true]; optional int32 i2cAddress = 5; - optional int32 i2cSpeed = 6; + optional int32 deprecatedI2cSpeed = 6 [deprecated = true]; optional ButtonLayout buttonLayout = 7; optional ButtonLayoutRight buttonLayoutRight = 8; @@ -369,10 +369,10 @@ message SliderOptions { optional bool enabled = 1; - optional int32 deprecatedPinSliderOne = 2; - optional int32 deprecatedPinSliderTwo = 3; - optional DpadMode deprecatedModeOne = 4; - optional DpadMode deprecatedModeTwo = 5; + optional int32 deprecatedPinSliderOne = 2 [deprecated = true]; + optional int32 deprecatedPinSliderTwo = 3 [deprecated = true]; + optional DpadMode deprecatedModeOne = 4 [deprecated = true]; + optional DpadMode deprecatedModeTwo = 5 [deprecated = true]; optional DpadMode modeDefault = 6; } @@ -380,12 +380,12 @@ message SOCDSliderOptions { optional bool enabled = 1; - optional int32 deprecatedPinOne = 2; - optional int32 deprecatedPinTwo = 3; + optional int32 deprecatedPinOne = 2 [deprecated = true]; + optional int32 deprecatedPinTwo = 3 [deprecated = true]; optional SOCDMode modeDefault = 4; - optional SOCDMode deprecatedModeOne = 5; - optional SOCDMode deprecatedModeTwo = 6; + optional SOCDMode deprecatedModeOne = 5 [deprecated = true]; + optional SOCDMode deprecatedModeTwo = 6 [deprecated = true]; } message ReverseOptions @@ -406,20 +406,20 @@ message AnalogADS1219Options optional bool enabled = 1; optional int32 i2cBlock = 2; - optional int32 i2cSDAPin = 3; - optional int32 i2cSCLPin = 4; + optional int32 deprecatedI2cSDAPin = 3 [deprecated = true]; + optional int32 deprecatedI2cSCLPin = 4 [deprecated = true]; optional int32 i2cAddress = 5; - optional int32 i2cSpeed = 6; + optional int32 deprecatedI2cSpeed = 6 [deprecated = true]; } message DualDirectionalOptions { optional bool enabled = 1; - optional int32 deprecatedUpPin = 2; - optional int32 deprecatedDownPin = 3; - optional int32 deprecatedLeftPin = 4; - optional int32 deprecatedRightPin = 5; + optional int32 deprecatedUpPin = 2 [deprecated = true]; + optional int32 deprecatedDownPin = 3 [deprecated = true]; + optional int32 deprecatedLeftPin = 4 [deprecated = true]; + optional int32 deprecatedRightPin = 5 [deprecated = true]; optional DpadMode dpadMode = 6; optional uint32 combineMode = 7; @@ -432,7 +432,7 @@ message TiltOptions optional int32 tilt1Pin = 2; optional int32 tilt2Pin = 3; - optional int32 deprecatedTiltFunctionPin = 4; + optional int32 deprecatedTiltFunctionPin = 4 [deprecated = true]; optional int32 tiltLeftAnalogUpPin = 5; optional int32 tiltLeftAnalogDownPin = 6; optional int32 tiltLeftAnalogLeftPin = 7; @@ -495,8 +495,8 @@ message PS4Options message PSPassthroughOptions { optional bool enabled = 1; - optional int32 pinDplus = 2 [deprecated = true]; - optional int32 pin5V = 3 [deprecated = true]; + optional int32 deprecatedPinDplus = 2 [deprecated = true]; + optional int32 deprecatedPin5V = 3 [deprecated = true]; } message XBOnePassthroughOptions @@ -616,9 +616,9 @@ message WiiOptions optional bool enabled = 1; optional int32 i2cBlock = 2; - optional int32 i2cSDAPin = 3; - optional int32 i2cSCLPin = 4; - optional int32 i2cSpeed = 5; + optional int32 deprecatedI2cSDAPin = 3 [deprecated = true]; + optional int32 deprecatedI2cSCLPin = 4 [deprecated = true]; + optional int32 deprecatedI2cSpeed = 5 [deprecated = true]; optional ControllerOptions controllers = 6; } @@ -634,9 +634,9 @@ message SNESOptions message KeyboardHostOptions { optional bool enabled = 1; - optional int32 pinDplus = 2; + optional int32 deprecatedPinDplus = 2 [deprecated = true]; optional KeyboardMapping mapping = 3; - optional int32 pin5V = 4; + optional int32 deprecatedPin5V = 4 [deprecated = true]; } message FocusModeOptions @@ -698,7 +698,7 @@ message AddonOptions optional AnalogADS1219Options analogADS1219Options = 7; optional DualDirectionalOptions dualDirectionalOptions = 8; optional BuzzerOptions buzzerOptions = 9; - optional ExtraButtonOptions deprecatedExtraButtonOptions = 10; + optional ExtraButtonOptions deprecatedExtraButtonOptions = 10 [deprecated = true]; optional PlayerNumberOptions playerNumberOptions = 11; optional PS4Options ps4Options = 12 [(nanopb).disallow_export = true]; optional WiiOptions wiiOptions = 13; @@ -726,7 +726,7 @@ message Config optional GamepadOptions gamepadOptions = 2; optional HotkeyOptions hotkeyOptions = 3; - optional PinMappings deprecatedPinMappings = 4; + optional PinMappings deprecatedPinMappings = 4 [deprecated = true]; optional KeyboardMapping keyboardMapping = 5; optional DisplayOptions displayOptions = 6; optional LEDOptions ledOptions = 7; diff --git a/src/config_legacy.cpp b/src/config_legacy.cpp index bac287f03..5e60970cb 100644 --- a/src/config_legacy.cpp +++ b/src/config_legacy.cpp @@ -787,10 +787,10 @@ bool ConfigUtils::fromLegacyStorage(Config& config) config.has_displayOptions = true; SET_PROPERTY(displayOptions, enabled, legacyBoardOptions.hasI2CDisplay); SET_PROPERTY(displayOptions, i2cBlock, legacyBoardOptions.i2cBlock); - SET_PROPERTY(displayOptions, i2cSDAPin, legacyBoardOptions.i2cSDAPin); - SET_PROPERTY(displayOptions, i2cSCLPin, legacyBoardOptions.i2cSCLPin); + SET_PROPERTY(displayOptions, deprecatedI2cSDAPin, legacyBoardOptions.i2cSDAPin); + SET_PROPERTY(displayOptions, deprecatedI2cSCLPin, legacyBoardOptions.i2cSCLPin); SET_PROPERTY(displayOptions, i2cAddress, legacyBoardOptions.displayI2CAddress); - SET_PROPERTY(displayOptions, i2cSpeed, legacyBoardOptions.i2cSpeed); + SET_PROPERTY(displayOptions, deprecatedI2cSpeed, legacyBoardOptions.i2cSpeed); if (isValidButtonLayout(legacyBoardOptions.buttonLayout)) { SET_PROPERTY(displayOptions, buttonLayout, static_cast(legacyBoardOptions.buttonLayout)); @@ -985,10 +985,10 @@ bool ConfigUtils::fromLegacyStorage(Config& config) config.addonOptions.has_analogADS1219Options = true; SET_PROPERTY(analogADS1219Options, enabled, legacyAddonOptions.I2CAnalog1219InputEnabled); SET_PROPERTY(analogADS1219Options, i2cBlock, legacyAddonOptions.i2cAnalog1219Block); - SET_PROPERTY(analogADS1219Options, i2cSDAPin, bytePinToIntPin(legacyAddonOptions.i2cAnalog1219SDAPin)); - SET_PROPERTY(analogADS1219Options, i2cSCLPin, bytePinToIntPin(legacyAddonOptions.i2cAnalog1219SCLPin)); + SET_PROPERTY(analogADS1219Options, deprecatedI2cSDAPin, bytePinToIntPin(legacyAddonOptions.i2cAnalog1219SDAPin)); + SET_PROPERTY(analogADS1219Options, deprecatedI2cSCLPin, bytePinToIntPin(legacyAddonOptions.i2cAnalog1219SCLPin)); SET_PROPERTY(analogADS1219Options, i2cAddress, legacyAddonOptions.i2cAnalog1219Address); - SET_PROPERTY(analogADS1219Options, i2cSpeed, legacyAddonOptions.i2cAnalog1219Speed); + SET_PROPERTY(analogADS1219Options, deprecatedI2cSpeed, legacyAddonOptions.i2cAnalog1219Speed); SliderOptions& sliderOptions = config.addonOptions.sliderOptions; config.addonOptions.has_sliderOptions = true; @@ -1066,9 +1066,9 @@ bool ConfigUtils::fromLegacyStorage(Config& config) config.addonOptions.has_wiiOptions = true; SET_PROPERTY(wiiOptions, enabled, legacyAddonOptions.WiiExtensionAddonEnabled); SET_PROPERTY(wiiOptions, i2cBlock, legacyAddonOptions.wiiExtensionBlock); - SET_PROPERTY(wiiOptions, i2cSDAPin, bytePinToIntPin(legacyAddonOptions.wiiExtensionSDAPin)); - SET_PROPERTY(wiiOptions, i2cSCLPin, bytePinToIntPin(legacyAddonOptions.wiiExtensionSCLPin)); - SET_PROPERTY(wiiOptions, i2cSpeed, legacyAddonOptions.wiiExtensionSpeed); + SET_PROPERTY(wiiOptions, deprecatedI2cSDAPin, bytePinToIntPin(legacyAddonOptions.wiiExtensionSDAPin)); + SET_PROPERTY(wiiOptions, deprecatedI2cSCLPin, bytePinToIntPin(legacyAddonOptions.wiiExtensionSCLPin)); + SET_PROPERTY(wiiOptions, deprecatedI2cSpeed, legacyAddonOptions.wiiExtensionSpeed); PS4Options& ps4Options = config.addonOptions.ps4Options; config.addonOptions.has_ps4Options = true; diff --git a/src/config_utils.cpp b/src/config_utils.cpp index a3c67b2c0..b96cd70a4 100644 --- a/src/config_utils.cpp +++ b/src/config_utils.cpp @@ -248,10 +248,10 @@ void ConfigUtils::initUnsetPropertiesWithDefaults(Config& config) // displayOptions INIT_UNSET_PROPERTY(config.displayOptions, enabled, !!HAS_I2C_DISPLAY); INIT_UNSET_PROPERTY(config.displayOptions, i2cBlock, (I2C_BLOCK == i2c0) ? 0 : 1); - INIT_UNSET_PROPERTY(config.displayOptions, i2cSDAPin, I2C_SDA_PIN); - INIT_UNSET_PROPERTY(config.displayOptions, i2cSCLPin, I2C_SCL_PIN); + INIT_UNSET_PROPERTY(config.displayOptions, deprecatedI2cSDAPin, I2C_SDA_PIN); + INIT_UNSET_PROPERTY(config.displayOptions, deprecatedI2cSCLPin, I2C_SCL_PIN); INIT_UNSET_PROPERTY(config.displayOptions, i2cAddress, DISPLAY_I2C_ADDR); - INIT_UNSET_PROPERTY(config.displayOptions, i2cSpeed, I2C_SPEED); + INIT_UNSET_PROPERTY(config.displayOptions, deprecatedI2cSpeed, I2C_SPEED); INIT_UNSET_PROPERTY(config.displayOptions, buttonLayout, BUTTON_LAYOUT); INIT_UNSET_PROPERTY(config.displayOptions, buttonLayoutRight, BUTTON_LAYOUT_RIGHT); INIT_UNSET_PROPERTY(config.displayOptions, turnOffWhenSuspended, DISPLAY_TURN_OFF_WHEN_SUSPENDED); @@ -451,10 +451,10 @@ void ConfigUtils::initUnsetPropertiesWithDefaults(Config& config) // addonOptions.analogADS1219Options INIT_UNSET_PROPERTY(config.addonOptions.analogADS1219Options, enabled, !!I2C_ANALOG1219_ENABLED); INIT_UNSET_PROPERTY(config.addonOptions.analogADS1219Options, i2cBlock, (I2C_ANALOG1219_BLOCK == i2c0) ? 0 : 1) - INIT_UNSET_PROPERTY(config.addonOptions.analogADS1219Options, i2cSDAPin, I2C_ANALOG1219_SDA_PIN); - INIT_UNSET_PROPERTY(config.addonOptions.analogADS1219Options, i2cSCLPin, I2C_ANALOG1219_SCL_PIN); + INIT_UNSET_PROPERTY(config.addonOptions.analogADS1219Options, deprecatedI2cSDAPin, I2C_ANALOG1219_SDA_PIN); + INIT_UNSET_PROPERTY(config.addonOptions.analogADS1219Options, deprecatedI2cSCLPin, I2C_ANALOG1219_SCL_PIN); INIT_UNSET_PROPERTY(config.addonOptions.analogADS1219Options, i2cAddress, I2C_ANALOG1219_ADDRESS); - INIT_UNSET_PROPERTY(config.addonOptions.analogADS1219Options, i2cSpeed, I2C_ANALOG1219_SPEED); + INIT_UNSET_PROPERTY(config.addonOptions.analogADS1219Options, deprecatedI2cSpeed, I2C_ANALOG1219_SPEED); // addonOptions.dualDirectionalOptions INIT_UNSET_PROPERTY(config.addonOptions.dualDirectionalOptions, enabled, !!DUAL_DIRECTIONAL_ENABLED); @@ -516,9 +516,9 @@ void ConfigUtils::initUnsetPropertiesWithDefaults(Config& config) // addonOptions.wiiOptions INIT_UNSET_PROPERTY(config.addonOptions.wiiOptions, enabled, WII_EXTENSION_ENABLED); INIT_UNSET_PROPERTY(config.addonOptions.wiiOptions, i2cBlock, (WII_EXTENSION_I2C_BLOCK == i2c0) ? 0 : 1); - INIT_UNSET_PROPERTY(config.addonOptions.wiiOptions, i2cSDAPin, WII_EXTENSION_I2C_SDA_PIN); - INIT_UNSET_PROPERTY(config.addonOptions.wiiOptions, i2cSCLPin, WII_EXTENSION_I2C_SCL_PIN); - INIT_UNSET_PROPERTY(config.addonOptions.wiiOptions, i2cSpeed, WII_EXTENSION_I2C_SPEED); + INIT_UNSET_PROPERTY(config.addonOptions.wiiOptions, deprecatedI2cSDAPin, WII_EXTENSION_I2C_SDA_PIN); + INIT_UNSET_PROPERTY(config.addonOptions.wiiOptions, deprecatedI2cSCLPin, WII_EXTENSION_I2C_SCL_PIN); + INIT_UNSET_PROPERTY(config.addonOptions.wiiOptions, deprecatedI2cSpeed, WII_EXTENSION_I2C_SPEED); // addonOptions.snesOptions INIT_UNSET_PROPERTY(config.addonOptions.snesOptions, enabled, !!SNES_PAD_ENABLED); @@ -528,8 +528,8 @@ void ConfigUtils::initUnsetPropertiesWithDefaults(Config& config) // keyboardMapping INIT_UNSET_PROPERTY(config.addonOptions.keyboardHostOptions, enabled, KEYBOARD_HOST_ENABLED); - INIT_UNSET_PROPERTY(config.addonOptions.keyboardHostOptions, pinDplus, KEYBOARD_HOST_PIN_DPLUS); - INIT_UNSET_PROPERTY(config.addonOptions.keyboardHostOptions, pin5V, KEYBOARD_HOST_PIN_5V); + INIT_UNSET_PROPERTY(config.addonOptions.keyboardHostOptions, deprecatedPinDplus, KEYBOARD_HOST_PIN_DPLUS); + INIT_UNSET_PROPERTY(config.addonOptions.keyboardHostOptions, deprecatedPin5V, KEYBOARD_HOST_PIN_5V); INIT_UNSET_PROPERTY(config.addonOptions.keyboardHostOptions.mapping, keyDpadUp, KEY_DPAD_UP); INIT_UNSET_PROPERTY(config.addonOptions.keyboardHostOptions.mapping, keyDpadDown, KEY_DPAD_DOWN); INIT_UNSET_PROPERTY(config.addonOptions.keyboardHostOptions.mapping, keyDpadRight, KEY_DPAD_RIGHT); @@ -880,43 +880,45 @@ void gpioMappingsMigrationCore(Config& config) // pin configuration peripheralOptions.blockI2C0.sda = ( - isValidPin(config.displayOptions.i2cSDAPin) && (config.displayOptions.i2cBlock == 0) ? - config.displayOptions.i2cSDAPin : + isValidPin(config.displayOptions.deprecatedI2cSDAPin) && (config.displayOptions.i2cBlock == 0) ? + config.displayOptions.deprecatedI2cSDAPin : ( - isValidPin(config.addonOptions.analogADS1219Options.i2cSDAPin) && (config.addonOptions.analogADS1219Options.i2cBlock == 0) ? - config.addonOptions.analogADS1219Options.i2cSDAPin : + isValidPin(config.addonOptions.analogADS1219Options.deprecatedI2cSDAPin) && (config.addonOptions.analogADS1219Options.i2cBlock == 0) ? + config.addonOptions.analogADS1219Options.deprecatedI2cSDAPin : ( - isValidPin(config.addonOptions.wiiOptions.i2cSDAPin) && (config.addonOptions.wiiOptions.i2cBlock == 0) ? - config.addonOptions.wiiOptions.i2cSDAPin : + isValidPin(config.addonOptions.wiiOptions.deprecatedI2cSDAPin) && (config.addonOptions.wiiOptions.i2cBlock == 0) ? + config.addonOptions.wiiOptions.deprecatedI2cSDAPin : -1 ) ) ); + markAddonPinIfUsed(peripheralOptions.blockI2C0.sda); peripheralOptions.blockI2C0.scl = ( - isValidPin(config.displayOptions.i2cSCLPin) && (config.displayOptions.i2cBlock == 0) ? - config.displayOptions.i2cSCLPin : + isValidPin(config.displayOptions.deprecatedI2cSCLPin) && (config.displayOptions.i2cBlock == 0) ? + config.displayOptions.deprecatedI2cSCLPin : ( - isValidPin(config.addonOptions.analogADS1219Options.i2cSCLPin) && (config.addonOptions.analogADS1219Options.i2cBlock == 0) ? - config.addonOptions.analogADS1219Options.i2cSCLPin : + isValidPin(config.addonOptions.analogADS1219Options.deprecatedI2cSCLPin) && (config.addonOptions.analogADS1219Options.i2cBlock == 0) ? + config.addonOptions.analogADS1219Options.deprecatedI2cSCLPin : ( - isValidPin(config.addonOptions.wiiOptions.i2cSCLPin) && (config.addonOptions.wiiOptions.i2cBlock == 0) ? - config.addonOptions.wiiOptions.i2cSCLPin : + isValidPin(config.addonOptions.wiiOptions.deprecatedI2cSCLPin) && (config.addonOptions.wiiOptions.i2cBlock == 0) ? + config.addonOptions.wiiOptions.deprecatedI2cSCLPin : -1 ) ) ); + markAddonPinIfUsed(peripheralOptions.blockI2C0.scl); // option configuration peripheralOptions.blockI2C0.speed = ( - isValidPin(config.displayOptions.i2cSpeed) && (config.displayOptions.i2cBlock == 0) ? - config.displayOptions.i2cSpeed : + isValidPin(config.displayOptions.deprecatedI2cSpeed) && (config.displayOptions.i2cBlock == 0) ? + config.displayOptions.deprecatedI2cSpeed : ( - isValidPin(config.addonOptions.analogADS1219Options.i2cSpeed) && (config.addonOptions.analogADS1219Options.i2cBlock == 0) ? - config.addonOptions.analogADS1219Options.i2cSpeed : + isValidPin(config.addonOptions.analogADS1219Options.deprecatedI2cSpeed) && (config.addonOptions.analogADS1219Options.i2cBlock == 0) ? + config.addonOptions.analogADS1219Options.deprecatedI2cSpeed : ( - isValidPin(config.addonOptions.wiiOptions.i2cSpeed) && (config.addonOptions.wiiOptions.i2cBlock == 0) ? - config.addonOptions.wiiOptions.i2cSpeed : + isValidPin(config.addonOptions.wiiOptions.deprecatedI2cSpeed) && (config.addonOptions.wiiOptions.i2cBlock == 0) ? + config.addonOptions.wiiOptions.deprecatedI2cSpeed : -1 ) ) @@ -938,43 +940,45 @@ void gpioMappingsMigrationCore(Config& config) // pin configuration peripheralOptions.blockI2C1.sda = ( - isValidPin(config.displayOptions.i2cSDAPin) && (config.displayOptions.i2cBlock == 1) ? - config.displayOptions.i2cSDAPin : + isValidPin(config.displayOptions.deprecatedI2cSDAPin) && (config.displayOptions.i2cBlock == 1) ? + config.displayOptions.deprecatedI2cSDAPin : ( - isValidPin(config.addonOptions.analogADS1219Options.i2cSDAPin) && (config.addonOptions.analogADS1219Options.i2cBlock == 1) ? - config.addonOptions.analogADS1219Options.i2cSDAPin : + isValidPin(config.addonOptions.analogADS1219Options.deprecatedI2cSDAPin) && (config.addonOptions.analogADS1219Options.i2cBlock == 1) ? + config.addonOptions.analogADS1219Options.deprecatedI2cSDAPin : ( - isValidPin(config.addonOptions.wiiOptions.i2cSDAPin) && (config.addonOptions.wiiOptions.i2cBlock == 1) ? - config.addonOptions.wiiOptions.i2cSDAPin : + isValidPin(config.addonOptions.wiiOptions.deprecatedI2cSDAPin) && (config.addonOptions.wiiOptions.i2cBlock == 1) ? + config.addonOptions.wiiOptions.deprecatedI2cSDAPin : -1 ) ) ); + markAddonPinIfUsed(peripheralOptions.blockI2C1.sda); peripheralOptions.blockI2C1.scl = ( - isValidPin(config.displayOptions.i2cSCLPin) && (config.displayOptions.i2cBlock == 1) ? - config.displayOptions.i2cSCLPin : + isValidPin(config.displayOptions.deprecatedI2cSCLPin) && (config.displayOptions.i2cBlock == 1) ? + config.displayOptions.deprecatedI2cSCLPin : ( - isValidPin(config.addonOptions.analogADS1219Options.i2cSCLPin) && (config.addonOptions.analogADS1219Options.i2cBlock == 1) ? - config.addonOptions.analogADS1219Options.i2cSCLPin : + isValidPin(config.addonOptions.analogADS1219Options.deprecatedI2cSCLPin) && (config.addonOptions.analogADS1219Options.i2cBlock == 1) ? + config.addonOptions.analogADS1219Options.deprecatedI2cSCLPin : ( - isValidPin(config.addonOptions.wiiOptions.i2cSCLPin) && (config.addonOptions.wiiOptions.i2cBlock == 1) ? - config.addonOptions.wiiOptions.i2cSCLPin : + isValidPin(config.addonOptions.wiiOptions.deprecatedI2cSCLPin) && (config.addonOptions.wiiOptions.i2cBlock == 1) ? + config.addonOptions.wiiOptions.deprecatedI2cSCLPin : -1 ) ) ); + markAddonPinIfUsed(peripheralOptions.blockI2C1.scl); // option configuration peripheralOptions.blockI2C1.speed = ( - isValidPin(config.displayOptions.i2cSpeed) && (config.displayOptions.i2cBlock == 1) ? - config.displayOptions.i2cSpeed : + isValidPin(config.displayOptions.deprecatedI2cSpeed) && (config.displayOptions.i2cBlock == 1) ? + config.displayOptions.deprecatedI2cSpeed : ( - isValidPin(config.addonOptions.analogADS1219Options.i2cSpeed) && (config.addonOptions.analogADS1219Options.i2cBlock == 1) ? - config.addonOptions.analogADS1219Options.i2cSpeed : + isValidPin(config.addonOptions.analogADS1219Options.deprecatedI2cSpeed) && (config.addonOptions.analogADS1219Options.i2cBlock == 1) ? + config.addonOptions.analogADS1219Options.deprecatedI2cSpeed : ( - isValidPin(config.addonOptions.wiiOptions.i2cSpeed) && (config.addonOptions.wiiOptions.i2cBlock == 1) ? - config.addonOptions.wiiOptions.i2cSpeed : + isValidPin(config.addonOptions.wiiOptions.deprecatedI2cSpeed) && (config.addonOptions.wiiOptions.i2cBlock == 1) ? + config.addonOptions.wiiOptions.deprecatedI2cSpeed : -1 ) ) @@ -987,22 +991,22 @@ void gpioMappingsMigrationCore(Config& config) if (peripheralOptions.blockUSB0.enabled) { peripheralOptions.blockUSB0.enable5v = ( - isValidPin(keyboardHostOptions.pin5V) ? - keyboardHostOptions.pin5V : + isValidPin(keyboardHostOptions.deprecatedPin5V) ? + keyboardHostOptions.deprecatedPin5V : ( - isValidPin(psPassthroughOptions.pin5V) ? - psPassthroughOptions.pin5V : + isValidPin(psPassthroughOptions.deprecatedPin5V) ? + psPassthroughOptions.deprecatedPin5V : -1 ) ); markAddonPinIfUsed(peripheralOptions.blockUSB0.enable5v); peripheralOptions.blockUSB0.dp = ( - isValidPin(keyboardHostOptions.pinDplus) ? - keyboardHostOptions.pinDplus : + isValidPin(keyboardHostOptions.deprecatedPinDplus) ? + keyboardHostOptions.deprecatedPinDplus : ( - isValidPin(psPassthroughOptions.pinDplus) ? - psPassthroughOptions.pinDplus : + isValidPin(psPassthroughOptions.deprecatedPinDplus) ? + psPassthroughOptions.deprecatedPinDplus : -1 ) ); @@ -1012,8 +1016,6 @@ void gpioMappingsMigrationCore(Config& config) } } - markAddonPinIfUsed(config.displayOptions.i2cSCLPin); - markAddonPinIfUsed(config.displayOptions.i2cSDAPin); markAddonPinIfUsed(config.ledOptions.dataPin); markAddonPinIfUsed(config.ledOptions.pledPin1); markAddonPinIfUsed(config.ledOptions.pledPin2); @@ -1034,8 +1036,6 @@ void gpioMappingsMigrationCore(Config& config) markAddonPinIfUsed(config.addonOptions.turboOptions.shmupBtn4Pin); markAddonPinIfUsed(config.addonOptions.reverseOptions.buttonPin); markAddonPinIfUsed(config.addonOptions.reverseOptions.ledPin); - markAddonPinIfUsed(config.addonOptions.analogADS1219Options.i2cSCLPin); - markAddonPinIfUsed(config.addonOptions.analogADS1219Options.i2cSDAPin); markAddonPinIfUsed(config.addonOptions.tiltOptions.tilt1Pin); markAddonPinIfUsed(config.addonOptions.tiltOptions.tilt2Pin); markAddonPinIfUsed(config.addonOptions.tiltOptions.tiltLeftAnalogUpPin); @@ -1046,19 +1046,9 @@ void gpioMappingsMigrationCore(Config& config) markAddonPinIfUsed(config.addonOptions.tiltOptions.tiltRightAnalogDownPin); markAddonPinIfUsed(config.addonOptions.tiltOptions.tiltRightAnalogLeftPin); markAddonPinIfUsed(config.addonOptions.tiltOptions.tiltRightAnalogRightPin); - markAddonPinIfUsed(config.addonOptions.wiiOptions.i2cSCLPin); - markAddonPinIfUsed(config.addonOptions.wiiOptions.i2cSDAPin); markAddonPinIfUsed(config.addonOptions.snesOptions.clockPin); markAddonPinIfUsed(config.addonOptions.snesOptions.latchPin); markAddonPinIfUsed(config.addonOptions.snesOptions.dataPin); - //markAddonPinIfUsed(config.addonOptions.keyboardHostOptions.pin5V); - //markAddonPinIfUsed(config.addonOptions.keyboardHostOptions.pinDplus); - //if (isValidPin(config.addonOptions.keyboardHostOptions.pinDplus)) - // actions[config.addonOptions.keyboardHostOptions.pinDplus+1] = GpioAction::ASSIGNED_TO_ADDON; - //markAddonPinIfUsed(config.addonOptions.psPassthroughOptions.pin5V); - //markAddonPinIfUsed(config.addonOptions.psPassthroughOptions.pinDplus); - //if (isValidPin(config.addonOptions.psPassthroughOptions.pinDplus)) - // actions[config.addonOptions.psPassthroughOptions.pinDplus+1] = GpioAction::ASSIGNED_TO_ADDON; markAddonPinIfUsed(config.addonOptions.macroOptions.pin); markAddonPinIfUsed(config.addonOptions.macroOptions.macroList[0].macroTriggerPin); markAddonPinIfUsed(config.addonOptions.macroOptions.macroList[1].macroTriggerPin); diff --git a/src/configs/webconfig.cpp b/src/configs/webconfig.cpp index 5abda7c13..5c40f271f 100644 --- a/src/configs/webconfig.cpp +++ b/src/configs/webconfig.cpp @@ -105,15 +105,6 @@ static void __attribute__((noinline)) docToValue(T& value, const DynamicJsonDocu } } -// Don't inline this function, we do not want to consume stack space in the calling function -static void __attribute__((noinline)) docToPinLegacy(uint8_t& pin, const DynamicJsonDocument& doc, const char* key) -{ - if (doc[key] != nullptr) - { - pin = doc[key] < 0 ? 0xff : doc[key]; - } -} - // Don't inline this function, we do not want to consume stack space in the calling function static void __attribute__((noinline)) docToPin(Pin_t& pin, const DynamicJsonDocument& doc, const char* key) { @@ -140,42 +131,42 @@ static void __attribute__((noinline)) docToPin(Pin_t& pin, const DynamicJsonDocu // Don't inline this function, we do not want to consume stack space in the calling function static void __attribute__((noinline)) docToPin(Pin_t& pin, const DynamicJsonDocument& doc, const char* key0, const char* key1) { - Pin_t oldPin = pin; + Pin_t oldPin = pin; if (doc.containsKey(key0) && doc[key0].containsKey(key1)) { pin = doc[key0][key1]; - GpioMappingInfo* gpioMappings = Storage::getInstance().getGpioMappings().pins; - if (!isValidPin(pin)) - { - gpioMappings[pin].action = GpioAction::ASSIGNED_TO_ADDON; - } else { + GpioMappingInfo* gpioMappings = Storage::getInstance().getGpioMappings().pins; + if (isValidPin(pin)) + { + gpioMappings[pin].action = GpioAction::ASSIGNED_TO_ADDON; + } else { pin = -1; if (isValidPin(oldPin)) { gpioMappings[oldPin].action = GpioAction::NONE; } - } + } } } // Don't inline this function, we do not want to consume stack space in the calling function static void __attribute__((noinline)) docToPin(Pin_t& pin, const DynamicJsonDocument& doc, const char* key0, const char* key1, const char* key2) { - Pin_t oldPin = pin; + Pin_t oldPin = pin; if (doc.containsKey(key0) && doc[key0].containsKey(key1) && doc[key0][key1].containsKey(key2)) { pin = doc[key0][key1][key2]; - GpioMappingInfo* gpioMappings = Storage::getInstance().getGpioMappings().pins; - if (!isValidPin(pin)) - { - gpioMappings[pin].action = GpioAction::ASSIGNED_TO_ADDON; - } else { + GpioMappingInfo* gpioMappings = Storage::getInstance().getGpioMappings().pins; + if (isValidPin(pin)) + { + gpioMappings[pin].action = GpioAction::ASSIGNED_TO_ADDON; + } else { pin = -1; if (isValidPin(oldPin)) { gpioMappings[oldPin].action = GpioAction::NONE; } - } + } } } @@ -413,20 +404,6 @@ void addUsedPinsArray(DynamicJsonDocument& doc) usedPins.add(pin); } } - - // TODO: Exclude non-button pins from validation for now, fix this when validation reworked - // addPinIfValid(boardOptions.i2cSDAPin); - // addPinIfValid(boardOptions.i2cSCLPin); - - // TODO: Used Pins logic does not work in add-ons, fix this - // const AnalogOptions& analogOptions = Storage::getInstance().getAddonOptions().analogOptions; - // addPinIfValid(analogOptions.analogAdc1PinX); - // addPinIfValid(analogOptions.analogAdc1PinY); - // addPinIfValid(analogOptions.analogAdc2PinX); - // addPinIfValid(analogOptions.analogAdc2PinY); - - // TODO: Exclude non-button pins from validation for now, fix this when validation reworked - // addPinIfValid(addonOptions.buzzerPin); } std::string serialize_json(JsonDocument &doc) @@ -447,11 +424,8 @@ std::string setDisplayOptions(DisplayOptions& displayOptions) { DynamicJsonDocument doc = get_post_data(); readDoc(displayOptions.enabled, doc, "enabled"); - docToPin(displayOptions.i2cSDAPin, doc, "sdaPin"); - docToPin(displayOptions.i2cSCLPin, doc, "sclPin"); readDoc(displayOptions.i2cAddress, doc, "i2cAddress"); readDoc(displayOptions.i2cBlock, doc, "i2cBlock"); - readDoc(displayOptions.i2cSpeed, doc, "i2cSpeed"); readDoc(displayOptions.flip, doc, "flipDisplay"); readDoc(displayOptions.invert, doc, "invertDisplay"); readDoc(displayOptions.buttonLayout, doc, "buttonLayout"); @@ -494,11 +468,8 @@ std::string getDisplayOptions() // Manually set Document Attributes for the disp DynamicJsonDocument doc(LWIP_HTTPD_POST_MAX_PAYLOAD_LEN); const DisplayOptions& displayOptions = Storage::getInstance().getDisplayOptions(); writeDoc(doc, "enabled", displayOptions.enabled ? 1 : 0); - writeDoc(doc, "sdaPin", cleanPin(displayOptions.i2cSDAPin)); - writeDoc(doc, "sclPin", cleanPin(displayOptions.i2cSCLPin)); writeDoc(doc, "i2cAddress", displayOptions.i2cAddress); writeDoc(doc, "i2cBlock", displayOptions.i2cBlock); - writeDoc(doc, "i2cSpeed", displayOptions.i2cSpeed); writeDoc(doc, "flipDisplay", displayOptions.flip ? 1 : 0); writeDoc(doc, "invertDisplay", displayOptions.invert ? 1 : 0); writeDoc(doc, "buttonLayout", displayOptions.buttonLayout); @@ -1104,32 +1075,44 @@ std::string setPeripheralOptions() PeripheralOptions& peripheralOptions = Storage::getInstance().getPeripheralOptions(); docToValue(peripheralOptions.blockI2C0.enabled, doc, "peripheral", "i2c0", "enabled"); - docToValue(peripheralOptions.blockI2C0.sda, doc, "peripheral", "i2c0", "sda"); - docToValue(peripheralOptions.blockI2C0.scl, doc, "peripheral", "i2c0", "scl"); + docToPin(peripheralOptions.blockI2C0.sda, doc, "peripheral", "i2c0", "sda"); + docToPin(peripheralOptions.blockI2C0.scl, doc, "peripheral", "i2c0", "scl"); docToValue(peripheralOptions.blockI2C0.speed, doc, "peripheral", "i2c0", "speed"); docToValue(peripheralOptions.blockI2C1.enabled, doc, "peripheral", "i2c1", "enabled"); - docToValue(peripheralOptions.blockI2C1.sda, doc, "peripheral", "i2c1", "sda"); - docToValue(peripheralOptions.blockI2C1.scl, doc, "peripheral", "i2c1", "scl"); + docToPin(peripheralOptions.blockI2C1.sda, doc, "peripheral", "i2c1", "sda"); + docToPin(peripheralOptions.blockI2C1.scl, doc, "peripheral", "i2c1", "scl"); docToValue(peripheralOptions.blockI2C1.speed, doc, "peripheral", "i2c1", "speed"); docToValue(peripheralOptions.blockSPI0.enabled, doc, "peripheral", "spi0", "enabled"); - docToValue(peripheralOptions.blockSPI0.rx, doc, "peripheral", "spi0", "rx"); - docToValue(peripheralOptions.blockSPI0.cs, doc, "peripheral", "spi0", "cs"); - docToValue(peripheralOptions.blockSPI0.sck, doc, "peripheral", "spi0", "sck"); - docToValue(peripheralOptions.blockSPI0.tx, doc, "peripheral", "spi0", "tx"); + docToPin(peripheralOptions.blockSPI0.rx, doc, "peripheral", "spi0", "rx"); + docToPin(peripheralOptions.blockSPI0.cs, doc, "peripheral", "spi0", "cs"); + docToPin(peripheralOptions.blockSPI0.sck, doc, "peripheral", "spi0", "sck"); + docToPin(peripheralOptions.blockSPI0.tx, doc, "peripheral", "spi0", "tx"); docToValue(peripheralOptions.blockSPI1.enabled, doc, "peripheral", "spi1", "enabled"); - docToValue(peripheralOptions.blockSPI1.rx, doc, "peripheral", "spi1", "rx"); - docToValue(peripheralOptions.blockSPI1.cs, doc, "peripheral", "spi1", "cs"); - docToValue(peripheralOptions.blockSPI1.sck, doc, "peripheral", "spi1", "sck"); - docToValue(peripheralOptions.blockSPI1.tx, doc, "peripheral", "spi1", "tx"); + docToPin(peripheralOptions.blockSPI1.rx, doc, "peripheral", "spi1", "rx"); + docToPin(peripheralOptions.blockSPI1.cs, doc, "peripheral", "spi1", "cs"); + docToPin(peripheralOptions.blockSPI1.sck, doc, "peripheral", "spi1", "sck"); + docToPin(peripheralOptions.blockSPI1.tx, doc, "peripheral", "spi1", "tx"); docToValue(peripheralOptions.blockUSB0.enabled, doc, "peripheral", "usb0", "enabled"); - docToValue(peripheralOptions.blockUSB0.dp, doc, "peripheral", "usb0", "dp"); docToValue(peripheralOptions.blockUSB0.enable5v, doc, "peripheral", "usb0", "enable5v"); docToValue(peripheralOptions.blockUSB0.order, doc, "peripheral", "usb0", "order"); + // need to reserve previous/next pin for dp + GpioMappingInfo* gpioMappings = Storage::getInstance().getGpioMappings().pins; + uint8_t adjacent = peripheralOptions.blockUSB0.order ? -1 : 1; + + Pin_t oldPinDplus = peripheralOptions.blockUSB0.dp; + docToPin(peripheralOptions.blockUSB0.dp, doc, "peripheral", "usb0", "dp"); + if (isValidPin(peripheralOptions.blockUSB0.dp)) + // if D+ pin is now set, also set the pin that will be used for D- + gpioMappings[peripheralOptions.blockUSB0.dp+adjacent].action = GpioAction::ASSIGNED_TO_ADDON; + else if (isValidPin(oldPinDplus)) + // if D+ pin was set and is no longer, also unset the pin that was used for D- + gpioMappings[oldPinDplus+adjacent].action = GpioAction::NONE; + Storage::getInstance().save(); return serialize_json(doc); @@ -1202,10 +1185,7 @@ std::string setAddonOptions() docToValue(focusModeOptions.enabled, doc, "FocusModeAddonEnabled"); AnalogADS1219Options& analogADS1219Options = Storage::getInstance().getAddonOptions().analogADS1219Options; - docToPin(analogADS1219Options.i2cSDAPin, doc, "i2cAnalog1219SDAPin"); - docToPin(analogADS1219Options.i2cSCLPin, doc, "i2cAnalog1219SCLPin"); docToValue(analogADS1219Options.i2cBlock, doc, "i2cAnalog1219Block"); - docToValue(analogADS1219Options.i2cSpeed, doc, "i2cAnalog1219Speed"); docToValue(analogADS1219Options.i2cAddress, doc, "i2cAnalog1219Address"); docToValue(analogADS1219Options.enabled, doc, "I2CAnalog1219InputEnabled"); @@ -1256,10 +1236,7 @@ std::string setAddonOptions() docToValue(turboOptions.enabled, doc, "TurboInputEnabled"); WiiOptions& wiiOptions = Storage::getInstance().getAddonOptions().wiiOptions; - docToPin(wiiOptions.i2cSDAPin, doc, "wiiExtensionSDAPin"); - docToPin(wiiOptions.i2cSCLPin, doc, "wiiExtensionSCLPin"); docToValue(wiiOptions.i2cBlock, doc, "wiiExtensionBlock"); - docToValue(wiiOptions.i2cSpeed, doc, "wiiExtensionSpeed"); docToValue(wiiOptions.enabled, doc, "WiiExtensionAddonEnabled"); PS4Options& ps4Options = Storage::getInstance().getAddonOptions().ps4Options; @@ -1279,14 +1256,6 @@ std::string setAddonOptions() KeyboardHostOptions& keyboardHostOptions = Storage::getInstance().getAddonOptions().keyboardHostOptions; docToValue(keyboardHostOptions.enabled, doc, "KeyboardHostAddonEnabled"); - Pin_t oldKbPinDplus = keyboardHostOptions.pinDplus; - docToPin(keyboardHostOptions.pinDplus, doc, "keyboardHostPinDplus"); - if (isValidPin(keyboardHostOptions.pinDplus)) - gpioMappings[keyboardHostOptions.pinDplus+1].action = GpioAction::ASSIGNED_TO_ADDON; - else if (isValidPin(oldKbPinDplus)) - // if D+ pin was set, and is no longer, also unset the pin that was used for D- - gpioMappings[oldKbPinDplus+1].action = GpioAction::NONE; - docToPin(keyboardHostOptions.pin5V, doc, "keyboardHostPin5V"); docToValue(keyboardHostOptions.mapping.keyDpadUp, doc, "keyboardHostMap", "Up"); docToValue(keyboardHostOptions.mapping.keyDpadDown, doc, "keyboardHostMap", "Down"); docToValue(keyboardHostOptions.mapping.keyDpadLeft, doc, "keyboardHostMap", "Left"); @@ -1308,15 +1277,6 @@ std::string setAddonOptions() PSPassthroughOptions& psPassthroughOptions = Storage::getInstance().getAddonOptions().psPassthroughOptions; docToValue(psPassthroughOptions.enabled, doc, "PSPassthroughAddonEnabled"); - Pin_t oldPsPinDplus = psPassthroughOptions.pinDplus; - docToPin(psPassthroughOptions.pinDplus, doc, "psPassthroughPinDplus"); - if (isValidPin(psPassthroughOptions.pinDplus)) - gpioMappings[psPassthroughOptions.pinDplus+1].action = GpioAction::ASSIGNED_TO_ADDON; - else if (isValidPin(oldPsPinDplus)) - // if D+ pin was set, and is no longer, also unset the pin that was used for D- - gpioMappings[oldPsPinDplus+1].action = GpioAction::NONE; - docToPin(psPassthroughOptions.pin5V, doc, "psPassthroughPin5V"); - XBOnePassthroughOptions& xbonePassthroughOptions = Storage::getInstance().getAddonOptions().xbonePassthroughOptions; docToValue(xbonePassthroughOptions.enabled, doc, "XBOnePassthroughAddonEnabled"); @@ -1619,10 +1579,7 @@ std::string getAddonOptions() writeDoc(doc, "TiltInputEnabled", tiltOptions.enabled); const AnalogADS1219Options& analogADS1219Options = Storage::getInstance().getAddonOptions().analogADS1219Options; - writeDoc(doc, "i2cAnalog1219SDAPin", cleanPin(analogADS1219Options.i2cSDAPin)); - writeDoc(doc, "i2cAnalog1219SCLPin", cleanPin(analogADS1219Options.i2cSCLPin)); writeDoc(doc, "i2cAnalog1219Block", analogADS1219Options.i2cBlock); - writeDoc(doc, "i2cAnalog1219Speed", analogADS1219Options.i2cSpeed); writeDoc(doc, "i2cAnalog1219Address", analogADS1219Options.i2cAddress); writeDoc(doc, "I2CAnalog1219InputEnabled", analogADS1219Options.enabled); @@ -1673,10 +1630,7 @@ std::string getAddonOptions() writeDoc(doc, "TurboInputEnabled", turboOptions.enabled); const WiiOptions& wiiOptions = Storage::getInstance().getAddonOptions().wiiOptions; - writeDoc(doc, "wiiExtensionSDAPin", cleanPin(wiiOptions.i2cSDAPin)); - writeDoc(doc, "wiiExtensionSCLPin", cleanPin(wiiOptions.i2cSCLPin)); writeDoc(doc, "wiiExtensionBlock", wiiOptions.i2cBlock); - writeDoc(doc, "wiiExtensionSpeed", wiiOptions.i2cSpeed); writeDoc(doc, "WiiExtensionAddonEnabled", wiiOptions.enabled); const PS4Options& ps4Options = Storage::getInstance().getAddonOptions().ps4Options; @@ -1696,8 +1650,6 @@ std::string getAddonOptions() const KeyboardHostOptions& keyboardHostOptions = Storage::getInstance().getAddonOptions().keyboardHostOptions; writeDoc(doc, "KeyboardHostAddonEnabled", keyboardHostOptions.enabled); - writeDoc(doc, "keyboardHostPinDplus", keyboardHostOptions.pinDplus); - writeDoc(doc, "keyboardHostPin5V", keyboardHostOptions.pin5V); writeDoc(doc, "keyboardHostMap", "Up", keyboardHostOptions.mapping.keyDpadUp); writeDoc(doc, "keyboardHostMap", "Down", keyboardHostOptions.mapping.keyDpadDown); writeDoc(doc, "keyboardHostMap", "Left", keyboardHostOptions.mapping.keyDpadLeft); diff --git a/www/server/app.js b/www/server/app.js index 195b0be73..867dfccd3 100644 --- a/www/server/app.js +++ b/www/server/app.js @@ -38,11 +38,8 @@ app.get('/api/resetSettings', (req, res) => { app.get('/api/getDisplayOptions', (req, res) => { const data = { enabled: 1, - sdaPin: 0, - sclPin: 1, i2cAddress: 61, i2cBlock: 0, - i2cSpeed: 400000, flipDisplay: 0, invertDisplay: 1, buttonLayout: 0, @@ -389,10 +386,7 @@ app.get('/api/getAddonsOptions', (req, res) => { reverseActionDown: 1, reverseActionLeft: 1, reverseActionRight: 1, - i2cAnalog1219SDAPin: -1, - i2cAnalog1219SCLPin: -1, i2cAnalog1219Block: 0, - i2cAnalog1219Speed: 400000, i2cAnalog1219Address: 0x40, onBoardLedMode: 0, dualDirDpadMode: 0, @@ -453,15 +447,10 @@ app.get('/api/getAddonsOptions', (req, res) => { shmupBtnMask4: 0, pinShmupDial: -1, sliderSOCDModeDefault: 1, - wiiExtensionSDAPin: -1, - wiiExtensionSCLPin: -1, wiiExtensionBlock: 0, - wiiExtensionSpeed: 400000, snesPadClockPin: -1, snesPadLatchPin: -1, snesPadDataPin: -1, - keyboardHostPinDplus: 0, - keyboardHostPin5V: -1, keyboardHostMap: DEFAULT_KEYBOARD_MAPPING, AnalogInputEnabled: 1, BoardLedAddonEnabled: 1, diff --git a/www/src/Addons/I2CAnalog1219.tsx b/www/src/Addons/I2CAnalog1219.tsx index 21f28478f..c40515d29 100644 --- a/www/src/Addons/I2CAnalog1219.tsx +++ b/www/src/Addons/I2CAnalog1219.tsx @@ -13,22 +13,10 @@ import { I2C_BLOCKS } from '../Data/Peripherals'; export const i2cAnalogScheme = { I2CAnalog1219InputEnabled: yup.number().label('I2C Analog1219 Input Enabled'), - i2cAnalog1219SDAPin: yup - .number() - .label('I2C Analog1219 SDA Pin') - .validatePinWhenValue('I2CAnalog1219InputEnabled'), - i2cAnalog1219SCLPin: yup - .number() - .label('I2C Analog1219 SCL Pin') - .validatePinWhenValue('I2CAnalog1219InputEnabled'), i2cAnalog1219Block: yup .number() .label('I2C Analog1219 Block') .validateSelectionWhenValue('I2CAnalog1219InputEnabled', I2C_BLOCKS), - i2cAnalog1219Speed: yup - .number() - .label('I2C Analog1219 Speed') - .validateNumberWhenValue('I2CAnalog1219InputEnabled'), i2cAnalog1219Address: yup .number() .label('I2C Analog1219 Address') @@ -37,10 +25,7 @@ export const i2cAnalogScheme = { export const i2cAnalogState = { I2CAnalog1219InputEnabled: 0, - i2cAnalog1219SDAPin: -1, - i2cAnalog1219SCLPin: -1, i2cAnalog1219Block: 0, - i2cAnalog1219Speed: 400000, i2cAnalog1219Address: 0x40, }; @@ -51,9 +36,6 @@ const I2CAnalog1219 = ({ values, errors, handleChange, handleCheckbox }) => { const handlePeripheralChange = (e) => { let device = getSelectedPeripheral('i2c', e.target.value); - values.i2cAnalog1219SDAPin = device.sda; - values.i2cAnalog1219SCLPin = device.scl; - values.i2cAnalog1219Speed = device.speed; handleChange(e); }; diff --git a/www/src/Addons/Keyboard.tsx b/www/src/Addons/Keyboard.tsx index 30f3740e9..fc03bf004 100644 --- a/www/src/Addons/Keyboard.tsx +++ b/www/src/Addons/Keyboard.tsx @@ -16,19 +16,9 @@ export const keyboardScheme = { .number() .required() .label('Keyboard Host Add-On Enabled'), - keyboardHostPinDplus: yup - .number() - .label('Keyboard Host D+ Pin') - .validatePinWhenValue('KeyboardHostAddonEnabled'), - keyboardHostPin5V: yup - .number() - .label('Keyboard Host 5V Power Pin') - .validatePinWhenValue('KeyboardHostAddonEnabled'), }; export const keyboardState = { - keyboardHostPinDplus: -1, - keyboardHostPin5V: -1, keyboardHostMap: baseButtonMappings, KeyboardHostAddonEnabled: 0, }; diff --git a/www/src/Addons/PSPassthrough.tsx b/www/src/Addons/PSPassthrough.tsx index 9c53fc28b..e765db15c 100644 --- a/www/src/Addons/PSPassthrough.tsx +++ b/www/src/Addons/PSPassthrough.tsx @@ -14,20 +14,10 @@ export const psPassthroughScheme = { .number() .required() .label('PS Passthrough Add-On Enabled'), - psPassthroughPinDplus: yup - .number() - .label('PS Passthrough D+ Pin') - .validatePinWhenValue('PSPassthroughAddonEnabled'), - psPassthroughPin5V: yup - .number() - .label('PS Passthrough 5V Power Pin') - .validatePinWhenValue('PSPassthroughAddonEnabled'), }; export const psPassthroughState = { PSPassthroughAddonEnabled: -1, - psPassthroughPinDplus: 0, - psPassthroughPin5V: -1, }; const PSPassthrough = ({ values, errors, handleChange, handleCheckbox }) => { diff --git a/www/src/Addons/Wii.tsx b/www/src/Addons/Wii.tsx index 61444cb2e..adecc75f6 100644 --- a/www/src/Addons/Wii.tsx +++ b/www/src/Addons/Wii.tsx @@ -19,33 +19,16 @@ export const wiiScheme = { .number() .required() .label('Wii Extensions Enabled'), - wiiExtensionSDAPin: yup - .number() - .required() - .label('WiiExtension I2C SDA Pin') - .validatePinWhenValue('WiiExtensionAddonEnabled'), - wiiExtensionSCLPin: yup - .number() - .required() - .label('WiiExtension I2C SCL Pin') - .validatePinWhenValue('WiiExtensionAddonEnabled'), wiiExtensionBlock: yup .number() .required() .label('WiiExtension I2C Block') .validateSelectionWhenValue('WiiExtensionAddonEnabled', I2C_BLOCKS), - wiiExtensionSpeed: yup - .number() - .label('WiiExtension I2C Speed') - .validateNumberWhenValue('WiiExtensionAddonEnabled'), }; export const wiiState = { WiiExtensionAddonEnabled: 0, - wiiExtensionSDAPin: -1, - wiiExtensionSCLPin: -1, wiiExtensionBlock: 0, - wiiExtensionSpeed: 400000, }; const WII_EXTENSION_CONTROLS = [ @@ -154,9 +137,6 @@ const Wii = ({ values, errors, handleChange, handleCheckbox, setFieldValue }) => const handlePeripheralChange = (e) => { let device = getSelectedPeripheral('i2c', e.target.value); - values.wiiExtensionSDAPin = device.sda; - values.wiiExtensionSCLPin = device.scl; - values.wiiExtensionSpeed = device.speed; handleChange(e); }; diff --git a/www/src/Pages/DisplayConfig.jsx b/www/src/Pages/DisplayConfig.jsx index 00696a62b..f59cb0733 100644 --- a/www/src/Pages/DisplayConfig.jsx +++ b/www/src/Pages/DisplayConfig.jsx @@ -73,11 +73,8 @@ const DISPLAY_FLIP_MODES = [ const defaultValues = { enabled: false, - sdaPin: -1, - sclPin: -1, i2cAddress: '0x3C', i2cBlock: 0, - i2cSpeed: 400000, flipDisplay: false, invertDisplay: false, buttonLayout: 0, @@ -119,14 +116,11 @@ const buttonLayoutRightSchema = yup const schema = yup.object().shape({ enabled: yup.number().label('Enabled?'), i2cAddress: yup.string().required().label('I2C Address'), - sdaPin: yup.number().label('SDA Pin').validatePinWhenValue('sdaPin'), - sclPin: yup.number().label('SCL Pin').validatePinWhenValue('sclPin'), i2cBlock: yup .number() .required() .oneOf(I2C_BLOCKS.map((o) => o.value)) .label('I2C Block'), - i2cSpeed: yup.number().required().label('I2C Speed'), flipDisplay: yup .number() .oneOf(DISPLAY_FLIP_MODES.map((o) => o.value)) @@ -287,9 +281,6 @@ export default function DisplayConfigPage() { {({ handleSubmit, handleChange, values, errors }) => { const handlePeripheralChange = (e) => { let device = getSelectedPeripheral('i2c', e.target.value); - values.sdaPin = device.sda; - values.sclPin = device.scl; - values.i2cSpeed = device.speed; handleChange(e); };