From 86277396f753191b7487768da19fd397db816080 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 15 Nov 2025 22:05:35 +0100 Subject: [PATCH] fix --- interface/src/app/main/SensorsAnalogDialog.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/interface/src/app/main/SensorsAnalogDialog.tsx b/interface/src/app/main/SensorsAnalogDialog.tsx index 4758b985b..baeb8f2b9 100644 --- a/interface/src/app/main/SensorsAnalogDialog.tsx +++ b/interface/src/app/main/SensorsAnalogDialog.tsx @@ -153,6 +153,20 @@ const SensorsAnalogDialog = ({ [creating, LL] ); + // Ensure the current GPIO is in the list when no creating + // note GPIO 99 means not set + const availableGPIOs = useMemo(() => { + const filteredList = analogGPIOList.filter((gpio) => gpio !== 99); + if ( + editItem.g !== undefined && + editItem.g !== 99 && + !filteredList.includes(editItem.g) + ) { + return [...filteredList, editItem.g].sort((a, b) => a - b); + } + return filteredList; + }, [analogGPIOList, editItem.g]); + return ( {dialogTitle} @@ -174,9 +188,8 @@ const SensorsAnalogDialog = ({ sx={{ width: '8ch' }} select onChange={updateFormValue} - disabled={editItem.s} > - {analogGPIOList?.map((gpio: number) => ( + {availableGPIOs?.map((gpio: number) => ( {gpio}