Browse Source

0.8.103..13

pull/1615/head
Patrick Amrhein 9 months ago
parent
commit
cef417c555
  1. 2
      src/defines.h
  2. 20
      src/plugins/zeroExport/powermeter.h
  3. 13
      src/plugins/zeroExport/zeroExport.h

2
src/defines.h

@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 8
#define VERSION_PATCH 1030012
#define VERSION_PATCH 1030013
//-------------------------------------
typedef struct {
uint8_t ch;

20
src/plugins/zeroExport/powermeter.h

@ -3,6 +3,8 @@
// Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed
//-----------------------------------------------------------------------------
#if defined(PLUGIN_ZEROEXPORT)
#ifndef __POWERMETER_H__
#define __POWERMETER_H__
@ -122,10 +124,10 @@ class powermeter {
}
}
/** groupGetPowermeter
/** getDataAVG
* Holt die Daten vom Powermeter
* @param group
* @returns true/false
* @returns value
*/
float getDataAVG(uint8_t group) {
float avg = 0.0;
@ -138,10 +140,10 @@ class powermeter {
return avg;
}
/** groupGetPowermeter
/** getDataMIN
* Holt die Daten vom Powermeter
* @param group
* @returns true/false
* @returns value
*/
float getDataMIN(uint8_t group) {
float min = 0.0;
@ -154,7 +156,7 @@ class powermeter {
return min;
}
/**
/** onMqttConnect
*
*/
void onMqttConnect(void) {
@ -173,7 +175,7 @@ class powermeter {
#endif /*defined(ZEROEXPORT_POWERMETER_MQTT)*/
}
/**
/** onMqttMessage
*
*/
void onMqttMessage(JsonObject obj) {
@ -253,7 +255,7 @@ class powermeter {
StaticJsonDocument<512> mqttDoc; // DynamicJsonDocument mqttDoc(512);
JsonObject mqttObj = mqttDoc.to<JsonObject>();
/**
/** setHeader
*
*/
void setHeader(HTTPClient *h) {
@ -285,8 +287,6 @@ class powermeter {
if (http.GET() == HTTP_CODE_OK) {
// Parsing
// http.getSize());
// TODO: Umstellen auf dynamische Größe
DynamicJsonDocument doc(2048);
DeserializationError error = deserializeJson(doc, http.getString());
if (error) {
@ -586,3 +586,5 @@ class powermeter {
};
#endif /*__POWERMETER_H__*/
#endif /* #if defined(PLUGIN_ZEROEXPORT) */

13
src/plugins/zeroExport/zeroExport.h

@ -181,6 +181,9 @@ class ZeroExport {
if ((e < CfgGroup->powerTolerance) && (e > -CfgGroup->powerTolerance)) {
e = 0;
mLog["eK"] = e;
sendLog();
clearLog();
return;
}
// Regler
@ -192,7 +195,12 @@ class ZeroExport {
int16_t yP = Kp * e;
CfgGroup->eSum += e;
int16_t yI = Ki * Ta * CfgGroup->eSum;
if (Ta == 0) return;
if (Ta == 0) {
mLog["Error"] = "Ta = 0";
sendLog();
clearLog();
return;
}
int16_t yD = Kd * (e - CfgGroup->eOld) / Ta;
if (mCfg->debug) {
@ -390,9 +398,6 @@ class ZeroExport {
void tickMidnight(void) {
if ((!mIsInitialized) || (!mCfg->enabled)) return;
// TODO: activate
return;
for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) {
if (!mCfg->groups[group].enabled) continue;

Loading…
Cancel
Save