From 458639b6488311efb3c894c5f916c6e4d2df7241 Mon Sep 17 00:00:00 2001
From: Andreas Schiffler
Date: Wed, 17 Aug 2022 11:30:18 +0200
Subject: [PATCH] button on index to get FW-Version
---
tools/esp8266/app.cpp | 7 ++-----
tools/esp8266/config.h | 2 +-
tools/esp8266/hmSystem.h | 3 ++-
tools/esp8266/html/h/index_html.h | 2 +-
tools/esp8266/html/index.html | 16 ++++++++++++++++
tools/esp8266/web.cpp | 6 +++---
6 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/tools/esp8266/app.cpp b/tools/esp8266/app.cpp
index 52316a32..4e6f3c09 100644
--- a/tools/esp8266/app.cpp
+++ b/tools/esp8266/app.cpp
@@ -111,7 +111,6 @@ void app::loop(void) {
case InverterDevInform_Simple:
{
DPRINT(DBG_INFO, "Response from inform simple\n");
- mSys->InfoCmd = RealTimeRunData_Debug; // Set back to default
break;
}
case InverterDevInform_All:
@@ -122,19 +121,16 @@ void app::loop(void) {
case GetLossRate:
{
DPRINT(DBG_INFO, "Response from get loss rate\n");
- mSys->InfoCmd = RealTimeRunData_Debug; // Set back to default
break;
}
case AlarmData:
{
DPRINT(DBG_INFO, "Response from AlarmData\n");
- mSys->InfoCmd = RealTimeRunData_Debug; // Set back to default
break;
}
case AlarmUpdate:
{
DPRINT(DBG_INFO, "Response from AlarmUpdate\n");
- mSys->InfoCmd = RealTimeRunData_Debug; // Set back to default
break;
}
case RealTimeRunData_Debug:
@@ -392,7 +388,8 @@ void app::processPayload(bool retransmit, uint8_t cmd = RealTimeRunData_Debug) {
mSys->Radio.dumpBuf(NULL, payload, offs);
}
mRxSuccess++;
- mSys->InfoCmd = RealTimeRunData_Debug; // On success set back to default
+ mSys->InfoCmd = mSys->NextInfoCmd; // On success set next
+ mSys->NextInfoCmd = RealTimeRunData_Debug; // Set next to default. Can/will be overwritten by REST API
iv->getAssignment(cmd); // choose the parser
for(uint8_t i = 0; i < iv->listLen; i++) {
diff --git a/tools/esp8266/config.h b/tools/esp8266/config.h
index a022528e..8331c273 100644
--- a/tools/esp8266/config.h
+++ b/tools/esp8266/config.h
@@ -58,7 +58,7 @@
#define MAX_RF_PAYLOAD_SIZE 32
// maximum total payload buffers (must be greater than the number of received frame fragments)
-#define MAX_PAYLOAD_ENTRIES 4
+#define MAX_PAYLOAD_ENTRIES 10
// maximum requests for retransmits per payload (per inverter)
#define DEF_MAX_RETRANS_PER_PYLD 5
diff --git a/tools/esp8266/hmSystem.h b/tools/esp8266/hmSystem.h
index 1070445a..00f2c381 100644
--- a/tools/esp8266/hmSystem.h
+++ b/tools/esp8266/hmSystem.h
@@ -19,7 +19,8 @@ class HmSystem {
RadioType Radio;
typedef BUFFER BufferType;
BufferType BufCtrl;
- InfoCmdType InfoCmd;
+ InfoCmdType NextInfoCmd; // For cmd-queue FIFO with one place
+ InfoCmdType InfoCmd; // For cmd-queue FIFO with one place
//DevControlCmdType DevControlCmd;
HmSystem() {
diff --git a/tools/esp8266/html/h/index_html.h b/tools/esp8266/html/h/index_html.h
index 61dd0cce..2e55a2a2 100644
--- a/tools/esp8266/html/h/index_html.h
+++ b/tools/esp8266/html/h/index_html.h
@@ -1,4 +1,4 @@
#ifndef __INDEX_HTML_H__
#define __INDEX_HTML_H__
-const char index_html[] PROGMEM = "Index - {DEVICE} AHOY - {DEVICE} Visualization Setup
Uptime:
Statistics:
Every {TS}seconds the values are updated
";
+const char index_html[] PROGMEM = "Index - {DEVICE} AHOY - {DEVICE} Visualization Setup
Uptime:
Statistics:
Every {TS}seconds the values are updated
";
#endif /*__INDEX_HTML_H__*/
diff --git a/tools/esp8266/html/index.html b/tools/esp8266/html/index.html
index d72ae6f3..850c0579 100644
--- a/tools/esp8266/html/index.html
+++ b/tools/esp8266/html/index.html
@@ -5,6 +5,11 @@
@@ -38,6 +53,7 @@
Uptime:
Statistics:
Every {TS}seconds the values are updated
+
This project was started from
this discussion. (Mikrocontroller.net)
diff --git a/tools/esp8266/web.cpp b/tools/esp8266/web.cpp
index 77339653..df35ae9a 100644
--- a/tools/esp8266/web.cpp
+++ b/tools/esp8266/web.cpp
@@ -434,10 +434,10 @@ void web::showWebApi(void)
{
if (response["tx_request"] == (uint8_t)TX_REQ_INFO)
{
- mMain->mSys->InfoCmd = response["cmd"];
- mMain->resetPayload(iv); // start request from new
+ //mMain->resetPayload(iv); // start request from new
+ mMain->mSys->NextInfoCmd = response["cmd"];
// process payload from web request corresponding to the cmd
- if (mMain->mSys->InfoCmd == AlarmData)
+ if (mMain->mSys->NextInfoCmd == AlarmData)
iv->alarmMesIndex = response["payload"];
DPRINTLN(DBG_INFO, F("Will make tx-request 0x15 with subcmd ") + String(mMain->mSys->InfoCmd) + F(" and payload ") + String(response["payload"]));
}