also now filling in the drying fields with default data based on the ambient component, or what was last used in the bin
This commit is contained in:
parent
a225f02795
commit
17728714a3
3 changed files with 18 additions and 15 deletions
|
|
@ -332,14 +332,23 @@ export default function BinVisualizer(props: Props) {
|
||||||
setNewGrainSettings(bin.customGrain());
|
setNewGrainSettings(bin.customGrain());
|
||||||
}
|
}
|
||||||
if (bin.settings) {
|
if (bin.settings) {
|
||||||
let t = bin.settings.outdoorTemp;
|
let t = 0
|
||||||
|
let h = 0
|
||||||
|
if(ambient){
|
||||||
|
t = ambient.temperature
|
||||||
|
h = ambient.humidity
|
||||||
|
}else{
|
||||||
|
t = bin.settings.outdoorTemp;//use what is already set in the bin settings
|
||||||
|
h = bin.settings.outdoorHumidity
|
||||||
|
}
|
||||||
|
|
||||||
if (user.settings.temperatureUnit === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT) {
|
if (user.settings.temperatureUnit === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT) {
|
||||||
t = CtoF(t);
|
t = CtoF(t);
|
||||||
}
|
}
|
||||||
setOutdoorTemp(t);
|
setOutdoorTemp(t);
|
||||||
|
setOutdoorHumidity(h)
|
||||||
}
|
}
|
||||||
if (bin.settings) setOutdoorHumidity(bin.settings.outdoorHumidity);
|
}, [bin, user, ambient]);
|
||||||
}, [bin, user]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
//if(loadingTrend) return
|
//if(loadingTrend) return
|
||||||
|
|
@ -1998,7 +2007,7 @@ export default function BinVisualizer(props: Props) {
|
||||||
}
|
}
|
||||||
b.settings.mode = newBinMode;
|
b.settings.mode = newBinMode;
|
||||||
}
|
}
|
||||||
|
console.log(b.settings)
|
||||||
binAPI.updateBin(bin.key(), b.settings, as).then(resp => {
|
binAPI.updateBin(bin.key(), b.settings, as).then(resp => {
|
||||||
refresh();
|
refresh();
|
||||||
});
|
});
|
||||||
|
|
@ -2025,8 +2034,8 @@ export default function BinVisualizer(props: Props) {
|
||||||
if(refresh) updateBin();
|
if(refresh) updateBin();
|
||||||
}}
|
}}
|
||||||
defaultTargetMoisture={bin.settings.inventory?.initialMoisture}
|
defaultTargetMoisture={bin.settings.inventory?.initialMoisture}
|
||||||
// defaultOutdoorTemp={get this from any ambient sensors}
|
defaultOutdoorTemp={outdoorTemp}
|
||||||
// defaultOutdoorHumidity={get this from any ambient sensors}
|
defaultOutdoorHumidity={outdoorHumidity}
|
||||||
changeTargetMoisture={newMoisture => {
|
changeTargetMoisture={newMoisture => {
|
||||||
setTargetMoisture(newMoisture)
|
setTargetMoisture(newMoisture)
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -108,9 +108,9 @@ export default function ModeChangeDialog(props: Props){
|
||||||
const [deviceOption, setDeviceOption] = useState<Option>()
|
const [deviceOption, setDeviceOption] = useState<Option>()
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
setMoistureInput(defaultTargetMoisture?.toFixed(2) ?? "0")
|
setMoistureInput(defaultTargetMoisture?.toString() ?? "0")
|
||||||
setOutdoorTempInput(defaultOutdoorTemp?.toFixed(2) ?? "0")
|
setOutdoorTempInput(defaultOutdoorTemp?.toString() ?? "0")
|
||||||
setOutdoorHumidityInput(defaultOutdoorHumidity?.toFixed(2) ?? "0")
|
setOutdoorHumidityInput(defaultOutdoorHumidity?.toString() ?? "0")
|
||||||
},[defaultTargetMoisture, defaultOutdoorTemp, defaultOutdoorHumidity])
|
},[defaultTargetMoisture, defaultOutdoorTemp, defaultOutdoorHumidity])
|
||||||
|
|
||||||
//get the interactions and components for the device when it is selected from the dropdown
|
//get the interactions and components for the device when it is selected from the dropdown
|
||||||
|
|
@ -624,11 +624,7 @@ if (!selectedDevice) return;
|
||||||
onChange={event => {
|
onChange={event => {
|
||||||
setOutdoorTempInput(event.target.value)
|
setOutdoorTempInput(event.target.value)
|
||||||
if(changeOutdoorTemp && !isNaN(parseFloat(event.target.value))){
|
if(changeOutdoorTemp && !isNaN(parseFloat(event.target.value))){
|
||||||
//if the users prefs are F will need to convert it to C when sending it back
|
|
||||||
let val = parseFloat(event.target.value)
|
let val = parseFloat(event.target.value)
|
||||||
if(getTemperatureUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT){
|
|
||||||
val = fahrenheitToCelsius(val)
|
|
||||||
}
|
|
||||||
changeOutdoorTemp(val)
|
changeOutdoorTemp(val)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ export function PromiseProgress(props: Props){
|
||||||
const [completion, setCompletion] = useState<Map<string, progress>>(new Map())
|
const [completion, setCompletion] = useState<Map<string, progress>>(new Map())
|
||||||
|
|
||||||
const execute = () => {
|
const execute = () => {
|
||||||
console.log("executing")
|
|
||||||
let completionMap: Map<string, progress> = new Map()
|
let completionMap: Map<string, progress> = new Map()
|
||||||
stages.forEach((stage, i) => {
|
stages.forEach((stage, i) => {
|
||||||
stage.steps.forEach((_, k) => {
|
stage.steps.forEach((_, k) => {
|
||||||
|
|
@ -48,7 +47,6 @@ export function PromiseProgress(props: Props){
|
||||||
const runStages = async () => {
|
const runStages = async () => {
|
||||||
let progMap = new Map(completionMap)
|
let progMap = new Map(completionMap)
|
||||||
for (const [i, stage] of stages.entries()) {
|
for (const [i, stage] of stages.entries()) {
|
||||||
console.log("the for loop:" + i)
|
|
||||||
// For each stage, map the steps into their own promise chains
|
// For each stage, map the steps into their own promise chains
|
||||||
const stepPromises = stage.steps.map((step, k) => {
|
const stepPromises = stage.steps.map((step, k) => {
|
||||||
// mark step as in progress
|
// mark step as in progress
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue