From 5fc80f660a64f249d25d7dc8e4efd395ae5f2500 Mon Sep 17 00:00:00 2001 From: rejoe2 Date: Wed, 23 Aug 2023 18:28:44 +0200 Subject: [PATCH] Add files via upload --- src/hm/hmInverter.h | 2 +- src/hm/miPayload.h | 32 ++++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/hm/hmInverter.h b/src/hm/hmInverter.h index 75ab9ec4..dc6c9779 100644 --- a/src/hm/hmInverter.h +++ b/src/hm/hmInverter.h @@ -210,7 +210,7 @@ class Inverter { enqueCommand(InverterDevInform_Simple); // hardware version enqueCommand(RealTimeRunData_Debug); // live data } else if (ivGen == IV_MI){ - if (getFwVersion() == 0) + if (getFwVersion() == 0 || getHwVersion() == 0) enqueCommand(InverterDevInform_All); // firmware version; might not work, esp. for 1/2 ch hardware if (type == INV_TYPE_4CH) { enqueCommand(0x36); diff --git a/src/hm/miPayload.h b/src/hm/miPayload.h index efb6102b..a16cbe21 100644 --- a/src/hm/miPayload.h +++ b/src/hm/miPayload.h @@ -243,20 +243,26 @@ 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, (uint16_t) ((p->packet[24] << 8) + p->packet[25])/1); + iv->setValue(1, rec, (uint32_t) ((p->packet[24] << 8) + p->packet[25])); //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); if ( p->packet[9] == 0x01 ) { DBGPRINTLN(F("got 2nd frame (hw info)")); + /* according to xlsx (different start byte -1!) + byte[11] to byte[14] HW_PN + byte[15] byte[16] HW_FB_TLmValue + byte[17] byte[18] HW_FB_ReSPRT + byte[19] byte[20] HW_GridSamp_ResValule + byte[21] byte[22] HW_ECapValue + byte[23] to byte[26] Matching_APPFW_PN + */ + DPRINT(DBG_INFO,F("HW_PartNo ")); DBGPRINTLN(String((uint32_t) (((p->packet[10] << 8) | p->packet[11]) << 8 | p->packet[12]) << 8 | p->packet[13])); mPayload[iv->id].gotFragment = true; record_t<> *rec = iv->getRecordStruct(InverterDevInform_Simple); // choose the record structure rec->ts = mPayload[iv->id].ts; - /*for (uint8_t i = 0; i < 5; i++) { - iv->setValue(i, rec, (float) ((p->packet[(10+2*i)] << 8) + p->packet[(11+2*i)])/1); - }*/ iv->setValue(0, rec, (uint32_t) ((((p->packet[10] << 8) | p->packet[11]) << 8 | p->packet[12]) << 8 | p->packet[13])/1); if(mSerialDebug) { @@ -268,6 +274,8 @@ const byteAssign_t InfoAssignment[] = { DBGPRINTLN(String((p->packet[18] << 8) + p->packet[19])); DPRINT(DBG_INFO,F("HW_ECapValue ")); DBGPRINTLN(String((p->packet[20] << 8) + p->packet[21])); + 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])); } } else { DBGPRINTLN(F("3rd gen. inverter!")); // see table in OpenDTU code, DevInfoParser.cpp devInfo[] @@ -276,6 +284,22 @@ const byteAssign_t InfoAssignment[] = { } else if ( p->packet[9] == 0x12 ) {//3rd frame DPRINT_IVID(DBG_INFO, iv->id); DBGPRINTLN(F("got 3rd frame (hw info)")); + /* according to xlsx (different start byte -1!) + byte[11] byte[12] APPFW_MINVER + byte[13] byte[14] HWInfoAddr + byte[15] byte[16] PNInfoCRC_gusv + byte[15] byte[16] PNInfoCRC_gusv + */ + if(mSerialDebug) { + DPRINT(DBG_INFO,F("APPFW_MINVER ")); + DBGPRINTLN(String((p->packet[10] << 8) + p->packet[11])); + DPRINT(DBG_INFO,F("HWInfoAddr ")); + DBGPRINTLN(String((p->packet[12] << 8) + p->packet[13])); + DPRINT(DBG_INFO,F("PNInfoCRC_gusv ")); + DBGPRINTLN(String((p->packet[14] << 8) + p->packet[15])); + DPRINT(DBG_INFO,F("PNInfoCRC_gusv (pt. 2?) ")); + DBGPRINTLN(String((p->packet[16] << 8) + p->packet[17])); + } iv->setQueuedCmdFinished(); mPayload[iv->id].complete = true; mStat->rxSuccess++;