Thank for the reply. The post misses the checksum. The real code is:
function checksum(str) { var cs = 0; for (const c of str) { cs = cs ^ c.charCodeAt(0); //XOR } return cs.toString(16).toUpperCase().padStart(2, '0'); } function configureSBAS() { const thisTime = new Date(); let timeString = thisTime.toISOString(); // SBAS satellite (SBAS satellite No. 1-19, corresponding to PRN 120-138 var cmd = "PCAS15,4,FFFF"; //turn on satellites 1-16 of SBAS //var cmd = "PCAS15,4,7FFFF"; //turn on satellites 1-19 of SBAS cmd = "$" + cmd + "*" + checksum(cmd); Serial1.println(cmd); writeLogFile(timeString + ": " + cmd + "\n"); SBASon = true; }
You are checksumming the command without the leading $, I think that needs to be included.
$
I thing line 19 of the presented code add the leading "$"
@halemmerich started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thank for the reply. The post misses the checksum. The real code is: