diff --git a/src/config/settings.h b/src/config/settings.h index 2b653fb9..ace54cfc 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -318,9 +318,9 @@ typedef struct { // PID controller float eSum; float eOld; - float Kp; - float Ki; - float Kd; + uint8_t Kp; + uint8_t Ki; + uint8_t Kd; float y; } zeroExportGroup_t; @@ -704,7 +704,7 @@ class settings { mCfg.plugin.zeroExport.groups[group].minimum = true; mCfg.plugin.zeroExport.groups[group].powerTolerance = 10; mCfg.plugin.zeroExport.groups[group].powerMax = 600; - mCfg.plugin.zeroExport.groups[group].Kp = -1; + mCfg.plugin.zeroExport.groups[group].Kp = 50; mCfg.plugin.zeroExport.groups[group].Ki = 0; mCfg.plugin.zeroExport.groups[group].Kd = 0; // @@ -1102,11 +1102,11 @@ class settings { if (obj.containsKey(F("powerMax"))) getVal(obj, F("powerMax"), &mCfg.plugin.zeroExport.groups[group].powerMax); if (obj.containsKey(F("Kp"))) - getVal(obj, F("Kp"), &mCfg.plugin.zeroExport.groups[group].Kp); + getVal(obj, F("Kp"), &mCfg.plugin.zeroExport.groups[group].Kp); if (obj.containsKey(F("Ki"))) - getVal(obj, F("Ki"), &mCfg.plugin.zeroExport.groups[group].Ki); + getVal(obj, F("Ki"), &mCfg.plugin.zeroExport.groups[group].Ki); if (obj.containsKey(F("Kd"))) - getVal(obj, F("Kd"), &mCfg.plugin.zeroExport.groups[group].Kd); + getVal(obj, F("Kd"), &mCfg.plugin.zeroExport.groups[group].Kd); } } diff --git a/src/plugins/zeroExport/zeroExport.h b/src/plugins/zeroExport/zeroExport.h index 572c07e9..c63ebad9 100644 --- a/src/plugins/zeroExport/zeroExport.h +++ b/src/plugins/zeroExport/zeroExport.h @@ -195,9 +195,9 @@ class ZeroExport { } // Regler - float Kp = CfgGroup->Kp; - float Ki = CfgGroup->Ki; - float Kd = CfgGroup->Kd; + float Kp = CfgGroup->Kp * -0.01; + float Ki = CfgGroup->Ki * -0.001; + float Kd = CfgGroup->Kd * -0.001; unsigned long Ta = Tsp - CfgGroup->lastRefresh; CfgGroup->lastRefresh = Tsp; int16_t yP = Kp * e; diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 3dd96d94..858e757d 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -869,9 +869,9 @@ class RestApi { objGroup[F("power")] = (int32_t)mConfig->plugin.zeroExport.groups[group].power; objGroup[F("powerTolerance")] = (uint8_t)mConfig->plugin.zeroExport.groups[group].powerTolerance; objGroup[F("powerMax")] = (uint16_t)mConfig->plugin.zeroExport.groups[group].powerMax; - objGroup[F("Kp")] = ah::round3((float)mConfig->plugin.zeroExport.groups[group].Kp); - objGroup[F("Ki")] = ah::round3((float)mConfig->plugin.zeroExport.groups[group].Ki); - objGroup[F("Kd")] = ah::round3((float)mConfig->plugin.zeroExport.groups[group].Kd); + objGroup[F("Kp")] = (uint8_t)mConfig->plugin.zeroExport.groups[group].Kp; + objGroup[F("Ki")] = (uint8_t)mConfig->plugin.zeroExport.groups[group].Ki; + objGroup[F("Kd")] = (uint8_t)mConfig->plugin.zeroExport.groups[group].Kd; } } #endif diff --git a/src/web/html/setup.html b/src/web/html/setup.html index 4d6ba40f..0dc4b521 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -1454,9 +1454,9 @@ divRow("{#ZE_GROUP_TAB_ADVANCED_MINIMUM}", cb_minimum), divRow("{#ZE_GROUP_TAB_ADVANCED_POWERTOLERANCE}", ml("input", {name: "powerTolerance", class: "text", type: "number", min: "0", max: "255", value: obj.powerTolerance}, null)), divRow("{#ZE_GROUP_TAB_ADVANCED_POWERMAX}", ml("input", {name: "powerMax", class: "text", type: "number", min: "0", max: "65535", value: obj.powerMax}, null)), - divRow("{#ZE_GROUP_TAB_ADVANCED_KP}", ml("input", {name: "Kp", class: "text", type: "number", min: "-1", max: "0", step: "0.001", value: obj.Kp}, null)), - divRow("{#ZE_GROUP_TAB_ADVANCED_KI}", ml("input", {name: "Ki", class: "text", type: "number", min: "-0.01", max: "0", step: "0.001", value: obj.Ki}, null)), - divRow("{#ZE_GROUP_TAB_ADVANCED_KD}", ml("input", {name: "Kd", class: "text", type: "number", min: "-0.01", max: "0", step: "0.001", value: obj.Kd}, null)), + divRow("{#ZE_GROUP_TAB_ADVANCED_KP}", ml("input", {name: "Kp", class: "text", type: "number", min: "0", max: "100", step: "1", value: obj.Kp}, null)), + divRow("{#ZE_GROUP_TAB_ADVANCED_KI}", ml("input", {name: "Ki", class: "text", type: "number", min: "0", max: "100", step: "1", value: obj.Ki}, null)), + divRow("{#ZE_GROUP_TAB_ADVANCED_KD}", ml("input", {name: "Kd", class: "text", type: "number", min: "0", max: "100", step: "1", value: obj.Kd}, null)), // TODO: Uebersetzen mit lang.json und auf die entsprechende Dokuseite verlinken divRow("Hinweis: ", ml("a", {href: "https://docs.ahoydtu.de/de/latest/zeroExport.html"}, "Bitte beachten Sie die Ausfüllhinweise in der Dokumentation."),), // TODO: Hinweis Github/Discord - Entfernen wenn erledigt @@ -1734,7 +1734,7 @@ o.power = 0; o.powerTolerance = 10; o.powerMax = 600; - o.Kp = -1; + o.Kp = 50; o.Ki = 0; o.Kd = 0; // Global