Skip to content

Conversation

@Adityacode-hub
Copy link

This PR improves the color sensor logic in SensorsBlocks.js by cleaning up duplicate methods, fixing RGB component issues, and improving documentation clarity.

🔧 Changes Made

🗑️ Removed redundant method getPixelDataFromMedia()

🔄 Unified pixel data extraction into a single method getPixelData()

🎨 Fixed incorrect RGB component indexing in color blocks

🧾 Improved JSDoc comments for clarity and accuracy

⚙️ Enhanced error handling for invalid or missing media blocks

✨ Minor refactoring for readability and consistency

✅ Benefits

Reduces code duplication and complexity

Improves maintainability and readability

Ensures accurate RGB value extraction

Provides better documentation for future contributors

🧪 Testing

Verified color sensor outputs manually

Confirmed no regressions in color block functionality

All unit tests passed successfully

📎 File Updated

SensorsBlocks.js

Adityacode-hub and others added 8 commits November 3, 2025 16:02
- Eliminated duplicate getPixelDataFromMedia method by merging functionality into getPixelData
- Updated arg method to use unified getPixelData method
- Fixed color component indexing in GetBlueBlock and GetGreenBlock
- Improved code organization and documentation
- Added proper error handling
- Maintained backward compatibility with existing tests

This change makes the code more maintainable by following DRY principles
while preserving all existing functionality.
…el data handling

- Removed duplicate getPixelDataFromMedia method
- Merged pixel data handling into unified getPixelData method
- Updated arg method to use the consolidated getPixelData
- Improved error handling and documentation
- Fixed RGB component indexing in GetBlueBlock and GetGreenBlock
- Made code more maintainable and DRY

This change eliminates code duplication while preserving all functionality
and improving error handling across the SensorsBlocks implementation.
@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2025

✅ All Jest tests passed! This PR is ready to merge.

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