Merge pull request #8683 from gemu2015/sml_modbus_fix

fix sml modbus raw mode
This commit is contained in:
Theo Arends 2020-06-14 12:14:44 +02:00 committed by GitHub
commit bea5130d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -2405,12 +2405,13 @@ void SML_Send_Seq(uint32_t meter,char *seq) {
if (!rflg) { if (!rflg) {
*ucp++=0; *ucp++=0;
*ucp++=2; *ucp++=2;
slen+=2;
} }
// append crc // append crc
uint16_t crc = MBUS_calculateCRC(sbuff,6); uint16_t crc = MBUS_calculateCRC(sbuff,slen);
*ucp++=lowByte(crc); *ucp++=lowByte(crc);
*ucp++=highByte(crc); *ucp++=highByte(crc);
slen+=4; slen+=2;
} }
if (script_meter_desc[meter].type=='o') { if (script_meter_desc[meter].type=='o') {
for (uint32_t cnt=0;cnt<slen;cnt++) { for (uint32_t cnt=0;cnt<slen;cnt++) {