mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-29 02:06:21 +02:00
0.7.43
* improved RSSI for NRF24, now it's read per package (and inverter) #1129 * arranged `heap` related info together in `/system` * fix display navi during save * clean up binary output, separated to folders
This commit is contained in:
parent
a515dbbde1
commit
3600a2e28c
13 changed files with 81 additions and 60 deletions
|
@ -55,58 +55,65 @@ def readVersion(path, infile):
|
|||
|
||||
versionout = version[:-1] + "_" + sha + "_esp8266.bin"
|
||||
src = path + ".pio/build/esp8266/firmware.bin"
|
||||
dst = path + "firmware/" + versionout
|
||||
dst = path + "firmware/ESP8266/" + versionout
|
||||
os.rename(src, dst)
|
||||
|
||||
versionout = version[:-1] + "_" + sha + "_esp8266_prometheus.bin"
|
||||
src = path + ".pio/build/esp8266-prometheus/firmware.bin"
|
||||
dst = path + "firmware/" + versionout
|
||||
dst = path + "firmware/ESP8266/" + versionout
|
||||
os.rename(src, dst)
|
||||
|
||||
versionout = version[:-1] + "_" + sha + "_esp8285.bin"
|
||||
src = path + ".pio/build/esp8285/firmware.bin"
|
||||
dst = path + "firmware/" + versionout
|
||||
dst = path + "firmware/ESP8285/" + versionout
|
||||
os.rename(src, dst)
|
||||
gzip_bin(dst, dst + ".gz")
|
||||
|
||||
versionout = version[:-1] + "_" + sha + "_esp32.bin"
|
||||
src = path + ".pio/build/esp32-wroom32/firmware.bin"
|
||||
dst = path + "firmware/" + versionout
|
||||
dst = path + "firmware/ESP32/" + versionout
|
||||
os.rename(src, dst)
|
||||
|
||||
versionout = version[:-1] + "_" + sha + "_esp32_prometheus.bin"
|
||||
src = path + ".pio/build/esp32-wroom32-prometheus/firmware.bin"
|
||||
dst = path + "firmware/" + versionout
|
||||
dst = path + "firmware/ESP32/" + versionout
|
||||
os.rename(src, dst)
|
||||
|
||||
versionout = version[:-1] + "_" + sha + "_esp32_ethernet.bin"
|
||||
src = path + ".pio/build/esp32-wroom32-ethernet/firmware.bin"
|
||||
dst = path + "firmware/" + versionout
|
||||
dst = path + "firmware/ESP32/" + versionout
|
||||
os.rename(src, dst)
|
||||
|
||||
versionout = version[:-1] + "_" + sha + "_esp32s2-mini.bin"
|
||||
src = path + ".pio/build/esp32-s2-mini/firmware.bin"
|
||||
dst = path + "firmware/" + versionout
|
||||
dst = path + "firmware/ESP32-S2/" + versionout
|
||||
os.rename(src, dst)
|
||||
|
||||
versionout = version[:-1] + "_" + sha + "_esp32s3.bin"
|
||||
src = path + ".pio/build/opendtufusionv1/firmware.bin"
|
||||
dst = path + "firmware/s3/" + versionout
|
||||
dst = path + "firmware/ESP32-S3/" + versionout
|
||||
os.rename(src, dst)
|
||||
|
||||
# other ESP32 bin files
|
||||
src = path + ".pio/build/esp32-wroom32/"
|
||||
dst = path + "firmware/"
|
||||
dst = path + "firmware/ESP32/"
|
||||
os.rename(src + "bootloader.bin", dst + "bootloader.bin")
|
||||
os.rename(src + "partitions.bin", dst + "partitions.bin")
|
||||
genOtaBin(path + "firmware/")
|
||||
genOtaBin(dst)
|
||||
|
||||
# other ESP32S3 bin files
|
||||
src = path + ".pio/build/opendtufusionv1/"
|
||||
dst = path + "firmware/s3/"
|
||||
# other ESP32-S2 bin files
|
||||
src = path + ".pio/build/esp32-s2-mini/"
|
||||
dst = path + "firmware/ESP32-S2/"
|
||||
os.rename(src + "bootloader.bin", dst + "bootloader.bin")
|
||||
os.rename(src + "partitions.bin", dst + "partitions.bin")
|
||||
os.rename(src + "ota.bin", dst + "ota.bin")
|
||||
genOtaBin(dst)
|
||||
|
||||
# other ESP32-S3 bin files
|
||||
src = path + ".pio/build/opendtufusionv1/"
|
||||
dst = path + "firmware/ESP32-S3/"
|
||||
os.rename(src + "bootloader.bin", dst + "bootloader.bin")
|
||||
os.rename(src + "partitions.bin", dst + "partitions.bin")
|
||||
genOtaBin(dst)
|
||||
|
||||
os.rename("../scripts/gh-action-dev-build-flash.html", path + "install.html")
|
||||
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
# Development Changes
|
||||
|
||||
## 0.7.43 - 2023-08-28
|
||||
* improved RSSI for NRF24, now it's read per package (and inverter) #1129
|
||||
* arranged `heap` related info together in `/system`
|
||||
* fix display navi during save
|
||||
* clean up binary output, separated to folders
|
||||
|
||||
## 0.7.42 - 2023-08-27
|
||||
* fix ePaper for opendtufusion_v2.x boards (Software SPI)
|
||||
* add signal strength for NRF24 - PR #1119
|
||||
|
|
|
@ -145,9 +145,11 @@ void app::loopStandard(void) {
|
|||
if (mConfig->serial.debug) {
|
||||
DPRINT(DBG_INFO, F("RX "));
|
||||
DBGPRINT(String(p->len));
|
||||
DBGPRINT(F("B Ch"));
|
||||
DBGPRINT(F(" CH"));
|
||||
DBGPRINT(String(p->ch));
|
||||
DBGPRINT(F(" | "));
|
||||
DBGPRINT(F(", "));
|
||||
DBGPRINT(String(p->rssi));
|
||||
DBGPRINT(F("dBm | "));
|
||||
ah::dumpBuf(p->packet, p->len);
|
||||
}
|
||||
mStat.frmCnt++;
|
||||
|
@ -172,7 +174,7 @@ void app::loopStandard(void) {
|
|||
if (mConfig->serial.debug) {
|
||||
DPRINT(DBG_INFO, F("RX "));
|
||||
DBGPRINT(String(p->data[0]));
|
||||
DBGPRINT(F(" RSSI "));
|
||||
DBGPRINT(F(", "));
|
||||
DBGPRINT(String(p->rssi));
|
||||
DBGPRINT(F("dBm | "));
|
||||
ah::dumpBuf(&p->data[1], p->data[0]);
|
||||
|
|
|
@ -13,12 +13,13 @@
|
|||
//-------------------------------------
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 7
|
||||
#define VERSION_PATCH 42
|
||||
#define VERSION_PATCH 43
|
||||
|
||||
//-------------------------------------
|
||||
typedef struct {
|
||||
uint8_t ch;
|
||||
uint8_t len;
|
||||
int8_t rssi;
|
||||
uint8_t packet[MAX_RF_PAYLOAD_SIZE];
|
||||
} packet_t;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
// inverter generations
|
||||
enum {IV_MI = 0, IV_HM, IV_HMS, IV_HMT, IV_UNKNOWN};
|
||||
const char* const generationNames[] = {"HM", "MI", "HMS", "HMT", "UNKNOWN"};
|
||||
const char* const generationNames[] = {"MI", "HM", "HMS", "HMT", "UNKNOWN"};
|
||||
|
||||
// units
|
||||
enum {UNIT_V = 0, UNIT_A, UNIT_W, UNIT_WH, UNIT_KWH, UNIT_HZ, UNIT_C, UNIT_PCT, UNIT_VAR, UNIT_NONE};
|
||||
|
|
|
@ -18,6 +18,7 @@ typedef struct {
|
|||
uint8_t invId;
|
||||
uint32_t ts;
|
||||
uint8_t data[MAX_PAYLOAD_ENTRIES][MAX_RF_PAYLOAD_SIZE];
|
||||
int8_t rssi[MAX_PAYLOAD_ENTRIES];
|
||||
uint8_t len[MAX_PAYLOAD_ENTRIES];
|
||||
bool complete;
|
||||
uint8_t maxPackId;
|
||||
|
@ -172,6 +173,7 @@ class HmPayload {
|
|||
memcpy(mPayload[iv->id].data[(*pid & 0x7F) - 1], &p->packet[10], p->len - 11);
|
||||
mPayload[iv->id].len[(*pid & 0x7F) - 1] = p->len - 11;
|
||||
mPayload[iv->id].gotFragment = true;
|
||||
mPayload[iv->id].rssi[(*pid & 0x7F) - 1] = p->rssi;
|
||||
}
|
||||
|
||||
if ((*pid & ALL_FRAMES) == ALL_FRAMES) {
|
||||
|
@ -284,8 +286,8 @@ class HmPayload {
|
|||
} else { // payload complete
|
||||
DPRINT(DBG_INFO, F("procPyld: cmd: 0x"));
|
||||
DBGHEXLN(mPayload[iv->id].txCmd);
|
||||
DPRINT(DBG_INFO, F("procPyld: txid: 0x"));
|
||||
DBGHEXLN(mPayload[iv->id].txId);
|
||||
//DPRINT(DBG_DEBUG, F("procPyld: txid: 0x"));
|
||||
//DBGHEXLN(mPayload[iv->id].txId);
|
||||
DPRINT(DBG_DEBUG, F("procPyld: max: "));
|
||||
DPRINTLN(DBG_DEBUG, String(mPayload[iv->id].maxPackId));
|
||||
record_t<> *rec = iv->getRecordStruct(mPayload[iv->id].txCmd); // choose the parser
|
||||
|
@ -296,6 +298,8 @@ class HmPayload {
|
|||
|
||||
memset(payload, 0, 150);
|
||||
|
||||
int8_t rssi = -127;
|
||||
|
||||
for (uint8_t i = 0; i < (mPayload[iv->id].maxPackId); i++) {
|
||||
if((mPayload[iv->id].len[i] + payloadLen) > 150) {
|
||||
DPRINTLN(DBG_ERROR, F("payload buffer to small!"));
|
||||
|
@ -303,12 +307,16 @@ class HmPayload {
|
|||
}
|
||||
memcpy(&payload[payloadLen], mPayload[iv->id].data[i], (mPayload[iv->id].len[i]));
|
||||
payloadLen += (mPayload[iv->id].len[i]);
|
||||
// get worst RSSI
|
||||
if(mPayload[iv->id].rssi[i] > rssi)
|
||||
rssi = mPayload[iv->id].rssi[i];
|
||||
yield();
|
||||
}
|
||||
payloadLen -= 2;
|
||||
|
||||
if (mSerialDebug) {
|
||||
DPRINT(DBG_INFO, F("Payload ("));
|
||||
DPRINT_IVID(DBG_INFO, iv->id);
|
||||
DBGPRINT(F("Payload ("));
|
||||
DBGPRINT(String(payloadLen));
|
||||
DBGPRINT(F("): "));
|
||||
ah::dumpBuf(payload, payloadLen);
|
||||
|
@ -325,6 +333,7 @@ class HmPayload {
|
|||
iv->addValue(i, payload, rec);
|
||||
yield();
|
||||
}
|
||||
iv->rssi = rssi;
|
||||
iv->doCalculations();
|
||||
notify(mPayload[iv->id].txCmd, iv);
|
||||
|
||||
|
@ -388,8 +397,8 @@ class HmPayload {
|
|||
}
|
||||
|
||||
void reset(uint8_t id) {
|
||||
DPRINT_IVID(DBG_INFO, id);
|
||||
DBGPRINTLN(F("resetPayload"));
|
||||
//DPRINT_IVID(DBG_INFO, id);
|
||||
//DBGPRINTLN(F("resetPayload"));
|
||||
memset(mPayload[id].len, 0, MAX_PAYLOAD_ENTRIES);
|
||||
mPayload[id].txCmd = 0;
|
||||
mPayload[id].gotFragment = false;
|
||||
|
|
|
@ -239,16 +239,6 @@ class HmRadio {
|
|||
return mNrf24.isPVariant();
|
||||
}
|
||||
|
||||
/* Test whether a signal (carrier or otherwise) greater than or equal to -64dBm is present on the channel.
|
||||
Valid only on nRF24L01P (+) hardware. On nRF24L01, use testCarrier().
|
||||
Useful to check for interference on the current channel and channel hopping strategies.
|
||||
bool goodSignal = radio.testRPD();*/
|
||||
bool goodSignal(void) {
|
||||
bool goodSignal = mNrf24.testRPD();
|
||||
mNrf24.read(0,0);
|
||||
return goodSignal;
|
||||
}
|
||||
|
||||
std::queue<packet_t> mBufCtrl;
|
||||
|
||||
uint32_t mSendCnt;
|
||||
|
@ -268,16 +258,17 @@ class HmRadio {
|
|||
if (len > 0) {
|
||||
packet_t p;
|
||||
p.ch = mRfChLst[mRxChIdx];
|
||||
p.len = len;
|
||||
mNrf24.read(p.packet, len);
|
||||
p.len = (len > MAX_RF_PAYLOAD_SIZE) ? MAX_RF_PAYLOAD_SIZE : len;
|
||||
p.rssi = mNrf24.testRPD() ? -64 : -75;
|
||||
mNrf24.read(p.packet, p.len);
|
||||
if (p.packet[0] != 0x00) {
|
||||
mBufCtrl.push(p);
|
||||
if (p.packet[0] == (TX_REQ_INFO + ALL_FRAMES)) // response from get information command
|
||||
isLastPackage = (p.packet[9] > ALL_FRAMES); // > ALL_FRAMES indicates last packet received
|
||||
else if (p.packet[0] == ( 0x0f + ALL_FRAMES) ) // response from MI get information command
|
||||
isLastPackage = (p.packet[9] > 0x10); // > 0x10 indicates last packet received
|
||||
else if ((p.packet[0] != 0x88) && (p.packet[0] != 0x92)) // ignore fragment number zero and MI status messages //#0 was p.packet[0] != 0x00 &&
|
||||
isLastPackage = true; // response from dev control command
|
||||
mBufCtrl.push(p);
|
||||
if (p.packet[0] == (TX_REQ_INFO + ALL_FRAMES)) // response from get information command
|
||||
isLastPackage = (p.packet[9] > ALL_FRAMES); // > ALL_FRAMES indicates last packet received
|
||||
else if (p.packet[0] == ( 0x0f + ALL_FRAMES) ) // response from MI get information command
|
||||
isLastPackage = (p.packet[9] > 0x10); // > 0x10 indicates last packet received
|
||||
else if ((p.packet[0] != 0x88) && (p.packet[0] != 0x92)) // ignore fragment number zero and MI status messages //#0 was p.packet[0] != 0x00 &&
|
||||
isLastPackage = true; // response from dev control command
|
||||
}
|
||||
}
|
||||
yield();
|
||||
|
@ -321,7 +312,7 @@ class HmRadio {
|
|||
if(mSerialDebug) {
|
||||
DPRINT(DBG_INFO, F("TX "));
|
||||
DBGPRINT(String(len));
|
||||
DBGPRINT("B Ch");
|
||||
DBGPRINT(" CH");
|
||||
DBGPRINT(String(mRfChLst[mTxChIdx]));
|
||||
DBGPRINT(F(" | "));
|
||||
ah::dumpBuf(mTxBuf, len);
|
||||
|
|
|
@ -272,8 +272,8 @@ class HmsPayload {
|
|||
}*/ else { // payload complete
|
||||
DPRINT(DBG_INFO, F("procPyld: cmd: 0x"));
|
||||
DBGPRINTLN(String(mPayload[iv->id].txCmd, HEX));
|
||||
DPRINT(DBG_INFO, F("procPyld: txid: 0x"));
|
||||
DBGPRINTLN(String(mPayload[iv->id].txId, HEX));
|
||||
//DPRINT(DBG_DEBUG, F("procPyld: txid: 0x"));
|
||||
//DBGPRINTLN(String(mPayload[iv->id].txId, HEX));
|
||||
DPRINTLN(DBG_DEBUG, F("procPyld: max: ") + String(mPayload[iv->id].maxPackId));
|
||||
record_t<> *rec = iv->getRecordStruct(mPayload[iv->id].txCmd); // choose the parser
|
||||
mPayload[iv->id].complete = true;
|
||||
|
@ -300,7 +300,8 @@ class HmsPayload {
|
|||
payloadLen -= 2;
|
||||
|
||||
if (mSerialDebug) {
|
||||
DPRINT(DBG_INFO, F("Payload ("));
|
||||
DPRINT_IVID(DBG_INFO, iv->id);
|
||||
DBGPRINT(F("Payload ("));
|
||||
DBGPRINT(String(payloadLen));
|
||||
DBGPRINT(F("): "));
|
||||
ah::dumpBuf(payload, payloadLen);
|
||||
|
@ -382,8 +383,8 @@ class HmsPayload {
|
|||
}
|
||||
|
||||
void reset(uint8_t id) {
|
||||
DPRINT(DBG_INFO, "resetPayload: id: ");
|
||||
DBGPRINTLN(String(id));
|
||||
//DPRINT(DBG_INFO, "resetPayload: id: ");
|
||||
//DBGPRINTLN(String(id));
|
||||
memset(&mPayload[id], 0, sizeof(hmsPayload_t));
|
||||
mPayload[id].txCmd = 0;
|
||||
mPayload[id].gotFragment = false;
|
||||
|
|
|
@ -242,10 +242,10 @@ class RestApi {
|
|||
getStatistics(obj.createNestedObject(F("statistics")));
|
||||
|
||||
#if defined(ESP32)
|
||||
obj[F("heap_total")] = ESP.getHeapSize();
|
||||
obj[F("chip_revision")] = ESP.getChipRevision();
|
||||
obj[F("chip_model")] = ESP.getChipModel();
|
||||
obj[F("chip_cores")] = ESP.getChipCores();
|
||||
obj[F("heap_total")] = ESP.getHeapSize();
|
||||
//obj[F("core_version")] = F("n/a");
|
||||
//obj[F("flash_size")] = F("n/a");
|
||||
//obj[F("heap_frag")] = F("n/a");
|
||||
|
@ -256,10 +256,10 @@ class RestApi {
|
|||
//obj[F("chip_revision")] = F("n/a");
|
||||
//obj[F("chip_model")] = F("n/a");
|
||||
//obj[F("chip_cores")] = F("n/a");
|
||||
obj[F("core_version")] = ESP.getCoreVersion();
|
||||
obj[F("flash_size")] = ESP.getFlashChipRealSize() / 1024; // in kb
|
||||
obj[F("heap_frag")] = mHeapFrag;
|
||||
obj[F("max_free_blk")] = mHeapFreeBlk;
|
||||
obj[F("core_version")] = ESP.getCoreVersion();
|
||||
obj[F("flash_size")] = ESP.getFlashChipRealSize() / 1024; // in kb
|
||||
obj[F("reboot_reason")] = ESP.getResetReason();
|
||||
#endif
|
||||
//obj[F("littlefs_total")] = LittleFS.totalBytes();
|
||||
|
@ -502,7 +502,6 @@ class RestApi {
|
|||
obj[F("isconnected")] = mRadio->isChipConnected();
|
||||
obj[F("DataRate")] = mRadio->getDataRate();
|
||||
obj[F("isPVariant")] = mRadio->isPVariant();
|
||||
obj[F("goodSignal")] = mRadio->goodSignal();
|
||||
obj[F("en")] = (bool) mConfig->nrf.enabled;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,9 @@
|
|||
parseHtml(obj);
|
||||
}
|
||||
}
|
||||
intervalId = window.setInterval("getAjax('/api/html/save', parse)", 2500);
|
||||
|
||||
intervalId = window.setInterval("getAjax('/api/html/save', parse)", 2500);
|
||||
getAjax("/api/generic", parseGeneric);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -899,8 +899,8 @@
|
|||
|
||||
function parse(root) {
|
||||
if(null != root) {
|
||||
parseSys(root["system"]);
|
||||
parseGeneric(root["generic"]);
|
||||
parseSys(root["system"]);
|
||||
parseStaticIp(root["static_ip"]);
|
||||
parseMqtt(root["mqtt"]);
|
||||
parseNtp(root["ntp"]);
|
||||
|
|
|
@ -60,9 +60,8 @@
|
|||
h.appendChild(r);
|
||||
main.appendChild(h);
|
||||
|
||||
main.append(
|
||||
genTabRow("nrf24l01" + (obj["isPVariant"] ? "+ " : ""), (obj["isconnected"] ? "is connected " : "is not connected ")),
|
||||
genTabRow("NRF Signal: ", (obj["goodSignal"] ? "Strong signal > 64dBm" : "Weak signal < 64dBm"))
|
||||
main.appendChild(
|
||||
genTabRow("nrf24l01" + (obj["isPVariant"] ? "+ " : ""), (obj["isconnected"] ? "is connected " : "is not connected "))
|
||||
);
|
||||
|
||||
if(obj["isconnected"]) {
|
||||
|
|
|
@ -177,8 +177,12 @@
|
|||
else
|
||||
ageInfo += "nothing received";
|
||||
|
||||
if((gen >= 2) && (rssi > -127))
|
||||
ageInfo += " (RSSI: " + rssi + "dBm)";
|
||||
if(rssi > -127) {
|
||||
if(gen < 2)
|
||||
ageInfo += " (RSSI: " + ((rssi == -64) ? ">=" : "<") + " -64dBm)";
|
||||
else
|
||||
ageInfo += " (RSSI: " + rssi + "dBm)";
|
||||
}
|
||||
|
||||
return ml("div", {class: "mb-5"}, [
|
||||
ml("div", {class: "row p-1 ts-h mx-2"},
|
||||
|
|
Loading…
Add table
Reference in a new issue