From 1f847118d427c7902226bfe6fc5076a32c12ae64 Mon Sep 17 00:00:00 2001 From: i7-8700 <1281261856@qq.com> Date: Wed, 11 Mar 2020 16:52:58 +0800 Subject: [PATCH] fix bug --- include/ademco_packet.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/include/ademco_packet.h b/include/ademco_packet.h index 87a7fd0..0440d79 100644 --- a/include/ademco_packet.h +++ b/include/ademco_packet.h @@ -238,8 +238,8 @@ struct CongwinFe100Packet data_[ndx++] = ' '; ndx += snprintf(data_ + ndx, sizeof(data_) - ndx, "%08d", static_cast<int>(acct)); // acct - data_[ndx++] = ' '; + data_[ndx++] = ' '; data_[ndx++] = '1'; // 18 data_[ndx++] = '8'; data_[ndx++] = ' '; @@ -262,12 +262,10 @@ struct CongwinFe100Packet data_[ndx++] = 'B'; data_[ndx++] = '2'; } else { - snprintf(data_ + ndx, sizeof(data_) - ndx, "%03d", static_cast<int>(evnt % 1000)); // event + ndx += snprintf(data_ + ndx, sizeof(data_) - ndx, "%03d", static_cast<int>(evnt % 1000)); // event } - ndx += 3; data_[ndx++] = ' '; - data_[ndx++] = '0'; // gg is always 00 data_[ndx++] = '0'; data_[ndx++] = ' '; @@ -279,8 +277,7 @@ struct CongwinFe100Packet data_[ndx++] = 'C'; // C } - sprintf(data_ + ndx, "%03d", static_cast<int>(zone % 10000)); - ndx += 3; + ndx += sprintf(data_ + ndx, "%03d", static_cast<int>(zone % 10000)); data_[ndx++] = ' '; data_[ndx++] = '\r'; -- 2.18.1