diff --git a/package-lock.json b/package-lock.json index 2ce74a9..d1673dc 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#libracart", + "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#dev", "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#e1a765ee24fd1c6e374fd6d7a21edb82feb45c6f", + "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#46df972192510aa2aec201100382063607535a66", "dependencies": { "protobufjs": "^6.8.8" } diff --git a/package.json b/package.json index 89efa4d..88ba7d0 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#libracart", + "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#dev", "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 }) diff --git a/src/component/ComponentSettings.tsx b/src/component/ComponentSettings.tsx index 54653a2..01ee66d 100644 --- a/src/component/ComponentSettings.tsx +++ b/src/component/ComponentSettings.tsx @@ -169,6 +169,7 @@ export default function ComponentSettings(props: Props) { const [removeDialogOpen, setRemoveDialogOpen] = useState(false); const [formComponent, setFormComponent] = useState(new Component()); const [cableID, setCableID] = useState(0); + const [expansionLine, setExpansionLine] = useState(0); const [overlayIndex, setOverlayIndex] = useState(0); const [overlayColourDialog, setOverlayCoulourDialog] = useState(false); const [tabVal, setTabVal] = useState(0); @@ -222,6 +223,9 @@ export default function ComponentSettings(props: Props) { const isFormValid = () => { //let { component } = form; let type = or(formComponent.settings.type, ""); + if(supportsExpansion() && expansionLine === 0){ + return false + } return isComponentTypeValid(type) && isAddressValid(formComponent); }; @@ -238,7 +242,6 @@ export default function ComponentSettings(props: Props) { componentType: quack.ComponentType ): number[] => { let positions = availablePositions.get(addressType); - console.log(positions) if (!positions) return []; switch (addressType) { case quack.AddressType.ADDRESS_TYPE_I2C: @@ -306,6 +309,7 @@ export default function ComponentSettings(props: Props) { const component = formComponent; //component.settings.calibrationCoefficient = Number(form.coefficient); if (cableID > 0) component.settings.addressType = cableID + 8; + component.settings.expansionLine = expansionLine componentAPI .add(device.id(), component.settings, as) .then((_response: any) => { @@ -372,10 +376,10 @@ export default function ComponentSettings(props: Props) { let ext = extension(type, subtype); formComponent.settings.type = type; formComponent.settings.subtype = subtype; - formComponent.settings.addressType = getAddressTypes( + formComponent.settings.addressType = or(addressTypeRestriction, getAddressTypes( formComponent.settings.type, formComponent.settings.subtype - )[0]; + )[0]); formComponent.settings.address = or( getAvailablePositions(formComponent.settings.addressType, formComponent.settings.type)[0], Component.create().settings.address @@ -398,11 +402,19 @@ export default function ComponentSettings(props: Props) { }; const handlePositionChanged = (event: any) => { + setCableID(0) + setExpansionLine(0) let f = cloneDeep(formComponent); - f.settings.address = event.target.value - .toString() - .split(":") - .pop(); + //split the string + let split: string[] = event.target.value.toString().split(":") + // pop the addres off of the end of the array + f.settings.address = parseInt(split.pop() ?? "0") + // pop the address type out of the array next + f.settings.addressType = parseInt(split.pop() ?? "0") + // f.settings.address = event.target.value + // .toString() + // .split(":") + // .pop(); setFormComponent(f); }; @@ -413,7 +425,6 @@ export default function ComponentSettings(props: Props) { for (let i = 0; i < addressTypes.length; i++) { let addressType = addressTypes[i]; let availablePositions = getAvailablePositions(addressType, type); - console.log(availablePositions) availableMenuItemPositions.push( @@ -490,6 +501,21 @@ export default function ComponentSettings(props: Props) { ); }; + const isCableComponent = () => { + return (formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE || + formComponent.settings.type === + quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE || + formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_PRESSURE_CABLE || + (formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE && + formComponent.subType() === + quack.CapacitorCableSubtype.CAPACITOR_CABLE_SUBTYPE_FROG)) + } + + const supportsExpansion = () => { + return (formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE && + formComponent.settings.addressType === quack.AddressType.ADDRESS_TYPE_I2C) + } + const addForm = () => { return ( @@ -543,14 +569,8 @@ export default function ComponentSettings(props: Props) { formComponent.settings.subtype )} - {(formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE || - formComponent.settings.type === - quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE || - formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_PRESSURE_CABLE || - (formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE && - formComponent.subType() === - quack.CapacitorCableSubtype.CAPACITOR_CABLE_SUBTYPE_FROG)) && - setComponentAddrType()} + {supportsExpansion() && setExpLine()} + {(isCableComponent() && !supportsExpansion())&& setComponentAddrType()} ) : activeStep === 1 ? ( ); }; + + const setExpLine = () => { + return ( + 12} + fullWidth + variant="outlined" + value={expansionLine} + helperText="Enter line the cable is connected to on your expander" + onChange={e => { + let number = parseInt(e.target.value); + if (number < 0 || isNaN(number)) number = 0; + if (number > 12) number = 12; + setExpansionLine(number); + }} + /> + ); + }; + const setComponentAddrType = () => { return ( { let currentAvailability = availability; + console.log(port) switch (port.addressType) { case quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY: currentAvailability.set(port.addressType, [{ address: port.address, label: port.label }]); + //since we now have a component type that can be pins or i2c need to remove i2c options if they selected a pin port + currentAvailability.set(quack.AddressType.ADDRESS_TYPE_I2C, new Map()); + break; + case quack.AddressType.ADDRESS_TYPE_I2C: + //since we now have a component type that can be pins or i2c need to remove pin options if they selected the i2c port + currentAvailability.set(quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY, []); + break; } return currentAvailability; }; diff --git a/src/device/autoDetect/DeviceScannedComponents.tsx b/src/device/autoDetect/DeviceScannedComponents.tsx index 2f5efdd..5e91dd0 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,19 @@ 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)){ + if(!(addrData.address === 0x71 && addrData.expansionLine === undefined)){ + valid.push(addrData) + } + } + }) + setValidComponentAddresses(valid) + },[scannedI2C]) + const stepper = () => { return ( @@ -205,9 +221,9 @@ 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 ( - + ) }) : 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 diff --git a/src/models/Component.ts b/src/models/Component.ts index 84f5574..9b96599 100644 --- a/src/models/Component.ts +++ b/src/models/Component.ts @@ -67,18 +67,25 @@ export class Component { return quack.ComponentID.fromObject({ type: this.settings.type, addressType: this.settings.addressType, - address: this.settings.address + address: this.settings.address, + expansionLine: this.settings.expansionLine, + muxLine: this.settings.muxLine }); } public locationString(): string { - return ( - or(this.settings.type, 0).toString() + + let compositeLocation = or(this.settings.type, 0).toString() + "-" + or(this.settings.addressType, 0).toString() + "-" + or(this.settings.address, 0).toString() - ); + if(this.settings.expansionLine){ + compositeLocation = compositeLocation + "-" + this.settings.expansionLine + } + if(this.settings.muxLine){ + compositeLocation = compositeLocation + ":" + this.settings.muxLine + } + return compositeLocation; } public type(): quack.ComponentType { diff --git a/src/models/Device.ts b/src/models/Device.ts index e45f7aa..46ce943 100644 --- a/src/models/Device.ts +++ b/src/models/Device.ts @@ -42,11 +42,11 @@ const featureVersions: Map = new Map([ v2Cell: "N/A", v2WifiS3: "N/A", v2CellS3: "N/A", - v2CellBlack: "N/A", + v2CellBlack: "2.1.6", v2CellGreen: "N/A", - v2WifiBlue: "N/A", - v2CellBlue: "N/A", - v2EthBlue: "N/A" + v2WifiBlue: "2.1.6", + v2CellBlue: "2.1.6", + v2EthBlue: "2.1.6" } ] ]); diff --git a/src/models/UnitMeasurement.ts b/src/models/UnitMeasurement.ts index 966b545..d33c17d 100644 --- a/src/models/UnitMeasurement.ts +++ b/src/models/UnitMeasurement.ts @@ -256,5 +256,15 @@ function unitConversion( }); } } + if (type === quack.MeasurementType.MEASUREMENT_TYPE_SPEED) { + if (user.settings.distanceUnit === pond.DistanceUnit.DISTANCE_UNIT_FEET) { + newVals.forEach((val, i) => { + val.values.forEach((v, j) => { + //convert m/s to ft/m by multiplying by 196.9 + newVals[i].values[j] = Math.round((v * 196.9)*100) /100 + }); + }); + } + } return newVals; } diff --git a/src/pbHelpers/AddressTypes/I2C.ts b/src/pbHelpers/AddressTypes/I2C.ts index c17c743..2410950 100644 --- a/src/pbHelpers/AddressTypes/I2C.ts +++ b/src/pbHelpers/AddressTypes/I2C.ts @@ -16,7 +16,8 @@ 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] ]); const offset = offsets.get(componentType); diff --git a/src/pbHelpers/Bin.ts b/src/pbHelpers/Bin.ts index 1d16928..7c868e0 100644 --- a/src/pbHelpers/Bin.ts +++ b/src/pbHelpers/Bin.ts @@ -16,6 +16,7 @@ export const GetBinShapeDescribers = (): BinShapeDescriber[] => { ]; }; +// DEPRECATED -- the bon now knows its components from the relative object table export const HasGrainCable = (bin?: pond.BinSettings): boolean => { if (bin && bin.deviceComponents) { bin.deviceComponents.forEach(dc => { diff --git a/src/pbHelpers/Component.ts b/src/pbHelpers/Component.ts index e5d0df1..9329878 100644 --- a/src/pbHelpers/Component.ts +++ b/src/pbHelpers/Component.ts @@ -23,7 +23,9 @@ export function getComponentIDString(component?: Component): string { ? componentIDToString({ type: component.settings.type, addressType: component.settings.addressType, - address: component.settings.address + address: component.settings.address, + expansionLine: component.settings.expansionLine, + muxLine: component.settings.muxLine }) : "0-0-0"; } @@ -40,13 +42,18 @@ export function componentIDToString(componentID?: quack.IComponentID | null): st if (!componentID) { return "0-0-0"; } - return ( - or(componentID.type, 0).toString() + + let compositeLocation = or(componentID.type, 0).toString() + "-" + or(componentID.addressType, 0).toString() + "-" + or(componentID.address, 0).toString() - ); + if(componentID.expansionLine){ + compositeLocation = compositeLocation + "-" + componentID.expansionLine + } + if(componentID.muxLine){ + compositeLocation = compositeLocation + ":" + componentID.muxLine + } + return compositeLocation; } export function stringToComponentId(componentIDString: string): quack.ComponentID { diff --git a/src/pbHelpers/ComponentType.tsx b/src/pbHelpers/ComponentType.tsx index 2d66c9d..e03a1ce 100644 --- a/src/pbHelpers/ComponentType.tsx +++ b/src/pbHelpers/ComponentType.tsx @@ -146,7 +146,7 @@ export interface ComponentTypeExtension { interactionResultTypes: Array; states: Array; measurements: Array; - measurementSummary: Function; //Deprecated: this summary used the old measurement structure + measurementSummary?: Function; //Deprecated: this summary used the old measurement structure unitMeasurementSummary: ( measurements: convertedUnitMeasurement, excludedNodes?: number[] @@ -382,7 +382,8 @@ export async function getMeasurementSummary( measurement: quack.IMeasurement, filters: GraphFilters ): Promise> { - return extension(type, subtype).measurementSummary(measurement, filters); + let sumFunc = extension(type, subtype).measurementSummary + return sumFunc ? sumFunc(measurement, filters) : []; } const validNodes = (nodeVals: number[], filters?: GraphFilters) => { diff --git a/src/pbHelpers/ComponentTypes/Airflow.ts b/src/pbHelpers/ComponentTypes/Airflow.ts index fde83e2..acc52fe 100644 --- a/src/pbHelpers/ComponentTypes/Airflow.ts +++ b/src/pbHelpers/ComponentTypes/Airflow.ts @@ -1,14 +1,15 @@ import { ComponentTypeExtension, Summary, - simpleMeasurements, - simpleSummaries, + // simpleMeasurements, + // simpleSummaries, unitMeasurementSummaries, AreaChartData, GraphFilters, simpleAreaChartData, LineChartData, - simpleLineChartData + simpleLineChartData, + ComponentMeasurement } from "pbHelpers/ComponentType"; import PressureDarkIcon from "assets/components/pressureDark.png"; import PressureLightIcon from "assets/components/pressureLight.png"; @@ -18,14 +19,46 @@ import { convertedUnitMeasurement } from "models/UnitMeasurement"; import { pond } from "protobuf-ts/pond"; export function Airflow(subtype: number = 0): ComponentTypeExtension { - let airflow = describeMeasurement( + let cfm = describeMeasurement( quack.MeasurementType.MEASUREMENT_TYPE_CFM, quack.ComponentType.COMPONENT_TYPE_AIRFLOW, subtype ); + + let velocity = describeMeasurement( + quack.MeasurementType.MEASUREMENT_TYPE_CFM, + quack.ComponentType.COMPONENT_TYPE_AIRFLOW, + subtype + ); + + let measurementTypes = [ + { + measurementType: quack.MeasurementType.MEASUREMENT_TYPE_PPM, + label: cfm.label(), + colour: cfm.colour(), + graphType: cfm.graph() + } as ComponentMeasurement, + { + measurementType: quack.MeasurementType.MEASUREMENT_TYPE_VOLTAGE, + label: velocity.label(), + colour: velocity.colour(), + graphType: velocity.graph() + } as ComponentMeasurement + ]; return { type: quack.ComponentType.COMPONENT_TYPE_AIRFLOW, - subtypes: [], + subtypes: [ + { + key: quack.AirFlowSubtype.AIR_FLOW_SUBTYPE_PROSENSE, + value: "AIR_FLOW_SUBTYPE_PROSENSE", + friendlyName: "Prosense" + }, + { + key: quack.AirFlowSubtype.AIR_FLOW_SUBTYPE_ULTRASONIC, + value: "AIR_FLOW_SUBTYPE_ULTRASONIC", + friendlyName: "Ultrasonic" + }, + ], friendlyName: "Airflow", description: "Measure the flow of air though a specified area", isController: false, @@ -36,10 +69,10 @@ export function Airflow(subtype: number = 0): ComponentTypeExtension { addressTypes: [quack.AddressType.ADDRESS_TYPE_I2C], interactionResultTypes: [], states: [], - measurements: simpleMeasurements(airflow), - measurementSummary: async function(measurement: quack.Measurement): Promise> { - return simpleSummaries(measurement, airflow); - }, + measurements: measurementTypes, + // measurementSummary: async function(measurement: quack.Measurement): Promise> { + // return simpleSummaries(measurement, airflow); + // }, unitMeasurementSummary: ( measurements: convertedUnitMeasurement, excludedNodes?: number[] diff --git a/src/pbHelpers/ComponentTypes/GrainCable.ts b/src/pbHelpers/ComponentTypes/GrainCable.ts index 4ddfd21..5369000 100644 --- a/src/pbHelpers/ComponentTypes/GrainCable.ts +++ b/src/pbHelpers/ComponentTypes/GrainCable.ts @@ -176,7 +176,7 @@ export function GrainCable(subtype: number = 0): ComponentTypeExtension { isSource: true, isArray: true, isCalibratable: false, - addressTypes: [quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY], + addressTypes: [quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY, quack.AddressType.ADDRESS_TYPE_I2C], interactionResultTypes: [], states: [], measurements: [ diff --git a/src/pbHelpers/DeviceAvailability.ts b/src/pbHelpers/DeviceAvailability.ts index c50a2a4..5e8807f 100644 --- a/src/pbHelpers/DeviceAvailability.ts +++ b/src/pbHelpers/DeviceAvailability.ts @@ -60,7 +60,8 @@ const DefaultAvailability: DeviceAvailabilityMap = new Map 0) addressType = addressType - (7 + offset); @@ -127,6 +129,9 @@ export class DeviceAvailability { break; case quack.AddressType.ADDRESS_TYPE_I2C: case quack.AddressType.ADDRESS_TYPE_SPI: + if(expansionLine){ + break; + } let addressTypePositions = cloneDeep( this.availability.get(addressType) as ComponentAvailabilityMap ); @@ -171,7 +176,8 @@ export function FindAvailablePositions( available.ClaimAddress( component.settings.addressType, component.settings.type, - or(component.settings.address, 0) + or(component.settings.address, 0), + component.settings.expansionLine ); } }); diff --git a/src/pbHelpers/MeasurementDescriber.ts b/src/pbHelpers/MeasurementDescriber.ts index a364b77..1fc2751 100644 --- a/src/pbHelpers/MeasurementDescriber.ts +++ b/src/pbHelpers/MeasurementDescriber.ts @@ -450,8 +450,9 @@ export class MeasurementDescriber { this.details.max = 100000; break; case quack.MeasurementType.MEASUREMENT_TYPE_SPEED: + let speedUnit = getDistanceUnit() this.details.label = "Speed"; - this.details.unit = "km/h"; + this.details.unit = speedUnit === pond.DistanceUnit.DISTANCE_UNIT_METERS ? "m/s" : "ft/m"; this.details.colour = green["500"]; this.details.path = "edgeTriggered.rises"; this.details.max = 500; diff --git a/src/products/Bindapt/BindaptAvailability.ts b/src/products/Bindapt/BindaptAvailability.ts index 3f70a11..50575d8 100644 --- a/src/products/Bindapt/BindaptAvailability.ts +++ b/src/products/Bindapt/BindaptAvailability.ts @@ -246,12 +246,13 @@ export const BindaptV2MonitorAvailability: DeviceAvailabilityMap = new Map< [ quack.AddressType.ADDRESS_TYPE_I2C, new Map([ - //[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]], + [quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]], [quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]], // [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //component type deprecated? [quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]], [quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]], - [quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]] + [quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]], + [quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE, [0x71]] ]) ], [quack.AddressType.ADDRESS_TYPE_POWER, [0]], @@ -278,12 +279,13 @@ export const BindaptV2AutomateAvailability: DeviceAvailabilityMap = new Map< [ quack.AddressType.ADDRESS_TYPE_I2C, new Map([ - //[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]], + [quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]], [quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]], // [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //component type deprecated? [quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]], [quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]], - [quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]] + [quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]], + [quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE, [0x71]] ]) ], [quack.AddressType.ADDRESS_TYPE_POWER, [0]], diff --git a/src/products/MiVent/MiVentAvailability.ts b/src/products/MiVent/MiVentAvailability.ts index 4002627..fed201c 100644 --- a/src/products/MiVent/MiVentAvailability.ts +++ b/src/products/MiVent/MiVentAvailability.ts @@ -22,7 +22,7 @@ export const MiVentV1Availability: 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]], @@ -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]],