Skip to content

Commit

Permalink
0.8.27
Browse files Browse the repository at this point in the history
* fix set power limit #1276
  • Loading branch information
lumapu committed Dec 18, 2023
1 parent 16d0eb2 commit d31f392
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 24 deletions.
3 changes: 3 additions & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
@@ -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`)

Expand Down
2 changes: 1 addition & 1 deletion src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 8
#define VERSION_PATCH 26
#define VERSION_PATCH 27

//-------------------------------------
typedef struct {
Expand Down
23 changes: 11 additions & 12 deletions src/hm/CommQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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:
Expand Down Expand Up @@ -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
}
Expand Down
22 changes: 12 additions & 10 deletions src/hm/Communication.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -502,16 +501,19 @@ 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;
mIsRetransmit = false;
mIsRetransmit = false;
mFirstTry = false; // for correct reset
mState = States::RESET;
DBGPRINTLN(F("-----"));
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/hm/hmRadio.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class HmRadio : public Radio {
startMicros = micros();
}
// not finished but time is over
mRxChIdx = 1;
mRxChIdx = (mRxChIdx + 1) % RF_CHANNELS;

return;
}
Expand Down

0 comments on commit d31f392

Please sign in to comment.