Merge branch 'analog_pressure_component' into staging_environment
This commit is contained in:
commit
e19e1f03eb
7 changed files with 100 additions and 7 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -11752,7 +11752,7 @@
|
||||||
},
|
},
|
||||||
"node_modules/protobuf-ts": {
|
"node_modules/protobuf-ts": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#9c0f668d4a56b8216dd71a44c3110a818aaf3541",
|
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#42f72fa7fb838b7771e6c847faaa192e93f42da7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"protobufjs": "^6.8.8"
|
"protobufjs": "^6.8.8"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,8 @@ import {
|
||||||
Voltage,
|
Voltage,
|
||||||
VPD,
|
VPD,
|
||||||
Weight,
|
Weight,
|
||||||
CapacitorCable
|
CapacitorCable,
|
||||||
|
AnalogPressure
|
||||||
} from "pbHelpers/ComponentTypes";
|
} from "pbHelpers/ComponentTypes";
|
||||||
//import { multilineGrainCableData } from "pbHelpers/ComponentTypes/GrainCable";
|
//import { multilineGrainCableData } from "pbHelpers/ComponentTypes/GrainCable";
|
||||||
//import { multilineCapCableData } from "./ComponentTypes/CapacitorCable";
|
//import { multilineCapCableData } from "./ComponentTypes/CapacitorCable";
|
||||||
|
|
@ -96,7 +97,8 @@ const COMPONENT_TYPE_MAP = new Map<quack.ComponentType, Function>([
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, Sen5x],
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, Sen5x],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VIBRATION_CHAIN, VibrationCable],
|
[quack.ComponentType.COMPONENT_TYPE_VIBRATION_CHAIN, VibrationCable],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE, dragerGasDongle],
|
[quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE, dragerGasDongle],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, Airflow]
|
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, Airflow],
|
||||||
|
[quack.ComponentType.COMPONENT_TYPE_ANALOG_PRESSURE, AnalogPressure]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export interface Subtype {
|
export interface Subtype {
|
||||||
|
|
|
||||||
88
src/pbHelpers/ComponentTypes/AnalogPressure.ts
Normal file
88
src/pbHelpers/ComponentTypes/AnalogPressure.ts
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
import {
|
||||||
|
ComponentTypeExtension,
|
||||||
|
Summary,
|
||||||
|
Subtype,
|
||||||
|
simpleMeasurements,
|
||||||
|
simpleSummaries,
|
||||||
|
unitMeasurementSummaries,
|
||||||
|
AreaChartData,
|
||||||
|
GraphFilters,
|
||||||
|
simpleAreaChartData,
|
||||||
|
LineChartData,
|
||||||
|
simpleLineChartData
|
||||||
|
} from "pbHelpers/ComponentType";
|
||||||
|
import PressureDarkIcon from "assets/components/pressureDark.png";
|
||||||
|
import PressureLightIcon from "assets/components/pressureLight.png";
|
||||||
|
import { quack } from "protobuf-ts/quack";
|
||||||
|
import { describeMeasurement } from "pbHelpers/MeasurementDescriber";
|
||||||
|
import { convertedUnitMeasurement } from "models/UnitMeasurement";
|
||||||
|
import { pond } from "protobuf-ts/pond";
|
||||||
|
|
||||||
|
export function AnalogPressure(subtype: number = 0): ComponentTypeExtension {
|
||||||
|
let pressure = describeMeasurement(
|
||||||
|
quack.MeasurementType.MEASUREMENT_TYPE_PRESSURE,
|
||||||
|
quack.ComponentType.COMPONENT_TYPE_ANALOG_PRESSURE,
|
||||||
|
subtype
|
||||||
|
);
|
||||||
|
let voltage = describeMeasurement(
|
||||||
|
quack.MeasurementType.MEASUREMENT_TYPE_VOLTAGE,
|
||||||
|
quack.ComponentType.COMPONENT_TYPE_ANALOG_PRESSURE,
|
||||||
|
subtype
|
||||||
|
)
|
||||||
|
let addressTypes = [quack.AddressType.ADDRESS_TYPE_I2C];
|
||||||
|
return {
|
||||||
|
type: quack.ComponentType.COMPONENT_TYPE_PRESSURE,
|
||||||
|
subtypes: [
|
||||||
|
{
|
||||||
|
key: quack.AnalogPressureSubtype.ANALOG_PRESSURE_SUBTYPE_PM1618,
|
||||||
|
value: "ANALOG_PRESSURE_SUBTYPE_PM1618",
|
||||||
|
friendlyName: "PM 1618"
|
||||||
|
} as Subtype
|
||||||
|
],
|
||||||
|
friendlyName: "Analog Pressure",
|
||||||
|
description: "Measures the atmospheric pressure or absolute pressure",
|
||||||
|
isController: false,
|
||||||
|
isSource: true,
|
||||||
|
isCalibratable: true,
|
||||||
|
hasFan: true,
|
||||||
|
addressTypes: addressTypes,
|
||||||
|
interactionResultTypes: [],
|
||||||
|
states: [],
|
||||||
|
measurements: simpleMeasurements(pressure, voltage),
|
||||||
|
measurementSummary: async function(measurement: quack.Measurement): Promise<Array<Summary>> {
|
||||||
|
return simpleSummaries(measurement, pressure);
|
||||||
|
},
|
||||||
|
unitMeasurementSummary: (
|
||||||
|
measurements: convertedUnitMeasurement,
|
||||||
|
): Summary[] => {
|
||||||
|
return unitMeasurementSummaries(
|
||||||
|
measurements,
|
||||||
|
quack.ComponentType.COMPONENT_TYPE_PRESSURE,
|
||||||
|
subtype,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
areaChartData: (
|
||||||
|
measurement: pond.UnitMeasurementsForComponent,
|
||||||
|
smoothingAverages?: number,
|
||||||
|
filters?: GraphFilters
|
||||||
|
): AreaChartData => {
|
||||||
|
return simpleAreaChartData(measurement, smoothingAverages, filters);
|
||||||
|
},
|
||||||
|
lineChartData: (
|
||||||
|
measurement: pond.UnitMeasurementsForComponent,
|
||||||
|
smoothingAverages?: number,
|
||||||
|
filters?: GraphFilters
|
||||||
|
): LineChartData => {
|
||||||
|
return simpleLineChartData(
|
||||||
|
quack.ComponentType.COMPONENT_TYPE_PRESSURE,
|
||||||
|
measurement,
|
||||||
|
smoothingAverages,
|
||||||
|
filters
|
||||||
|
);
|
||||||
|
},
|
||||||
|
minMeasurementPeriodMs: 1000,
|
||||||
|
icon: (theme?: "light" | "dark"): string | undefined => {
|
||||||
|
return theme === "light" ? PressureDarkIcon : PressureLightIcon;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -29,3 +29,4 @@ export * from "./Voltage";
|
||||||
export * from "./VPD";
|
export * from "./VPD";
|
||||||
export * from "./Weight";
|
export * from "./Weight";
|
||||||
export * from "./CapacitorCable";
|
export * from "./CapacitorCable";
|
||||||
|
export * from "./AnalogPressure";
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,8 @@ const DefaultAvailability: DeviceAvailabilityMap = new Map<quack.AddressType, De
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]],
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, [0x6c]],
|
[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
|
[quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE, [0x71]], // the address cables will use when they are plugged into the expander with V2 device only
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE, [0x6d]]
|
[quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE, [0x6d]],
|
||||||
|
[quack.ComponentType.COMPONENT_TYPE_ANALOG_PRESSURE, [0x6e]]
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
[quack.AddressType.ADDRESS_TYPE_DAC, [0, 1]],
|
[quack.AddressType.ADDRESS_TYPE_DAC, [0, 1]],
|
||||||
|
|
|
||||||
|
|
@ -174,10 +174,9 @@ export class MeasurementDescriber {
|
||||||
this.details.path = "power.inputVoltageTimes10";
|
this.details.path = "power.inputVoltageTimes10";
|
||||||
this.details.decimals = 1;
|
this.details.decimals = 1;
|
||||||
}
|
}
|
||||||
if (componentType === quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE) {
|
if (componentType === quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE || componentType === quack.ComponentType.COMPONENT_TYPE_ANALOG_PRESSURE) {
|
||||||
this.details.unit = "mV";
|
this.details.unit = "mV";
|
||||||
this.details.graph = GraphType.MULTILINE;
|
this.details.graph = GraphType.MULTILINE;
|
||||||
this.details.unit = "mV";
|
|
||||||
this.details.decimals = 0
|
this.details.decimals = 0
|
||||||
// this.details.nodeDetails = {
|
// this.details.nodeDetails = {
|
||||||
// colours: ["white", "black", "red", "blue"],
|
// colours: ["white", "black", "red", "blue"],
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ const MiVentV1Pins: ConfigurablePin[] = [
|
||||||
{ address: 1024, label: "C2" }
|
{ address: 1024, label: "C2" }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
//no longer in development so if you are adding new component types DO NOT add the I2C address here because the firmware of the device will not support it
|
||||||
export const MiVentV1Availability: DeviceAvailabilityMap = new Map<
|
export const MiVentV1Availability: DeviceAvailabilityMap = new Map<
|
||||||
quack.AddressType,
|
quack.AddressType,
|
||||||
DevicePositions
|
DevicePositions
|
||||||
|
|
@ -53,7 +54,8 @@ export const MiVentV2Availability: DeviceAvailabilityMap = new Map<
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]],
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, [0x6c]],
|
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, [0x6c]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE, [0x6d]]
|
[quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE, [0x6d]],
|
||||||
|
[quack.ComponentType.COMPONENT_TYPE_ANALOG_PRESSURE, [0x6e]]
|
||||||
|
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue