From f9857b52ab41f47c4418eac4519685f53f81fed1 Mon Sep 17 00:00:00 2001 From: rejoe2 Date: Thu, 24 Aug 2023 10:10:47 +0200 Subject: [PATCH] MI - assure HW part no is there --- src/hm/hmInverter.h | 9 +++++++-- src/hm/miPayload.h | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/hm/hmInverter.h b/src/hm/hmInverter.h index dc6c9779..d00e9e5d 100644 --- a/src/hm/hmInverter.h +++ b/src/hm/hmInverter.h @@ -210,8 +210,13 @@ class Inverter { enqueCommand(InverterDevInform_Simple); // hardware version enqueCommand(RealTimeRunData_Debug); // live data } else if (ivGen == IV_MI){ - if (getFwVersion() == 0 || getHwVersion() == 0) - enqueCommand(InverterDevInform_All); // firmware version; might not work, esp. for 1/2 ch hardware + if (getFwVersion() == 0) { + enqueCommand(InverterDevInform_All); // hard- and firmware version + } else { + record_t<> *rec = getRecordStruct(InverterDevInform_Simple); + if (getChannelFieldValue(CH0, FLD_PART_NUM, rec) == 0) + enqueCommand(InverterDevInform_All); // hard- and firmware version for missing HW part nr, delivered by frame 1 + } if (type == INV_TYPE_4CH) { enqueCommand(0x36); } else { diff --git a/src/hm/miPayload.h b/src/hm/miPayload.h index a16cbe21..c96e9896 100644 --- a/src/hm/miPayload.h +++ b/src/hm/miPayload.h @@ -243,7 +243,8 @@ const byteAssign_t InfoAssignment[] = { } record_t<> *rec = iv->getRecordStruct(InverterDevInform_Simple); // choose the record structure rec->ts = mPayload[iv->id].ts; - iv->setValue(1, rec, (uint32_t) ((p->packet[24] << 8) + p->packet[25])); + iv->setValue(1, rec, (uint32_t) ((p->packet[24] << 8) + p->packet[25])/1); + notify(InverterDevInform_All, iv); //28737 } else if ( p->packet[9] == 0x01 || p->packet[9] == 0x10 ) {//second frame for MI, 3rd gen. answers in 0x10 DPRINT_IVID(DBG_INFO, iv->id); @@ -277,6 +278,7 @@ const byteAssign_t InfoAssignment[] = { DPRINT(DBG_INFO,F("Matching_APPFW_PN ")); DBGPRINTLN(String((uint32_t) (((p->packet[22] << 8) | p->packet[23]) << 8 | p->packet[24]) << 8 | p->packet[25])); } + notify(InverterDevInform_Simple, iv); } else { DBGPRINTLN(F("3rd gen. inverter!")); // see table in OpenDTU code, DevInfoParser.cpp devInfo[] }