mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-08 21:51:38 +02:00
Merge branch 'lumapu:zero-export' into zero-export
This commit is contained in:
commit
11aa53e9d6
4 changed files with 22 additions and 6 deletions
|
@ -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 {
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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…
Add table
Add a link
Reference in a new issue