mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-08 13:41:40 +02:00
further improvement
This commit is contained in:
parent
98ba3b8a68
commit
e4f100660b
1 changed files with 3 additions and 6 deletions
|
@ -11,7 +11,7 @@
|
||||||
#include "../config/config.h"
|
#include "../config/config.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#define HMS_TIMEOUT_MS 30000 // 30s * 1000
|
#define HMS_TIMEOUT_SEC 30 // 30s * 1000
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t txCmd;
|
uint8_t txCmd;
|
||||||
|
@ -141,13 +141,10 @@ class HmsPayload {
|
||||||
mPayload[iv->id].txCmd = cmd;
|
mPayload[iv->id].txCmd = cmd;
|
||||||
}*/
|
}*/
|
||||||
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
|
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
|
||||||
DPRINT(DBG_INFO, "LastRx: ");
|
if(((rec->ts + HMS_TIMEOUT_SEC) < *mTimestamp) && (mIvCmd56Cnt[iv->id] < 3)) {
|
||||||
DBGPRINTLN(String(rec->ts));
|
|
||||||
if(((rec->ts + HMS_TIMEOUT_MS) < *mTimestamp) && (mIvCmd56Cnt[iv->id] < 3)) {
|
|
||||||
//mRadio->switchFrequency(&iv->radioId.u64, 863000, WORK_FREQ_KHZ);
|
//mRadio->switchFrequency(&iv->radioId.u64, 863000, WORK_FREQ_KHZ);
|
||||||
mRadio->switchFrequency(&iv->radioId.u64, HOY_BOOT_FREQ_KHZ, WORK_FREQ_KHZ);
|
mRadio->switchFrequency(&iv->radioId.u64, HOY_BOOT_FREQ_KHZ, WORK_FREQ_KHZ);
|
||||||
mIvCmd56Cnt[iv->id]++;
|
mIvCmd56Cnt[iv->id]++;
|
||||||
//mLastRx = millis() - (HMS_TIMEOUT_MS / 6);
|
|
||||||
} else {
|
} else {
|
||||||
if(++mIvCmd56Cnt[iv->id] == 10)
|
if(++mIvCmd56Cnt[iv->id] == 10)
|
||||||
mIvCmd56Cnt[iv->id] = 0;
|
mIvCmd56Cnt[iv->id] = 0;
|
||||||
|
@ -161,7 +158,6 @@ class HmsPayload {
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(Inverter<> *iv, hmsPacket_t *p) {
|
void add(Inverter<> *iv, hmsPacket_t *p) {
|
||||||
//mLastRx = millis();
|
|
||||||
if (p->data[1] == (TX_REQ_INFO + ALL_FRAMES)) { // response from get information command
|
if (p->data[1] == (TX_REQ_INFO + ALL_FRAMES)) { // response from get information command
|
||||||
mPayload[iv->id].txId = p->data[1];
|
mPayload[iv->id].txId = p->data[1];
|
||||||
DPRINTLN(DBG_DEBUG, F("Response from info request received"));
|
DPRINTLN(DBG_DEBUG, F("Response from info request received"));
|
||||||
|
@ -343,6 +339,7 @@ class HmsPayload {
|
||||||
}
|
}
|
||||||
|
|
||||||
iv->setQueuedCmdFinished();
|
iv->setQueuedCmdFinished();
|
||||||
|
reset(iv->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
yield();
|
yield();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue