Browse Source

Powerlimit is transfered immediately to inverter

pull/555/head
lumapu 2 years ago
parent
commit
27b3a9cd87
  1. 4
      src/CHANGES.md
  2. 3
      src/app.cpp
  3. 4
      src/app.h
  4. 3
      src/appInterface.h
  5. 2
      src/defines.h
  6. 45
      src/hm/payload.h
  7. 1
      src/web/RestApi.h

4
src/CHANGES.md

@ -2,6 +2,10 @@
(starting from release version `0.5.66`)
## 0.5.68
* repaired receive payload
* Powerlimit is transfered immediately to inverter
## 0.5.67
* changed calculation of start / stop communication to 1 min after last comm. stop #515
* moved payload send to `payload.h`, function `ivSend` #515

3
src/app.cpp

@ -90,6 +90,7 @@ void app::loop(void) {
ah::Scheduler::loop();
mSys->Radio.loop();
mPayload.loop();
yield();
@ -116,8 +117,6 @@ void app::loop(void) {
if (rxRdy)
mPayload.process(true);
mRxTicker = 0;
}
#if !defined(AP_ONLY)

4
src/app.h

@ -122,6 +122,10 @@ class app : public IApp, public ah::Scheduler {
once(std::bind(&PubMqttType::sendDiscoveryConfig, &mMqtt), 1);
}
void ivSendHighPrio(Inverter<> *iv) {
mPayload.ivSendHighPrio(iv);
}
bool getMqttIsConnected() {
return mMqtt.isConnected();
}

3
src/appInterface.h

@ -7,6 +7,7 @@
#define __IAPP_H__
#include "defines.h"
#include "hm/hmSystem.h"
// abstract interface to App. Make members of App accessible from child class
// like web or API without forward declaration
@ -34,6 +35,8 @@ class IApp {
virtual bool getSettingsValid() = 0;
virtual void setMqttDiscoveryFlag() = 0;
virtual void ivSendHighPrio(Inverter<> *iv) = 0;
virtual bool getMqttIsConnected() = 0;
virtual uint32_t getMqttRxCnt() = 0;
virtual uint32_t getMqttTxCnt() = 0;

2
src/defines.h

@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 5
#define VERSION_PATCH 67
#define VERSION_PATCH 68
//-------------------------------------
typedef struct {

45
src/hm/payload.h

@ -42,6 +42,7 @@ class Payload : public Handler<payloadListenerType> {
mTimestamp = timestamp;
memset(mPayload, 0, (MAX_NUM_INVERTERS * sizeof(invPayload_t)));
mSerialDebug = false;
mHighPrioIv = NULL;
}
void enableSerialDebug(bool enable) {
@ -54,22 +55,35 @@ class Payload : public Handler<payloadListenerType> {
}
}
void ivSend(Inverter<> *iv) {
if (!mPayload[iv->id].complete)
process(false);
void loop() {
if(NULL != mHighPrioIv) {
ivSend(mHighPrioIv, true);
mHighPrioIv = NULL;
}
}
if (!mPayload[iv->id].complete) {
if (0 == mPayload[iv->id].maxPackId)
mStat->rxFailNoAnser++;
else
mStat->rxFail++;
void ivSendHighPrio(Inverter<> *iv) {
mHighPrioIv = iv;
}
iv->setQueuedCmdFinished(); // command failed
if (mSerialDebug)
DPRINTLN(DBG_INFO, F("enqueued cmd failed/timeout"));
if (mSerialDebug) {
DPRINT(DBG_INFO, F("(#") + String(iv->id) + ") ");
DPRINTLN(DBG_INFO, F("no Payload received! (retransmits: ") + String(mPayload[iv->id].retransmits) + ")");
void ivSend(Inverter<> *iv, bool highPrio = false) {
if(!highPrio) {
if (!mPayload[iv->id].complete)
process(false);
if (!mPayload[iv->id].complete) {
if (0 == mPayload[iv->id].maxPackId)
mStat->rxFailNoAnser++;
else
mStat->rxFail++;
iv->setQueuedCmdFinished(); // command failed
if (mSerialDebug)
DPRINTLN(DBG_INFO, F("enqueued cmd failed/timeout"));
if (mSerialDebug) {
DPRINT(DBG_INFO, F("(#") + String(iv->id) + ") ");
DPRINTLN(DBG_INFO, F("no Payload received! (retransmits: ") + String(mPayload[iv->id].retransmits) + ")");
}
}
}
@ -180,7 +194,7 @@ class Payload : public Handler<payloadListenerType> {
mPayload[iv->id].txCmd = iv->getQueuedCmd();
DPRINTLN(DBG_INFO, F("(#") + String(iv->id) + F(") sendTimePacket"));
mSys->Radio.sendTimePacket(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmMesIndex);
} else if (mPayload[iv->id].maxPackId != 0) {
} else {
for (uint8_t i = 0; i < (mPayload[iv->id].maxPackId - 1); i++) {
if (mPayload[iv->id].len[i] == 0) {
DPRINTLN(DBG_WARN, F("while retrieving data: Frame ") + String(i + 1) + F(" missing: Request Retransmit"));
@ -264,6 +278,7 @@ class Payload : public Handler<payloadListenerType> {
uint32_t *mTimestamp;
invPayload_t mPayload[MAX_NUM_INVERTERS];
bool mSerialDebug;
Inverter<> *mHighPrioIv;
};
#endif /*__PAYLOAD_H_*/

1
src/web/RestApi.h

@ -534,6 +534,7 @@ class RestApi {
iv->powerLimit[1] = AbsolutNonPersistent;
iv->devControlCmd = ActivePowerContr;
iv->devControlRequest = true;
mApp->ivSendHighPrio(iv);
}
else if(F("dev") == jsonIn[F("cmd")]) {
DPRINTLN(DBG_INFO, F("dev cmd"));

Loading…
Cancel
Save