From 952a9c16907134d6638981c3f9c8272827e61840 Mon Sep 17 00:00:00 2001 From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:04:59 +0200 Subject: [PATCH] Add MAKER_ALCOHOL_FACTOR to scale base of cocktail alcohol --- docs/setup.md | 1 + src/config/config_manager.py | 3 +++ src/language.yaml | 3 +++ src/ui/setup_cocktail_selection.py | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/setup.md b/docs/setup.md index 715d6292..f62a29a7 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -56,6 +56,7 @@ They can be used at own risk of CocktailBerry not working 100% properly. | `MAKER_SEARCH_UPDATES` | Search for updates at program start | | `MAKER_CHECK_BOTTLE` | Check if there is enough of each ingredient left | | `MAKER_CLEAN_TIME` | Time the machine will execute the cleaning program | + | `MAKER_ALCOHOL_FACTOR` | Value to multiply alcoholic ingredients in all recipes | | `MAKER_MAX_HAND_INGREDIENTS` | Max x ingredients are allowed to add by hand | | `MAKER_CHECK_INTERNET` | Do a connection check at start for time adjustment window | | `MAKER_USE_RECIPE_VOLUME` | Do not scale but use defined amounts | diff --git a/src/config/config_manager.py b/src/config/config_manager.py index 639eb37d..c0758497 100644 --- a/src/config/config_manager.py +++ b/src/config/config_manager.py @@ -77,6 +77,8 @@ class ConfigManager: MAKER_SIMULTANEOUSLY_PUMPS: int = 16 # Time in seconds to execute clean program MAKER_CLEAN_TIME: int = 20 + # Base multiplier for alcohol in the recipe + MAKER_ALCOHOL_FACTOR: int = 100 # Option to invert pump direction MAKER_PUMP_REVERSION: bool = False # Pin used for the pump direction @@ -161,6 +163,7 @@ def __init__(self) -> None: "MAKER_PREPARE_VOLUME": ListType(IntType([build_number_limiter(25, 1000)], suffix="ml"), 1), "MAKER_SIMULTANEOUSLY_PUMPS": IntType([build_number_limiter(1, MAX_SUPPORTED_BOTTLES)]), "MAKER_CLEAN_TIME": IntType([build_number_limiter()], suffix="s"), + "MAKER_ALCOHOL_FACTOR": IntType([build_number_limiter(10, 200)], suffix="%"), "MAKER_PUMP_REVERSION": BoolType(), "MAKER_REVERSION_PIN": IntType([self._validate_pin_numbers]), "MAKER_SEARCH_UPDATES": BoolType(), diff --git a/src/language.yaml b/src/language.yaml index 8a5533e6..070620c8 100644 --- a/src/language.yaml +++ b/src/language.yaml @@ -571,6 +571,9 @@ ui: MAKER_CLEAN_TIME: en: 'Time in seconds the cleaning program is executed' de: 'Zeit in Sekunden, die das Reinigungsprogramm ausgeführt wird' + MAKER_ALCOHOL_FACTOR: + en: 'Value to scale alcoholic ingredients in each recipe. Use this to decrease/increase the alcohol level of all cocktails. Default is 100%' + de: 'Skalierungsfaktor für alkoholische Zutaten in jedem Rezept. Verwende diesen, um den Alkoholgehalt aller Cocktails zu verringern/erhöhen. Standard ist 100%' MAKER_PUMP_REVERSION: en: 'Enable the reversion of the pump direction, needs according hardware for reversion, usually a relay' de: 'Ermöglicht die Pumpenrichtung zu ändern, benötigt entsprechende Hardware, meist ein Relais' diff --git a/src/ui/setup_cocktail_selection.py b/src/ui/setup_cocktail_selection.py index 52836765..7af26f3c 100644 --- a/src/ui/setup_cocktail_selection.py +++ b/src/ui/setup_cocktail_selection.py @@ -100,7 +100,7 @@ def _scale_cocktail(self, amount: int | None = None): # overwrite the amount if the cocktail has a fixed volume if cfg.MAKER_USE_RECIPE_VOLUME: amount = self.cocktail.amount - factor = shared.alcohol_factor + factor = shared.alcohol_factor * (cfg.MAKER_ALCOHOL_FACTOR / 100) # remember this is percent is_virgin = self.virgin_checkbox.isChecked() if is_virgin: factor = 0