mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-10 23:46:37 +02:00
added receive no answer counter #332
corrected resetPayload in app loop
This commit is contained in:
parent
67f99abdfc
commit
7cd075fbad
4 changed files with 23 additions and 15 deletions
|
@ -226,25 +226,29 @@ void app::loop(void) {
|
|||
mSendLastIvId = ((MAX_NUM_INVERTERS-1) == mSendLastIvId) ? 0 : mSendLastIvId + 1;
|
||||
iv = mSys->getInverterByPos(mSendLastIvId);
|
||||
} while((NULL == iv) && ((maxLoop--) > 0));
|
||||
resetPayload(iv);
|
||||
mPayload[iv->id].requested = true;
|
||||
|
||||
if(NULL != iv) {
|
||||
if(!mPayload[iv->id].complete)
|
||||
processPayload(false);
|
||||
|
||||
if(!mPayload[iv->id].complete) {
|
||||
if(0 == mPayload[iv->id].maxPackId)
|
||||
mStat.rxFailNoAnser++;
|
||||
else
|
||||
mStat.rxFail++;
|
||||
|
||||
iv->setQueuedCmdFinished(); // command failed
|
||||
if(mConfig.serialDebug) {
|
||||
if(mConfig.serialDebug)
|
||||
DPRINTLN(DBG_INFO, F("enqueued cmd failed/timeout"));
|
||||
}
|
||||
if(mConfig.serialDebug) {
|
||||
DPRINT(DBG_INFO, F("Inverter #") + String(iv->id) + " ");
|
||||
DPRINTLN(DBG_INFO, F("no Payload received! (retransmits: ") + String(mPayload[iv->id].retransmits) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
resetPayload(iv);
|
||||
mPayload[iv->id].requested = true;
|
||||
|
||||
yield();
|
||||
if(mConfig.serialDebug) {
|
||||
DPRINTLN(DBG_DEBUG, F("app:loop WiFi WiFi.status ") + String(WiFi.status()));
|
||||
|
@ -257,7 +261,8 @@ void app::loop(void) {
|
|||
mPayload[iv->id].txCmd = iv->devControlCmd;
|
||||
iv->clearCmdQueue();
|
||||
iv->enqueCommand<InfoCommand>(SystemConfigPara);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
uint8_t cmd = iv->getQueuedCmd();
|
||||
mSys->Radio.sendTimePacket(iv->radioId.u64, cmd, mPayload[iv->id].ts, iv->alarmMesIndex);
|
||||
mPayload[iv->id].txCmd = cmd;
|
||||
|
@ -316,11 +321,12 @@ void app::processPayload(bool retransmit) {
|
|||
for(uint8_t id = 0; id < mSys->getNumInverters(); id++) {
|
||||
Inverter<> *iv = mSys->getInverterByPos(id);
|
||||
if(NULL != iv) {
|
||||
if(mPayload[iv->id].txId != (TX_REQ_INFO + 0x80)) {
|
||||
if((mPayload[iv->id].txId != (TX_REQ_INFO + 0x80)) && (0 != mPayload[iv->id].txId)) {
|
||||
// no processing needed if txId is not 0x95
|
||||
DPRINTLN(DBG_DEBUG, F("processPayload - set complete"));
|
||||
//DPRINTLN(DBG_INFO, F("processPayload - set complete, txId: ") + String(mPayload[iv->id].txId, HEX));
|
||||
mPayload[iv->id].complete = true;
|
||||
}
|
||||
|
||||
if(!mPayload[iv->id].complete ) {
|
||||
if(!buildPayload(iv->id)) { // payload not complete
|
||||
if(mPayload[iv->id].requested) {
|
||||
|
@ -365,6 +371,7 @@ void app::processPayload(bool retransmit) {
|
|||
DPRINTLN(DBG_DEBUG, F("procPyld: max: ") + String(mPayload[iv->id].maxPackId));
|
||||
record_t<> *rec = iv->getRecordStruct(mPayload[iv->id].txCmd); // choose the parser
|
||||
mPayload[iv->id].complete = true;
|
||||
if(mPayload[iv->id].txId == (TX_REQ_INFO + 0x80))
|
||||
mStat.rxSuccess++;
|
||||
|
||||
uint8_t payload[128];
|
||||
|
@ -466,8 +473,6 @@ void app::processPayload(bool retransmit) {
|
|||
|
||||
iv->setQueuedCmdFinished();
|
||||
|
||||
//resetPayload(iv);
|
||||
|
||||
#ifdef __MQTT_AFTER_RX__
|
||||
doMQTT = true;
|
||||
#endif
|
||||
|
|
|
@ -142,6 +142,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
uint32_t rxFail;
|
||||
uint32_t rxFailNoAnser;
|
||||
uint32_t rxSuccess;
|
||||
uint32_t frmCnt;
|
||||
} statistics_t;
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
function parseStat(obj) {
|
||||
document.getElementById("stat").innerHTML = "RX success: " + obj["rx_success"]
|
||||
+ "\nRX fail: " + obj["rx_fail"]
|
||||
+ "\nRX no anwser: " + obj["rx_fail_answer"]
|
||||
+ "\nFrames received: " + obj["frame_cnt"]
|
||||
+ "\nTX Cnt: " + obj["tx_cnt"];
|
||||
}
|
||||
|
|
|
@ -131,6 +131,7 @@ void webApi::getSystem(JsonObject obj) {
|
|||
void webApi::getStatistics(JsonObject obj) {
|
||||
obj[F("rx_success")] = mStat->rxSuccess;
|
||||
obj[F("rx_fail")] = mStat->rxFail;
|
||||
obj[F("rx_fail_answer")] = mStat->rxFailNoAnser;
|
||||
obj[F("frame_cnt")] = mStat->frmCnt;
|
||||
obj[F("tx_cnt")] = mApp->mSys->Radio.mSendCnt;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue