From 8b787c8b96c7d0b64cf3081e53e45dbe65c721d2 Mon Sep 17 00:00:00 2001 From: Darcraytore1 <57347517+Darcraytore1@users.noreply.github.com> Date: Wed, 26 Jun 2024 04:36:35 -0700 Subject: [PATCH] set power with percentage (#104) * set power with percentage * set power with value or percentage --------- Co-authored-by: Damien Albisson --- panduza/interfaces/blc.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/panduza/interfaces/blc.py b/panduza/interfaces/blc.py index ea8d411..9ef3b33 100644 --- a/panduza/interfaces/blc.py +++ b/panduza/interfaces/blc.py @@ -87,10 +87,15 @@ def set_mode_constant_power(self): def set_mode_constant_current(self): self.mode.value.set("constant_current") - # Set power value - def set_power_goal_point(self, value): + # Set power value directly with value + def set_power_value(self, value): self.power.value.set(value) + # Set power value with percentage (0% to 100%) + def set_power_with_percentage(self, percentage): + value_with_percentage = (1/100) * percentage * self.power.max.get() + self.power.value.set(value_with_percentage) + def get_power_min_value(self): return self.power.min.get()