fix(boards): 修复micropython_esp32c5下 板载显示 转代码异常
This commit is contained in:
@@ -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);
|
||||
@@ -1613,9 +1606,9 @@ export const onboard_tft_show_qrcode = {
|
||||
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);
|
||||
|
||||
@@ -588,7 +588,6 @@ export const MIXIO_REPORT_IMAGE_DATA = function (_, generator) {
|
||||
|
||||
//simplified part
|
||||
export const CREATE_CAMERA_SIMPLE = function (_, generator) {
|
||||
var version = Boards.getSelectedBoardKey().split(':')[2];
|
||||
generator.definitions_['import_Camera_FrameSize'] = 'from camera import Camera,FrameSize';
|
||||
var cmd = this.getFieldValue('cmd');
|
||||
var code = 'camera = Camera(FrameSize.' + cmd + ', hmirror=False,vflip=False)\n';
|
||||
|
||||
@@ -1187,7 +1187,6 @@ export const onboard_tft_show_qrcode = function (_, generator) {
|
||||
var version = Boards.getSelectedBoardKey().split(':')[2];
|
||||
generator.definitions_['import_' + version + '_onboard_tft'] = "from " + version + " import onboard_tft";
|
||||
var direct = generator.valueToCode(this, 'direct', generator.ORDER_ATOMIC);
|
||||
var bool = generator.valueToCode(this, 'boolean', generator.ORDER_ATOMIC) || 'True';
|
||||
var code = 'onboard_tft.qrcode(' + direct + ')\n';
|
||||
return code;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user