diff --git a/www/server/app.js b/www/server/app.js index 5e940a27e..71c37c273 100644 --- a/www/server/app.js +++ b/www/server/app.js @@ -481,54 +481,54 @@ app.get('/api/getAddonsOptions', (req, res) => { analog1256DrdyPin: -1, analog1256AnalogMax: 3.3, analog1256EnableTriggers: false, - encoderOneEnabled: 0, - encoderOnePinA: -1, - encoderOnePinB: -1, - encoderOneMode: 0, - encoderOnePPR: 24, - encoderOneResetAfter: 0, - encoderOneAllowWrapAround: false, - encoderOneMultiplier: 1, - encoderTwoEnabled: 0, - encoderTwoPinA: -1, - encoderTwoPinB: -1, - encoderTwoMode: 0, - encoderTwoPPR: 24, - encoderTwoResetAfter: 0, - encoderTwoAllowWrapAround: false, - encoderTwoMultiplier: 1, - RotaryAddonEnabled: 1, - pcf8575Block: 0, - PCF8575AddonEnabled: 1, + encoderOneEnabled: 0, + encoderOnePinA: -1, + encoderOnePinB: -1, + encoderOneMode: 0, + encoderOnePPR: 24, + encoderOneResetAfter: 0, + encoderOneAllowWrapAround: false, + encoderOneMultiplier: 1, + encoderTwoEnabled: 0, + encoderTwoPinA: -1, + encoderTwoPinB: -1, + encoderTwoMode: 0, + encoderTwoPPR: 24, + encoderTwoResetAfter: 0, + encoderTwoAllowWrapAround: false, + encoderTwoMultiplier: 1, + RotaryAddonEnabled: 1, + pcf8575Block: 0, + PCF8575AddonEnabled: 1, usedPins: Object.values(picoController), }); }); app.get('/api/getExpansionPins', (req, res) => { - return res.send({ - "pins": { - "pcf8575": [ - { - "pin00": {"option": 2,"direction": 0}, - "pin01": {"option": -10,"direction": 0}, - "pin02": {"option": -10,"direction": 0}, - "pin03": {"option": -10,"direction": 0}, - "pin04": {"option": -10,"direction": 0}, - "pin05": {"option": -10,"direction": 0}, - "pin06": {"option": -10,"direction": 0}, - "pin07": {"option": -10,"direction": 0}, - "pin08": {"option": -10,"direction": 0}, - "pin09": {"option": -10,"direction": 0}, - "pin10": {"option": -10,"direction": 0}, - "pin11": {"option": -10,"direction": 0}, - "pin12": {"option": -10,"direction": 0}, - "pin13": {"option": -10,"direction": 0}, - "pin14": {"option": -10,"direction": 0}, - "pin15": {"option": -10,"direction": 0} - } - ] - } - }); + return res.send({ + pins: { + pcf8575: [ + { + pin00: { option: 2, direction: 0 }, + pin01: { option: -10, direction: 0 }, + pin02: { option: -10, direction: 0 }, + pin03: { option: -10, direction: 0 }, + pin04: { option: -10, direction: 0 }, + pin05: { option: -10, direction: 0 }, + pin06: { option: -10, direction: 0 }, + pin07: { option: -10, direction: 0 }, + pin08: { option: -10, direction: 0 }, + pin09: { option: -10, direction: 0 }, + pin10: { option: -10, direction: 0 }, + pin11: { option: -10, direction: 0 }, + pin12: { option: -10, direction: 0 }, + pin13: { option: -10, direction: 0 }, + pin14: { option: -10, direction: 0 }, + pin15: { option: -10, direction: 0 }, + }, + ], + }, + }); }); app.get('/api/getMacroAddonOptions', (req, res) => { @@ -553,26 +553,61 @@ app.get('/api/getMacroAddonOptions', (req, res) => { }, ], }, - { enabled: 0, exclusive: 1, interruptible: 1, showFrames: 1, - macroType: 1, useMacroTriggerButton: 0, - macroTriggerButton: 0, macroLabel: '', - macroInputs: [],}, - { enabled: 0, exclusive: 1, interruptible: 1, showFrames: 1, - macroType: 1, useMacroTriggerButton: 0, - macroTriggerButton: 0, macroLabel: '', - macroInputs: [],}, - { enabled: 0, exclusive: 1, interruptible: 1, showFrames: 1, - macroType: 1, useMacroTriggerButton: 0, - macroTriggerButton: 0, macroLabel: '', - macroInputs: [],}, - { enabled: 0, exclusive: 1, interruptible: 1, showFrames: 1, - macroType: 1, useMacroTriggerButton: 0, - macroTriggerButton: 0, macroLabel: '', - macroInputs: [],}, - { enabled: 0, exclusive: 1, interruptible: 1, showFrames: 1, - macroType: 1, useMacroTriggerButton: 0, - macroTriggerButton: 0, macroLabel: '', - macroInputs: [],}, + { + enabled: 0, + exclusive: 1, + interruptible: 1, + showFrames: 1, + macroType: 1, + useMacroTriggerButton: 0, + macroTriggerButton: 0, + macroLabel: '', + macroInputs: [], + }, + { + enabled: 0, + exclusive: 1, + interruptible: 1, + showFrames: 1, + macroType: 1, + useMacroTriggerButton: 0, + macroTriggerButton: 0, + macroLabel: '', + macroInputs: [], + }, + { + enabled: 0, + exclusive: 1, + interruptible: 1, + showFrames: 1, + macroType: 1, + useMacroTriggerButton: 0, + macroTriggerButton: 0, + macroLabel: '', + macroInputs: [], + }, + { + enabled: 0, + exclusive: 1, + interruptible: 1, + showFrames: 1, + macroType: 1, + useMacroTriggerButton: 0, + macroTriggerButton: 0, + macroLabel: '', + macroInputs: [], + }, + { + enabled: 0, + exclusive: 1, + interruptible: 1, + showFrames: 1, + macroType: 1, + useMacroTriggerButton: 0, + macroTriggerButton: 0, + macroLabel: '', + macroInputs: [], + }, ], macroBoardLedEnabled: 1, }); @@ -608,34 +643,80 @@ app.get('/api/getButtonLayoutCustomOptions', (req, res) => { app.get('/api/getButtonLayoutDefs', (req, res) => { return res.send({ - "buttonLayout":{ - "BUTTON_LAYOUT_STICK":0,"BUTTON_LAYOUT_STICKLESS":1,"BUTTON_LAYOUT_BUTTONS_ANGLED":2, - "BUTTON_LAYOUT_BUTTONS_BASIC":3,"BUTTON_LAYOUT_KEYBOARD_ANGLED":4,"BUTTON_LAYOUT_KEYBOARDA":5, - "BUTTON_LAYOUT_DANCEPADA":6,"BUTTON_LAYOUT_TWINSTICKA":7,"BUTTON_LAYOUT_BLANKA":8, - "BUTTON_LAYOUT_VLXA":9,"BUTTON_LAYOUT_FIGHTBOARD_STICK":10,"BUTTON_LAYOUT_FIGHTBOARD_MIRRORED":11, - "BUTTON_LAYOUT_CUSTOMA":12,"BUTTON_LAYOUT_OPENCORE0WASDA":13,"BUTTON_LAYOUT_STICKLESS_13":14, - "BUTTON_LAYOUT_STICKLESS_16":15,"BUTTON_LAYOUT_STICKLESS_14":16,"BUTTON_LAYOUT_DANCEPAD_DDR_LEFT":17, - "BUTTON_LAYOUT_DANCEPAD_DDR_SOLO":18,"BUTTON_LAYOUT_DANCEPAD_PIU_LEFT":19,"BUTTON_LAYOUT_POPN_A":20, - "BUTTON_LAYOUT_TAIKO_A":21,"BUTTON_LAYOUT_BM_TURNTABLE_A":22,"BUTTON_LAYOUT_BM_5KEY_A":23, - "BUTTON_LAYOUT_BM_7KEY_A":24,"BUTTON_LAYOUT_GITADORA_FRET_A":25,"BUTTON_LAYOUT_GITADORA_STRUM_A":26, - "BUTTON_LAYOUT_BOARD_DEFINED_A":27,"BUTTON_LAYOUT_BANDHERO_FRET_A":28,"BUTTON_LAYOUT_BANDHERO_STRUM_A":29, - "BUTTON_LAYOUT_6GAWD_A":30,"BUTTON_LAYOUT_6GAWD_ALLBUTTON_A":31,"BUTTON_LAYOUT_6GAWD_ALLBUTTONPLUS_A":32 + buttonLayout: { + BUTTON_LAYOUT_STICK: 0, + BUTTON_LAYOUT_STICKLESS: 1, + BUTTON_LAYOUT_BUTTONS_ANGLED: 2, + BUTTON_LAYOUT_BUTTONS_BASIC: 3, + BUTTON_LAYOUT_KEYBOARD_ANGLED: 4, + BUTTON_LAYOUT_KEYBOARDA: 5, + BUTTON_LAYOUT_DANCEPADA: 6, + BUTTON_LAYOUT_TWINSTICKA: 7, + BUTTON_LAYOUT_BLANKA: 8, + BUTTON_LAYOUT_VLXA: 9, + BUTTON_LAYOUT_FIGHTBOARD_STICK: 10, + BUTTON_LAYOUT_FIGHTBOARD_MIRRORED: 11, + BUTTON_LAYOUT_CUSTOMA: 12, + BUTTON_LAYOUT_OPENCORE0WASDA: 13, + BUTTON_LAYOUT_STICKLESS_13: 14, + BUTTON_LAYOUT_STICKLESS_16: 15, + BUTTON_LAYOUT_STICKLESS_14: 16, + BUTTON_LAYOUT_DANCEPAD_DDR_LEFT: 17, + BUTTON_LAYOUT_DANCEPAD_DDR_SOLO: 18, + BUTTON_LAYOUT_DANCEPAD_PIU_LEFT: 19, + BUTTON_LAYOUT_POPN_A: 20, + BUTTON_LAYOUT_TAIKO_A: 21, + BUTTON_LAYOUT_BM_TURNTABLE_A: 22, + BUTTON_LAYOUT_BM_5KEY_A: 23, + BUTTON_LAYOUT_BM_7KEY_A: 24, + BUTTON_LAYOUT_GITADORA_FRET_A: 25, + BUTTON_LAYOUT_GITADORA_STRUM_A: 26, + BUTTON_LAYOUT_BOARD_DEFINED_A: 27, + BUTTON_LAYOUT_BANDHERO_FRET_A: 28, + BUTTON_LAYOUT_BANDHERO_STRUM_A: 29, + BUTTON_LAYOUT_6GAWD_A: 30, + BUTTON_LAYOUT_6GAWD_ALLBUTTON_A: 31, + BUTTON_LAYOUT_6GAWD_ALLBUTTONPLUS_A: 32, + }, + buttonLayoutRight: { + BUTTON_LAYOUT_ARCADE: 0, + BUTTON_LAYOUT_STICKLESSB: 1, + BUTTON_LAYOUT_BUTTONS_ANGLEDB: 2, + BUTTON_LAYOUT_VEWLIX: 3, + BUTTON_LAYOUT_VEWLIX7: 4, + BUTTON_LAYOUT_CAPCOM: 5, + BUTTON_LAYOUT_CAPCOM6: 6, + BUTTON_LAYOUT_SEGA2P: 7, + BUTTON_LAYOUT_NOIR8: 8, + BUTTON_LAYOUT_KEYBOARDB: 9, + BUTTON_LAYOUT_DANCEPADB: 10, + BUTTON_LAYOUT_TWINSTICKB: 11, + BUTTON_LAYOUT_BLANKB: 12, + BUTTON_LAYOUT_VLXB: 13, + BUTTON_LAYOUT_FIGHTBOARD: 14, + BUTTON_LAYOUT_FIGHTBOARD_STICK_MIRRORED: 15, + BUTTON_LAYOUT_CUSTOMB: 16, + BUTTON_LAYOUT_KEYBOARD8B: 17, + BUTTON_LAYOUT_OPENCORE0WASDB: 18, + BUTTON_LAYOUT_STICKLESS_13B: 19, + BUTTON_LAYOUT_STICKLESS_16B: 20, + BUTTON_LAYOUT_STICKLESS_14B: 21, + BUTTON_LAYOUT_DANCEPAD_DDR_RIGHT: 22, + BUTTON_LAYOUT_DANCEPAD_PIU_RIGHT: 23, + BUTTON_LAYOUT_POPN_B: 24, + BUTTON_LAYOUT_TAIKO_B: 25, + BUTTON_LAYOUT_BM_TURNTABLE_B: 26, + BUTTON_LAYOUT_BM_5KEY_B: 27, + BUTTON_LAYOUT_BM_7KEY_B: 28, + BUTTON_LAYOUT_GITADORA_FRET_B: 29, + BUTTON_LAYOUT_GITADORA_STRUM_B: 30, + BUTTON_LAYOUT_BOARD_DEFINED_B: 31, + BUTTON_LAYOUT_BANDHERO_FRET_B: 32, + BUTTON_LAYOUT_BANDHERO_STRUM_B: 33, + BUTTON_LAYOUT_6GAWD_B: 34, + BUTTON_LAYOUT_6GAWD_ALLBUTTON_B: 35, + BUTTON_LAYOUT_6GAWD_ALLBUTTONPLUS_B: 36, }, - "buttonLayoutRight":{ - "BUTTON_LAYOUT_ARCADE":0,"BUTTON_LAYOUT_STICKLESSB":1,"BUTTON_LAYOUT_BUTTONS_ANGLEDB":2, - "BUTTON_LAYOUT_VEWLIX":3,"BUTTON_LAYOUT_VEWLIX7":4,"BUTTON_LAYOUT_CAPCOM":5, - "BUTTON_LAYOUT_CAPCOM6":6,"BUTTON_LAYOUT_SEGA2P":7,"BUTTON_LAYOUT_NOIR8":8, - "BUTTON_LAYOUT_KEYBOARDB":9,"BUTTON_LAYOUT_DANCEPADB":10,"BUTTON_LAYOUT_TWINSTICKB":11, - "BUTTON_LAYOUT_BLANKB":12,"BUTTON_LAYOUT_VLXB":13,"BUTTON_LAYOUT_FIGHTBOARD":14, - "BUTTON_LAYOUT_FIGHTBOARD_STICK_MIRRORED":15,"BUTTON_LAYOUT_CUSTOMB":16, - "BUTTON_LAYOUT_KEYBOARD8B":17,"BUTTON_LAYOUT_OPENCORE0WASDB":18,"BUTTON_LAYOUT_STICKLESS_13B":19, - "BUTTON_LAYOUT_STICKLESS_16B":20,"BUTTON_LAYOUT_STICKLESS_14B":21,"BUTTON_LAYOUT_DANCEPAD_DDR_RIGHT":22, - "BUTTON_LAYOUT_DANCEPAD_PIU_RIGHT":23,"BUTTON_LAYOUT_POPN_B":24,"BUTTON_LAYOUT_TAIKO_B":25, - "BUTTON_LAYOUT_BM_TURNTABLE_B":26,"BUTTON_LAYOUT_BM_5KEY_B":27,"BUTTON_LAYOUT_BM_7KEY_B":28, - "BUTTON_LAYOUT_GITADORA_FRET_B":29,"BUTTON_LAYOUT_GITADORA_STRUM_B":30,"BUTTON_LAYOUT_BOARD_DEFINED_B":31, - "BUTTON_LAYOUT_BANDHERO_FRET_B":32,"BUTTON_LAYOUT_BANDHERO_STRUM_B":33,"BUTTON_LAYOUT_6GAWD_B":34, - "BUTTON_LAYOUT_6GAWD_ALLBUTTON_B":35,"BUTTON_LAYOUT_6GAWD_ALLBUTTONPLUS_B":36 - } }); }); diff --git a/www/src/Addons/Analog1256.tsx b/www/src/Addons/Analog1256.tsx index 761883001..42d6cf49c 100644 --- a/www/src/Addons/Analog1256.tsx +++ b/www/src/Addons/Analog1256.tsx @@ -13,16 +13,12 @@ import { SPI_BLOCKS } from '../Data/Peripherals'; import WebApi from '../Services/WebApi'; export const analog1256Scheme = { - Analog1256Enabled: yup - .number() - .label('Analog1256 Input Enabled'), + Analog1256Enabled: yup.number().label('Analog1256 Input Enabled'), analog1256Block: yup .number() .label('Analog1256 Block') .validateSelectionWhenValue('Analog1256Enabled', SPI_BLOCKS), - analog1256CsPin: yup - .number() - .label('Analog1256 CS Pin'), + analog1256CsPin: yup.number().label('Analog1256 CS Pin'), analog1256DrdyPin: yup .number() .label('Analog1256 DRDY Pin') @@ -39,7 +35,12 @@ export const analog1256State = { }; const Analog1256 = ({ values, errors, handleChange, handleCheckbox }) => { - const { getAvailablePeripherals, getSelectedPeripheral, setLoading, usedPins } = useContext(AppContext); + const { + getAvailablePeripherals, + getSelectedPeripheral, + setLoading, + usedPins, + } = useContext(AppContext); const [csPins, setCsPins] = useState([]); const { t } = useTranslation(); @@ -53,13 +54,20 @@ const Analog1256 = ({ values, errors, handleChange, handleCheckbox }) => { const csPins = []; const peripheralOptions = await WebApi.getPeripheralOptions(setLoading); - if (peripheralOptions.peripheral[`spi${spiBlock}`] && peripheralOptions.peripheral[`spi${spiBlock}`].cs > -1) - csPins.push({ pin: peripheralOptions.peripheral[`spi${spiBlock}`].cs, hwcs: true }); + if ( + peripheralOptions.peripheral[`spi${spiBlock}`] && + peripheralOptions.peripheral[`spi${spiBlock}`].cs > -1 + ) + csPins.push({ + pin: peripheralOptions.peripheral[`spi${spiBlock}`].cs, + hwcs: true, + }); - const availablePins = [...Array(boards[import.meta.env.VITE_GP2040_BOARD].maxPin + 1).keys()] - .filter(p => (usedPins || []).indexOf(p) === -1) // Filter out used pins + const availablePins = [ + ...Array(boards[import.meta.env.VITE_GP2040_BOARD].maxPin + 1).keys(), + ].filter((p) => (usedPins || []).indexOf(p) === -1); // Filter out used pins - csPins.push(...availablePins.map(pin => ({ pin, hwcs: false }))); + csPins.push(...availablePins.map((pin) => ({ pin, hwcs: false }))); return csPins; }; @@ -77,9 +85,7 @@ const Analog1256 = ({ values, errors, handleChange, handleCheckbox }) => {