Skip to content

Commit

Permalink
Fix issue where chemical tank state can lose the capacity configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
rstrouse committed Jun 4, 2023
1 parent 59f6b20 commit 8197e90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions controller/Equipment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2459,6 +2459,7 @@ export class ChemicalPh extends Chemical {
public getExtended() {
let chem = super.getExtended();
chem.probe = this.probe.getExtended();
chem.tank = this.tank.getExtended();
chem.phSupply = sys.board.valueMaps.phSupplyTypes.transform(this.phSupply);
chem.doserType = sys.board.valueMaps.phDoserTypes.transform(this.doserType);
return chem;
Expand Down Expand Up @@ -2489,6 +2490,7 @@ export class ChemicalORP extends Chemical {
public getExtended() {
let chem = super.getExtended();
chem.probe = this.probe.getExtended();
chem.tank = this.tank.getExtended();
chem.doserType = sys.board.valueMaps.orpDoserTypes.transform(this.doserType);
return chem;
}
Expand Down
8 changes: 3 additions & 5 deletions controller/nixie/chemistry/ChemController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ export class NixieChemController extends NixieChemControllerBase {
schem.ph.enabled = this.chem.ph.enabled;
let probeType = chem.orp.probe.type;
if (this.chem.orp.enabled) {

let useChlorinator = chem.orp.useChlorinator;
let pumpType = chem.orp.pump.type;
let currLevelPercent = schem.orp.tank.level / schem.orp.tank.capacity * 100;
Expand Down Expand Up @@ -773,7 +772,6 @@ export class NixieChemController extends NixieChemControllerBase {
else schem.alarms.pH = 0;
schem.ph.freezeProtect = (state.freeze && chem.ph.disableOnFreeze && schem.isBodyOn);
}

else {
schem.alarms.pHTank = 0;
schem.warnings.pHDailyLimitReached = 0;
Expand Down Expand Up @@ -1130,10 +1128,10 @@ export class NixieChemTank extends NixieChildEquipment {
try {
if (typeof data !== 'undefined') {
stank.level = typeof data.level !== 'undefined' ? parseFloat(data.level) : stank.level;
stank.capacity = this.tank.capacity = typeof data.capacity !== 'undefined' ? parseFloat(data.capacity) : stank.capacity;
stank.capacity = this.tank.capacity = typeof data.capacity !== 'undefined' ? parseFloat(data.capacity) : this.tank.capacity;
stank.units = this.tank.units = typeof data.units !== 'undefined' ? sys.board.valueMaps.volumeUnits.encode(data.units) : this.tank.units;
stank.alarmEmptyEnabled = this.tank.alarmEmptyEnabled = typeof data.alarmEmptyEnabled !== 'undefined' ? data.alarmEmptyEnabled : stank.alarmEmptyEnabled;
stank.alarmEmptyLevel = this.tank.alarmEmptyLevel = typeof data.alarmEmptyLevel !== 'undefined' ? data.alarmEmptyLevel : stank.alarmEmptyLevel;
stank.alarmEmptyEnabled = this.tank.alarmEmptyEnabled = typeof data.alarmEmptyEnabled !== 'undefined' ? data.alarmEmptyEnabled : this.tank.alarmEmptyEnabled;
stank.alarmEmptyLevel = this.tank.alarmEmptyLevel = typeof data.alarmEmptyLevel !== 'undefined' ? data.alarmEmptyLevel : this.tank.alarmEmptyLevel;
}
}
catch (err) { logger.error(`setTankAsync: ${err.message}`); return Promise.reject(err); }
Expand Down

0 comments on commit 8197e90

Please sign in to comment.