Merge branch 'drager_i2c' into dev_environment
This commit is contained in:
commit
f2636795d1
7 changed files with 63 additions and 131283 deletions
|
|
@ -431,8 +431,6 @@ export default function BinSVGV2(props: Props) {
|
|||
);
|
||||
};
|
||||
|
||||
//console.log(cables)
|
||||
|
||||
const cableGrainEstimate = (
|
||||
points: GrainNodePoint[],
|
||||
cableSpacing: number,
|
||||
|
|
@ -619,16 +617,6 @@ export default function BinSVGV2(props: Props) {
|
|||
if (!cable.excludedNodes.includes(nodeNumber - 1)){
|
||||
if (cable.topNode > 0) {
|
||||
if (nodeNumber <= cable.topNode) {
|
||||
// nodeHeatMap.push(
|
||||
// <ellipse
|
||||
// key={index}
|
||||
// cx={cablePos}
|
||||
// cy={nodeY}
|
||||
// rx="120"
|
||||
// ry="60"
|
||||
// fill={getGrainGradient(temp)}
|
||||
// />
|
||||
// );
|
||||
nodeHeatMapData.push({
|
||||
key: index,
|
||||
xCenter: cablePos,
|
||||
|
|
@ -639,17 +627,6 @@ export default function BinSVGV2(props: Props) {
|
|||
})
|
||||
}
|
||||
} else if (nodeY > filledToY) {
|
||||
//otherwise use the fill level of the bin
|
||||
// nodeHeatMap.push(
|
||||
// <ellipse
|
||||
// key={index}
|
||||
// cx={cablePos}
|
||||
// cy={nodeY}
|
||||
// rx="120"
|
||||
// ry="60"
|
||||
// fill={getGrainGradient(temp)}
|
||||
// />
|
||||
// );
|
||||
nodeHeatMapData.push({
|
||||
key: index,
|
||||
xCenter: cablePos,
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ export default function GrainNodeInteractions(props: Props) {
|
|||
const humDescriber = describeMeasurement(quack.MeasurementType.MEASUREMENT_TYPE_PERCENT);
|
||||
const moistureDescriber = describeMeasurement(quack.MeasurementType.MEASUREMENT_TYPE_GRAIN_EMC);
|
||||
const [topNode, setTopNode] = useState(false);
|
||||
const [excluded, setExcluded] = useState(false);
|
||||
const componentAPI = useComponentAPI();
|
||||
const interactionAPI = useInteractionsAPI();
|
||||
const binAPI = useBinAPI();
|
||||
|
|
@ -131,6 +132,13 @@ export default function GrainNodeInteractions(props: Props) {
|
|||
} else {
|
||||
setTopNode(false);
|
||||
}
|
||||
|
||||
//determine if the node is excluded
|
||||
if (cable.excludedNodes.includes(displayNode - 1)){
|
||||
setExcluded(true)
|
||||
}else{
|
||||
setExcluded(false)
|
||||
}
|
||||
}, [cable, displayNode]);
|
||||
|
||||
const goToComponent = () => {
|
||||
|
|
@ -167,6 +175,7 @@ export default function GrainNodeInteractions(props: Props) {
|
|||
.then(resp => {})
|
||||
.catch(err => {});
|
||||
});
|
||||
updateComponentCallback(cable.key())
|
||||
})
|
||||
.catch(err => {
|
||||
openSnack("Failed to update component");
|
||||
|
|
@ -204,6 +213,15 @@ export default function GrainNodeInteractions(props: Props) {
|
|||
setTopNode(checked);
|
||||
};
|
||||
|
||||
const updateNodeExclusion = (checked: boolean) => {
|
||||
if (checked) {
|
||||
cable.settings.excludedNodes.push(selectedNode-1)
|
||||
} else {
|
||||
cable.settings.excludedNodes.splice(cable.settings.excludedNodes.indexOf(selectedNode - 1), 1)
|
||||
}
|
||||
setExcluded(checked)
|
||||
}
|
||||
|
||||
const displayTemp = () => {
|
||||
let tempFinal = nodeTemp ?? 0;
|
||||
if (user.settings.temperatureUnit === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT) {
|
||||
|
|
@ -312,15 +330,38 @@ export default function GrainNodeInteractions(props: Props) {
|
|||
);
|
||||
};
|
||||
|
||||
const fillNodeSet = () => {
|
||||
const nodeControl = () => {
|
||||
return (
|
||||
<Box style={{ marginTop: 10 }}>
|
||||
<Typography style={{ fontSize: 20, fontWeight: 650 }}>Top Node Control</Typography>
|
||||
<Typography style={{ fontSize: 20, fontWeight: 650 }}>Node Control</Typography>
|
||||
<FormControlLabel
|
||||
style={{ marginTop: 10 }}
|
||||
control={
|
||||
<Checkbox
|
||||
checked={excluded}
|
||||
onChange={e => {
|
||||
updateNodeExclusion(e.target.checked);
|
||||
}}
|
||||
name="excludedNode"
|
||||
/>
|
||||
}
|
||||
label={
|
||||
<React.Fragment>
|
||||
<Typography style={{ fontSize: 15, fontWeight: 650 }}>
|
||||
Exclude Node
|
||||
</Typography>
|
||||
<Typography style={{ fontSize: 15 }}>
|
||||
If checked this will set the node to be disabled and will not be used for any calculations done for the bin
|
||||
</Typography>
|
||||
</React.Fragment>
|
||||
}
|
||||
/>
|
||||
<FormControlLabel
|
||||
style={{ marginTop: 10 }}
|
||||
control={
|
||||
<Checkbox
|
||||
checked={topNode}
|
||||
disabled={excluded}
|
||||
onChange={e => {
|
||||
updateTopNode(e.target.checked);
|
||||
}}
|
||||
|
|
@ -418,7 +459,7 @@ export default function GrainNodeInteractions(props: Props) {
|
|||
</DialogTitle>
|
||||
<DialogContent>
|
||||
{latestReading()}
|
||||
{fillNodeSet()}
|
||||
{nodeControl()}
|
||||
{interactionDisplay()}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -17,7 +17,8 @@ export const I2C: AddressTypeExtension = {
|
|||
[quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE, 0x4f],
|
||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, 0x68],
|
||||
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, 0x6b],
|
||||
[quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE, 0x70]
|
||||
[quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE, 0x70],
|
||||
[quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE, 0x6c]
|
||||
]);
|
||||
|
||||
const offset = offsets.get(componentType);
|
||||
|
|
|
|||
|
|
@ -48,16 +48,16 @@ export function dragerGasDongle(subtype: number = 0): ComponentTypeExtension {
|
|||
return {
|
||||
type: quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE,
|
||||
subtypes: [
|
||||
{
|
||||
key: quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_NONE,
|
||||
value: "DRAGER_GAS_DONGLE_SUBTYPE_NONE",
|
||||
friendlyName: "Drager Gas Chain"
|
||||
},
|
||||
{
|
||||
key: quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_DEBUG_VOLTAGE,
|
||||
value: "DRAGER_GAS_DONGLE_SUBTYPE_ADVANCED",
|
||||
friendlyName: "Drager Gas Chain - Voltage Debug"
|
||||
},
|
||||
// {
|
||||
// key: quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_NONE,
|
||||
// value: "DRAGER_GAS_DONGLE_SUBTYPE_NONE",
|
||||
// friendlyName: "Drager Gas Chain"
|
||||
// },
|
||||
// {
|
||||
// key: quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_DEBUG_VOLTAGE,
|
||||
// value: "DRAGER_GAS_DONGLE_SUBTYPE_ADVANCED",
|
||||
// friendlyName: "Drager Gas Chain - Voltage Debug"
|
||||
// },
|
||||
// {
|
||||
// key: quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_CO_CO2_NO2_O2,
|
||||
// value: "DRAGER_GAS_DONGLE_SUBTYPE_ADVANCED",
|
||||
|
|
@ -100,7 +100,7 @@ export function dragerGasDongle(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: [],
|
||||
//this is apparently used by the interactions to determine what the possible options for measurement type are
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ const DefaultAvailability: DeviceAvailabilityMap = new Map<quack.AddressType, De
|
|||
[quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE, [0x50]],
|
||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]],
|
||||
[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.AddressType.ADDRESS_TYPE_DAC, [0, 1]],
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@ 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, [0x6c]]
|
||||
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, [0x6c]],
|
||||
[quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE, [0x6d]]
|
||||
|
||||
])
|
||||
],
|
||||
[quack.AddressType.ADDRESS_TYPE_POWER, [0]],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue