added mux address as a blacklisted address so it doesn't appear on the card, and changed the i2c address for airflow
This commit is contained in:
parent
4cfbe9f1c6
commit
4ab5b4aedd
4 changed files with 21 additions and 6 deletions
|
|
@ -24,11 +24,14 @@ interface CompStep {
|
|||
completed?: boolean;
|
||||
}
|
||||
|
||||
let i2cBlacklistAddresses: number[] = [0x70]
|
||||
|
||||
export default function DeviceScannedComponents(props: Props){
|
||||
const {scannedComponents, device, availablePositions, availableOffsets, refreshCallback} = props
|
||||
const compAPI = useComponentAPI();
|
||||
const deviceAPI = useDeviceAPI()
|
||||
const [scannedI2C, setScannedI2C] = useState<pond.DetectI2C>()
|
||||
const [scannedI2C, setScannedI2C] = useState<pond.DetectI2C>() //the unmodified scan of addresses
|
||||
const [validCompAddresses, setValidComponentAddresses] = useState<quack.AddressData[]>([]) //the filtered array of address data
|
||||
const [components, setComponents] = useState<Component[]>([])
|
||||
const [steps, setSteps] = useState<CompStep[]>([]);
|
||||
const { error, success } = useSnackbar();
|
||||
|
|
@ -59,6 +62,18 @@ export default function DeviceScannedComponents(props: Props){
|
|||
setSteps(steps)
|
||||
},[components])
|
||||
|
||||
useEffect(()=>{
|
||||
let valid: quack.AddressData[] = []
|
||||
//filter the address data
|
||||
scannedI2C?.settings?.foundAddresses.forEach(addrData => {
|
||||
if(!i2cBlacklistAddresses.includes(addrData.address)){
|
||||
valid.push(addrData)
|
||||
}
|
||||
})
|
||||
console.log(valid)
|
||||
setValidComponentAddresses(valid)
|
||||
},[scannedI2C])
|
||||
|
||||
const stepper = () => {
|
||||
return (
|
||||
<Stepper nonLinear activeStep={currentStep} style={{ width: "100%" }}>
|
||||
|
|
@ -205,7 +220,7 @@ export default function DeviceScannedComponents(props: Props){
|
|||
</Typography>
|
||||
<Button variant="contained" color="primary" onClick={()=>{removeScan(scannedI2C.key)}}>Clear Scan</Button>
|
||||
</Box>
|
||||
{scannedI2C.settings?.foundAddresses && scannedI2C.settings.foundAddresses.length > 0 ? scannedI2C?.settings?.foundAddresses.map((addr, index) => {
|
||||
{validCompAddresses.length > 0 ? validCompAddresses.map((addr, index) => {
|
||||
return (
|
||||
<ScannedI2C key={index} sensorNum={index+1} addressData={addr} deviceProduct={device.settings.product} componentSelectionCallback={componentSelection} availablePositions={availablePositions.get(quack.AddressType.ADDRESS_TYPE_I2C) ?? []}/>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export const I2C: AddressTypeExtension = {
|
|||
[quack.ComponentType.COMPONENT_TYPE_CAPACITANCE, 0x4f],
|
||||
[quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE, 0x4f],
|
||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, 0x68],
|
||||
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, 0x29],
|
||||
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, 0x6b],
|
||||
[quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE, 0x70]
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ const DefaultAvailability: DeviceAvailabilityMap = new Map<quack.AddressType, De
|
|||
[quack.ComponentType.COMPONENT_TYPE_CAPACITANCE, [0x50]],
|
||||
[quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE, [0x50]],
|
||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]],
|
||||
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, [0x2a]],
|
||||
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, [0x6c]],
|
||||
[quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE, [0x71]] // the address cables will use when they are plugged into the expander with V2 device only
|
||||
])
|
||||
],
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export const MiVentV2Availability: DeviceAvailabilityMap = new Map<
|
|||
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]],
|
||||
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, [0x2a]]
|
||||
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, [0x6c]]
|
||||
])
|
||||
],
|
||||
[quack.AddressType.ADDRESS_TYPE_POWER, [0]],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue