mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-10 14:41:37 +02:00
0.8.103..13
This commit is contained in:
parent
1cf836fbfc
commit
cef417c555
3 changed files with 21 additions and 14 deletions
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 8
|
#define VERSION_MINOR 8
|
||||||
#define VERSION_PATCH 1030012
|
#define VERSION_PATCH 1030013
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t ch;
|
uint8_t ch;
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
// Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed
|
// Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if defined(PLUGIN_ZEROEXPORT)
|
||||||
|
|
||||||
#ifndef __POWERMETER_H__
|
#ifndef __POWERMETER_H__
|
||||||
#define __POWERMETER_H__
|
#define __POWERMETER_H__
|
||||||
|
|
||||||
|
@ -122,10 +124,10 @@ class powermeter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** groupGetPowermeter
|
/** getDataAVG
|
||||||
* Holt die Daten vom Powermeter
|
* Holt die Daten vom Powermeter
|
||||||
* @param group
|
* @param group
|
||||||
* @returns true/false
|
* @returns value
|
||||||
*/
|
*/
|
||||||
float getDataAVG(uint8_t group) {
|
float getDataAVG(uint8_t group) {
|
||||||
float avg = 0.0;
|
float avg = 0.0;
|
||||||
|
@ -138,10 +140,10 @@ class powermeter {
|
||||||
return avg;
|
return avg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** groupGetPowermeter
|
/** getDataMIN
|
||||||
* Holt die Daten vom Powermeter
|
* Holt die Daten vom Powermeter
|
||||||
* @param group
|
* @param group
|
||||||
* @returns true/false
|
* @returns value
|
||||||
*/
|
*/
|
||||||
float getDataMIN(uint8_t group) {
|
float getDataMIN(uint8_t group) {
|
||||||
float min = 0.0;
|
float min = 0.0;
|
||||||
|
@ -154,7 +156,7 @@ class powermeter {
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** onMqttConnect
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void onMqttConnect(void) {
|
void onMqttConnect(void) {
|
||||||
|
@ -173,7 +175,7 @@ class powermeter {
|
||||||
#endif /*defined(ZEROEXPORT_POWERMETER_MQTT)*/
|
#endif /*defined(ZEROEXPORT_POWERMETER_MQTT)*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** onMqttMessage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void onMqttMessage(JsonObject obj) {
|
void onMqttMessage(JsonObject obj) {
|
||||||
|
@ -253,7 +255,7 @@ class powermeter {
|
||||||
StaticJsonDocument<512> mqttDoc; // DynamicJsonDocument mqttDoc(512);
|
StaticJsonDocument<512> mqttDoc; // DynamicJsonDocument mqttDoc(512);
|
||||||
JsonObject mqttObj = mqttDoc.to<JsonObject>();
|
JsonObject mqttObj = mqttDoc.to<JsonObject>();
|
||||||
|
|
||||||
/**
|
/** setHeader
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void setHeader(HTTPClient *h) {
|
void setHeader(HTTPClient *h) {
|
||||||
|
@ -285,8 +287,6 @@ class powermeter {
|
||||||
|
|
||||||
if (http.GET() == HTTP_CODE_OK) {
|
if (http.GET() == HTTP_CODE_OK) {
|
||||||
// Parsing
|
// Parsing
|
||||||
// http.getSize());
|
|
||||||
// TODO: Umstellen auf dynamische Größe
|
|
||||||
DynamicJsonDocument doc(2048);
|
DynamicJsonDocument doc(2048);
|
||||||
DeserializationError error = deserializeJson(doc, http.getString());
|
DeserializationError error = deserializeJson(doc, http.getString());
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@ -586,3 +586,5 @@ class powermeter {
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*__POWERMETER_H__*/
|
#endif /*__POWERMETER_H__*/
|
||||||
|
|
||||||
|
#endif /* #if defined(PLUGIN_ZEROEXPORT) */
|
||||||
|
|
|
@ -181,6 +181,9 @@ class ZeroExport {
|
||||||
if ((e < CfgGroup->powerTolerance) && (e > -CfgGroup->powerTolerance)) {
|
if ((e < CfgGroup->powerTolerance) && (e > -CfgGroup->powerTolerance)) {
|
||||||
e = 0;
|
e = 0;
|
||||||
mLog["eK"] = e;
|
mLog["eK"] = e;
|
||||||
|
sendLog();
|
||||||
|
clearLog();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regler
|
// Regler
|
||||||
|
@ -192,7 +195,12 @@ class ZeroExport {
|
||||||
int16_t yP = Kp * e;
|
int16_t yP = Kp * e;
|
||||||
CfgGroup->eSum += e;
|
CfgGroup->eSum += e;
|
||||||
int16_t yI = Ki * Ta * CfgGroup->eSum;
|
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;
|
int16_t yD = Kd * (e - CfgGroup->eOld) / Ta;
|
||||||
|
|
||||||
if (mCfg->debug) {
|
if (mCfg->debug) {
|
||||||
|
@ -390,9 +398,6 @@ class ZeroExport {
|
||||||
void tickMidnight(void) {
|
void tickMidnight(void) {
|
||||||
if ((!mIsInitialized) || (!mCfg->enabled)) return;
|
if ((!mIsInitialized) || (!mCfg->enabled)) return;
|
||||||
|
|
||||||
// TODO: activate
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) {
|
for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) {
|
||||||
if (!mCfg->groups[group].enabled) continue;
|
if (!mCfg->groups[group].enabled) continue;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue