mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-10 15:36:38 +02:00
MI - add grid profile request
Note: this doesn't deliver entire grid profile infos...
This commit is contained in:
parent
1b73e493a9
commit
2571e3c9f9
2 changed files with 32 additions and 15 deletions
|
@ -353,6 +353,12 @@ class Communication : public CommQueue<> {
|
||||||
miDataDecode(p, q);
|
miDataDecode(p, q);
|
||||||
} else if (p->packet[0] == (0x0f + ALL_FRAMES))
|
} else if (p->packet[0] == (0x0f + ALL_FRAMES))
|
||||||
miHwDecode(p, q);
|
miHwDecode(p, q);
|
||||||
|
|
||||||
|
else if (p->packet[0] == ( 0x10 + ALL_FRAMES)) {
|
||||||
|
// MI response from get Grid Profile information request
|
||||||
|
miGPFDecode(p, q);
|
||||||
|
}
|
||||||
|
|
||||||
else if ((p->packet[0] == 0x88) || (p->packet[0] == 0x92)) {
|
else if ((p->packet[0] == 0x88) || (p->packet[0] == 0x92)) {
|
||||||
record_t<> *rec = q->iv->getRecordStruct(RealTimeRunData_Debug); // choose the record structure
|
record_t<> *rec = q->iv->getRecordStruct(RealTimeRunData_Debug); // choose the record structure
|
||||||
rec->ts = q->ts;
|
rec->ts = q->ts;
|
||||||
|
@ -650,22 +656,31 @@ class Communication : public CommQueue<> {
|
||||||
(mCbPayload)(InverterDevInform_Simple, q->iv);
|
(mCbPayload)(InverterDevInform_Simple, q->iv);
|
||||||
q->iv->miMultiParts++;
|
q->iv->miMultiParts++;
|
||||||
}
|
}
|
||||||
//if(q->iv->miMultiParts > 5)
|
}
|
||||||
//closeRequest(q->iv, true);
|
|
||||||
//else
|
|
||||||
//if(q->iv->miMultiParts < 6)
|
|
||||||
// mState = States::WAIT;
|
|
||||||
|
|
||||||
/*if (mPayload[iv->id].multi_parts > 5) {
|
inline void miGPFDecode(packet_t *p, const queue_s *q) {
|
||||||
iv->setQueuedCmdFinished();
|
record_t<> *rec = q->iv->getRecordStruct(InverterDevInform_Simple); // choose the record structure
|
||||||
mPayload[iv->id].complete = true;
|
rec->ts = q->ts;
|
||||||
mPayload[iv->id].rxTmo = true;
|
|
||||||
mPayload[iv->id].requested= false;
|
q->iv->setValue(2, rec, (uint32_t) (((p->packet[10] << 8) | p->packet[11]))); //FLD_GRID_PROFILE_CODE
|
||||||
iv->radioStatistics.rxSuccess++;
|
q->iv->setValue(3, rec, (uint32_t) (((p->packet[12] << 8) | p->packet[13]))); //FLD_GRID_PROFILE_VERSION
|
||||||
}
|
|
||||||
if (mHighPrioIv == NULL)
|
/* according to xlsx (different start byte -1!)
|
||||||
mHighPrioIv = iv;
|
Polling Grid-connected Protection Parameter File Command - Receipt
|
||||||
*/
|
byte[10] ST1 indicates the status of the grid-connected protection file. ST1=1 indicates the default grid-connected protection file, ST=2 indicates that the grid-connected protection file is configured and normal, ST=3 indicates that the grid-connected protection file cannot be recognized, ST=4 indicates that the grid-connected protection file is damaged
|
||||||
|
byte[11] byte[12] CountryStd variable indicates the national standard code of the grid-connected protection file
|
||||||
|
byte[13] byte[14] Version indicates the version of the grid-connected protection file
|
||||||
|
byte[15] byte[16]
|
||||||
|
*/
|
||||||
|
/*if(mSerialDebug) {
|
||||||
|
DPRINT(DBG_INFO,F("ST1 "));
|
||||||
|
DBGPRINTLN(String(p->packet[9]));
|
||||||
|
DPRINT(DBG_INFO,F("CountryStd "));
|
||||||
|
DBGPRINTLN(String((p->packet[10] << 8) + p->packet[11]));
|
||||||
|
DPRINT(DBG_INFO,F("Version "));
|
||||||
|
DBGPRINTLN(String((p->packet[12] << 8) + p->packet[13]));
|
||||||
|
}*/
|
||||||
|
q->iv->miMultiParts = 7; // indicate we are ready
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void miDataDecode(packet_t *p, const queue_s *q) {
|
inline void miDataDecode(packet_t *p, const queue_s *q) {
|
||||||
|
|
|
@ -215,6 +215,8 @@ class Inverter {
|
||||||
record_t<> *rec = getRecordStruct(InverterDevInform_Simple);
|
record_t<> *rec = getRecordStruct(InverterDevInform_Simple);
|
||||||
if (getChannelFieldValue(CH0, FLD_PART_NUM, rec) == 0)
|
if (getChannelFieldValue(CH0, FLD_PART_NUM, rec) == 0)
|
||||||
cb(0x0f, false); // hard- and firmware version for missing HW part nr, delivered by frame 1
|
cb(0x0f, false); // hard- and firmware version for missing HW part nr, delivered by frame 1
|
||||||
|
else if((getChannelFieldValue(CH0, FLD_GRID_PROFILE_CODE, rec) == 0) && generalConfig->readGrid) // read grid profile
|
||||||
|
cb(0x10, false); // legacy GPF command
|
||||||
else
|
else
|
||||||
cb(((type == INV_TYPE_4CH) ? MI_REQ_4CH : MI_REQ_CH1), false);
|
cb(((type == INV_TYPE_4CH) ? MI_REQ_4CH : MI_REQ_CH1), false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue