Merge branch 'airflow' into node_exclusion_update
This commit is contained in:
commit
25fc5021fe
13 changed files with 107 additions and 31 deletions
|
|
@ -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]
|
||||
]);
|
||||
|
||||
const offset = offsets.get(componentType);
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ export interface ComponentTypeExtension {
|
|||
interactionResultTypes: Array<quack.InteractionResultType>;
|
||||
states: Array<string>;
|
||||
measurements: Array<ComponentMeasurement>;
|
||||
measurementSummary: Function; //Deprecated: this summary used the old measurement structure
|
||||
measurementSummary?: Function; //Deprecated: this summary used the old measurement structure
|
||||
unitMeasurementSummary: (
|
||||
measurements: convertedUnitMeasurement
|
||||
) => Summary[];
|
||||
|
|
@ -365,7 +365,8 @@ export async function getMeasurementSummary(
|
|||
measurement: quack.IMeasurement,
|
||||
filters: GraphFilters
|
||||
): Promise<Array<Summary>> {
|
||||
return extension(type, subtype).measurementSummary(measurement, filters);
|
||||
let sumFunc = extension(type, subtype).measurementSummary
|
||||
return sumFunc ? sumFunc(measurement, filters) : [];
|
||||
}
|
||||
|
||||
const validNodes = (nodeVals: number[], filters?: GraphFilters) => {
|
||||
|
|
|
|||
|
|
@ -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<Array<Summary>> {
|
||||
return simpleSummaries(measurement, airflow);
|
||||
},
|
||||
measurements: measurementTypes,
|
||||
// measurementSummary: async function(measurement: quack.Measurement): Promise<Array<Summary>> {
|
||||
// return simpleSummaries(measurement, airflow);
|
||||
// },
|
||||
unitMeasurementSummary: (
|
||||
measurements: convertedUnitMeasurement,
|
||||
): Summary[] => {
|
||||
|
|
|
|||
|
|
@ -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.AddressType.ADDRESS_TYPE_DAC, [0, 1]],
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue