fix(boards): 修复micropython_esp32c5下 板载显示 转代码异常

This commit is contained in:
王立帮
2026-01-12 09:26:40 +08:00
parent 3cc7584660
commit 18ea44a38e
3 changed files with 35 additions and 44 deletions

View File

@@ -10,9 +10,9 @@ export const display_show_image = {
.setCheck([String, "esp32_image", "List", 'Tuple'])
.appendField(Blockly.Msg.MIXLY_ESP32_SHOW_IMAGE_OR_STRING);
var version = Boards.getSelectedBoardKey()
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
this.appendValueInput('boolean')
.appendField( Blockly.Msg.MIXLY_synchronize);
.appendField(Blockly.Msg.MIXLY_synchronize);
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
@@ -38,9 +38,9 @@ export const display_show_image_or_string_delay = {
[Blockly.Msg.MICROPYTHON_DISPLAY_YES, "True"],
[Blockly.Msg.MICROPYTHON_DISPLAY_NO, "False"]
]), 'center')
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
this.appendValueInput('boolean')
.appendField( Blockly.Msg.MIXLY_synchronize);
.appendField(Blockly.Msg.MIXLY_synchronize);
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
@@ -97,11 +97,11 @@ export const display_scroll_way = {
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_SETTING + Blockly.Msg.MIXLY_DISPLAY_SCROLL_WAY)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.MIXLY_GAME_UP,"0"],
[Blockly.Msg.MIXLY_GAME_DOWN,"1"],
[Blockly.Msg.MIXLY_GAME_RIGHT,"2"],
[Blockly.Msg.MIXLY_GAME_LEFT,"3"]
]),"way");;
[Blockly.Msg.MIXLY_GAME_UP, "0"],
[Blockly.Msg.MIXLY_GAME_DOWN, "1"],
[Blockly.Msg.MIXLY_GAME_RIGHT, "2"],
[Blockly.Msg.MIXLY_GAME_LEFT, "3"]
]), "way");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setInputsInline(true);
@@ -301,10 +301,9 @@ export const display_shift = {
.setCheck(Number);
this.appendDummyInput('')
.appendField(Blockly.Msg.DISPLAY_IMAGE_UNIT)
var version = Boards.getSelectedBoardKey()
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
this.appendValueInput('boolean')
.appendField( Blockly.Msg.MIXLY_synchronize);
.appendField(Blockly.Msg.MIXLY_synchronize);
}
var thisBlock = this;
this.setTooltip(function () {
@@ -394,10 +393,9 @@ export const display_clear = {
this.setColour(DISPLAY_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_MICROBIT_Clear_display);
var version = Boards.getSelectedBoardKey()
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
this.appendValueInput('boolean')
.appendField( Blockly.Msg.MIXLY_synchronize);
.appendField(Blockly.Msg.MIXLY_synchronize);
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
@@ -1114,10 +1112,9 @@ export const onboard_tft_show_image_xy = {
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_NUMBER);
this.appendValueInput('VAR')
.appendField(Blockly.Msg.HTML_COLOUR);
var version = Boards.getSelectedBoardKey()
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
this.appendValueInput('boolean')
.appendField( Blockly.Msg.MIXLY_synchronize );
.appendField(Blockly.Msg.MIXLY_synchronize);
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
@@ -1169,10 +1166,9 @@ export const onboard_tft_show_image_or_string_delay = {
]), 'center')
this.appendValueInput('VAR')
.appendField(Blockly.Msg.HTML_COLOUR);
var version = Boards.getSelectedBoardKey()
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
this.appendValueInput('boolean')
.appendField( Blockly.Msg.MIXLY_synchronize);
.appendField(Blockly.Msg.MIXLY_synchronize);
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
@@ -1385,10 +1381,9 @@ export const onboard_tft_bright_point = {
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_PLOT_POINT_Y);
this.appendValueInput('VAR')
.appendField(Blockly.Msg.HTML_COLOUR);
var version = Boards.getSelectedBoardKey()
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
this.appendValueInput('boolean')
.appendField( Blockly.Msg.MIXLY_synchronize);
.appendField(Blockly.Msg.MIXLY_synchronize);
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
@@ -1402,10 +1397,9 @@ export const onboard_tft_fill = {
this.setColour(DISPLAY_ONBOARD_HUE);
this.appendValueInput('VAR')
.appendField(Blockly.Msg.MIXLY_SCREEN_FILL);
var version = Boards.getSelectedBoardKey()
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
this.appendValueInput('boolean')
.appendField( Blockly.Msg.MIXLY_synchronize);
.appendField(Blockly.Msg.MIXLY_synchronize);
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
@@ -1596,10 +1590,9 @@ export const onboard_tft_show_texts = {
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_NUMBER);
this.appendValueInput('VAR')
.appendField(Blockly.Msg.HTML_COLOUR);
var version = Boards.getSelectedBoardKey()
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
this.appendValueInput('boolean')
.appendField( Blockly.Msg.MIXLY_synchronize);
.appendField(Blockly.Msg.MIXLY_synchronize);
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
@@ -1607,15 +1600,15 @@ export const onboard_tft_show_texts = {
}
};
export const onboard_tft_show_qrcode = {
export const onboard_tft_show_qrcode = {
init: function () {
this.setColour(DISPLAY_ONBOARD_HUE);
this.appendValueInput('direct')
.appendField(Blockly.Msg.OLED_BITMAP)
.appendField(Blockly.Msg.MIXLY_QR_CODE);
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
this.appendValueInput('boolean')
.appendField( Blockly.Msg.MIXLY_synchronize);
.appendField(Blockly.Msg.MIXLY_synchronize);
}
this.setPreviousStatement(true);
this.setNextStatement(true);
@@ -1642,16 +1635,16 @@ export const onboard_tft_show_qrcode_details = {
this.appendDummyInput("")
.appendField(Blockly.Msg.MIXLY_ERROR_RATE)
.appendField(new Blockly.FieldDropdown([
["0","7%"],
["1","15%"],
["2","25%"],
["3","30"]
]),"correct");
["0", "7%"],
["1", "15%"],
["2", "25%"],
["3", "30"]
]), "correct");
this.appendValueInput('VAR')
.appendField(Blockly.Msg.HTML_COLOUR);
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
this.appendValueInput('boolean')
.appendField( Blockly.Msg.MIXLY_synchronize);
.appendField(Blockly.Msg.MIXLY_synchronize);
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);