Merge branch 'drager_i2c' into dev_environment

This commit is contained in:
csawatzky 2025-08-01 15:25:37 -06:00
commit f2636795d1
7 changed files with 63 additions and 131283 deletions

View file

@ -431,8 +431,6 @@ export default function BinSVGV2(props: Props) {
); );
}; };
//console.log(cables)
const cableGrainEstimate = ( const cableGrainEstimate = (
points: GrainNodePoint[], points: GrainNodePoint[],
cableSpacing: number, cableSpacing: number,
@ -619,16 +617,6 @@ export default function BinSVGV2(props: Props) {
if (!cable.excludedNodes.includes(nodeNumber - 1)){ if (!cable.excludedNodes.includes(nodeNumber - 1)){
if (cable.topNode > 0) { if (cable.topNode > 0) {
if (nodeNumber <= cable.topNode) { if (nodeNumber <= cable.topNode) {
// nodeHeatMap.push(
// <ellipse
// key={index}
// cx={cablePos}
// cy={nodeY}
// rx="120"
// ry="60"
// fill={getGrainGradient(temp)}
// />
// );
nodeHeatMapData.push({ nodeHeatMapData.push({
key: index, key: index,
xCenter: cablePos, xCenter: cablePos,
@ -639,17 +627,6 @@ export default function BinSVGV2(props: Props) {
}) })
} }
} else if (nodeY > filledToY) { } 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({ nodeHeatMapData.push({
key: index, key: index,
xCenter: cablePos, xCenter: cablePos,

View file

@ -91,6 +91,7 @@ export default function GrainNodeInteractions(props: Props) {
const humDescriber = describeMeasurement(quack.MeasurementType.MEASUREMENT_TYPE_PERCENT); const humDescriber = describeMeasurement(quack.MeasurementType.MEASUREMENT_TYPE_PERCENT);
const moistureDescriber = describeMeasurement(quack.MeasurementType.MEASUREMENT_TYPE_GRAIN_EMC); const moistureDescriber = describeMeasurement(quack.MeasurementType.MEASUREMENT_TYPE_GRAIN_EMC);
const [topNode, setTopNode] = useState(false); const [topNode, setTopNode] = useState(false);
const [excluded, setExcluded] = useState(false);
const componentAPI = useComponentAPI(); const componentAPI = useComponentAPI();
const interactionAPI = useInteractionsAPI(); const interactionAPI = useInteractionsAPI();
const binAPI = useBinAPI(); const binAPI = useBinAPI();
@ -131,6 +132,13 @@ export default function GrainNodeInteractions(props: Props) {
} else { } else {
setTopNode(false); setTopNode(false);
} }
//determine if the node is excluded
if (cable.excludedNodes.includes(displayNode - 1)){
setExcluded(true)
}else{
setExcluded(false)
}
}, [cable, displayNode]); }, [cable, displayNode]);
const goToComponent = () => { const goToComponent = () => {
@ -167,6 +175,7 @@ export default function GrainNodeInteractions(props: Props) {
.then(resp => {}) .then(resp => {})
.catch(err => {}); .catch(err => {});
}); });
updateComponentCallback(cable.key())
}) })
.catch(err => { .catch(err => {
openSnack("Failed to update component"); openSnack("Failed to update component");
@ -204,6 +213,15 @@ export default function GrainNodeInteractions(props: Props) {
setTopNode(checked); 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 = () => { const displayTemp = () => {
let tempFinal = nodeTemp ?? 0; let tempFinal = nodeTemp ?? 0;
if (user.settings.temperatureUnit === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT) { if (user.settings.temperatureUnit === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT) {
@ -312,15 +330,38 @@ export default function GrainNodeInteractions(props: Props) {
); );
}; };
const fillNodeSet = () => { const nodeControl = () => {
return ( return (
<Box style={{ marginTop: 10 }}> <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 <FormControlLabel
style={{ marginTop: 10 }} style={{ marginTop: 10 }}
control={ control={
<Checkbox <Checkbox
checked={topNode} checked={topNode}
disabled={excluded}
onChange={e => { onChange={e => {
updateTopNode(e.target.checked); updateTopNode(e.target.checked);
}} }}
@ -418,7 +459,7 @@ export default function GrainNodeInteractions(props: Props) {
</DialogTitle> </DialogTitle>
<DialogContent> <DialogContent>
{latestReading()} {latestReading()}
{fillNodeSet()} {nodeControl()}
{interactionDisplay()} {interactionDisplay()}
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>

File diff suppressed because one or more lines are too long

View file

@ -17,7 +17,8 @@ export const I2C: AddressTypeExtension = {
[quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE, 0x4f], [quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE, 0x4f],
[quack.ComponentType.COMPONENT_TYPE_SEN5X, 0x68], [quack.ComponentType.COMPONENT_TYPE_SEN5X, 0x68],
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, 0x6b], [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); const offset = offsets.get(componentType);

View file

@ -48,16 +48,16 @@ export function dragerGasDongle(subtype: number = 0): ComponentTypeExtension {
return { return {
type: quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE, type: quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE,
subtypes: [ subtypes: [
{ // {
key: quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_NONE, // key: quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_NONE,
value: "DRAGER_GAS_DONGLE_SUBTYPE_NONE", // value: "DRAGER_GAS_DONGLE_SUBTYPE_NONE",
friendlyName: "Drager Gas Chain" // friendlyName: "Drager Gas Chain"
}, // },
{ // {
key: quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_DEBUG_VOLTAGE, // key: quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_DEBUG_VOLTAGE,
value: "DRAGER_GAS_DONGLE_SUBTYPE_ADVANCED", // value: "DRAGER_GAS_DONGLE_SUBTYPE_ADVANCED",
friendlyName: "Drager Gas Chain - Voltage Debug" // friendlyName: "Drager Gas Chain - Voltage Debug"
}, // },
// { // {
// key: quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_CO_CO2_NO2_O2, // key: quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_CO_CO2_NO2_O2,
// value: "DRAGER_GAS_DONGLE_SUBTYPE_ADVANCED", // value: "DRAGER_GAS_DONGLE_SUBTYPE_ADVANCED",
@ -100,7 +100,7 @@ export function dragerGasDongle(subtype: number = 0): ComponentTypeExtension {
isSource: true, isSource: true,
isArray: true, isArray: true,
isCalibratable: false, isCalibratable: false,
addressTypes: [quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY], addressTypes: [quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY, quack.AddressType.ADDRESS_TYPE_I2C],
interactionResultTypes: [], interactionResultTypes: [],
states: [], states: [],
//this is apparently used by the interactions to determine what the possible options for measurement type are //this is apparently used by the interactions to determine what the possible options for measurement type are

View file

@ -61,7 +61,8 @@ const DefaultAvailability: DeviceAvailabilityMap = new Map<quack.AddressType, De
[quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE, [0x50]], [quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE, [0x50]],
[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.AddressType.ADDRESS_TYPE_DAC, [0, 1]], [quack.AddressType.ADDRESS_TYPE_DAC, [0, 1]],

View file

@ -52,7 +52,9 @@ export const MiVentV2Availability: DeviceAvailabilityMap = new Map<
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]], [quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
[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.AddressType.ADDRESS_TYPE_POWER, [0]], [quack.AddressType.ADDRESS_TYPE_POWER, [0]],