From 4cfbe9f1c6a89eca04e9c056e37c8722aae3f5f7 Mon Sep 17 00:00:00 2001 From: csawatzky Date: Mon, 14 Jul 2025 13:25:54 -0600 Subject: [PATCH] updated the proto with the new definition for the i2c scan stuff, and updated the react components accordingly --- package-lock.json | 4 ++-- package.json | 2 +- .../autoDetect/DeviceScannedComponents.tsx | 2 +- src/device/autoDetect/ScannedI2C.tsx | 18 +++++++++--------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 46b99c0..2c26833 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,7 @@ "mui-tel-input": "^7.0.0", "notistack": "^3.0.1", "openweathermap-ts": "^1.2.10", - "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#cable_expander", + "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#i2c_detect", "query-string": "^9.2.1", "react": "^18.3.1", "react-beautiful-dnd": "^13.1.1", @@ -10889,7 +10889,7 @@ }, "node_modules/protobuf-ts": { "version": "1.0.0", - "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#eff6e4e51be080fdee9503d74ee66a0504436545", + "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#955871c0a855e8da5dd10b8d72a1ccc5e391d218", "dependencies": { "protobufjs": "^6.8.8" } diff --git a/package.json b/package.json index 28bd178..99939e6 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "mui-tel-input": "^7.0.0", "notistack": "^3.0.1", "openweathermap-ts": "^1.2.10", - "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#cable_expander", + "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#i2c_detect", "query-string": "^9.2.1", "react": "^18.3.1", "react-beautiful-dnd": "^13.1.1", diff --git a/src/device/autoDetect/DeviceScannedComponents.tsx b/src/device/autoDetect/DeviceScannedComponents.tsx index 2f5efdd..03a847e 100644 --- a/src/device/autoDetect/DeviceScannedComponents.tsx +++ b/src/device/autoDetect/DeviceScannedComponents.tsx @@ -207,7 +207,7 @@ export default function DeviceScannedComponents(props: Props){ {scannedI2C.settings?.foundAddresses && scannedI2C.settings.foundAddresses.length > 0 ? scannedI2C?.settings?.foundAddresses.map((addr, index) => { return ( - + ) }) : void availablePositions: DevicePositions @@ -16,7 +16,7 @@ interface Props { } export default function ScannedI2C(props: Props){ - const {decimalAddress, deviceProduct, componentSelectionCallback, availablePositions, sensorNum} = props + const {addressData, deviceProduct, componentSelectionCallback, availablePositions, sensorNum} = props const [types, setTypes] = useState([]) const [subtypeOptions, setSubtypeOptions] = useState>([]) const [selectedPrimaryType, setSelectedPrimaryType] = useState(quack.ComponentType.COMPONENT_TYPE_INVALID) @@ -34,7 +34,7 @@ export default function ScannedI2C(props: Props){ if(i2cMap){ i2cMap.forEach((val, key) => { let addresses = val as number[] ?? [] - if(addresses.length > 0 && addresses.includes(decimalAddress)){ + if(addresses.length > 0 && addresses.includes(addressData.address)){ types.push(key) } }) @@ -47,7 +47,7 @@ export default function ScannedI2C(props: Props){ checkAddressAvailable(types[0]) } setTypes(types) - },[decimalAddress, deviceProduct]) + },[addressData, deviceProduct]) const buildSubtypeOptions = (compType: quack.ComponentType) => { let subtypes = getSubtypes(compType) @@ -69,7 +69,7 @@ export default function ScannedI2C(props: Props){ const checkAddressAvailable = (compType: quack.ComponentType) => { let i2cMap = availablePositions as ComponentAvailabilityMap let compAddresses = i2cMap.get(compType) ?? [] - if (!compAddresses.includes(decimalAddress)){ + if (!compAddresses.includes(addressData.address)){ setAddressInUse(true) }else{ setAddressInUse(false) @@ -86,7 +86,10 @@ export default function ScannedI2C(props: Props){ primaryComponent.settings.type = selectedPrimaryType primaryComponent.settings.subtype = selectedPrimarySubtype primaryComponent.settings.addressType = quack.AddressType.ADDRESS_TYPE_I2C - primaryComponent.settings.address = decimalAddress + primaryComponent.settings.address = addressData.address + primaryComponent.settings.expansionLine = addressData.expansionLine + primaryComponent.settings.muxLine = addressData.muxLine + primaryComponent.settings.name = getFriendlyName(selectedPrimaryType, selectedPrimarySubtype) toAdd.push(primaryComponent) @@ -161,9 +164,6 @@ export default function ScannedI2C(props: Props){ - { - - } : Sensor Not Supported By Product