Browse Source

0.8.65 - 2024-01-24

* removed patch for NRF `PLOS`
* fix lang issues #1388
* fix build on Windows of `opendtufusion` environments (git: trailing whitespaces)
pull/1394/head^2
lumapu 1 year ago
parent
commit
97d74d3090
  1. 35
      patches/RF24.patch
  2. 6
      scripts/applyPatches.py
  3. 5
      src/CHANGES.md
  4. 2
      src/defines.h
  5. 6
      src/hm/CommQueue.h
  6. 14
      src/hm/Communication.h
  7. 27
      src/hm/hmRadio.h
  8. 10
      src/hm/radio.h
  9. 9
      src/hms/hmsRadio.h
  10. 4
      src/web/lang.json

35
patches/RF24.patch

@ -1,35 +0,0 @@
diff --git a/RF24.cpp b/RF24.cpp
index 9e5b4a8..a4de63c 100644
--- a/RF24.cpp
+++ b/RF24.cpp
@@ -1871,6 +1871,11 @@ uint8_t RF24::getARC(void)
return read_register(OBSERVE_TX) & 0x0F;
}
+uint8_t RF24::getPLOS(void)
+{
+ return read_register(OBSERVE_TX) & 0x0F;
+}
+
/****************************************************************************/
bool RF24::setDataRate(rf24_datarate_e speed)
diff --git a/RF24.h b/RF24.h
index dbd32ae..a3d6b52 100644
--- a/RF24.h
+++ b/RF24.h
@@ -1644,6 +1644,7 @@ public:
* @return Returns values from 0 to 15.
*/
uint8_t getARC(void);
+ uint8_t getPLOS(void);
/**
* Set the transmission @ref Datarate
@@ -2415,4 +2416,4 @@ private:
* Use `ctrl+c` to quit at any time.
*/
-#endif // __RF24_H__
\ No newline at end of file
+#endif // __RF24_H__

6
scripts/applyPatches.py

@ -12,11 +12,11 @@ def applyPatch(libName, patchFile):
os.chdir('.pio/libdeps/' + env['PIOENV'] + '/' + libName) os.chdir('.pio/libdeps/' + env['PIOENV'] + '/' + libName)
process = subprocess.run(['git', 'apply', '--reverse', '--check', '../../../../' + patchFile], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) process = subprocess.run(['git', 'apply', '--ignore-whitespace', '--reverse', '--check', '../../../../' + patchFile], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if (process.returncode == 0): if (process.returncode == 0):
print('\'' + patchFile + '\' already applied') print('\'' + patchFile + '\' already applied')
else: else:
process = subprocess.run(['git', 'apply', '../../../../' + patchFile]) process = subprocess.run(['git', 'apply', '--ignore-whitespace', '../../../../' + patchFile])
if (process.returncode == 0): if (process.returncode == 0):
print('\'' + patchFile + '\' applied') print('\'' + patchFile + '\' applied')
else: else:
@ -32,5 +32,3 @@ if env['PIOENV'][:22] != "opendtufusion-ethernet":
if env['PIOENV'][:13] == "opendtufusion": if env['PIOENV'][:13] == "opendtufusion":
applyPatch("GxEPD2", "../patches/GxEPD2_SW_SPI.patch") applyPatch("GxEPD2", "../patches/GxEPD2_SW_SPI.patch")
applyPatch("RF24", "../patches/RF24_Hal.patch") applyPatch("RF24", "../patches/RF24_Hal.patch")
else:
applyPatch("RF24", "../patches/RF24.patch")

5
src/CHANGES.md

@ -1,5 +1,10 @@
# Development Changes # Development Changes
## 0.8.65 - 2024-01-24
* removed patch for NRF `PLOS`
* fix lang issues #1388
* fix build on Windows of `opendtufusion` environments (git: trailing whitespaces)
## 0.8.64 - 2024-01-22 ## 0.8.64 - 2024-01-22
* add `ARC` to log (NRF24 Debug) * add `ARC` to log (NRF24 Debug)
* merge PR: ETH NTP update bugfix #1385 * merge PR: ETH NTP update bugfix #1385

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 64 #define VERSION_PATCH 65
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

6
src/hm/CommQueue.h

@ -18,8 +18,6 @@
template <uint8_t N=100> template <uint8_t N=100>
class CommQueue { class CommQueue {
public: public:
CommQueue() {}
void addImportant(Inverter<> *iv, uint8_t cmd) { void addImportant(Inverter<> *iv, uint8_t cmd) {
dec(&mRdPtr); dec(&mRdPtr);
mQueue[mRdPtr] = queue_s(iv, cmd, true); mQueue[mRdPtr] = queue_s(iv, cmd, true);
@ -34,12 +32,12 @@ class CommQueue {
mQueue[mWrPtr] = queue_s(iv, cmd, false); mQueue[mWrPtr] = queue_s(iv, cmd, false);
} }
uint8_t getFillState(void) { uint8_t getFillState(void) const {
//DPRINTLN(DBG_INFO, "wr: " + String(mWrPtr) + ", rd: " + String(mRdPtr)); //DPRINTLN(DBG_INFO, "wr: " + String(mWrPtr) + ", rd: " + String(mRdPtr));
return abs(mRdPtr - mWrPtr); return abs(mRdPtr - mWrPtr);
} }
uint8_t getMaxFill(void) { uint8_t getMaxFill(void) const {
return N; return N;
} }

14
src/hm/Communication.h

@ -134,14 +134,7 @@ class Communication : public CommQueue<> {
DPRINT_IVID(DBG_INFO, q->iv->id); DPRINT_IVID(DBG_INFO, q->iv->id);
DBGPRINT(F("request timeout: ")); DBGPRINT(F("request timeout: "));
DBGPRINT(String(q->iv->radio->mRadioWaitTime.getRunTime())); DBGPRINT(String(q->iv->radio->mRadioWaitTime.getRunTime()));
DBGPRINT(F("ms")); DBGPRINTLN(F("ms"));
if(INV_RADIO_TYPE_NRF == q->iv->ivRadioType) {
DBGPRINT(F(", ARC "));
DBGPRINT(String(q->iv->radio->getARC()));
DBGPRINT(F(", PLOS "));
DBGPRINTLN(String(q->iv->radio->getPLOS()));
} else
DBGPRINTLN("");
} }
if(!q->iv->mGotFragment) { if(!q->iv->mGotFragment) {
if(INV_RADIO_TYPE_CMT == q->iv->ivRadioType) { if(INV_RADIO_TYPE_CMT == q->iv->ivRadioType) {
@ -291,11 +284,6 @@ 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));
DBGPRINT(F(", ARC "));
DBGPRINT(String(p->arc));
DBGPRINT(F(", PLOS "));
DBGPRINT(String(p->plos));
DBGPRINT(F(" |"));
if(INV_RADIO_TYPE_NRF == q->iv->ivRadioType) { if(INV_RADIO_TYPE_NRF == q->iv->ivRadioType) {
DBGPRINT(F(" CH")); DBGPRINT(F(" CH"));
if(3 == p->ch) if(3 == p->ch)

27
src/hm/hmRadio.h

@ -15,7 +15,6 @@
#endif #endif
#define SPI_SPEED 1000000 #define SPI_SPEED 1000000
#define RF_CHANNELS 5 #define RF_CHANNELS 5
const char* const rf24AmpPowerNames[] = {"MIN", "LOW", "HIGH", "MAX"}; const char* const rf24AmpPowerNames[] = {"MIN", "LOW", "HIGH", "MAX"};
@ -183,17 +182,13 @@ class HmRadio : public Radio {
} }
} }
return mNRFisInRX; return mNRFisInRX;
} /*else if(tx_fail) { }
mNRFisInRX = false;
return false;
}*/
} }
return false; return false;
} }
bool isChipConnected(void) { bool isChipConnected(void) const {
//DPRINTLN(DBG_VERBOSE, F("hmRadio.h:isChipConnected"));
return mNrf24->isChipConnected(); return mNrf24->isChipConnected();
} }
@ -283,24 +278,16 @@ class HmRadio : public Radio {
sendPacket(iv, cnt, isRetransmit, (IV_MI != iv->ivGen)); sendPacket(iv, cnt, isRetransmit, (IV_MI != iv->ivGen));
} }
uint8_t getDataRate(void) { uint8_t getDataRate(void) const {
if(!mNrf24->isChipConnected()) if(!mNrf24->isChipConnected())
return 3; // unknown return 3; // unknown
return mNrf24->getDataRate(); return mNrf24->getDataRate();
} }
bool isPVariant(void) { bool isPVariant(void) const {
return mNrf24->isPVariant(); return mNrf24->isPVariant();
} }
uint8_t getARC(void) {
return mNrf24->getARC();
}
uint8_t getPLOS(void) {
return mNrf24->getPLOS();
}
private: private:
inline bool getReceived(void) { inline bool getReceived(void) {
bool isLastPackage = false; bool isLastPackage = false;
@ -315,8 +302,6 @@ class HmRadio : public Radio {
p.len = (len > MAX_RF_PAYLOAD_SIZE) ? MAX_RF_PAYLOAD_SIZE : len; p.len = (len > MAX_RF_PAYLOAD_SIZE) ? MAX_RF_PAYLOAD_SIZE : len;
p.rssi = mNrf24->testRPD() ? -64 : -75; p.rssi = mNrf24->testRPD() ? -64 : -75;
p.millis = millis() - mMillis; p.millis = millis() - mMillis;
p.arc = mNrf24->getARC();
p.plos = mNrf24->getPLOS();
mNrf24->read(p.packet, p.len); mNrf24->read(p.packet, p.len);
if (p.packet[0] != 0x00) { if (p.packet[0] != 0x00) {
@ -393,11 +378,11 @@ class HmRadio : public Radio {
mNRFisInRX = false; mNRFisInRX = false;
} }
uint64_t getIvId(Inverter<> *iv) { uint64_t getIvId(Inverter<> *iv) const {
return iv->radioId.u64; return iv->radioId.u64;
} }
uint8_t getIvGen(Inverter<> *iv) { uint8_t getIvGen(Inverter<> *iv) const {
return iv->ivGen; return iv->ivGen;
} }

10
src/hm/radio.h

@ -27,10 +27,8 @@ class Radio {
virtual void sendControlPacket(Inverter<> *iv, uint8_t cmd, uint16_t *data, bool isRetransmit) = 0; virtual void sendControlPacket(Inverter<> *iv, uint8_t cmd, uint16_t *data, bool isRetransmit) = 0;
virtual bool switchFrequency(Inverter<> *iv, uint32_t fromkHz, uint32_t tokHz) { return true; } virtual bool switchFrequency(Inverter<> *iv, uint32_t fromkHz, uint32_t tokHz) { return true; }
virtual bool switchFrequencyCh(Inverter<> *iv, uint8_t fromCh, uint8_t toCh) { return true; } virtual bool switchFrequencyCh(Inverter<> *iv, uint8_t fromCh, uint8_t toCh) { return true; }
virtual bool isChipConnected(void) { return false; } virtual bool isChipConnected(void) const { return false; }
virtual bool loop(void) = 0; virtual bool loop(void) = 0;
virtual uint8_t getARC(void) { return 0xff; }
virtual uint8_t getPLOS(void) { return 0xff; }
void handleIntr(void) { void handleIntr(void) {
mIrqRcvd = true; mIrqRcvd = true;
@ -66,7 +64,7 @@ class Radio {
sendPacket(iv, 24, isRetransmit); sendPacket(iv, 24, isRetransmit);
} }
uint32_t getDTUSn(void) { uint32_t getDTUSn(void) const {
return mDtuSn; return mDtuSn;
} }
@ -81,8 +79,8 @@ class Radio {
protected: protected:
virtual void sendPacket(Inverter<> *iv, uint8_t len, bool isRetransmit, bool appendCrc16=true) = 0; virtual void sendPacket(Inverter<> *iv, uint8_t len, bool isRetransmit, bool appendCrc16=true) = 0;
virtual uint64_t getIvId(Inverter<> *iv) = 0; virtual uint64_t getIvId(Inverter<> *iv) const = 0;
virtual uint8_t getIvGen(Inverter<> *iv) = 0; virtual uint8_t getIvGen(Inverter<> *iv) const = 0;
void initPacket(uint64_t ivId, uint8_t mid, uint8_t pid) { void initPacket(uint64_t ivId, uint8_t mid, uint8_t pid) {
mTxBuf[0] = mid; mTxBuf[0] = mid;

9
src/hms/hmsRadio.h

@ -15,7 +15,6 @@ class CmtRadio : public Radio {
public: public:
CmtRadio() { CmtRadio() {
mDtuSn = DTU_SN; mDtuSn = DTU_SN;
mCmtAvail = false;
} }
void setup(bool *serialDebug, bool *privacyMode, bool *printWholeTrace, uint8_t pinSclk, uint8_t pinSdio, uint8_t pinCsb, uint8_t pinFcsb, bool genDtuSn = true) { void setup(bool *serialDebug, bool *privacyMode, bool *printWholeTrace, uint8_t pinSclk, uint8_t pinSdio, uint8_t pinCsb, uint8_t pinFcsb, bool genDtuSn = true) {
@ -38,7 +37,7 @@ class CmtRadio : public Radio {
return false; return false;
} }
bool isChipConnected(void) { bool isChipConnected(void) const {
return mCmtAvail; return mCmtAvail;
} }
@ -116,11 +115,11 @@ class CmtRadio : public Radio {
iv->mDtuTxCnt++; iv->mDtuTxCnt++;
} }
uint64_t getIvId(Inverter<> *iv) { uint64_t getIvId(Inverter<> *iv) const {
return iv->radioId.u64; return iv->radioId.u64;
} }
uint8_t getIvGen(Inverter<> *iv) { uint8_t getIvGen(Inverter<> *iv) const {
return iv->ivGen; return iv->ivGen;
} }
@ -172,7 +171,7 @@ class CmtRadio : public Radio {
} }
CmtType mCmt; CmtType mCmt;
bool mCmtAvail; bool mCmtAvail = false;
bool mRqstGetRx = false; bool mRqstGetRx = false;
uint32_t mMillis; uint32_t mMillis;
}; };

4
src/web/lang.json

@ -670,7 +670,7 @@
}, },
{ {
"token": "INV_DELETE_SURE", "token": "INV_DELETE_SURE",
"en": "do you realy want to delete inverter?", "en": "do you really want to delete inverter?",
"de": "Willst du den Wechselrichter wirklich l&ouml;schen?" "de": "Willst du den Wechselrichter wirklich l&ouml;schen?"
}, },
{ {
@ -1070,7 +1070,7 @@
}, },
{ {
"token": "WARN_DIFF_ENV", "token": "WARN_DIFF_ENV",
"en": "your environment does not match the update file!", "en": "your environment may not match the update file!",
"de": "Die ausgew&auml;hlte Firmware passt u.U. nicht zum Chipsatz!" "de": "Die ausgew&auml;hlte Firmware passt u.U. nicht zum Chipsatz!"
}, },
{ {

Loading…
Cancel
Save