From 283eae295ba5d9436759b4358c5cd9703dd8a761 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Mon, 10 Oct 2022 19:20:19 +0200 Subject: [PATCH] Show absolute limit in limit dialogue --- src/WebApi_limit.cpp | 1 + webapp/src/components/HomeView.vue | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/WebApi_limit.cpp b/src/WebApi_limit.cpp index fda74c5..cfcb21e 100644 --- a/src/WebApi_limit.cpp +++ b/src/WebApi_limit.cpp @@ -36,6 +36,7 @@ void WebApiLimitClass::onLimitStatus(AsyncWebServerRequest* request) ((uint32_t)(inv->serial() & 0xFFFFFFFF))); root[buffer]["limit_relative"] = inv->SystemConfigPara()->getLimitPercent(); + root[buffer]["max_power"] = inv->DevInfo()->getMaxPower(); LastCommandSuccess status = inv->SystemConfigPara()->getLastLimitCommandSuccess(); String limitStatus = "Unknown"; diff --git a/webapp/src/components/HomeView.vue b/webapp/src/components/HomeView.vue index 87b705c..eb3a550 100644 --- a/webapp/src/components/HomeView.vue +++ b/webapp/src/components/HomeView.vue @@ -173,13 +173,22 @@
-
+
%
+ +
+
+ + W +
+
@@ -341,7 +350,9 @@ export default defineComponent({ limitSettingLoading: true, currentLimit: 0, + currentLimitAbsolute: 0, successCommandLimit: "", + maxPower: 0, targetLimit: 0, targetLimitMin: 10, targetLimitMax: 100, @@ -494,7 +505,11 @@ export default defineComponent({ fetch("/api/limit/status") .then((response) => response.json()) .then((data) => { + this.maxPower = data[serial].max_power; this.currentLimit = data[serial].limit_relative; + if (this.maxPower > 0) { + this.currentLimitAbsolute = this.currentLimit * this.maxPower / 100; + } this.successCommandLimit = data[serial].limit_set_status; this.limitSettingSerial = serial; this.limitSettingLoading = false;