|
|
@ -178,11 +178,11 @@ class Communication : public CommQueue<> { |
|
|
|
yield(); |
|
|
|
} |
|
|
|
|
|
|
|
if(0 == q->attempts) { |
|
|
|
/*if(0 == q->attempts) {
|
|
|
|
DPRINT_IVID(DBG_INFO, q->iv->id); |
|
|
|
DBGPRINT(F("no attempts left")); |
|
|
|
closeRequest(q, false); |
|
|
|
} else { |
|
|
|
} else {*/ |
|
|
|
if(q->iv->ivGen != IV_MI) { |
|
|
|
mState = States::CHECK_PACKAGE; |
|
|
|
} else { |
|
|
@ -207,7 +207,7 @@ class Communication : public CommQueue<> { |
|
|
|
closeRequest(q, true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//}
|
|
|
|
|
|
|
|
} |
|
|
|
break; |
|
|
@ -235,6 +235,12 @@ class Communication : public CommQueue<> { |
|
|
|
} |
|
|
|
|
|
|
|
if(framnr) { |
|
|
|
if(0 == q->attempts) { |
|
|
|
DPRINT_IVID(DBG_INFO, q->iv->id); |
|
|
|
DBGPRINT(F("no attempts left")); |
|
|
|
closeRequest(q, false); |
|
|
|
return; |
|
|
|
} |
|
|
|
setAttempt(); |
|
|
|
|
|
|
|
if(*mSerialDebug) { |
|
|
@ -516,15 +522,15 @@ class Communication : public CommQueue<> { |
|
|
|
} |
|
|
|
|
|
|
|
void sendRetransmit(const queue_s *q, uint8_t i) { |
|
|
|
if(q->attempts) { |
|
|
|
//if(q->attempts) {
|
|
|
|
q->iv->radio->sendCmdPacket(q->iv, TX_REQ_INFO, (SINGLE_FRAME + i), true); |
|
|
|
q->iv->radioStatistics.retransmits++; |
|
|
|
mWaitTime.startTimeMonitor(SINGLEFR_TIMEOUT); // timeout
|
|
|
|
mState = States::WAIT; |
|
|
|
} else { |
|
|
|
/*} else {
|
|
|
|
//add(q, true);
|
|
|
|
closeRequest(q, false); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
} |
|
|
|
|
|
|
|
private: |
|
|
@ -604,6 +610,8 @@ class Communication : public CommQueue<> { |
|
|
|
rec->ts = q->ts; |
|
|
|
q->iv->setValue(1, rec, (uint32_t) ((p->packet[24] << 8) + p->packet[25])/1); |
|
|
|
q->iv->miMultiParts +=4; |
|
|
|
rec->mqttSentStatus = MqttSentStatus::NEW_DATA; |
|
|
|
|
|
|
|
} else if ( p->packet[9] == 0x01 || p->packet[9] == 0x10 ) {//second frame for MI, 3rd gen. answers in 0x10
|
|
|
|
DPRINT_IVID(DBG_INFO, q->iv->id); |
|
|
|
if ( p->packet[9] == 0x01 ) { |
|
|
@ -620,6 +628,7 @@ class Communication : public CommQueue<> { |
|
|
|
record_t<> *rec = q->iv->getRecordStruct(InverterDevInform_Simple); // choose the record structure
|
|
|
|
rec->ts = q->ts; |
|
|
|
q->iv->setValue(0, rec, (uint32_t) ((((p->packet[10] << 8) | p->packet[11]) << 8 | p->packet[12]) << 8 | p->packet[13])/1); |
|
|
|
rec->mqttSentStatus = MqttSentStatus::NEW_DATA; |
|
|
|
|
|
|
|
if(*mSerialDebug) { |
|
|
|
DPRINT(DBG_INFO,F("HW_FB_TLmValue ")); |
|
|
@ -667,6 +676,7 @@ class Communication : public CommQueue<> { |
|
|
|
inline void miGPFDecode(packet_t *p, const queue_s *q) { |
|
|
|
record_t<> *rec = q->iv->getRecordStruct(InverterDevInform_Simple); // choose the record structure
|
|
|
|
rec->ts = q->ts; |
|
|
|
rec->mqttSentStatus = MqttSentStatus::NEW_DATA; |
|
|
|
|
|
|
|
q->iv->setValue(2, rec, (uint32_t) (((p->packet[10] << 8) | p->packet[11]))); //FLD_GRID_PROFILE_CODE
|
|
|
|
q->iv->setValue(3, rec, (uint32_t) (((p->packet[12] << 8) | p->packet[13]))); //FLD_GRID_PROFILE_VERSION
|
|
|
@ -849,6 +859,8 @@ class Communication : public CommQueue<> { |
|
|
|
if (!stsok) { |
|
|
|
q->iv->setValue(q->iv->getPosByChFld(0, FLD_EVT, rec), rec, prntsts); |
|
|
|
q->iv->lastAlarm[0] = alarm_t(prntsts, q->ts, 0); |
|
|
|
rec->ts = q->ts; |
|
|
|
rec->mqttSentStatus = MqttSentStatus::NEW_DATA; |
|
|
|
} |
|
|
|
|
|
|
|
if (q->iv->alarmMesIndex < rec->record[q->iv->getPosByChFld(0, FLD_EVT, rec)]) { |
|
|
@ -907,17 +919,12 @@ class Communication : public CommQueue<> { |
|
|
|
iv->setValue(iv->getPosByChFld(0, FLD_PAC, rec), rec, (float) ac_pow/10); |
|
|
|
|
|
|
|
iv->doCalculations(); |
|
|
|
rec->mqttSentStatus = MqttSentStatus::NEW_DATA; |
|
|
|
// update status state-machine,
|
|
|
|
if (ac_pow) |
|
|
|
iv->isProducing(); |
|
|
|
//closeRequest(iv, iv->miMultiParts > 5);
|
|
|
|
|
|
|
|
//mHeu.setGotAll(iv);
|
|
|
|
//cmdDone(false);
|
|
|
|
if(NULL != mCbPayload) |
|
|
|
(mCbPayload)(RealTimeRunData_Debug, iv); |
|
|
|
|
|
|
|
//mState = States::RESET; // everything ok, next request
|
|
|
|
} |
|
|
|
|
|
|
|
private: |
|
|
|