mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-12 23:51:39 +02:00
parent
16d0eb2048
commit
d31f39286e
5 changed files with 28 additions and 24 deletions
|
@ -1,5 +1,8 @@
|
|||
# Development Changes
|
||||
|
||||
## 0.8.27 - 2023-12-18
|
||||
* fix set power limit #1276
|
||||
|
||||
## 0.8.26 - 2023-12-17
|
||||
* read grid profile as HEX (`live` -> click inverter name -> `show grid profile`)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//-------------------------------------
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 8
|
||||
#define VERSION_PATCH 26
|
||||
#define VERSION_PATCH 27
|
||||
|
||||
//-------------------------------------
|
||||
typedef struct {
|
||||
|
|
|
@ -16,22 +16,22 @@ class CommQueue {
|
|||
public:
|
||||
CommQueue() {}
|
||||
|
||||
void addImportant(Inverter<> *iv, uint8_t cmd, bool delOnPop = true) {
|
||||
void addImportant(Inverter<> *iv, uint8_t cmd) {
|
||||
dec(&mRdPtr);
|
||||
mQueue[mRdPtr] = queue_s(iv, cmd, delOnPop, true);
|
||||
mQueue[mRdPtr] = queue_s(iv, cmd, true);
|
||||
}
|
||||
|
||||
void add(Inverter<> *iv, uint8_t cmd, bool delOnPop = true) {
|
||||
mQueue[mWrPtr] = queue_s(iv, cmd, delOnPop, false);
|
||||
void add(Inverter<> *iv, uint8_t cmd) {
|
||||
mQueue[mWrPtr] = queue_s(iv, cmd, false);
|
||||
inc(&mWrPtr);
|
||||
}
|
||||
|
||||
void chgCmd(Inverter<> *iv, uint8_t cmd, bool delOnPop = true) {
|
||||
mQueue[mWrPtr] = queue_s(iv, cmd, delOnPop, false);
|
||||
void chgCmd(Inverter<> *iv, uint8_t cmd) {
|
||||
mQueue[mWrPtr] = queue_s(iv, cmd, false);
|
||||
}
|
||||
|
||||
uint8_t getFillState(void) {
|
||||
DPRINTLN(DBG_INFO, "wr: " + String(mWrPtr) + ", rd: " + String(mRdPtr));
|
||||
//DPRINTLN(DBG_INFO, "wr: " + String(mWrPtr) + ", rd: " + String(mRdPtr));
|
||||
return abs(mRdPtr - mWrPtr);
|
||||
}
|
||||
|
||||
|
@ -45,11 +45,10 @@ class CommQueue {
|
|||
uint8_t cmd;
|
||||
uint8_t attempts;
|
||||
uint32_t ts;
|
||||
bool delOnPop;
|
||||
bool isDevControl;
|
||||
queue_s() {}
|
||||
queue_s(Inverter<> *i, uint8_t c, bool d, bool dev) :
|
||||
iv(i), cmd(c), attempts(5), ts(0), delOnPop(d), isDevControl(dev) {}
|
||||
queue_s(Inverter<> *i, uint8_t c, bool dev) :
|
||||
iv(i), cmd(c), attempts(5), ts(0), isDevControl(dev) {}
|
||||
};
|
||||
|
||||
protected:
|
||||
|
@ -78,8 +77,8 @@ class CommQueue {
|
|||
cb(true, &mQueue[mRdPtr]);
|
||||
}
|
||||
|
||||
void cmdDone(bool force = false) {
|
||||
if(!mQueue[mRdPtr].delOnPop && !force) {
|
||||
void cmdDone(bool keep = false) {
|
||||
if(keep) {
|
||||
mQueue[mRdPtr].attempts = 5;
|
||||
add(mQueue[mRdPtr]); // add to the end again
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ class Communication : public CommQueue<> {
|
|||
mInverterGap = inverterGap;
|
||||
}
|
||||
|
||||
void addImportant(Inverter<> *iv, uint8_t cmd, bool delOnPop = true) {
|
||||
void addImportant(Inverter<> *iv, uint8_t cmd) {
|
||||
mState = States::RESET; // cancel current operation
|
||||
CommQueue::addImportant(iv, cmd, delOnPop);
|
||||
CommQueue::addImportant(iv, cmd);
|
||||
}
|
||||
|
||||
void addPayloadListener(payloadListenerType cb) {
|
||||
|
@ -84,7 +84,7 @@ class Communication : public CommQueue<> {
|
|||
q->iv->curFrmCnt = 0;
|
||||
mIsRetransmit = false;
|
||||
if(NULL == q->iv->radio)
|
||||
cmdDone(true); // can't communicate while radio is not defined!
|
||||
cmdDone(false); // can't communicate while radio is not defined!
|
||||
mState = States::START;
|
||||
break;
|
||||
|
||||
|
@ -177,6 +177,7 @@ class Communication : public CommQueue<> {
|
|||
closeRequest(q, true);
|
||||
else
|
||||
closeRequest(q, false);
|
||||
q->iv->radio->mBufCtrl.pop();
|
||||
return; // don't wait for empty buffer
|
||||
} else if(IV_MI == q->iv->ivGen) {
|
||||
if(parseMiFrame(p, q))
|
||||
|
@ -399,8 +400,6 @@ class Communication : public CommQueue<> {
|
|||
DBGPRINT(F("CRC Error "));
|
||||
if(q->attempts == 0) {
|
||||
DBGPRINTLN(F("-> Fail"));
|
||||
/*q->iv->radioStatistics.rxFail++; // got fragments but not complete response
|
||||
cmdDone();*/
|
||||
closeRequest(q, false);
|
||||
|
||||
} else
|
||||
|
@ -502,12 +501,15 @@ class Communication : public CommQueue<> {
|
|||
q->iv->radioStatistics.rxSuccess++;
|
||||
else if(q->iv->mGotFragment)
|
||||
q->iv->radioStatistics.rxFail++; // got no complete payload
|
||||
else {
|
||||
else
|
||||
q->iv->radioStatistics.rxFailNoAnser++; // got nothing
|
||||
}
|
||||
mWaitTimeout = millis() + *mInverterGap;
|
||||
|
||||
cmdDone(q->delOnPop);
|
||||
bool keep = false;
|
||||
if(q->isDevControl)
|
||||
keep = !crcPass;
|
||||
|
||||
cmdDone(keep);
|
||||
q->iv->mGotFragment = false;
|
||||
q->iv->mGotLastMsg = false;
|
||||
q->iv->miMultiParts = 0;
|
||||
|
@ -836,7 +838,7 @@ class Communication : public CommQueue<> {
|
|||
//closeRequest(iv, iv->miMultiParts > 5);
|
||||
|
||||
//mHeu.setGotAll(iv);
|
||||
//cmdDone(true);
|
||||
//cmdDone(false);
|
||||
if(NULL != mCbPayload)
|
||||
(mCbPayload)(RealTimeRunData_Debug, iv);
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ class HmRadio : public Radio {
|
|||
startMicros = micros();
|
||||
}
|
||||
// not finished but time is over
|
||||
mRxChIdx = 1;
|
||||
mRxChIdx = (mRxChIdx + 1) % RF_CHANNELS;
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue