Browse Source
Merge branch 'lumapu:zero-export' into zero-export
pull/1535/head
tictrick
10 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
22 additions and
6 deletions
-
src/defines.h
-
src/hm/Communication.h
-
src/plugins/zeroExport/zeroExport.h
-
src/web/RestApi.h
|
|
@ -13,7 +13,7 @@ |
|
|
|
//-------------------------------------
|
|
|
|
#define VERSION_MAJOR 0 |
|
|
|
#define VERSION_MINOR 8 |
|
|
|
#define VERSION_PATCH 970004 |
|
|
|
#define VERSION_PATCH 970005 |
|
|
|
|
|
|
|
//-------------------------------------
|
|
|
|
typedef struct { |
|
|
|
|
|
@ -490,12 +490,16 @@ class Communication : public CommQueue<> { |
|
|
|
|
|
|
|
case TurnOn: [[fallthrough]]; |
|
|
|
case TurnOff: //[[fallthrough]];
|
|
|
|
(mCbPwrPowerAck)(q->iv); |
|
|
|
if (NULL != mCbPwrPowerAck) { |
|
|
|
(mCbPwrPowerAck)(q->iv); |
|
|
|
} |
|
|
|
return true; |
|
|
|
break; |
|
|
|
|
|
|
|
case Restart: |
|
|
|
(mCbPwrRebootAck)(q->iv); |
|
|
|
if (NULL != mCbPwrRebootAck) { |
|
|
|
(mCbPwrRebootAck)(q->iv); |
|
|
|
} |
|
|
|
return true; |
|
|
|
break; |
|
|
|
|
|
|
@ -519,7 +523,9 @@ class Communication : public CommQueue<> { |
|
|
|
DBGPRINT(F(" with PowerLimitControl ")); |
|
|
|
DBGPRINTLN(String(q->iv->powerLimit[1])); |
|
|
|
q->iv->actPowerLimit = 0xffff; // unknown, readback current value
|
|
|
|
(mCbPwrAck)(q->iv); |
|
|
|
if (NULL != mCbPwrAck) { |
|
|
|
(mCbPwrAck)(q->iv); |
|
|
|
} |
|
|
|
|
|
|
|
return accepted; |
|
|
|
} |
|
|
@ -606,12 +612,15 @@ class Communication : public CommQueue<> { |
|
|
|
for (uint8_t i = 0; i < rec->length; i++) { |
|
|
|
q->iv->addValue(i, mPayload.data(), rec); |
|
|
|
} |
|
|
|
(mCbNewData)(q->iv); |
|
|
|
rec->mqttSentStatus = MqttSentStatus::NEW_DATA; |
|
|
|
|
|
|
|
q->iv->rssi = rssi; |
|
|
|
q->iv->doCalculations(); |
|
|
|
|
|
|
|
if (NULL != mCbNewData) { |
|
|
|
(mCbNewData)(q->iv); |
|
|
|
} |
|
|
|
|
|
|
|
if(AlarmData == q->cmd) { |
|
|
|
uint8_t i = 0; |
|
|
|
while(1) { |
|
|
|
|
|
@ -257,6 +257,10 @@ class ZeroExport { |
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (iv->actPowerLimit == 65535) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) { |
|
|
|
for (uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) { |
|
|
|
if (iv->id == mCfg->groups[group].inverters[inv].id) { |
|
|
@ -271,7 +275,7 @@ class ZeroExport { |
|
|
|
mLog["ivPm"] = iv->getMaxPower(); |
|
|
|
mLog["ivL"] = (uint16_t)(iv->getMaxPower() / 100 * iv->actPowerLimit); |
|
|
|
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(); |
|
|
|
mLog["B"] = bTsp; |
|
|
|
mLog["E"] = eTsp; |
|
|
|
|
|
@ -1157,6 +1157,9 @@ class RestApi { |
|
|
|
mConfig->plugin.zeroExport.groups[group].Ki = jsonIn[F("Ki")]; |
|
|
|
mConfig->plugin.zeroExport.groups[group].Kd = jsonIn[F("Kd")]; |
|
|
|
// 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
|
|
|
|
} |
|
|
|
#endif |
|
|
|