Skip to content

Modify function to append dummy clear value if not provided #1231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Enabled `hyphens: auto` globally (with exceptions) to prevent overflow with longer words (#1215)
- Removed fixed size from `ProjectBar` to prevent overflow when text wraps (#1221)
- Added missing translation strings (#1222)
- Changed `colour_raw` to now correctly return a 4-tuple (R, G, B, Clear) in simulation

## Changed

Expand Down
11 changes: 9 additions & 2 deletions public/shims/sense_hat/sense_hat_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,14 @@ def max_raw(self):

@property
def colour_raw(self):
return _ish.colourRead()
"""
Ensure a 4 length tuple is returned even if simulation only provides 3 values
"""
data = _ish.colourRead()
if len(data) == 3:
data.append(256) # Append dummy Clear value
return tuple(data)


@property
def red_raw(self):
Expand Down Expand Up @@ -1507,7 +1514,7 @@ def get_compass(self):
# but the emulator cannot do fusionPose as we derive everything from the orientation.
# Therefore, we a shortcut and read directly from our internal module that applies compass tilt compensation algorithm
# and returns the heading in radians.

deg = math.degrees(_ish.headingRead())

return deg + 360 if deg < 0 else deg
Expand Down
Loading