mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-28 15:26:58 +02:00
fix receive payload
This commit is contained in:
parent
26b06184cd
commit
0721910fe3
2 changed files with 8 additions and 11 deletions
|
@ -103,8 +103,7 @@ void app::loop(void) {
|
||||||
|
|
||||||
if (0 != len) {
|
if (0 != len) {
|
||||||
Inverter<> *iv = mSys->findInverter(&p->packet[1]);
|
Inverter<> *iv = mSys->findInverter(&p->packet[1]);
|
||||||
if ((NULL != iv) && (p->packet[0] == (TX_REQ_INFO + ALL_FRAMES))) // response from get information command
|
if ((NULL != iv) && (p->packet[0] == (TX_REQ_INFO + ALL_FRAMES))) { // response from get information command
|
||||||
{
|
|
||||||
mPayload[iv->id].txId = p->packet[0];
|
mPayload[iv->id].txId = p->packet[0];
|
||||||
DPRINTLN(DBG_DEBUG, F("Response from info request received"));
|
DPRINTLN(DBG_DEBUG, F("Response from info request received"));
|
||||||
uint8_t *pid = &p->packet[9];
|
uint8_t *pid = &p->packet[9];
|
||||||
|
@ -127,8 +126,7 @@ void app::loop(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((NULL != iv) && (p->packet[0] == (TX_REQ_DEVCONTROL + ALL_FRAMES))) // response from dev control command
|
if ((NULL != iv) && (p->packet[0] == (TX_REQ_DEVCONTROL + ALL_FRAMES))) { // response from dev control command
|
||||||
{
|
|
||||||
DPRINTLN(DBG_DEBUG, F("Response from devcontrol request received"));
|
DPRINTLN(DBG_DEBUG, F("Response from devcontrol request received"));
|
||||||
|
|
||||||
mPayload[iv->id].txId = p->packet[0];
|
mPayload[iv->id].txId = p->packet[0];
|
||||||
|
@ -294,8 +292,8 @@ bool app::buildPayload(uint8_t id) {
|
||||||
void app::processPayload(bool retransmit) {
|
void app::processPayload(bool retransmit) {
|
||||||
for (uint8_t id = 0; id < mSys->getNumInverters(); id++) {
|
for (uint8_t id = 0; id < mSys->getNumInverters(); id++) {
|
||||||
Inverter<> *iv = mSys->getInverterByPos(id);
|
Inverter<> *iv = mSys->getInverterByPos(id);
|
||||||
if (NULL != iv)
|
if (NULL == iv)
|
||||||
break; // skip to next inverter
|
continue; // skip to next inverter
|
||||||
|
|
||||||
if ((mPayload[iv->id].txId != (TX_REQ_INFO + ALL_FRAMES)) && (0 != mPayload[iv->id].txId)) {
|
if ((mPayload[iv->id].txId != (TX_REQ_INFO + ALL_FRAMES)) && (0 != mPayload[iv->id].txId)) {
|
||||||
// no processing needed if txId is not 0x95
|
// no processing needed if txId is not 0x95
|
||||||
|
@ -411,8 +409,7 @@ void app::cbMqtt(char *topic, byte *payload, unsigned int length) {
|
||||||
if (iv_id >= 0 && iv_id <= MAX_NUM_INVERTERS) {
|
if (iv_id >= 0 && iv_id <= MAX_NUM_INVERTERS) {
|
||||||
Inverter<> *iv = this->mSys->getInverterByPos(iv_id);
|
Inverter<> *iv = this->mSys->getInverterByPos(iv_id);
|
||||||
if (NULL != iv) {
|
if (NULL != iv) {
|
||||||
if (!iv->devControlRequest) // still pending
|
if (!iv->devControlRequest) { // still pending
|
||||||
{
|
|
||||||
token = strtok(NULL, "/");
|
token = strtok(NULL, "/");
|
||||||
|
|
||||||
switch (std::stoi(token)) {
|
switch (std::stoi(token)) {
|
||||||
|
@ -588,8 +585,8 @@ void app::sendMqtt(void) {
|
||||||
while(!mMqttSendList.empty()) {
|
while(!mMqttSendList.empty()) {
|
||||||
for (uint8_t id = 0; id < mSys->getNumInverters(); id++) {
|
for (uint8_t id = 0; id < mSys->getNumInverters(); id++) {
|
||||||
Inverter<> *iv = mSys->getInverterByPos(id);
|
Inverter<> *iv = mSys->getInverterByPos(id);
|
||||||
if (NULL != iv)
|
if (NULL == iv)
|
||||||
break; // skip to next inverter
|
continue; // skip to next inverter
|
||||||
|
|
||||||
record_t<> *rec = iv->getRecordStruct(mMqttSendList.front());
|
record_t<> *rec = iv->getRecordStruct(mMqttSendList.front());
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 5
|
#define VERSION_MINOR 5
|
||||||
#define VERSION_PATCH 27
|
#define VERSION_PATCH 28
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue