Implement Desktop MJS simulator bridges - #277
Merged
Merged
Conversation
jblanked
requested changes
Sep 3, 2026
| void lcd_js_screenshot(struct mjs *mjs) | ||
| { | ||
| #ifdef LCD_MP_READ_ROW | ||
| #ifdef DESKTOP |
Owner
There was a problem hiding this comment.
this should use LCD_MP_READ_ROW. a desktop version of that is better than implementing a separate approach
jblanked
requested changes
Sep 4, 2026
Comment on lines
+473
to
+517
|
|
||
| def display(): | ||
| value = sim_runtime.get_lcd() | ||
| return value if value is not None else lcd.LCD() | ||
|
|
||
| def draw_color(value): | ||
| if isinstance(value, str): | ||
| value = value.strip() | ||
| if value.startswith("#"): | ||
| value = value[1:] | ||
| elif value.lower().startswith("0x"): | ||
| value = value[2:] | ||
| try: | ||
| return int(value, 16) | ||
| except ValueError: | ||
| return 0 | ||
| return int(value) | ||
|
|
||
| def draw_method(name, color_index=None): | ||
| def call(*args): | ||
| values = list(args) | ||
| if color_index is not None: | ||
| while len(values) <= color_index: | ||
| values.append(0xFFFF) | ||
| values[color_index] = draw_color(values[color_index]) | ||
| return getattr(display(), "_" + name)(*values) | ||
|
|
||
| return call | ||
|
|
||
| methods = { | ||
| "char": ("char", 3), | ||
| "circle": ("circle", 3), | ||
| "clear": ("clear", 0), | ||
| "fillCircle": ("fill_circle", 3), | ||
| "fillRectangle": ("fill_rectangle", 4), | ||
| "fillRoundRectangle": ("fill_round_rectangle", 5), | ||
| "fillTriangle": ("fill_triangle", 6), | ||
| "line": ("line", 4), | ||
| "pixel": ("pixel", 2), | ||
| "rectangle": ("rectangle", 4), | ||
| "text": ("text", 3), | ||
| "triangle": ("triangle", 6), | ||
| } | ||
| for js_name, (name, color_index) in methods.items(): | ||
| module[js_name] = draw_method(name, color_index) |
| if self._fixture: | ||
| if self._websocket: | ||
| self._response += _websocket_frames(data) | ||
| self._request += data |
Owner
There was a problem hiding this comment.
Same for this file, just use the Picoware class
jblanked
approved these changes
Sep 4, 2026
jblanked
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
The broader simulator suite still has the separate pre-existing Library route-map mismatch for C/FlipSocial/Infrared.