Skip to content

Conversation

@THEb0nny
Copy link
Contributor

@THEb0nny THEb0nny commented Mar 19, 2024

After switching to pxt-core v10, fieldmotors break.
Related to this.

I understand that these changes should be considered after this
#1048

microsoft/pxt-microbit#5496
microsoft/pxt#9865

@THEb0nny
Copy link
Contributor Author

Fixed all fields field_motors, field_ports, field_brickbuttons, field_music except field_color. When choosing a color, the color does not change. There is no error in the console.

Replacing ports with images. field ports has been removed. Almost completely repeats the functionality.
@THEb0nny
Copy link
Contributor Author

THEb0nny commented Mar 20, 2024

Replacing field ports to images. field ports has been removed. Almost completely repeats the functionality.

All sensor blocks that used field_ports had to register this. I don’t know how it could have been done differently without repeating these lines.

this.fieldOptions.columns="4"
this.fieldOptions.width="300"

Accidentally added field_colors changes to this commit. He's not ready. There are no errors, but the color selection does not work.

Where did turnRatio come from?
The last change to field_colour removed the addition of className. It’s not clear for what reason, but I’m adding it myself now.
The new version of FieldColorNumber does not apply applyColour() inside the doValueUpdate_() method. Secondly, the applyColour() method was redesigned in the new version so that it no longer worked with this enum code.
@THEb0nny
Copy link
Contributor Author

The colorenum field has been fixed.

@THEb0nny
Copy link
Contributor Author

@jwunderl @riknoll can someone see all the changes?

@abchatra abchatra requested review from Copilot and riknoll June 17, 2025 23:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades to pxt-core v11 and pxt-common-packages v12, updates block field editors across sensor libraries to use image pickers with layout options, refactors custom field editor implementations, and adds EV3 debugging and improved serial-buffer parsing.

  • Bump pxt-core and pxt-common-packages versions in package.json
  • Switch block fieldEditors from "ports" to "images" with new fieldOptions in sensor libs
  • Restructure/refactor fieldeditors (motors, music, color, brickbuttons) and update reference paths
  • Add dumpInputCmd/dumpOutputCmd helpers in editor/wrap.ts and enhance buffer parsing in editor/deploy.ts

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json Updated pxt-core/pxt-common-packages versions
libs/*/ultrasonic-sensor/ultrasonic.ts Changed fieldEditor to "images" with columns/width options
libs/storage/storage-core.ts Moved Separators enum out of namespace and rewrapped namespace
fieldeditors/field_motors.ts Refactored FieldMotors rendering and dropdown logic
editor/wrap.ts Added dumpInputCmd/dumpOutputCmd for detailed HF2 logging
editor/deploy.ts Improved WebSerialPackageIO bufferSize method and parsing logic

Comment on lines +1 to +8
enum Separators {
//% block="comma"
Comma,
//% block="semicolon"
Semicolon
}

export enum Separators {
//% block="comma"
Comma,
//% block="semicolon"
Semicolon
}
namespace storage {
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving Separators to the top-level without export and outside namespace storage breaks references to storage.Separators. Re-export it inside namespace storage or add export.

Suggested change
enum Separators {
//% block="comma"
Comma,
//% block="semicolon"
Semicolon
}
export enum Separators {
//% block="comma"
Comma,
//% block="semicolon"
Semicolon
}
namespace storage {
namespace storage {
export enum Separators {
//% block="comma"
Comma,
//% block="semicolon"
Semicolon
}

Copilot uses AI. Check for mistakes.
Comment on lines +90 to +97
console.warn(`Received larger bufer then command command: ${buffer.length} recieved but waiting for ${size}`);
let tmp = buffer.slice(0, size - 1);
this.onData(new Uint8Array(tmp));
tmp = buffer.slice(size, buffer.length - 1);
buffer = tmp;
console.debug(`Next buffer size: ${this.bufferSize(buffer)}`);
} else {
console.warn("Incomplete command " + size);
console.warn(`Incomplete command: ${buffer.length} recieved but waiting for ${size}. Keep waiting...`);
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix spelling and grammar: "bufer" → "buffer", "then" → "than", and "recieved" → "received".

Copilot uses AI. Check for mistakes.
Comment on lines +91 to +93
let tmp = buffer.slice(0, size - 1);
this.onData(new Uint8Array(tmp));
tmp = buffer.slice(size, buffer.length - 1);
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using slice(0, size - 1) drops the last byte of the intended payload. It should be slice(0, size) to include all bytes of the frame header and body.

Suggested change
let tmp = buffer.slice(0, size - 1);
this.onData(new Uint8Array(tmp));
tmp = buffer.slice(size, buffer.length - 1);
let tmp = buffer.slice(0, size);
this.onData(new Uint8Array(tmp));
tmp = buffer.slice(size, buffer.length);

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember what this change was connected with, but Bluetooth download didn't break for me.

Fix for no voice acting when mouse is hovered. But console shows error:
Uncaught (in promise) AbortError: The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22
@THEb0nny
Copy link
Contributor Author

@abchatra @riknoll pr is not ready yet.
So far, support is not completed, without it the appearance is very broken, but I am in the process, although it is difficult for me to figure it out, although I look at other Microbit and Arcade projects.
And there are some mistakes that do not seem to affect the functionality, but are displayed in the console.
For example, there is a simulator crash, I have not reached that yet.

If they gave me some tips how to solve or something was not the best made, it would be great.

THEb0nny added 8 commits June 18, 2025 08:58
There is a problem in pxsim.AudioContextManager, which manifests itself in the fact that if you quickly move the mouse cursor, an error appears in the console:
Uncaught (in promise) AbortError: The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22
Replacing substr with slice.
Optimized the withdrawal of logs about file download. DumpinPutCmd Reply Status should have been by BYTE 6, not 5. Fixed.
Change to allow the use of underscores in file names.
Return scroll for default blocklyDropDownContent class.
@THEb0nny
Copy link
Contributor Author

THEb0nny commented Jul 1, 2025

Scrolling is missing in the new version of blockly. Scroll y had to be returned.
image

An error that prevented the simulator from starting, citing errors when executing brick.readButtons() and hashDevices(). Simulator crashed, no error handler Error: TypeError: Expected type Buffer but received type object.

Here buf() simply returns an object with a data: Uint8Array field, not a real Buffer (i.e. RefBuffer), which the PXT runtime expects.

The BufferMethods.slice, getNumber, etc. methods expect an object with a Buffer prototype and methods, not a raw JS object { data: Uint8Array }.

By returning a full Buffer from buf() you fix this.
@THEb0nny
Copy link
Contributor Author

Fixed simulator crash in last commit.

@THEb0nny THEb0nny changed the title Bump pxt 10 and some other changes Bump pxt 12.x and some other changes Aug 5, 2025
@THEb0nny
Copy link
Contributor Author

THEb0nny commented Nov 21, 2025

I noticed one thing: the EV3 code stops immediately after loading. I don't understand what's causing this. And I don't understand when this happened. I don't remember if I tested it on hardware right away when creating the PR.

@abchatra @riknoll Is this related to the need to update the runtime due to increased pxt-core versions? core---linux?

@abchatra
Copy link
Collaborator

We haven't done any intentional change and don't have bandwidth either to debug.

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.

2 participants