added command queue

+ command queue
+ feedback from inverter for actual power limit via InfoCmd -> SystemConfigPara (0x05)
+ REST API will enqueue a new info command
+ change in power limit will enqueue infocm to get actual power limit
+ actual power limit is available under mqtt topic <TOPIC>/<NAME>/ch0/PowerLimit ALWAYS in percent
+ Firmware information will be requested automatically up on start of dtu
This commit is contained in:
Andreas Schiffler 2022-08-20 13:34:31 +02:00
parent 76f2de853c
commit 51fbe7868c
8 changed files with 202 additions and 129 deletions

View file

@ -443,19 +443,19 @@ void web::showWebApi(void)
deserializeJson(response, mWeb->arg("plain"));
// ToDo: error handling for payload
uint8_t iv_id = response["inverter"];
uint8_t cmd = response["cmd"];
Inverter<> *iv = mMain->mSys->getInverterByPos(iv_id);
if (NULL != iv)
{
if (response["tx_request"] == (uint8_t)TX_REQ_INFO)
{
//mMain->resetPayload(iv); // start request from new
mMain->mSys->NextInfoCmd = response["cmd"];
// process payload from web request corresponding to the cmd
if (mMain->mSys->NextInfoCmd == AlarmData)
// if the AlarmData is requested set the Alarm Index to the requested one
if (cmd == AlarmData){
iv->alarmMesIndex = response["payload"];
DPRINTLN(DBG_INFO, F("Will make tx-request 0x15 with subcmd ") + String(mMain->mSys->InfoCmd) + F(" and payload ") + String((uint16_t) response["payload"]));
//DPRINTLN(DBG_INFO, F("Will make tx-request 0x15 with subcmd ") + String(mMain->mSys->InfoCmd) + F(" and payload "));
}
DPRINTLN(DBG_INFO, F("Will make tx-request 0x15 with subcmd ") + String(cmd) + F(" and payload ") + String(response["payload"]));
// process payload from web request corresponding to the cmd
iv->enqueCommand<InfoCommand>(cmd);
}