Skip to content

Commit f695916

Browse files
committed
fix(Messages): start checksum calculation at correct index for Jandy protocol
#1128
1 parent ad45242 commit f695916

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

controller/comms/messages/Messages.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ export class Message {
263263
public get chkLo(): number { return this.protocol === Protocol.Chlorinator || this.protocol === Protocol.AquaLink || this.protocol === Protocol.Jandy ? this.term[0] : this.term[1]; }
264264
public get checksum(): number {
265265
var sum = 0;
266-
for (let i = 0; i < this.header.length; i++) sum += this.header[i];
266+
let start = this.protocol === Protocol.Jandy ? 2 : 0;
267+
for (let i = start; i < this.header.length; i++) sum += this.header[i];
267268
for (let i = 0; i < this.payload.length; i++) sum += this.payload[i];
268269
return sum;
269270
}

0 commit comments

Comments
 (0)