diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 0000000..58d8f26 --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,69 @@ +History +== + +0.4.0 (2025-11-19) +-- +* Feature +1. Add RGB support for Env module v2.x+ + - New properties: `red`, `green`, `blue`, `white`, `black` + - New properties: `color_class` (0-5: unknown/red/green/blue/white/black) + - New property: `brightness` (0-100%) + - Automatic version detection (v1.x: not supported, v2.x+: supported) +2. Enhanced GitHub Actions workflows + - Support Python 3.8-3.13 across all platforms + - Platform-specific compatibility fixes (macOS, Windows) + - Improved CI/CD with conditional linting (flake8 for 3.8-3.11, ruff for 3.12+) + +* Tests +1. Add 31 new RGB-related tests + - Version compatibility tests + - RGB property tests + - Data type validation tests + - Total: 94 tests (all passing) + +* Documentation +1. Complete RGB feature documentation +2. GitHub Actions compatibility guides +3. Branch protection setup guide + +0.3.0 (2023-01-19) +-- +* Feature +1. Add `draw_dot` function on display module + +* Patch +1. Fix `write_text` function error on display module if text length is 23 +2. Change module constructor argument from uuid to id + +0.2.1 (2022-12-02) +-- +* Patch +1. Refactor `write_text` input type on display module + +0.2.0 (2022-12-02) +-- +* Feature +1. Refactor getter/setter for each MODI+ module + +0.1.1 (2022-11-23) +-- +* Feature +1. Change python minimum version to 3.7 + +0.1.0 (2022-11-22) +-- +* Feature +1. Add creation examples (brush, dodge) +2. Add network, battery module functions +3. Fix `play_music` function on speaker module +4. Add preset resource on speaker and display module +5. Add search module time and timeout exception + +0.0.2 (2022-11-18) +-- +* Feature +1. Change python minimum version to 3.9 + +0.0.1 (2022-11-15) +-- +* Release initial version of the package on in-house GitHub diff --git a/examples/basic_usage_examples/env_rgb_example.py b/examples/basic_usage_examples/env_rgb_example.py index 4dbd2f4..41df279 100644 --- a/examples/basic_usage_examples/env_rgb_example.py +++ b/examples/basic_usage_examples/env_rgb_example.py @@ -1,9 +1,14 @@ -"""Example of using Env module RGB properties +"""Example of using Env module RGB and color properties -This example demonstrates how to use the RGB color sensor properties -of the Env module. RGB properties are only available in version 2.x and above. +This example demonstrates how to use the color sensor properties +of the Env module including: +- RGB (red, green, blue) values +- White and Black values +- Color class detection (red/green/blue/white/black/unknown) +- Brightness value -Note: This example tests ALL connected Env modules. +Note: These properties are only available in version 2.x and above. +This example tests ALL connected Env modules. """ import modi_plus @@ -36,7 +41,7 @@ def test_env_module(env, index): bundle = modi_plus.MODIPlus() print("=" * 60) - print("Env Module RGB Example - Multi-Module Support") + print("Env Module Color Sensor Example - Multi-Module Support") print("=" * 60) # Check how many Env modules are connected @@ -57,17 +62,37 @@ def test_env_module(env, index): # If any module supports RGB, start continuous reading if rgb_supported_modules: print(f"\n{'=' * 60}") - print(f"Reading RGB values from {len(rgb_supported_modules)} module(s)") + print(f"Reading color sensor values from {len(rgb_supported_modules)} module(s)") print("Press Ctrl+C to stop") print(f"{'=' * 60}\n") + # Color class 이름 매핑 + color_names = { + 0: "unknown", + 1: "red", + 2: "green", + 3: "blue", + 4: "white", + 5: "black" + } + try: while True: - # Read and display RGB from all supported modules + # Read and display all color properties from all supported modules for idx, env in rgb_supported_modules: try: r, g, b = env.rgb - print(f"Module #{idx + 1}: RGB=({r:3d}, {g:3d}, {b:3d})", end=" ") + white = env.white + black = env.black + color_class = env.color_class + brightness = env.brightness + color_name = color_names.get(color_class, "unknown") + + print(f"Module #{idx + 1}: ", end="") + print(f"RGB=({r:3d},{g:3d},{b:3d}) ", end="") + print(f"W={white:3d} B={black:3d} ", end="") + print(f"Bright={brightness:3d} ", end="") + print(f"Color={color_name:7s}", end=" ") except Exception as e: print(f"Module #{idx + 1}: Error - {e}", end=" ")