diff --git a/www/src/Contexts/AppContext.jsx b/www/src/Contexts/AppContext.jsx index 7a3217b6f4..02f8d05639 100644 --- a/www/src/Contexts/AppContext.jsx +++ b/www/src/Contexts/AppContext.jsx @@ -108,7 +108,6 @@ export const AppContextProvider = ({ children, ...props }) => { buttonLabelType: newType, swapTpShareLabels: newSwap, }) => { - console.log('buttonLabelType is', newType); newType && localStorage.setItem('buttonLabelType', newType); newSwap !== undefined && localStorage.setItem('swapTpShareLabels', parseBoolean(newSwap)); @@ -194,28 +193,24 @@ export const AppContextProvider = ({ children, ...props }) => { const updateUsedPins = async () => { const data = await WebApi.getUsedPins(setLoading); setUsedPins(data.usedPins); - console.log('usedPins updated:', data.usedPins); return data; }; const updateExpansionPins = async () => { const data = await WebApi.getExpansionPins(setLoading); setExpansionPins(data); - console.log('expansionPins updated:', data); return data; }; const updateHETriggerOptions = async () => { const data = await WebApi.getHETriggerOptions(setLoading); setHETriggerOptions(data); - console.log('HETrigger Options updated:', data); return data; }; const updatePeripherals = async () => { const peripherals = await WebApi.getPeripheralOptions(setLoading); setAvailablePeripherals(peripherals); - console.log('availablePeripherals updated:', peripherals); }; useEffect(() => { diff --git a/www/src/Data/Buttons.js b/www/src/Data/Buttons.js index 1afc5cd284..cdadaeee90 100644 --- a/www/src/Data/Buttons.js +++ b/www/src/Data/Buttons.js @@ -264,7 +264,6 @@ const AUX_BUTTONS = ['S1', 'S2', 'L3', 'R3', 'A1', 'A2']; const AUX_BUTTONS_STICKLESS_13 = ['S1', 'S2', 'L3', 'R3', 'A2']; const AUX_BUTTONS_STICKLESS_14 = ['S1', 'S2', 'A1', 'A2']; const AUX_BUTTONS_STICKLESS_16 = ['S1', 'S2']; -const AUX_BUTTONS_STICKLESS_16_A = ['S1', 'S2']; const MAIN_BUTTONS = [ 'Up', 'Down', @@ -328,24 +327,6 @@ const MAIN_BUTTONS_STICKLESS_16 = [ 'L3', 'A2', ]; -const MAIN_BUTTONS_STICKLESS_16_A = [ - 'Up', - 'A1', - 'Down', - 'Left', - 'Right', - 'B1', - 'B2', - 'B3', - 'B4', - 'L1', - 'R1', - 'L2', - 'R2', - 'R3', - 'L3', - 'A2', -]; const STICK_LAYOUT = [ [null, 'Left', null], @@ -401,17 +382,6 @@ const STICKLESS_16_LAYOUT = [ [null, 'L1', 'L2', null], ]; -const STICKLESS_16_A_LAYOUT = [ - ['L3', null, null, null], - [null, 'Left', null, null], - ['A1', 'Down', null, null], - [null, 'Right', null, null], - ['A2', 'B3', 'B1', 'Up'], - [null, 'B4', 'B2', 'R3'], - [null, 'R1', 'R2', null], - [null, 'L1', 'L2', null], -]; - const KEYBOARD_LAYOUT = [ [null, 'Left'], ['Up', 'Down'], @@ -590,7 +560,7 @@ export const BUTTON_LAYOUTS = [ mainButtons: MAIN_BUTTONS, }, { - label: 'Pop\'n Music', + label: "Pop'n Music", value: 20, stickLayout: 'standard', matrix: STICK_LAYOUT, @@ -740,7 +710,7 @@ export const BUTTON_LAYOUTS = [ matrix: STICK_LAYOUT, auxButtons: AUX_BUTTONS, mainButtons: MAIN_BUTTONS, - } + }, ]; export const BUTTON_MASKS = [ diff --git a/www/src/Pages/LEDConfigPage.jsx b/www/src/Pages/LEDConfigPage.jsx index 907c50aab7..eab70db97a 100644 --- a/www/src/Pages/LEDConfigPage.jsx +++ b/www/src/Pages/LEDConfigPage.jsx @@ -37,9 +37,9 @@ const PLED_LABELS = [ ]; const CASE_TYPE = [ - { value: -1, label: 'Off'}, - { value: 0, label: 'Ambient'}, - { value: 1, label: 'Linked'} + { value: -1, label: 'Off' }, + { value: 0, label: 'Ambient' }, + { value: 1, label: 'Linked' }, ]; const defaultValue = { @@ -184,21 +184,12 @@ const getLedButtons = (buttonLabels, map, excludeNulls, swapTpShareLabels) => { ); }; -const getLedMap = (buttonLabels, ledButtons, excludeNulls) => { +const createLedMap = (ledButtons, clear) => { if (!ledButtons) return; - - const buttons = getButtonLabels(buttonLabels, false); - const map = Object.keys(buttons) - .filter((p) => p !== 'label' && p !== 'value') - .filter((p) => (excludeNulls ? ledButtons[p].value > -1 : true)) - .reduce((p, n) => { - p[n] = null; - return p; - }, {}); - - for (let i = 0; i < ledButtons.length; i++) map[ledButtons[i].id] = i; - - return map; + return ledButtons.reduce( + (acc, btn) => ({ ...acc, [btn.id]: clear ? null : btn.value }), + {}, + ); }; const FormContext = ({ @@ -221,7 +212,6 @@ const FormContext = ({ setDataSources(dataSources); setValues(data); } - fetchData(); }, []); @@ -262,15 +252,10 @@ export default function LEDConfigPage() { const ledOrderChanged = (setFieldValue, ledOrderArrays, ledsPerButton) => { if (ledOrderArrays.length === 2) { setRgbLedStartIndex(ledOrderArrays[1].length * (ledsPerButton || 0)); - setFieldValue( - 'ledButtonMap', - getLedMap(buttonLabelType, ledOrderArrays[1]), - ); - console.log( - 'new start index: ', - ledOrderArrays[1].length * (ledsPerButton || 0), - ledOrderArrays, - ); + setFieldValue('ledButtonMap', { + ...createLedMap(ledOrderArrays[0], true), + ...createLedMap(ledOrderArrays[1], false), + }); } };