From 4ab5b4aedd607997a95079a45e0f0ef8e8d90e4b Mon Sep 17 00:00:00 2001 From: csawatzky Date: Mon, 28 Jul 2025 14:45:06 -0600 Subject: [PATCH 1/3] added mux address as a blacklisted address so it doesn't appear on the card, and changed the i2c address for airflow --- .../autoDetect/DeviceScannedComponents.tsx | 21 ++++++++++++++++--- src/pbHelpers/AddressTypes/I2C.ts | 2 +- src/pbHelpers/DeviceAvailability.ts | 2 +- src/products/MiVent/MiVentAvailability.ts | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/device/autoDetect/DeviceScannedComponents.tsx b/src/device/autoDetect/DeviceScannedComponents.tsx index 03a847e..6899959 100644 --- a/src/device/autoDetect/DeviceScannedComponents.tsx +++ b/src/device/autoDetect/DeviceScannedComponents.tsx @@ -18,17 +18,20 @@ interface Props { availableOffsets: OffsetAvailabilityMap refreshCallback: () => void } - + interface CompStep { label: string; 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() + const [scannedI2C, setScannedI2C] = useState() //the unmodified scan of addresses + const [validCompAddresses, setValidComponentAddresses] = useState([]) //the filtered array of address data const [components, setComponents] = useState([]) const [steps, setSteps] = useState([]); 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 ( @@ -205,7 +220,7 @@ export default function DeviceScannedComponents(props: Props){ - {scannedI2C.settings?.foundAddresses && scannedI2C.settings.foundAddresses.length > 0 ? scannedI2C?.settings?.foundAddresses.map((addr, index) => { + {validCompAddresses.length > 0 ? validCompAddresses.map((addr, index) => { return ( ) diff --git a/src/pbHelpers/AddressTypes/I2C.ts b/src/pbHelpers/AddressTypes/I2C.ts index 339ce70..2410950 100644 --- a/src/pbHelpers/AddressTypes/I2C.ts +++ b/src/pbHelpers/AddressTypes/I2C.ts @@ -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] ]); diff --git a/src/pbHelpers/DeviceAvailability.ts b/src/pbHelpers/DeviceAvailability.ts index 72bbbdc..5e8807f 100644 --- a/src/pbHelpers/DeviceAvailability.ts +++ b/src/pbHelpers/DeviceAvailability.ts @@ -60,7 +60,7 @@ const DefaultAvailability: DeviceAvailabilityMap = new Map Date: Mon, 28 Jul 2025 15:12:45 -0600 Subject: [PATCH 2/3] fixed errors from moving the calibration definition to the quack --- package-lock.json | 4 ++-- package.json | 2 +- src/component/ComponentForm.tsx | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 222fcf3..2c64e83 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#beans", + "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#component_quack", "query-string": "^9.2.1", "react": "^18.3.1", "react-beautiful-dnd": "^13.1.1", @@ -10911,7 +10911,7 @@ }, "node_modules/protobuf-ts": { "version": "1.0.0", - "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#f09196cbc38911bab69fb35c16b1c8f691a4413f", + "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#4e16c7a754503111aad27eeaef98069f95451e59", "dependencies": { "protobufjs": "^6.8.8" } diff --git a/package.json b/package.json index 5a27ce1..1a32f62 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#beans", + "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#component_quack", "query-string": "^9.2.1", "react": "^18.3.1", "react-beautiful-dnd": "^13.1.1", diff --git a/src/component/ComponentForm.tsx b/src/component/ComponentForm.tsx index ef61681..08d6117 100644 --- a/src/component/ComponentForm.tsx +++ b/src/component/ComponentForm.tsx @@ -482,7 +482,7 @@ export default function ComponentForm(props: Props) { const updateCalibrationTypes = (event: any, index: number) => { let f = cloneDeep(form); - f.component.settings.calibrations[index].type = event.target.value as quack.MeasurementType; + f.component.settings.calibrations[index].measurementType = event.target.value as quack.MeasurementType; setForm(f); }; @@ -508,7 +508,7 @@ export default function ComponentForm(props: Props) { if (dimensions !== undefined && dimensions !== null) { dimensions.lengthCm = value; } else { - dimensions = pond.Dimensions.create({ + dimensions = quack.Dimensions.create({ heightCm: 0, lengthCm: value, widthCm: 0 @@ -537,7 +537,7 @@ export default function ComponentForm(props: Props) { if (dimensions !== undefined && dimensions !== null) { dimensions.heightCm = value; } else { - dimensions = pond.Dimensions.create({ + dimensions = quack.Dimensions.create({ heightCm: value, lengthCm: 0, widthCm: 0 @@ -566,7 +566,7 @@ export default function ComponentForm(props: Props) { if (dimensions !== undefined && dimensions !== null) { dimensions.widthCm = value; } else { - dimensions = pond.Dimensions.create({ + dimensions = quack.Dimensions.create({ heightCm: 0, lengthCm: 0, widthCm: value @@ -788,7 +788,7 @@ export default function ComponentForm(props: Props) { // !isMeasurementTypeValid(interaction.settings.conditions[index].measurementType) // } disabled={!component.settings.calibrate} - value={calibration.type ?? quack.MeasurementType.MEASUREMENT_TYPE_INVALID} + value={calibration.measurementType ?? quack.MeasurementType.MEASUREMENT_TYPE_INVALID} onChange={event => updateCalibrationTypes(event, i)} autoFocus={false} margin="normal" @@ -814,8 +814,8 @@ export default function ComponentForm(props: Props) { f.coefficients.push("0"); f.offsets.push("0"); f.component.settings.calibrations.push( - pond.Calibration.create({ - type: quack.MeasurementType.MEASUREMENT_TYPE_INVALID, + quack.Calibration.create({ + measurementType: quack.MeasurementType.MEASUREMENT_TYPE_INVALID, calibrationOffset: 0, calibrationCoefficient: 0 }) From e662645fa2eca72cf193f96067305d38d961819c Mon Sep 17 00:00:00 2001 From: csawatzky Date: Mon, 28 Jul 2025 15:23:49 -0600 Subject: [PATCH 3/3] rounding the ft/m conversion --- src/models/UnitMeasurement.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/UnitMeasurement.ts b/src/models/UnitMeasurement.ts index 344abe0..46e67ef 100644 --- a/src/models/UnitMeasurement.ts +++ b/src/models/UnitMeasurement.ts @@ -261,7 +261,7 @@ function unitConversion( newVals.forEach((val, i) => { val.values.forEach((v, j) => { //convert m/s to ft/m by multiplying by 196.9 - newVals[i].values[j] = v * 196.9 + newVals[i].values[j] = Math.round(v * 196.9) }); }); }