Skip to content

bump version to 0.2.1 with mvcrender 0.0.8 dependency update#43

Merged
sca075 merged 32 commits intomainfrom
dev_main
Jan 25, 2026
Merged

bump version to 0.2.1 with mvcrender 0.0.8 dependency update#43
sca075 merged 32 commits intomainfrom
dev_main

Conversation

@sca075
Copy link
Owner

@sca075 sca075 commented Jan 25, 2026

  • 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.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed default floor value initialization in trim data clearing operations.
  • New Features

    • Added automatic crop area refresh following auto-trim and zoom operations.
  • Documentation

    • Enhanced documentation for trim data input format and clearing behavior.
  • Chores

    • Version bumped to 0.2.1.
    • Updated mvcrender dependency to 0.0.8.

✏️ Tip: You can customize this high-level summary in your review settings.

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>
@sca075 sca075 self-assigned this Jan 25, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Version 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

Cohort / File(s) Summary
Version & Dependency Updates
SCR/__init__.py, SCR/valetudo_map_parser/__init__.py, pyproject.toml
Bumped module version from 0.2.0 to 0.2.1 and mvcrender dependency from 0.0.7 to 0.0.8
TrimsData Configuration
SCR/valetudo_map_parser/config/types.py
Updated from_list docstring with crop_area format details; changed clear method to initialize floor field to "floor_0" instead of empty string
Handler trim Updates
SCR/valetudo_map_parser/hypfer_handler.py, SCR/valetudo_map_parser/rand256_handler.py
Added update_trims() call in _draw_map_elements after auto-trim/zoom operations to refresh shared crop values

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • PR #29: Both modify TrimsData.from_list and introduce/integrate update_trims() calls in handlers, indicating overlapping trim-handling changes
  • PR #37: Shares changes to TrimsData floor field defaults and update_trims() integration for trim/floor handling
  • PR #21: Both modify the same handler files (hypfer_handler.py, rand256_handler.py) with trim-related logic updates

Suggested labels

bug

Poem

🐰 A hop and a bump to two-point-one,
Mvcrender's dancing, updates are done,
Trims now whisper "floor_zero" with glee,
Handlers refresh their crop values, free!
Our map parser bounds with renewed delight,
Each auto-trim call shining so bright! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: version bump to 0.2.1 and mvcrender dependency update to 0.0.8, which are the primary modifications evident in pyproject.toml and version strings throughout the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 93.75% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sca075 sca075 merged commit b0d6c12 into main Jan 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant