Skip to content

Commit a9fa14f

Browse files
Merge pull request #401 from AndreWohnsland/dev
Add led preparation state control
2 parents dc2d5df + 2c94bc1 commit a9fa14f

File tree

13 files changed

+64
-215
lines changed

13 files changed

+64
-215
lines changed

docs/pictures/CocktailBerry.svg

Lines changed: 1 addition & 91 deletions
Loading

docs/pictures/CocktailBerry_k.svg

Lines changed: 0 additions & 92 deletions
This file was deleted.

docs/setup.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,20 @@ They can be used at own risk of CocktailBerry not working 100% properly.
6565
??? info "List Hardware Config Values"
6666
Hardware config values are used to configure and enable the connected hardware.
6767

68-
| Value Name | Description |
69-
| :--------------------- | :--------------------------------------------------------------------------------------- |
70-
| `PUMP_CONFIG` | List with config for each pump: pin, volume flow, tube volume to pump up |
71-
| `LED_PINS` | List of pins connected to LEDs for preparation |
72-
| `LED_BRIGHTNESS` | Brightness for the WS281x LED (1-255) |
73-
| `LED_COUNT` | Number of LEDs on the WS281x |
74-
| `LED_NUMBER_RINGS` | Number of IDENTICAL daisy chained WS281x LED rings |
75-
| `LED_DEFAULT_ON` | Always turn on to a white LED by default |
76-
| `LED_IS_WS` | Is the led a controllable WS281x LED, [see also](troubleshooting.md#get-the-led-working) |
77-
| `RFID_READER` | Enables connected RFID reader, [more info](troubleshooting.md#set-up-rfid-reader) |
78-
| `MAKER_PINS_INVERTED` | [Inverts](faq.md#what-is-the-inverted-option) pin signal (on=low, off=high) |
79-
| `MAKER_PUMP_REVERSION` | Enables reversion (direction) of pump |
80-
| `MAKER_REVERSION_PIN` | [Pin](#configuring-the-pins-or-used-board) which triggers reversion |
68+
| Value Name | Description |
69+
| :---------------------- | :--------------------------------------------------------------------------------------- |
70+
| `PUMP_CONFIG` | List with config for each pump: pin, volume flow, tube volume to pump up |
71+
| `LED_PINS` | List of pins connected to LEDs for preparation |
72+
| `LED_BRIGHTNESS` | Brightness for the WS281x LED (1-255) |
73+
| `LED_COUNT` | Number of LEDs on the WS281x |
74+
| `LED_NUMBER_RINGS` | Number of IDENTICAL daisy chained WS281x LED rings |
75+
| `LED_DEFAULT_ON` | Always turn on to a white LED by default |
76+
| `LED_PREPARATION_STATE` | Set LED state/effect during preparation (e.g. color effects, on, off) |
77+
| `LED_IS_WS` | Is the led a controllable WS281x LED, [see also](troubleshooting.md#get-the-led-working) |
78+
| `RFID_READER` | Enables connected RFID reader, [more info](troubleshooting.md#set-up-rfid-reader) |
79+
| `MAKER_PINS_INVERTED` | [Inverts](faq.md#what-is-the-inverted-option) pin signal (on=low, off=high) |
80+
| `MAKER_PUMP_REVERSION` | Enables reversion (direction) of pump |
81+
| `MAKER_REVERSION_PIN` | [Pin](#configuring-the-pins-or-used-board) which triggers reversion |
8182

8283
??? info "List Software Config Values"
8384
Software config values are used to configure additional connected software and its behavior.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "CocktailBerry"
3-
version = "2.6.2"
3+
version = "2.7.0"
44
description = "A Python and Qt based App for a Cocktail Machine on a Raspberry Pi. Easily serve Cocktails with Raspberry Pi and Python"
55
authors = [{ name= "Andre Wohnsland" , email = "cocktailmakeraw@gmail.com" }]
66
readme = "readme.md"

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<img src="docs/pictures/CocktailBerry.svg" alt="CocktailBerry"/>
22

3+
<br/>
4+
35
![GitHub release (latest by date)](https://img.shields.io/github/v/release/AndreWohnsland/CocktailBerry)
46
![GitHub Release Date](https://img.shields.io/github/release-date/AndreWohnsland/CocktailBerry)
57
![Python Version](https://img.shields.io/badge/python-%3E%3D%203.11-blue)

src/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from typing import Literal
22

3-
__version__ = "2.6.2"
3+
__version__ = "2.7.0"
44
PROJECT_NAME = "CocktailBerry"
55
MAX_SUPPORTED_BOTTLES = 24
66
SupportedLanguagesType = Literal["en", "de"]
77
SupportedThemesType = Literal["default", "bavaria", "alien", "berry", "tropical", "purple", "custom"]
88
SupportedRfidType = Literal["No", "MFRC522", "PiicoDev"]
9+
SupportedLedStatesType = Literal["Off", "On", "Effect"]
910
NEEDED_PYTHON_VERSION = (3, 9)
1011
FUTURE_PYTHON_VERSION = (3, 11)

src/config/config_manager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
MAX_SUPPORTED_BOTTLES,
1515
PROJECT_NAME,
1616
SupportedLanguagesType,
17+
SupportedLedStatesType,
1718
SupportedRfidType,
1819
SupportedThemesType,
1920
__version__,
@@ -120,6 +121,8 @@ class ConfigManager:
120121
LED_NUMBER_RINGS: int = 1
121122
# Turns the led always on to a white when not doing anything else
122123
LED_DEFAULT_ON: bool = False
124+
# LED does things during Preparation (e.g. on or color effects)
125+
LED_PREPARATION_STATE: SupportedLedStatesType = "Effect"
123126
# If the led is as ws-x series (and controllable)
124127
LED_IS_WS: bool = True
125128
# if a RFID reader exists
@@ -195,6 +198,7 @@ def __init__(self) -> None:
195198
"LED_COUNT": IntType([build_number_limiter(1, 500)]),
196199
"LED_NUMBER_RINGS": IntType([build_number_limiter(1, 10)]),
197200
"LED_DEFAULT_ON": BoolType(check_name="Default On"),
201+
"LED_PREPARATION_STATE": ChooseOptions.leds,
198202
"LED_IS_WS": BoolType(check_name="WS281x"),
199203
"RFID_READER": ChooseOptions.rfid,
200204
"MICROSERVICE_ACTIVE": BoolType(check_name="Microservice Active"),

src/config/config_types.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
from dataclasses import dataclass, field
1111
from typing import Any, Callable, Generic, Protocol, TypeVar, get_args
1212

13-
from src import SupportedLanguagesType, SupportedRfidType, SupportedThemesType
13+
from src import SupportedLanguagesType, SupportedLedStatesType, SupportedRfidType, SupportedThemesType
1414
from src.config.errors import ConfigError
1515

1616
SUPPORTED_LANGUAGES = list(get_args(SupportedLanguagesType))
1717
SUPPORTED_THEMES = list(get_args(SupportedThemesType))
1818
SUPPORTED_RFID = list(get_args(SupportedRfidType))
19+
SUPPORTED_LED_STATES = list(get_args(SupportedLedStatesType))
1920

2021

2122
class ConfigInterface(Protocol):
@@ -66,6 +67,7 @@ class ChooseOptions:
6667
language = ChooseType(allowed=SUPPORTED_LANGUAGES)
6768
rfid = ChooseType(allowed=SUPPORTED_RFID)
6869
theme = ChooseType(allowed=SUPPORTED_THEMES)
70+
leds = ChooseType(allowed=SUPPORTED_LED_STATES)
6971

7072

7173
@dataclass

src/dialog_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def _choose_language(self, dialog_name: str, **kwargs: Any) -> str:
161161
return tmpl.format(**kwargs)
162162

163163
def standard_box(self, message: str, title: str = "", use_ok: bool = False, close_time: int | None = None) -> bool:
164-
"""Display the messagebox for the Maker. Uses a Custom QDialog with Close-Button. Blocks until closed."""
164+
"""Display the messagebox for the Maker. Blocks until closed."""
165165
from src.ui.setup_custom_dialog import CustomDialog
166166

167167
if not title:

src/language.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,9 @@ ui:
670670
LED_DEFAULT_ON:
671671
en: 'LED is on by default, use white LED color. Still use colors during preparation.'
672672
de: 'LED ist standardmäßig an, verwendet weiße LED Farbe. Verwendet immer noch Farben-Zyklus während der Zubereitung.'
673+
LED_PREPARATION_STATE:
674+
en: 'LED state during preparation, on/off/effects.'
675+
de: 'LED Zustand während der Zubereitung, an/aus/Effekte.'
673676
LED_IS_WS:
674677
en: 'Is the LED a controllable (WS281x) LED'
675678
de: 'Ist der LED ein ansteuerbarer (WS281x) LED'

0 commit comments

Comments
 (0)