mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-19 20:06:11 +02:00
button on index to get FW-Version
This commit is contained in:
parent
e8524961c5
commit
458639b648
6 changed files with 25 additions and 11 deletions
|
@ -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++) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __INDEX_HTML_H__
|
||||
#define __INDEX_HTML_H__
|
||||
const char index_html[] PROGMEM = "<!doctype html><html><head><title>Index - {DEVICE}</title><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><script type=\"text/javascript\">getAjax('/uptime', 'uptime');getAjax('/cmdstat', 'cmds');window.setInterval(\"getAjax('/uptime', 'uptime')\", {JS_TS});window.setInterval(\"getAjax('/cmdstat', 'cmds')\", {JS_TS});function getAjax(url, resid) {var http = null;http = new XMLHttpRequest();if(http != null) {http.open(\"GET\", url, true);http.onreadystatechange = print;http.send(null);}function print() {if(http.readyState == 4) {document.getElementById(resid).innerHTML = http.responseText;}}}</script></head><body><h1>AHOY - {DEVICE}</h1><div id=\"content\" class=\"content\"><p><a href=\"/visualization\">Visualization</a><br/><br/><a href=\"/setup\">Setup</a><br/></p><p><span class=\"des\">Uptime: </span><span id=\"uptime\"></span></p><p><span class=\"des\">Statistics: </span><pre id=\"cmds\"></pre></p><p>Every {TS}seconds the values are updated</p><div id=\"note\">This project was started from <a href=\"https://www.mikrocontroller.net/topic/525778\" target=\"_blank\">this discussion. (Mikrocontroller.net)</a><br/>New updates can be found on Github: <a href=\"https://github.com/grindylow/ahoy\" target=\"_blank\">https://github.com/grindylow/ahoy</a><br/><br/>Please report issues using the feature provided by <a href=\"https://github.com/grindylow/ahoy/issues\">Github</a><br/><br/>Discuss with us on <a href=\"https://discord.gg/WzhxEY62mB\">Discord</a><br/><p class=\"lic\"><a href=\"https://creativecommons.org/licenses/by-nc-sa/3.0/de\">Creative Commons - https://creativecommons.org/licenses/by-nc-sa/3.0/de/</a><br/>Check the licenses which are published on <a href=\"https://github.com/grindylow/ahoy\">https://github.com/grindylow/ahoy</a>as well</p></div></div><div id=\"footer\"><p class=\"left\">© 2022</p><p class=\"left\"><a href=\"/update\">Update Firmware</a></p><p class=\"right\">AHOY :: {VERSION}</p><p class=\"right\"><a href=\"/reboot\">Reboot</a></p><p class=\"right\">Git SHA: {BUILD}</p></div></body></html>";
|
||||
const char index_html[] PROGMEM = "<!doctype html><html><head><title>Index - {DEVICE}</title><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><script type=\"text/javascript\">document.addEventListener('DOMContentLoaded', function(){document.getElementById(\"btn_req_fw\").addEventListener(\"click\", function(){getInverterInfo(`{\"inverter\":0,\"tx_request\": 21,\"cmd\": 1}`);});});getAjax('/uptime', 'uptime');getAjax('/cmdstat', 'cmds');window.setInterval(\"getAjax('/uptime', 'uptime')\", {JS_TS});window.setInterval(\"getAjax('/cmdstat', 'cmds')\", {JS_TS});function getAjax(url, resid) {var http = null;http = new XMLHttpRequest();if(http != null) {http.open(\"GET\", url, true);http.onreadystatechange = print;http.send(null);}function print() {if(http.readyState == 4) {document.getElementById(resid).innerHTML = http.responseText;}}}function getInverterInfo(data){var http = null;http = new XMLHttpRequest();if(http != null) {http.open(\"POST\", \"/api\");http.setRequestHeader(\"Accept\", \"application/json\");http.setRequestHeader(\"Content-Type\", \"application/json\");http.send(data);}}</script></head><body><h1>AHOY - {DEVICE}</h1><div id=\"content\" class=\"content\"><p><a href=\"/visualization\">Visualization</a><br/><br/><a href=\"/setup\">Setup</a><br/></p><p><span class=\"des\">Uptime: </span><span id=\"uptime\"></span></p><p><span class=\"des\">Statistics: </span><pre id=\"cmds\"></pre></p><p>Every {TS}seconds the values are updated</p><p><input type=\"button\" id=\"btn_req_fw\" value=\"Get FW-Info\"/></p><div id=\"note\">This project was started from <a href=\"https://www.mikrocontroller.net/topic/525778\" target=\"_blank\">this discussion. (Mikrocontroller.net)</a><br/>New updates can be found on Github: <a href=\"https://github.com/grindylow/ahoy\" target=\"_blank\">https://github.com/grindylow/ahoy</a><br/><br/>Please report issues using the feature provided by <a href=\"https://github.com/grindylow/ahoy/issues\">Github</a><br/><br/>Discuss with us on <a href=\"https://discord.gg/WzhxEY62mB\">Discord</a><br/><p class=\"lic\"><a href=\"https://creativecommons.org/licenses/by-nc-sa/3.0/de\">Creative Commons - https://creativecommons.org/licenses/by-nc-sa/3.0/de/</a><br/>Check the licenses which are published on <a href=\"https://github.com/grindylow/ahoy\">https://github.com/grindylow/ahoy</a>as well</p></div></div><div id=\"footer\"><p class=\"left\">© 2022</p><p class=\"left\"><a href=\"/update\">Update Firmware</a></p><p class=\"right\">AHOY :: {VERSION}</p><p class=\"right\"><a href=\"/reboot\">Reboot</a></p><p class=\"right\">Git SHA: {BUILD}</p></div></body></html>";
|
||||
#endif /*__INDEX_HTML_H__*/
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', function(){
|
||||
document.getElementById("btn_req_fw").addEventListener("click", function(){
|
||||
getInverterInfo(`{"inverter":0,"tx_request": 21,"cmd": 1}`);
|
||||
});
|
||||
});
|
||||
getAjax('/uptime', 'uptime');
|
||||
getAjax('/cmdstat', 'cmds');
|
||||
window.setInterval("getAjax('/uptime', 'uptime')", {JS_TS});
|
||||
|
@ -25,6 +30,16 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
function getInverterInfo(data){
|
||||
var http = null;
|
||||
http = new XMLHttpRequest();
|
||||
if(http != null) {
|
||||
http.open("POST", "/api");
|
||||
http.setRequestHeader("Accept", "application/json");
|
||||
http.setRequestHeader("Content-Type", "application/json");
|
||||
http.send(data);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -38,6 +53,7 @@
|
|||
<p><span class="des">Uptime: </span><span id="uptime"></span></p>
|
||||
<p><span class="des">Statistics: </span><pre id="cmds"></pre></p>
|
||||
<p>Every {TS}seconds the values are updated</p>
|
||||
<p><input type="button" id="btn_req_fw" value="Get FW-Info"/></p>
|
||||
|
||||
<div id="note">
|
||||
This project was started from <a href="https://www.mikrocontroller.net/topic/525778" target="_blank">this discussion. (Mikrocontroller.net)</a><br/>
|
||||
|
|
|
@ -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"]));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue