The doc say id << 24, but when its goes through the different msg types it always puts class followed by id together in every table. Its a bit confusing and easy to read the check sum as class << 24 when in fact its msg_id << 24.
It looks to me like the initial part of the chksum calc is done as:
//The calculation of the check value can follow the following algorithm:
ckSum = (id << 24) + (class << 16) + len;
for (i = 0; i <(len / 4); i++)
{
ckSum = ckSum + payload [i];
}
In this instance msg_id is 0x01, msg_class is 0x0B
The length is 0x0038 or 0x38 = 56 decimal bytes which is the size of the payload buffer.
As per screenshot below - the msg class and msg id are shown in that order in every part of the doc
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.
The doc say id << 24, but when its goes through the different msg types it always puts class followed by id together in every table. Its a bit confusing and easy to read the check sum as class << 24 when in fact its msg_id << 24.
It looks to me like the initial part of the chksum calc is done as:
which matches the doc:
In this instance msg_id is 0x01, msg_class is 0x0B
The length is 0x0038 or 0x38 = 56 decimal bytes which is the size of the payload buffer.
As per screenshot below - the msg class and msg id are shown in that order in every part of the doc
1 Attachment