Skip to content

Commit

Permalink
fix the assignment of peripheral pins in GpioMappings
Browse files Browse the repository at this point in the history
this also deprecates old fields replaced by peripherals, which no longer
need to be touched in webconfig/be present in the website
  • Loading branch information
bsstephan committed Dec 22, 2023
1 parent 65a8bb4 commit 8bfcc17
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 263 deletions.
58 changes: 29 additions & 29 deletions proto/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand All @@ -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;
Expand Down Expand Up @@ -369,23 +369,23 @@ 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;
}

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
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
18 changes: 9 additions & 9 deletions src/config_legacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ButtonLayout>(legacyBoardOptions.buttonLayout));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 8bfcc17

Please sign in to comment.