mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-08 13:41:40 +02:00
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
This commit is contained in:
parent
689a295d0b
commit
8c0ff5a3bd
8 changed files with 44 additions and 28 deletions
|
@ -1,5 +1,10 @@
|
||||||
# Development Changes
|
# 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
|
## 0.8.20 - 2023-12-12
|
||||||
* improved HM communication #1259 #1249
|
* improved HM communication #1259 #1249
|
||||||
* fix `loadDefaults` for ethernet builds #1263
|
* fix `loadDefaults` for ethernet builds #1263
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 8
|
#define VERSION_MINOR 8
|
||||||
#define VERSION_PATCH 20
|
#define VERSION_PATCH 21
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -145,7 +145,7 @@ class Communication : public CommQueue<> {
|
||||||
mWaitTimeout = millis() + 1000;
|
mWaitTimeout = millis() + 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closeRequest(q, false, false);
|
closeRequest(q, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ class Communication : public CommQueue<> {
|
||||||
nextState = States::CHECK_PACKAGE;
|
nextState = States::CHECK_PACKAGE;
|
||||||
} else if (p->packet[0] == (TX_REQ_DEVCONTROL + ALL_FRAMES)) { // response from dev control command
|
} else if (p->packet[0] == (TX_REQ_DEVCONTROL + ALL_FRAMES)) { // response from dev control command
|
||||||
parseDevCtrl(p, q);
|
parseDevCtrl(p, q);
|
||||||
closeRequest(q, true, true);
|
closeRequest(q, true);
|
||||||
} else if(IV_MI == q->iv->ivGen) {
|
} else if(IV_MI == q->iv->ivGen) {
|
||||||
if(parseMiFrame(p, q))
|
if(parseMiFrame(p, q))
|
||||||
q->iv->curFrmCnt++;
|
q->iv->curFrmCnt++;
|
||||||
|
@ -206,10 +206,13 @@ class Communication : public CommQueue<> {
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
if(0 == q->attempts)
|
if(0 == q->attempts)
|
||||||
closeRequest(q, false, true);
|
closeRequest(q, false);
|
||||||
else {
|
else {
|
||||||
if(q->iv->ivGen != IV_MI)
|
if(q->iv->ivGen != IV_MI) {
|
||||||
mState = nextState;
|
mState = nextState;
|
||||||
|
if(States::RESET == mState)
|
||||||
|
closeRequest(q, false);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if(q->iv->miMultiParts < 6) {
|
if(q->iv->miMultiParts < 6) {
|
||||||
nextState = States::WAIT;
|
nextState = States::WAIT;
|
||||||
|
@ -219,7 +222,7 @@ class Communication : public CommQueue<> {
|
||||||
|| ((q->cmd == MI_REQ_CH1) && (q->iv->type == INV_TYPE_1CH))) {
|
|| ((q->cmd == MI_REQ_CH1) && (q->iv->type == INV_TYPE_1CH))) {
|
||||||
miComplete(q->iv);
|
miComplete(q->iv);
|
||||||
}
|
}
|
||||||
closeRequest(q, true, true);
|
closeRequest(q, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -272,7 +275,7 @@ class Communication : public CommQueue<> {
|
||||||
if(NULL != mCbPayload)
|
if(NULL != mCbPayload)
|
||||||
(mCbPayload)(q->cmd, q->iv);
|
(mCbPayload)(q->cmd, q->iv);
|
||||||
|
|
||||||
closeRequest(q, true, true);
|
closeRequest(q, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -384,7 +387,7 @@ class Communication : public CommQueue<> {
|
||||||
DBGPRINTLN(F("-> Fail"));
|
DBGPRINTLN(F("-> Fail"));
|
||||||
/*q->iv->radioStatistics.rxFail++; // got fragments but not complete response
|
/*q->iv->radioStatistics.rxFail++; // got fragments but not complete response
|
||||||
cmdDone();*/
|
cmdDone();*/
|
||||||
closeRequest(q, false, false);
|
closeRequest(q, false);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
DBGPRINTLN(F("-> complete retransmit"));
|
DBGPRINTLN(F("-> complete retransmit"));
|
||||||
|
@ -432,7 +435,7 @@ class Communication : public CommQueue<> {
|
||||||
DBGPRINTLN(F(" bytes"));
|
DBGPRINTLN(F(" bytes"));
|
||||||
}
|
}
|
||||||
/*q->iv->radioStatistics.rxFail++;*/
|
/*q->iv->radioStatistics.rxFail++;*/
|
||||||
closeRequest(q, false, false);
|
closeRequest(q, false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -465,12 +468,12 @@ class Communication : public CommQueue<> {
|
||||||
mState = States::WAIT;
|
mState = States::WAIT;
|
||||||
} else {
|
} else {
|
||||||
//add(q, true);
|
//add(q, true);
|
||||||
closeRequest(q, false, true);
|
closeRequest(q, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
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);
|
mHeu.evalTxChQuality(q->iv, crcPass, (4 - q->attempts), q->iv->curFrmCnt);
|
||||||
if(crcPass)
|
if(crcPass)
|
||||||
q->iv->radioStatistics.rxSuccess++;
|
q->iv->radioStatistics.rxSuccess++;
|
||||||
|
|
|
@ -120,11 +120,14 @@ class Heuristic {
|
||||||
void printStatus(Inverter<> *iv) {
|
void printStatus(Inverter<> *iv) {
|
||||||
DPRINT_IVID(DBG_INFO, iv->id);
|
DPRINT_IVID(DBG_INFO, iv->id);
|
||||||
DBGPRINT(F("Radio infos:"));
|
DBGPRINT(F("Radio infos:"));
|
||||||
|
if((IV_HMS != iv->ivGen) && (IV_HMT != iv->ivGen)) {
|
||||||
for(uint8_t i = 0; i < RF_MAX_CHANNEL_ID; i++) {
|
for(uint8_t i = 0; i < RF_MAX_CHANNEL_ID; i++) {
|
||||||
DBGPRINT(F(" "));
|
DBGPRINT(F(" "));
|
||||||
DBGPRINT(String(iv->heuristics.txRfQuality[i]));
|
DBGPRINT(String(iv->heuristics.txRfQuality[i]));
|
||||||
}
|
}
|
||||||
DBGPRINT(F(" | t: "));
|
DBGPRINT(F(" |"));
|
||||||
|
}
|
||||||
|
DBGPRINT(F(" t: "));
|
||||||
DBGPRINT(String(iv->radioStatistics.txCnt));
|
DBGPRINT(String(iv->radioStatistics.txCnt));
|
||||||
DBGPRINT(F(", s: "));
|
DBGPRINT(F(", s: "));
|
||||||
DBGPRINT(String(iv->radioStatistics.rxSuccess));
|
DBGPRINT(String(iv->radioStatistics.rxSuccess));
|
||||||
|
|
|
@ -52,16 +52,6 @@ class HmRadio : public Radio {
|
||||||
mPrivacyMode = privacyMode;
|
mPrivacyMode = privacyMode;
|
||||||
mPrintWholeTrace = printWholeTrace;
|
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();
|
generateDtuSn();
|
||||||
DTU_RADIO_ID = ((uint64_t)(((mDtuSn >> 24) & 0xFF) | ((mDtuSn >> 8) & 0xFF00) | ((mDtuSn << 8) & 0xFF0000) | ((mDtuSn << 24) & 0xFF000000)) << 8) | 0x01;
|
DTU_RADIO_ID = ((uint64_t)(((mDtuSn >> 24) & 0xFF) | ((mDtuSn >> 8) & 0xFF00) | ((mDtuSn << 8) & 0xFF0000) | ((mDtuSn << 24) & 0xFF000000)) << 8) | 0x01;
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ build_flags = ${env.build_flags}
|
||||||
-DDEF_LED1=17
|
-DDEF_LED1=17
|
||||||
-DLED_ACTIVE_HIGH
|
-DLED_ACTIVE_HIGH
|
||||||
-DARDUINO_USB_MODE=1
|
-DARDUINO_USB_MODE=1
|
||||||
#-DARDUINO_USB_CDC_ON_BOOT=1
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
esp32_exception_decoder, colorize
|
esp32_exception_decoder, colorize
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,9 @@ class RestApi {
|
||||||
mRadioCmt = (CmtRadio<>*)mApp->getRadioObj(false);
|
mRadioCmt = (CmtRadio<>*)mApp->getRadioObj(false);
|
||||||
#endif
|
#endif
|
||||||
mConfig = config;
|
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(
|
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));
|
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));
|
mSrv->on("/get_setup", HTTP_GET, std::bind(&RestApi::onDwnldSetup, this, std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,8 @@ class RestApi {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onApi(AsyncWebServerRequest *request) {
|
void onApi(AsyncWebServerRequest *request) {
|
||||||
|
DPRINTLN(DBG_VERBOSE, String("onApi: ") + String((uint16_t)request->method())); // 1 == Get, 3 == POST
|
||||||
|
|
||||||
mHeapFree = ESP.getFreeHeap();
|
mHeapFree = ESP.getFreeHeap();
|
||||||
#ifndef ESP32
|
#ifndef ESP32
|
||||||
mHeapFreeBlk = ESP.getMaxFreeBlockSize();
|
mHeapFreeBlk = ESP.getMaxFreeBlockSize();
|
||||||
|
@ -120,6 +122,12 @@ class RestApi {
|
||||||
|
|
||||||
void onApiPost(AsyncWebServerRequest *request) {
|
void onApiPost(AsyncWebServerRequest *request) {
|
||||||
DPRINTLN(DBG_VERBOSE, "onApiPost");
|
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) {
|
void onApiPostBody(AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total) {
|
||||||
|
|
|
@ -82,9 +82,9 @@ class Web {
|
||||||
mWeb.on("/metrics", HTTP_ANY, std::bind(&Web::showMetrics, this, std::placeholders::_1));
|
mWeb.on("/metrics", HTTP_ANY, std::bind(&Web::showMetrics, this, std::placeholders::_1));
|
||||||
#endif
|
#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),
|
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));
|
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),
|
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));
|
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));
|
mWeb.on("/serial", HTTP_GET, std::bind(&Web::onSerial, this, std::placeholders::_1));
|
||||||
|
@ -273,6 +273,13 @@ class Web {
|
||||||
}
|
}
|
||||||
|
|
||||||
void showUpdate(AsyncWebServerRequest *request) {
|
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());
|
bool reboot = (!Update.hasError());
|
||||||
|
|
||||||
String html = F("<!doctype html><html><head><title>Update</title><meta http-equiv=\"refresh\" content=\"20; URL=/\"></head><body>Update: ");
|
String html = F("<!doctype html><html><head><title>Update</title><meta http-equiv=\"refresh\" content=\"20; URL=/\"></head><body>Update: ");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue