Skip to content

Commit

Permalink
Screenlogic implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
tagyoureit committed Nov 22, 2022
1 parent a6bbe91 commit 1e6cddc
Show file tree
Hide file tree
Showing 14 changed files with 1,830 additions and 1,036 deletions.
2 changes: 1 addition & 1 deletion anslq25/MessagesMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class MessagesMock {
constructor() { }

public static process(msg: Inbound) {
switch (msg.protocol) {
switch (msg. protocol) {
case Protocol.Broadcast: {
switch (sys.controllerType) {
case ControllerType.IntelliCenter:
Expand Down
11 changes: 2 additions & 9 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,8 @@ export async function initAsync() {
await conn.initAsync();
await sys.start();
await webApp.initAutoBackup();
await sl.connectAsync();
await sl.initAsync();
} catch (err) { console.log(`Error Initializing nodejs-PoolController ${err.message}`); }
//return Promise.resolve()
// .then(function () { config.init(); })
// .then(function () { logger.init(); })
// .then(function () { conn.init(); })
// .then(function () { sys.init(); })
// .then(function () { state.init(); })
// .then(function () { webApp.init(); })
// .then(function () { sys.start(); });
}

export async function startPacketCapture(bResetLogs: boolean) {
Expand Down Expand Up @@ -78,6 +70,7 @@ export async function stopAsync(): Promise<void> {
await sys.stopAsync();
await state.stopAsync();
await conn.stopAsync();
await sl.stopAsync();
await webApp.stopAsync();
await config.updateAsync();
await logger.stopAsync();
Expand Down
30 changes: 19 additions & 11 deletions controller/Equipment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { NixieControlPanel } from "./nixie/Nixie";
import { NixieBoard } from 'controller/boards/NixieBoard';
import { MockSystemBoard } from "../anslq25/boards/MockSystemBoard";
import { MockBoardFactory } from "../anslq25/boards/MockBoardFactory";
import { ScreenLogicComms } from "./comms/ScreenLogic";

interface IPoolSystem {
cfgPath: string;
Expand Down Expand Up @@ -335,6 +336,7 @@ export class PoolSystem implements IPoolSystem {
public chemControllers: ChemControllerCollection;
public chemDosers: ChemDoserCollection;
public filters: FilterCollection;
public screenlogic: ScreenLogicComms;
public appVersion: string;
public get dirty(): boolean { return this._isDirty; }
public set dirty(val) {
Expand Down Expand Up @@ -819,17 +821,6 @@ export class Options extends EqItem {
public set cleanerSolarDelay(val: boolean) { this.setDataVal('cleanerSolarDelay', val); }
public get cleanerSolarDelayTime(): number { return this.data.cleanerSolarDelayTime; }
public set cleanerSolarDelayTime(val: number) { this.setDataVal('cleanerSolarDelayTime', val); }

//public get airTempAdj(): number { return typeof this.data.airTempAdj === 'undefined' ? 0 : this.data.airTempAdj; }
//public set airTempAdj(val: number) { this.setDataVal('airTempAdj', val); }
//public get waterTempAdj1(): number { return typeof this.data.waterTempAdj1 === 'undefined' ? 0 : this.data.waterTempAdj1; }
//public set waterTempAdj1(val: number) { this.setDataVal('waterTempAdj1', val); }
//public get solarTempAdj1(): number { return typeof this.data.solarTempAdj1 === 'undefined' ? 0 : this.data.solarTempAdj1; }
//public set solarTempAdj1(val: number) { this.setDataVal('solarTempAdj1', val); }
//public get waterTempAdj2(): number { return typeof this.data.waterTempAdj2 === 'undefined' ? 0 : this.data.waterTempAdj2; }
//public set waterTempAdj2(val: number) { this.setDataVal('waterTempAdj2', val); }
//public get solarTempAdj2(): number { return typeof this.data.solarTempAdj2 === 'undefined' ? 0 : this.data.solarTempAdj2; }
//public set solarTempAdj2(val: number) { this.setDataVal('solarTempAd2', val); }
}
export class VacationOptions extends ChildEqItem {
public initData() {
Expand Down Expand Up @@ -2652,4 +2643,21 @@ export class AlarmSetting extends ChildEqItem {
public get high(): number { return this.data.high; }
public set high(val: number) { this.setDataVal('high', val); }
}
export class Screenlogic extends EqItem {
ctor(data: any, name?: any): General { return new General(data, name || 'pool'); }
public get enabled(): boolean { return this.data.enabled; }
public set enabled(val: boolean) { this.setDataVal('enabled', val); }
public get type(): 'local'|'remote' { return this.data.type; }
public set type(val: 'local'|'remote') { this.setDataVal('type', val); }
public get systemName(): string { return this.data.systemName; }
public set systemName(val: string) { this.setDataVal('systemName', val); }
public get password(): string { return this.data.password; }
public set password(val: string) { this.setDataVal('password', val); }

public clear(master: number = -1) {
if (master === -1)
super.clear();
}

}
export let sys = new PoolSystem();
4 changes: 2 additions & 2 deletions controller/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -966,15 +966,15 @@ export class PumpState extends EqState {
this.hasChanged = true;
}
}
public get virtualControllerStatus(): number {
/* public get virtualControllerStatus(): number {
return typeof (this.data.virtualControllerStatus) !== 'undefined' ? this.data.virtualControllerStatus.val : -1;
}
public set virtualControllerStatus(val: number) {
if (this.virtualControllerStatus !== val) {
this.data.virtualControllerStatus = sys.board.valueMaps.virtualControllerStatus.transform(val);
this.hasChanged = true;
}
}
} */
public get targetSpeed(): number { return this.data.targetSpeed; } // used for virtual controller
public set targetSpeed(val: number) { this.setDataVal('targetSpeed', val); }
public get type() { return typeof (this.data.type) !== 'undefined' ? this.data.type.val : -1; }
Expand Down
Loading

0 comments on commit 1e6cddc

Please sign in to comment.