Conversation
Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@79f3d049-9006-400d-9954-2e5dcd250fa9.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
…it bump version in pyproject.toml added to __init__.py Trims and Floor Data Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
…ses old key trims_data Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
- Add CARPET drawable element with configurable color and alpha - Implement carpet zone parsing from Valetudo JSON (PolygonMapEntity) - Add carpet rendering with customizable color (default: 50% of room_0) - Support disable_carpets flag to toggle carpet visibility - Fix COLORS list order to match base_color_keys mapping - Fix floor rendering to use correct MAP_BACKGROUND color - Add carpet color configuration to device_info Fixes color index mismatch that affected carpet and floor color updates Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
from_list Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Fixes carpet color/alpha from device_info not being applied due to missing DrawableElement.CARPET entry in update_from_device_info(). Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
…tial implementation attempt and is not needed since we're using the simpler approach of passing color_carpet directly from device_info to the zones() drawing method. Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
- Path width adjusts to robot_size - 2 when mop_mode=True (default: 5px) - Cache robot_size in ImageDraw for performance - Update handler to use cached robot_size - Test with mop_mode enabled in test.py When mop mode is active, path width visually represents mop coverage area. Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
…ileRenderer Remove dead code from MaterialTileRenderer class in material.py: - Deleted apply_overlay_on_region() static method (lines 210-223) - Method was never called anywhere in the codebase - Duplicated functionality already implemented in hypfer_draw._apply_material_overlay() - Removed implementation used inferior mask-based assignment vs proper alpha blending The active material overlay implementation in hypfer_draw.py continues to use: - MaterialTileRenderer.get_tile() for tile generation - MaterialTileRenderer.tile_block() for tile positioning - Proper alpha blending: region[:] = (1 - alpha) * region + alpha * overlay This cleanup eliminates 15 lines of unused code while maintaining all functional material overlay capabilities. Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Replace all hardcoded user_colors[x] array indices with a ColorIndex IntEnum to prevent breakage when color order changes and improve code maintainability. Changes: - Add ColorIndex IntEnum in config/colors.py with named constants for all user_colors array indices (WALL=0, ZONE_CLEAN=1, ROBOT=2, BACKGROUND=3, MOVE=4, CHARGER=5, CARPET=6, NO_GO=7, GO_TO=8, TEXT=9, MATERIAL_WOOD=10, MATERIAL_TILE=11) - Add 'material_wood' and 'material_tile' to COLORS list in const.py to match the actual colors being initialized - Replace user_colors[10] and user_colors[11] with ColorIndex.MATERIAL_WOOD and ColorIndex.MATERIAL_TILE in hypfer_draw.py - Replace user_colors[8] with ColorIndex.TEXT in config/utils.py Benefits: - Self-documenting code with named constants instead of magic numbers - Type-safe access to color indices - Easy to maintain and reorder colors without breaking existing code - Clear mapping between color names and their array positions Tested: Hypfer test passes successfully with all colors initialized correctly Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
…ovements ## Version Update - Bumped version to 0.2.0 across pyproject.toml, __init__.py, and README.md ## Color System Enhancements ### ColorIndex Enum Implementation - Created ColorIndex IntEnum with named constants for all user_colors array indices - Replaced hardcoded numeric indices (user_colors[8], [10], [11]) with type-safe enum constants - Prevents breakage when color order changes in the future - Updated hypfer_draw.py to use ColorIndex.MATERIAL_WOOD and ColorIndex.MATERIAL_TILE - Updated utils.py to use ColorIndex.TEXT for status text rendering ### Material Colors Refactoring - Refactored MaterialTileRenderer to use MaterialColors dataclass - Made material overlay colors (wood and tile) user-configurable via device_info - Removed hardcoded class variables WOOD_RGBA/TILE_RGBA and set_colors()/reset_colors() methods - All rendering methods now accept color parameters instead of using class state - Added material color constants to DEFAULT_VALUES (color_material_wood, color_material_tile) - Updated material overlay implementation to extract colors from shared.user_colors ### Color Initialization Fix - Fixed initialize_user_colors() to use same base_color_keys order as set_initial_colours() and ColorIndex enum - Prevents color index mismatches during initialization - Added 'material_wood' and 'material_tile' to COLORS list in const.py ### Color Blending Implementation - Implemented color blending for semi-transparent elements using mvcrender's sample_and_blend_color - Applied blending to flag, obstacles, and charger elements when alpha < 255 - Optimized alpha blending to minimize temporary allocations in zone drawing ### Path Color Enhancements - Updated default path color to more vibrant blue (50, 150, 255) for better visibility - Implemented mop mode path width adjustment: path_width = max(1, robot_size - 2) when mop_mode=True - Added robot_size caching in ImageDraw to reduce shared data access - Path lines now support different colors when crossing different rooms ### Alpha Transparency Updates - Updated default alpha values: path (200.0), walls (150.0) - Semi-transparent elements (restricted areas, no-mop areas, predicted path) default to alpha=125.0 ## Code Quality Improvements ### Logging Cleanup - Converted 24+ INFO logs to DEBUG level across 5 files to reduce production log noise - hypfer_handler.py: 5 logs converted - rand256_handler.py: 4 logs converted - hypfer_draw.py: 1 log converted + fixed misleading else clause - reimg_draw.py: 8 logs converted + fixed else clause pattern - drawable_elements.py: 6 logs converted + removed duplicate logging - Fixed misleading else-clause logging patterns in virtual walls and entity dict methods - Removed duplicate log statements in enable_element/disable_element methods ### Dead Code Removal - Removed unused material_mvcrender.py (test/alternative implementation) - Removed unused apply_overlay_on_region() static method from MaterialTileRenderer ## Documentation Updates - Updated Python requirement documentation from 3.12 to 3.13 in README.md - Added complete dependency list with version constraints: - Pillow (>=10.3.0) - NumPy (>=1.26.4) - SciPy (>=1.12.0) - mvcrender (==0.0.7) ## Performance Optimizations - Added mop_mode attribute to CameraShared class for tracking vacuum operation mode - Cached robot_size in ImageDraw to avoid repeated shared data access - Optimized color blending operations to reduce memory allocations ## Deferred Issues (Medium Priority) - Pylint disabled in CI since refactoring (to be re-enabled) - Potential null reference in _convert_to_binary when last_image is None - Room ID indexing inconsistency (0-based vs 1-based) - Potential race conditions in async shared data access - Hardcoded /tmp/ paths in tests (Windows incompatible) - Virtual walls logging pattern needs review Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
- Updated mvcrender dependency from 0.0.7 to 0.0.8 (critical trim swap fix) - Updated TrimsData.from_list() docstring to reflect actual implementation - Added investigation note for future parameter mapping review This patch release addresses critical autocrop trim coordinate handling with the updated mvcrender dependency. Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughVersion bumped to 0.2.1 across the module and mvcrender dependency updated to 0.0.8. TrimsData.clear now sets floor to "floor_0" instead of empty string. Both handler files now invoke update_trims() after auto-trim/zoom operations. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This patch release addresses critical autocrop trim coordinate handling
with the updated mvcrender dependency.
Summary by CodeRabbit
Bug Fixes
New Features
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.