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. 19
      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`) (starting from release version `0.5.66`)
## 0.5.68
* repaired receive payload
* Powerlimit is transfered immediately to inverter
## 0.5.67 ## 0.5.67
* changed calculation of start / stop communication to 1 min after last comm. stop #515 * changed calculation of start / stop communication to 1 min after last comm. stop #515
* moved payload send to `payload.h`, function `ivSend` #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(); ah::Scheduler::loop();
mSys->Radio.loop(); mSys->Radio.loop();
mPayload.loop();
yield(); yield();
@ -116,8 +117,6 @@ void app::loop(void) {
if (rxRdy) if (rxRdy)
mPayload.process(true); mPayload.process(true);
mRxTicker = 0;
} }
#if !defined(AP_ONLY) #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); once(std::bind(&PubMqttType::sendDiscoveryConfig, &mMqtt), 1);
} }
void ivSendHighPrio(Inverter<> *iv) {
mPayload.ivSendHighPrio(iv);
}
bool getMqttIsConnected() { bool getMqttIsConnected() {
return mMqtt.isConnected(); return mMqtt.isConnected();
} }

3
src/appInterface.h

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

2
src/defines.h

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

19
src/hm/payload.h

@ -42,6 +42,7 @@ class Payload : public Handler<payloadListenerType> {
mTimestamp = timestamp; mTimestamp = timestamp;
memset(mPayload, 0, (MAX_NUM_INVERTERS * sizeof(invPayload_t))); memset(mPayload, 0, (MAX_NUM_INVERTERS * sizeof(invPayload_t)));
mSerialDebug = false; mSerialDebug = false;
mHighPrioIv = NULL;
} }
void enableSerialDebug(bool enable) { void enableSerialDebug(bool enable) {
@ -54,7 +55,19 @@ class Payload : public Handler<payloadListenerType> {
} }
} }
void ivSend(Inverter<> *iv) { void loop() {
if(NULL != mHighPrioIv) {
ivSend(mHighPrioIv, true);
mHighPrioIv = NULL;
}
}
void ivSendHighPrio(Inverter<> *iv) {
mHighPrioIv = iv;
}
void ivSend(Inverter<> *iv, bool highPrio = false) {
if(!highPrio) {
if (!mPayload[iv->id].complete) if (!mPayload[iv->id].complete)
process(false); process(false);
@ -72,6 +85,7 @@ class Payload : public Handler<payloadListenerType> {
DPRINTLN(DBG_INFO, F("no Payload received! (retransmits: ") + String(mPayload[iv->id].retransmits) + ")"); DPRINTLN(DBG_INFO, F("no Payload received! (retransmits: ") + String(mPayload[iv->id].retransmits) + ")");
} }
} }
}
reset(iv); reset(iv);
mPayload[iv->id].requested = true; mPayload[iv->id].requested = true;
@ -180,7 +194,7 @@ class Payload : public Handler<payloadListenerType> {
mPayload[iv->id].txCmd = iv->getQueuedCmd(); mPayload[iv->id].txCmd = iv->getQueuedCmd();
DPRINTLN(DBG_INFO, F("(#") + String(iv->id) + F(") sendTimePacket")); 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); 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++) { for (uint8_t i = 0; i < (mPayload[iv->id].maxPackId - 1); i++) {
if (mPayload[iv->id].len[i] == 0) { if (mPayload[iv->id].len[i] == 0) {
DPRINTLN(DBG_WARN, F("while retrieving data: Frame ") + String(i + 1) + F(" missing: Request Retransmit")); 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; uint32_t *mTimestamp;
invPayload_t mPayload[MAX_NUM_INVERTERS]; invPayload_t mPayload[MAX_NUM_INVERTERS];
bool mSerialDebug; bool mSerialDebug;
Inverter<> *mHighPrioIv;
}; };
#endif /*__PAYLOAD_H_*/ #endif /*__PAYLOAD_H_*/

1
src/web/RestApi.h

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

Loading…
Cancel
Save