mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
fix
This commit is contained in:
@@ -153,6 +153,20 @@ const SensorsAnalogDialog = ({
|
|||||||
[creating, LL]
|
[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 (
|
return (
|
||||||
<Dialog sx={dialogStyle} open={open} onClose={handleClose}>
|
<Dialog sx={dialogStyle} open={open} onClose={handleClose}>
|
||||||
<DialogTitle>{dialogTitle}</DialogTitle>
|
<DialogTitle>{dialogTitle}</DialogTitle>
|
||||||
@@ -174,9 +188,8 @@ const SensorsAnalogDialog = ({
|
|||||||
sx={{ width: '8ch' }}
|
sx={{ width: '8ch' }}
|
||||||
select
|
select
|
||||||
onChange={updateFormValue}
|
onChange={updateFormValue}
|
||||||
disabled={editItem.s}
|
|
||||||
>
|
>
|
||||||
{analogGPIOList?.map((gpio: number) => (
|
{availableGPIOs?.map((gpio: number) => (
|
||||||
<MenuItem key={gpio} value={gpio}>
|
<MenuItem key={gpio} value={gpio}>
|
||||||
{gpio}
|
{gpio}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|||||||
Reference in New Issue
Block a user