From a5b68d374f73f51b326f0614a5f49604c14b79d6 Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Mon, 26 Sep 2022 16:53:48 +0200 Subject: [PATCH] some fixes --- tools/esp8266/hmDefines.h | 8 +++----- tools/esp8266/hmRadio.h | 9 +++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tools/esp8266/hmDefines.h b/tools/esp8266/hmDefines.h index 28adbb2a..6763b50d 100644 --- a/tools/esp8266/hmDefines.h +++ b/tools/esp8266/hmDefines.h @@ -18,8 +18,7 @@ union serial_u { // units enum {UNIT_V = 0, UNIT_A, UNIT_W, UNIT_WH, UNIT_KWH, UNIT_HZ, UNIT_C, UNIT_PCT, UNIT_VA, UNIT_NONE}; -const char* const units[] = {"V", "A", "W", "Wh", "kWh", "Hz", "°C", "%","VAr",""}; - +const char* const units[] = {"V", "A", "W", "Wh", "kWh", "Hz", "°C", "%","Var",""}; // field types enum {FLD_UDC = 0, FLD_IDC, FLD_PDC, FLD_YD, FLD_YW, FLD_YT, @@ -125,10 +124,9 @@ const byteAssign_t hm1chAssignment[] = { { FLD_PAC, UNIT_W, CH0, 18, 2, 10 }, { FLD_Q, UNIT_VA, CH0, 20, 2, 10 }, { FLD_F, UNIT_HZ, CH0, 16, 2, 100 }, - { FLD_PF, UNIT_NONE,CH0, 24, 2, 1000 }, - { FLD_PFC, UNIT_PCT, CH0, 24, 2, 10 }, { FLD_T, UNIT_C, CH0, 26, 2, 10 }, - { FLD_ALARM_MES_ID, UNIT_NONE, CH0, 28, 2, 1 }, + { FLD_PF, UNIT_NONE,CH0, 24, 2, 1000 }, + { FLD_ALARM_MES_CNT, UNIT_NONE, CH0, 28, 2, 1 }, { FLD_YD, UNIT_WH, CH0, CALC_YD_CH0, 0, CMD_CALC }, { FLD_YT, UNIT_KWH, CH0, CALC_YT_CH0, 0, CMD_CALC }, { FLD_PDC, UNIT_W, CH0, CALC_PDC_CH0, 0, CMD_CALC }, diff --git a/tools/esp8266/hmRadio.h b/tools/esp8266/hmRadio.h index fcaa10bf..d392f8f4 100644 --- a/tools/esp8266/hmRadio.h +++ b/tools/esp8266/hmRadio.h @@ -177,12 +177,13 @@ class HmRadio { mTxBuf[10 + (++cnt)] = ((data[1] ) >> 8) & 0xff; // setting for persistens handlings mTxBuf[10 + (++cnt)] = ((data[1] ) ) & 0xff; // setting for persistens handling } - // crc control data - uint16_t crc = Ahoy::crc16(&mTxBuf[10], cnt+1); - mTxBuf[10 + (++cnt)] = (crc >> 8) & 0xff; - mTxBuf[10 + (++cnt)] = (crc ) & 0xff; } + // crc control data + uint16_t crc = Ahoy::crc16(&mTxBuf[10], cnt+1); + mTxBuf[10 + (++cnt)] = (crc >> 8) & 0xff; + mTxBuf[10 + (++cnt)] = (crc ) & 0xff; + // crc over all cnt++; mTxBuf[10 + cnt] = Ahoy::crc8(mTxBuf, 10 + cnt);