diff --git a/src/device/autoDetect/DeviceScannedComponents.tsx b/src/device/autoDetect/DeviceScannedComponents.tsx index 5e91dd0..b4e0c9f 100644 --- a/src/device/autoDetect/DeviceScannedComponents.tsx +++ b/src/device/autoDetect/DeviceScannedComponents.tsx @@ -40,6 +40,7 @@ export default function DeviceScannedComponents(props: Props){ const [openDialog, setOpenDialog] = useState(false); useEffect(()=>{ + console.log(scannedComponents) if (scannedComponents.i2c) setScannedI2C(scannedComponents.i2c) //makes the array empty for testing // if (scannedComponents.i2c) { @@ -65,13 +66,16 @@ export default function DeviceScannedComponents(props: Props){ useEffect(()=>{ let valid: quack.AddressData[] = [] //filter the address data - scannedI2C?.settings?.foundAddresses.forEach(addrData => { - if(!i2cBlacklistAddresses.includes(addrData.address)){ - if(!(addrData.address === 0x71 && addrData.expansionLine === undefined)){ - valid.push(addrData) + let addr = scannedI2C?.settings?.foundAddresses + if(addr){ + addr.forEach(addrData => { + if(!i2cBlacklistAddresses.includes(addrData.address)){ + if(!(addrData.address === 0x71 && addrData.expansionLine === undefined)){ + valid.push(addrData) + } } - } - }) + }) + } setValidComponentAddresses(valid) },[scannedI2C])