Skip to content

Commit

Permalink
Fixes for IntelliChem messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
rstrouse committed Mar 23, 2021
1 parent bc37896 commit 58e494a
Show file tree
Hide file tree
Showing 3 changed files with 207 additions and 87 deletions.
9 changes: 9 additions & 0 deletions controller/boards/NixieBoard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ export class NixieBoard extends SystemBoard {

} catch (err) { logger.error(`Error verifying setup`); }
}
/// This method processes the status message periodically. The role of this method is to verify the circuit, valve, and heater
/// relays. This method does not control RS485 operations such as pumps and chlorinators. These are done through the respective
/// equipment polling functions.
public async processStatusAsync() {
try {


} catch (err) {}
}
}
export class NixieSystemCommands extends SystemCommands {
public cancelDelay(): Promise<any> { state.delay = sys.board.valueMaps.delay.getValue('nodelay'); return Promise.resolve(state.data.delay); }
Expand Down
27 changes: 22 additions & 5 deletions controller/boards/SystemBoard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3388,8 +3388,24 @@ export class ChemControllerCommands extends BoardCommands {
//})
}
protected async setIntelliChemStateAsync(data: any): Promise<ChemControllerState> {
// We will land here whenever the chem controller is not attached to an IntelliCenter. Apparently
// *Touch controllers communicate directly with the IntelliChem controller and the OCP has no play in it.
// Changing TA to 160 from 120.
// Settings:
// CYA: 44
// CH: 250
// ORP Tank: 6
// pH Tank: 6
// Changing a value on the IntelliChem
//[255, 0, 255][165, 0, 144, 16, 146, 21][2,228,2,188,6,6,0,250,0,44,0,120,20,0,0,0,0,0,0,0,0][5, 78]
// Bytes - Description
// 0-1 : pH Setpoint 2x256 + 228 / 100 = 7.4
// 2-3 : ORP Setpoint 2x256 + 188 = 700
// 4 : pH Tank level
// 5 : ORP Tank level
// 6-7 : Calcium Hardness = 0x256 + 250 = 250
// 8 : Unknown (This is probably the first byte of CYA) 0x256 = 0.
// 9 : CYA = 44
// 10-12 : TA = 0x256 + 20 = 20
// 11 : Unknown 120
try {
let chem = sys.chemControllers.find(elem => elem.id === data.id);
if (typeof chem === 'undefined') return Promise.reject(`A valid IntelliChem controller could not be found at id ${data.id}`);
Expand Down Expand Up @@ -3424,7 +3440,8 @@ export class ChemControllerCommands extends BoardCommands {
action: 146,
payload: [],
retries: 1,
response: true,
response: Response.create({ dest: 16, action: 1, payload: [146] }),
//response: true, This is not correct. The response is actually an ack a message will never come with this.
protocol: Protocol.IntelliChem,
onComplete: (err, msg) => {
if (err) {
Expand Down Expand Up @@ -3455,8 +3472,8 @@ export class ChemControllerCommands extends BoardCommands {
out.setPayloadByte(7, Math.round(calciumHardness % 256) || 0);
out.setPayloadByte(9, parseInt(data.cyanuricAcid, 10), chem.cyanuricAcid || 0);
out.setPayloadByte(10, Math.floor(alkalinity / 256) || 0);
out.setPayloadByte(12, Math.round(alkalinity % 256) || 0);
// out.setPayloadByte(12, 20); // fixed value?
out.setPayloadByte(11, Math.round(alkalinity % 256) || 0); // RKS: This was incorrect and was using 12 as the lower encoded byte.
out.setPayloadByte(12, 20); // fixed value?
conn.queueSendMessage(out);
})
return Promise.resolve(schem);
Expand Down
Loading

0 comments on commit 58e494a

Please sign in to comment.