Browse Source

Merge branch 'lumapu:zero-export' into zero-export

pull/1535/head
tictrick 6 months ago
committed by GitHub
parent
commit
11aa53e9d6
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      src/defines.h
  2. 11
      src/hm/Communication.h
  3. 6
      src/plugins/zeroExport/zeroExport.h
  4. 3
      src/web/RestApi.h

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 8 #define VERSION_MINOR 8
#define VERSION_PATCH 970004 #define VERSION_PATCH 970005
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

11
src/hm/Communication.h

@ -490,12 +490,16 @@ class Communication : public CommQueue<> {
case TurnOn: [[fallthrough]]; case TurnOn: [[fallthrough]];
case TurnOff: //[[fallthrough]]; case TurnOff: //[[fallthrough]];
if (NULL != mCbPwrPowerAck) {
(mCbPwrPowerAck)(q->iv); (mCbPwrPowerAck)(q->iv);
}
return true; return true;
break; break;
case Restart: case Restart:
if (NULL != mCbPwrRebootAck) {
(mCbPwrRebootAck)(q->iv); (mCbPwrRebootAck)(q->iv);
}
return true; return true;
break; break;
@ -519,7 +523,9 @@ class Communication : public CommQueue<> {
DBGPRINT(F(" with PowerLimitControl ")); DBGPRINT(F(" with PowerLimitControl "));
DBGPRINTLN(String(q->iv->powerLimit[1])); DBGPRINTLN(String(q->iv->powerLimit[1]));
q->iv->actPowerLimit = 0xffff; // unknown, readback current value q->iv->actPowerLimit = 0xffff; // unknown, readback current value
if (NULL != mCbPwrAck) {
(mCbPwrAck)(q->iv); (mCbPwrAck)(q->iv);
}
return accepted; return accepted;
} }
@ -606,12 +612,15 @@ class Communication : public CommQueue<> {
for (uint8_t i = 0; i < rec->length; i++) { for (uint8_t i = 0; i < rec->length; i++) {
q->iv->addValue(i, mPayload.data(), rec); q->iv->addValue(i, mPayload.data(), rec);
} }
(mCbNewData)(q->iv);
rec->mqttSentStatus = MqttSentStatus::NEW_DATA; rec->mqttSentStatus = MqttSentStatus::NEW_DATA;
q->iv->rssi = rssi; q->iv->rssi = rssi;
q->iv->doCalculations(); q->iv->doCalculations();
if (NULL != mCbNewData) {
(mCbNewData)(q->iv);
}
if(AlarmData == q->cmd) { if(AlarmData == q->cmd) {
uint8_t i = 0; uint8_t i = 0;
while(1) { while(1) {

6
src/plugins/zeroExport/zeroExport.h

@ -257,6 +257,10 @@ class ZeroExport {
// return; // return;
// } // }
if (iv->actPowerLimit == 65535) {
return;
}
for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) { for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) {
for (uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) { for (uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) {
if (iv->id == mCfg->groups[group].inverters[inv].id) { if (iv->id == mCfg->groups[group].inverters[inv].id) {
@ -271,7 +275,7 @@ class ZeroExport {
mLog["ivPm"] = iv->getMaxPower(); mLog["ivPm"] = iv->getMaxPower();
mLog["ivL"] = (uint16_t)(iv->getMaxPower() / 100 * iv->actPowerLimit); mLog["ivL"] = (uint16_t)(iv->getMaxPower() / 100 * iv->actPowerLimit);
mLog["zeL"] = (uint16_t)mCfg->groups[group].inverters[inv].limit; mLog["zeL"] = (uint16_t)mCfg->groups[group].inverters[inv].limit;
mCfg->groups[group].inverters[inv].limit = (iv->getMaxPower() / 100 * iv->actPowerLimit);
unsigned long eTsp = millis(); unsigned long eTsp = millis();
mLog["B"] = bTsp; mLog["B"] = bTsp;
mLog["E"] = eTsp; mLog["E"] = eTsp;

3
src/web/RestApi.h

@ -1157,6 +1157,9 @@ class RestApi {
mConfig->plugin.zeroExport.groups[group].Ki = jsonIn[F("Ki")]; mConfig->plugin.zeroExport.groups[group].Ki = jsonIn[F("Ki")];
mConfig->plugin.zeroExport.groups[group].Kd = jsonIn[F("Kd")]; mConfig->plugin.zeroExport.groups[group].Kd = jsonIn[F("Kd")];
// Global // Global
mConfig->plugin.zeroExport.groups[group].stateLast = zeroExportState::INIT;
mConfig->plugin.zeroExport.groups[group].state = zeroExportState::INIT;
mConfig->plugin.zeroExport.groups[group].stateNext = zeroExportState::INIT;
mApp->saveSettings(false); // without reboot mApp->saveSettings(false); // without reboot
} }
#endif #endif

Loading…
Cancel
Save