Browse Source

0.8.60

* merge PR: non blocking nRF loop #1371
pull/1376/head
lumapu 1 year ago
parent
commit
9601e900ac
  1. 3
      src/CHANGES.md
  2. 2
      src/defines.h
  3. 4
      src/hm/Communication.h
  4. 14
      src/hm/hmRadio.h
  5. 3
      src/hms/hmsRadio.h

3
src/CHANGES.md

@ -1,5 +1,8 @@
# Development Changes # Development Changes
## 0.8.60 - 2024-01-20
* merge PR: non blocking nRF loop #1371
## 0.8.59 - 2024-01-18 ## 0.8.59 - 2024-01-18
* merge PR: solve display settings dependencies #1369 * merge PR: solve display settings dependencies #1369
* fix language typos #1346 * fix language typos #1346

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 8 #define VERSION_MINOR 8
#define VERSION_PATCH 59 #define VERSION_PATCH 60
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

4
src/hm/Communication.h

@ -96,7 +96,7 @@ class Communication : public CommQueue<> {
case States::START: case States::START:
setTs(mTimestamp); setTs(mTimestamp);
if(q->iv->ivRadioType == INV_RADIO_TYPE_CMT) { if(INV_RADIO_TYPE_CMT == q->iv->ivRadioType) {
// frequency was changed during runtime // frequency was changed during runtime
if(q->iv->curCmtFreq != q->iv->config->frequency) { if(q->iv->curCmtFreq != q->iv->config->frequency) {
if(q->iv->radio->switchFrequencyCh(q->iv, q->iv->curCmtFreq, q->iv->config->frequency)) if(q->iv->radio->switchFrequencyCh(q->iv, q->iv->curCmtFreq, q->iv->config->frequency))
@ -284,7 +284,7 @@ class Communication : public CommQueue<> {
DBGPRINT(String(p->millis)); DBGPRINT(String(p->millis));
DBGPRINT(F("ms | ")); DBGPRINT(F("ms | "));
DBGPRINT(String(p->len)); DBGPRINT(String(p->len));
if(q->iv->ivRadioType == INV_RADIO_TYPE_NRF) { if(INV_RADIO_TYPE_NRF == q->iv->ivRadioType) {
DBGPRINT(F(" CH")); DBGPRINT(F(" CH"));
if(3 == p->ch) if(3 == p->ch)
DBGPRINT(F("0")); DBGPRINT(F("0"));

14
src/hm/hmRadio.h

@ -120,21 +120,23 @@ class HmRadio : public Radio {
yield(); yield();
if (millis() - mTimeslotStart < innerLoopTimeout) if ((millis() - mTimeslotStart) < innerLoopTimeout)
return; // nothing to do return; // nothing to do
// otherwise switch to next RX channel // otherwise switch to next RX channel
mTimeslotStart = millis(); mTimeslotStart = millis();
if(!mNRFloopChannels && (mTimeslotStart - mLastIrqTime > (DURATION_TXFRAME+DURATION_ONEFRAME))) if(!mNRFloopChannels && ((mTimeslotStart - mLastIrqTime) > (DURATION_TXFRAME+DURATION_ONEFRAME)))
mNRFloopChannels = true; mNRFloopChannels = true;
rxPendular = !rxPendular; rxPendular = !rxPendular;
//innerLoopTimeout = (rxPendular ? 1 : 2)*DURATION_LISTEN_MIN; //innerLoopTimeout = (rxPendular ? 1 : 2)*DURATION_LISTEN_MIN;
innerLoopTimeout = DURATION_LISTEN_MIN; innerLoopTimeout = DURATION_LISTEN_MIN;
tempRxChIdx = mNRFloopChannels ? if(mNRFloopChannels)
(tempRxChIdx + 4) % RF_CHANNELS : tempRxChIdx = (tempRxChIdx + 4) % RF_CHANNELS
(mRxChIdx + rxPendular*4) % RF_CHANNELS; else
tempRxChIdx = (mRxChIdx + rxPendular*4) % RF_CHANNELS;
mNrf24->setChannel(mRfChLst[tempRxChIdx]); mNrf24->setChannel(mRfChLst[tempRxChIdx]);
isRxInit = false; isRxInit = false;
@ -172,7 +174,6 @@ class HmRadio : public Radio {
} }
if(rx_ready) { if(rx_ready) {
if (getReceived()) { // check what we got, returns true for last package if (getReceived()) { // check what we got, returns true for last package
mNRFisInRX = false; mNRFisInRX = false;
mRadioWaitTime.startTimeMonitor(DURATION_PAUSE_LASTFR); // let the inverter first end his transmissions mRadioWaitTime.startTimeMonitor(DURATION_PAUSE_LASTFR); // let the inverter first end his transmissions
@ -188,7 +189,6 @@ class HmRadio : public Radio {
mNrf24->setChannel(mRfChLst[tempRxChIdx]); mNrf24->setChannel(mRfChLst[tempRxChIdx]);
} else } else
mRxChIdx = tempRxChIdx; mRxChIdx = tempRxChIdx;
} }
} }
return; return;

3
src/hms/hmsRadio.h

@ -163,9 +163,6 @@ class CmtRadio : public Radio {
uint8_t status = mCmt.getRx(p.packet, &p.len, 28, &p.rssi); uint8_t status = mCmt.getRx(p.packet, &p.len, 28, &p.rssi);
if(CMT_SUCCESS == status) if(CMT_SUCCESS == status)
mBufCtrl.push(p); mBufCtrl.push(p);
//if(p.packet[9] > ALL_FRAMES) // indicates last frame
// mRadioWaitTime.stopTimeMonitor(); // we got everything we expected and can exit rx mode...
//optionally instead: mRadioWaitTime.startTimeMonitor(DURATION_PAUSE_LASTFR); // let the inverter first get back to rx mode?
} }
CmtType mCmt; CmtType mCmt;

Loading…
Cancel
Save