fix(boards): 修复micropython_esp32c5下 板载显示 转代码异常
This commit is contained in:
@@ -10,7 +10,7 @@ export const display_show_image = {
|
|||||||
.setCheck([String, "esp32_image", "List", 'Tuple'])
|
.setCheck([String, "esp32_image", "List", 'Tuple'])
|
||||||
.appendField(Blockly.Msg.MIXLY_ESP32_SHOW_IMAGE_OR_STRING);
|
.appendField(Blockly.Msg.MIXLY_ESP32_SHOW_IMAGE_OR_STRING);
|
||||||
var version = Boards.getSelectedBoardKey()
|
var version = Boards.getSelectedBoardKey()
|
||||||
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
|
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
|
||||||
this.appendValueInput('boolean')
|
this.appendValueInput('boolean')
|
||||||
.appendField(Blockly.Msg.MIXLY_synchronize);
|
.appendField(Blockly.Msg.MIXLY_synchronize);
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ export const display_show_image_or_string_delay = {
|
|||||||
[Blockly.Msg.MICROPYTHON_DISPLAY_YES, "True"],
|
[Blockly.Msg.MICROPYTHON_DISPLAY_YES, "True"],
|
||||||
[Blockly.Msg.MICROPYTHON_DISPLAY_NO, "False"]
|
[Blockly.Msg.MICROPYTHON_DISPLAY_NO, "False"]
|
||||||
]), 'center')
|
]), 'center')
|
||||||
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
|
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
|
||||||
this.appendValueInput('boolean')
|
this.appendValueInput('boolean')
|
||||||
.appendField(Blockly.Msg.MIXLY_synchronize);
|
.appendField(Blockly.Msg.MIXLY_synchronize);
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ export const display_scroll_way = {
|
|||||||
[Blockly.Msg.MIXLY_GAME_DOWN, "1"],
|
[Blockly.Msg.MIXLY_GAME_DOWN, "1"],
|
||||||
[Blockly.Msg.MIXLY_GAME_RIGHT, "2"],
|
[Blockly.Msg.MIXLY_GAME_RIGHT, "2"],
|
||||||
[Blockly.Msg.MIXLY_GAME_LEFT, "3"]
|
[Blockly.Msg.MIXLY_GAME_LEFT, "3"]
|
||||||
]),"way");;
|
]), "way");
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
@@ -301,8 +301,7 @@ export const display_shift = {
|
|||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
this.appendDummyInput('')
|
this.appendDummyInput('')
|
||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_UNIT)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_UNIT)
|
||||||
var version = Boards.getSelectedBoardKey()
|
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
|
||||||
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
|
|
||||||
this.appendValueInput('boolean')
|
this.appendValueInput('boolean')
|
||||||
.appendField(Blockly.Msg.MIXLY_synchronize);
|
.appendField(Blockly.Msg.MIXLY_synchronize);
|
||||||
}
|
}
|
||||||
@@ -394,8 +393,7 @@ export const display_clear = {
|
|||||||
this.setColour(DISPLAY_ONBOARD_HUE);
|
this.setColour(DISPLAY_ONBOARD_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_Clear_display);
|
.appendField(Blockly.Msg.MIXLY_MICROBIT_Clear_display);
|
||||||
var version = Boards.getSelectedBoardKey()
|
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
|
||||||
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
|
|
||||||
this.appendValueInput('boolean')
|
this.appendValueInput('boolean')
|
||||||
.appendField(Blockly.Msg.MIXLY_synchronize);
|
.appendField(Blockly.Msg.MIXLY_synchronize);
|
||||||
}
|
}
|
||||||
@@ -1114,8 +1112,7 @@ export const onboard_tft_show_image_xy = {
|
|||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_NUMBER);
|
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_NUMBER);
|
||||||
this.appendValueInput('VAR')
|
this.appendValueInput('VAR')
|
||||||
.appendField(Blockly.Msg.HTML_COLOUR);
|
.appendField(Blockly.Msg.HTML_COLOUR);
|
||||||
var version = Boards.getSelectedBoardKey()
|
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
|
||||||
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
|
|
||||||
this.appendValueInput('boolean')
|
this.appendValueInput('boolean')
|
||||||
.appendField(Blockly.Msg.MIXLY_synchronize);
|
.appendField(Blockly.Msg.MIXLY_synchronize);
|
||||||
}
|
}
|
||||||
@@ -1169,8 +1166,7 @@ export const onboard_tft_show_image_or_string_delay = {
|
|||||||
]), 'center')
|
]), 'center')
|
||||||
this.appendValueInput('VAR')
|
this.appendValueInput('VAR')
|
||||||
.appendField(Blockly.Msg.HTML_COLOUR);
|
.appendField(Blockly.Msg.HTML_COLOUR);
|
||||||
var version = Boards.getSelectedBoardKey()
|
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
|
||||||
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
|
|
||||||
this.appendValueInput('boolean')
|
this.appendValueInput('boolean')
|
||||||
.appendField(Blockly.Msg.MIXLY_synchronize);
|
.appendField(Blockly.Msg.MIXLY_synchronize);
|
||||||
}
|
}
|
||||||
@@ -1385,8 +1381,7 @@ export const onboard_tft_bright_point = {
|
|||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_PLOT_POINT_Y);
|
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_PLOT_POINT_Y);
|
||||||
this.appendValueInput('VAR')
|
this.appendValueInput('VAR')
|
||||||
.appendField(Blockly.Msg.HTML_COLOUR);
|
.appendField(Blockly.Msg.HTML_COLOUR);
|
||||||
var version = Boards.getSelectedBoardKey()
|
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
|
||||||
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
|
|
||||||
this.appendValueInput('boolean')
|
this.appendValueInput('boolean')
|
||||||
.appendField(Blockly.Msg.MIXLY_synchronize);
|
.appendField(Blockly.Msg.MIXLY_synchronize);
|
||||||
}
|
}
|
||||||
@@ -1402,8 +1397,7 @@ export const onboard_tft_fill = {
|
|||||||
this.setColour(DISPLAY_ONBOARD_HUE);
|
this.setColour(DISPLAY_ONBOARD_HUE);
|
||||||
this.appendValueInput('VAR')
|
this.appendValueInput('VAR')
|
||||||
.appendField(Blockly.Msg.MIXLY_SCREEN_FILL);
|
.appendField(Blockly.Msg.MIXLY_SCREEN_FILL);
|
||||||
var version = Boards.getSelectedBoardKey()
|
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
|
||||||
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
|
|
||||||
this.appendValueInput('boolean')
|
this.appendValueInput('boolean')
|
||||||
.appendField(Blockly.Msg.MIXLY_synchronize);
|
.appendField(Blockly.Msg.MIXLY_synchronize);
|
||||||
}
|
}
|
||||||
@@ -1596,8 +1590,7 @@ export const onboard_tft_show_texts = {
|
|||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_NUMBER);
|
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_NUMBER);
|
||||||
this.appendValueInput('VAR')
|
this.appendValueInput('VAR')
|
||||||
.appendField(Blockly.Msg.HTML_COLOUR);
|
.appendField(Blockly.Msg.HTML_COLOUR);
|
||||||
var version = Boards.getSelectedBoardKey()
|
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
|
||||||
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
|
|
||||||
this.appendValueInput('boolean')
|
this.appendValueInput('boolean')
|
||||||
.appendField(Blockly.Msg.MIXLY_synchronize);
|
.appendField(Blockly.Msg.MIXLY_synchronize);
|
||||||
}
|
}
|
||||||
@@ -1613,7 +1606,7 @@ export const onboard_tft_show_qrcode = {
|
|||||||
this.appendValueInput('direct')
|
this.appendValueInput('direct')
|
||||||
.appendField(Blockly.Msg.OLED_BITMAP)
|
.appendField(Blockly.Msg.OLED_BITMAP)
|
||||||
.appendField(Blockly.Msg.MIXLY_QR_CODE);
|
.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')
|
this.appendValueInput('boolean')
|
||||||
.appendField(Blockly.Msg.MIXLY_synchronize);
|
.appendField(Blockly.Msg.MIXLY_synchronize);
|
||||||
}
|
}
|
||||||
@@ -1649,7 +1642,7 @@ export const onboard_tft_show_qrcode_details = {
|
|||||||
]), "correct");
|
]), "correct");
|
||||||
this.appendValueInput('VAR')
|
this.appendValueInput('VAR')
|
||||||
.appendField(Blockly.Msg.HTML_COLOUR);
|
.appendField(Blockly.Msg.HTML_COLOUR);
|
||||||
if (JSFuncs.getPlatform() === 'Python ESP32-S3') {
|
if (['Python ESP32-S3', 'Python ESP32-C5'].includes(JSFuncs.getPlatform())) {
|
||||||
this.appendValueInput('boolean')
|
this.appendValueInput('boolean')
|
||||||
.appendField(Blockly.Msg.MIXLY_synchronize);
|
.appendField(Blockly.Msg.MIXLY_synchronize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -588,7 +588,6 @@ export const MIXIO_REPORT_IMAGE_DATA = function (_, generator) {
|
|||||||
|
|
||||||
//simplified part
|
//simplified part
|
||||||
export const CREATE_CAMERA_SIMPLE = function (_, generator) {
|
export const CREATE_CAMERA_SIMPLE = function (_, generator) {
|
||||||
var version = Boards.getSelectedBoardKey().split(':')[2];
|
|
||||||
generator.definitions_['import_Camera_FrameSize'] = 'from camera import Camera,FrameSize';
|
generator.definitions_['import_Camera_FrameSize'] = 'from camera import Camera,FrameSize';
|
||||||
var cmd = this.getFieldValue('cmd');
|
var cmd = this.getFieldValue('cmd');
|
||||||
var code = 'camera = Camera(FrameSize.' + cmd + ', hmirror=False,vflip=False)\n';
|
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];
|
var version = Boards.getSelectedBoardKey().split(':')[2];
|
||||||
generator.definitions_['import_' + version + '_onboard_tft'] = "from " + version + " import onboard_tft";
|
generator.definitions_['import_' + version + '_onboard_tft'] = "from " + version + " import onboard_tft";
|
||||||
var direct = generator.valueToCode(this, 'direct', generator.ORDER_ATOMIC);
|
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';
|
var code = 'onboard_tft.qrcode(' + direct + ')\n';
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user