Browse Source

0.8.21

* fix ethernet save inverter parameters #886
* fix ethernet OTA update #886
* improved radio statistics, fixed heuristic output for HMS and HMT inverters
pull/1270/head
lumapu 10 months ago
parent
commit
8c0ff5a3bd
  1. 5
      src/CHANGES.md
  2. 2
      src/defines.h
  3. 23
      src/hm/Communication.h
  4. 11
      src/hm/Heuristic.h
  5. 10
      src/hm/hmRadio.h
  6. 2
      src/platformio.ini
  7. 10
      src/web/RestApi.h
  8. 9
      src/web/web.h

5
src/CHANGES.md

@ -1,5 +1,10 @@
# Development Changes
## 0.8.21 - 2023-12-12
* fix ethernet save inverter parameters #886
* fix ethernet OTA update #886
* improved radio statistics, fixed heuristic output for HMS and HMT inverters
## 0.8.20 - 2023-12-12
* improved HM communication #1259 #1249
* fix `loadDefaults` for ethernet builds #1263

2
src/defines.h

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

23
src/hm/Communication.h

@ -145,7 +145,7 @@ class Communication : public CommQueue<> {
mWaitTimeout = millis() + 1000;
}
}
closeRequest(q, false, false);
closeRequest(q, false);
break;
}
@ -192,7 +192,7 @@ class Communication : public CommQueue<> {
nextState = States::CHECK_PACKAGE;
} else if (p->packet[0] == (TX_REQ_DEVCONTROL + ALL_FRAMES)) { // response from dev control command
parseDevCtrl(p, q);
closeRequest(q, true, true);
closeRequest(q, true);
} else if(IV_MI == q->iv->ivGen) {
if(parseMiFrame(p, q))
q->iv->curFrmCnt++;
@ -206,10 +206,13 @@ class Communication : public CommQueue<> {
yield();
}
if(0 == q->attempts)
closeRequest(q, false, true);
closeRequest(q, false);
else {
if(q->iv->ivGen != IV_MI)
if(q->iv->ivGen != IV_MI) {
mState = nextState;
if(States::RESET == mState)
closeRequest(q, false);
}
else {
if(q->iv->miMultiParts < 6) {
nextState = States::WAIT;
@ -219,7 +222,7 @@ class Communication : public CommQueue<> {
|| ((q->cmd == MI_REQ_CH1) && (q->iv->type == INV_TYPE_1CH))) {
miComplete(q->iv);
}
closeRequest(q, true, true);
closeRequest(q, true);
}
}
@ -272,7 +275,7 @@ class Communication : public CommQueue<> {
if(NULL != mCbPayload)
(mCbPayload)(q->cmd, q->iv);
closeRequest(q, true, true);
closeRequest(q, true);
break;
}
});
@ -384,7 +387,7 @@ class Communication : public CommQueue<> {
DBGPRINTLN(F("-> Fail"));
/*q->iv->radioStatistics.rxFail++; // got fragments but not complete response
cmdDone();*/
closeRequest(q, false, false);
closeRequest(q, false);
} else
DBGPRINTLN(F("-> complete retransmit"));
@ -432,7 +435,7 @@ class Communication : public CommQueue<> {
DBGPRINTLN(F(" bytes"));
}
/*q->iv->radioStatistics.rxFail++;*/
closeRequest(q, false, false);
closeRequest(q, false);
return;
}
@ -465,12 +468,12 @@ class Communication : public CommQueue<> {
mState = States::WAIT;
} else {
//add(q, true);
closeRequest(q, false, true);
closeRequest(q, false);
}
}
private:
void closeRequest(const queue_s *q, bool crcPass, bool delCmd) {
void closeRequest(const queue_s *q, bool crcPass) {
mHeu.evalTxChQuality(q->iv, crcPass, (4 - q->attempts), q->iv->curFrmCnt);
if(crcPass)
q->iv->radioStatistics.rxSuccess++;

11
src/hm/Heuristic.h

@ -120,11 +120,14 @@ class Heuristic {
void printStatus(Inverter<> *iv) {
DPRINT_IVID(DBG_INFO, iv->id);
DBGPRINT(F("Radio infos:"));
for(uint8_t i = 0; i < RF_MAX_CHANNEL_ID; i++) {
DBGPRINT(F(" "));
DBGPRINT(String(iv->heuristics.txRfQuality[i]));
if((IV_HMS != iv->ivGen) && (IV_HMT != iv->ivGen)) {
for(uint8_t i = 0; i < RF_MAX_CHANNEL_ID; i++) {
DBGPRINT(F(" "));
DBGPRINT(String(iv->heuristics.txRfQuality[i]));
}
DBGPRINT(F(" |"));
}
DBGPRINT(F(" | t: "));
DBGPRINT(F(" t: "));
DBGPRINT(String(iv->radioStatistics.txCnt));
DBGPRINT(F(", s: "));
DBGPRINT(String(iv->radioStatistics.rxSuccess));

10
src/hm/hmRadio.h

@ -52,16 +52,6 @@ class HmRadio : public Radio {
mPrivacyMode = privacyMode;
mPrintWholeTrace = printWholeTrace;
if(*mSerialDebug) {
DPRINT(DBG_VERBOSE, F("hmRadio.h : HmRadio():mNrf24(CE_PIN: "));
DBGPRINT(String(CE_PIN));
DBGPRINT(F(", CS_PIN: "));
DBGPRINT(String(CS_PIN));
DBGPRINT(F(", SPI_SPEED: "));
DBGPRINT(String(SPI_SPEED));
DBGPRINTLN(F(")"));
}
generateDtuSn();
DTU_RADIO_ID = ((uint64_t)(((mDtuSn >> 24) & 0xFF) | ((mDtuSn >> 8) & 0xFF00) | ((mDtuSn << 8) & 0xFF0000) | ((mDtuSn << 24) & 0xFF000000)) << 8) | 0x01;

2
src/platformio.ini

@ -184,7 +184,7 @@ build_flags = ${env.build_flags}
-DDEF_LED1=17
-DLED_ACTIVE_HIGH
-DARDUINO_USB_MODE=1
#-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_CDC_ON_BOOT=1
monitor_filters =
esp32_exception_decoder, colorize

10
src/web/RestApi.h

@ -50,9 +50,9 @@ class RestApi {
mRadioCmt = (CmtRadio<>*)mApp->getRadioObj(false);
#endif
mConfig = config;
mSrv->on("/api", HTTP_GET, std::bind(&RestApi::onApi, this, std::placeholders::_1));
mSrv->on("/api", HTTP_POST, std::bind(&RestApi::onApiPost, this, std::placeholders::_1)).onBody(
std::bind(&RestApi::onApiPostBody, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5));
mSrv->on("/api", HTTP_GET, std::bind(&RestApi::onApi, this, std::placeholders::_1));
mSrv->on("/get_setup", HTTP_GET, std::bind(&RestApi::onDwnldSetup, this, std::placeholders::_1));
}
@ -72,6 +72,8 @@ class RestApi {
private:
void onApi(AsyncWebServerRequest *request) {
DPRINTLN(DBG_VERBOSE, String("onApi: ") + String((uint16_t)request->method())); // 1 == Get, 3 == POST
mHeapFree = ESP.getFreeHeap();
#ifndef ESP32
mHeapFreeBlk = ESP.getMaxFreeBlockSize();
@ -120,6 +122,12 @@ class RestApi {
void onApiPost(AsyncWebServerRequest *request) {
DPRINTLN(DBG_VERBOSE, "onApiPost");
#if defined(ETHERNET)
// workaround for AsyncWebServer_ESP32_W5500, because it can't distinguish
// between HTTP_GET and HTTP_POST if both are registered
if(request->method() == HTTP_GET)
onApi(request);
#endif
}
void onApiPostBody(AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total) {

9
src/web/web.h

@ -82,9 +82,9 @@ class Web {
mWeb.on("/metrics", HTTP_ANY, std::bind(&Web::showMetrics, this, std::placeholders::_1));
#endif
mWeb.on("/update", HTTP_GET, std::bind(&Web::onUpdate, this, std::placeholders::_1));
mWeb.on("/update", HTTP_POST, std::bind(&Web::showUpdate, this, std::placeholders::_1),
std::bind(&Web::showUpdate2, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
mWeb.on("/update", HTTP_GET, std::bind(&Web::onUpdate, this, std::placeholders::_1));
mWeb.on("/upload", HTTP_POST, std::bind(&Web::onUpload, this, std::placeholders::_1),
std::bind(&Web::onUpload2, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
mWeb.on("/serial", HTTP_GET, std::bind(&Web::onSerial, this, std::placeholders::_1));
@ -273,6 +273,13 @@ class Web {
}
void showUpdate(AsyncWebServerRequest *request) {
#if defined(ETHERNET)
// workaround for AsyncWebServer_ESP32_W5500, because it can't distinguish
// between HTTP_GET and HTTP_POST if both are registered
if(request->method() == HTTP_GET)
onUpdate(request);
#endif
bool reboot = (!Update.hasError());
String html = F("<!doctype html><html><head><title>Update</title><meta http-equiv=\"refresh\" content=\"20; URL=/\"></head><body>Update: ");

Loading…
Cancel
Save