Fix(boards): 修复arduino mega pinout异常同时优化各板卡pinout相关block定义
This commit is contained in:
164
boards/default_src/arduino_esp32/blocks/pinout.js
Normal file
164
boards/default_src/arduino_esp32/blocks/pinout.js
Normal file
@@ -0,0 +1,164 @@
|
||||
import * as Blockly from 'blockly/core';
|
||||
|
||||
const PINOUT_HUE = '#555555';
|
||||
|
||||
|
||||
export const esp32_pin = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/ESP32.png'), 525, 265, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const handbit_A = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/HandbitA.jpg'), 525, 260, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const handbit_B = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/HandbitB.jpg'), 460, 260, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const handbit_pin_A = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/HandbitPinA.jpg'), 270, 376, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const handbit_pin_B = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/HandbitPinB.jpg'), 270, 376, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const mixgo_pin_A = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/MixGoPinA.png'), 525, 376, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const mixgo_pin_B = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/MixGoPinB.png'), 525, 376, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const PocketCard_A = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/PocketCardA.jpg'), 525, 376, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const PocketCard_B = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/PocketCardB.jpg'), 525, 376, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const esp32_cam_pin = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/ESP32Cam.png'), 525, 270, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const esp32_pico_kit_1_pin = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/ESP32PicoKit.png'), 525, 230, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const nodemcu_32s_pin = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/NodeMCU32S.png'), 380, 376, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const esp32c3_pin = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/ESP32C3.jpg'), 525, 365, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const core_esp32c3_pin = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/CoreESP32C3.png'), 500, 376, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const esp32s3_pin = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/ESP32S3.jpg'), 500, 350, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
|
||||
export const esp32s2_pin = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/boards/ESP32S2.jpg'), 500, 350, '*'));
|
||||
this.setColour(PINOUT_HUE);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as Blockly from 'blockly/core';
|
||||
import { Profile } from 'mixly';
|
||||
import { sensor_mixgo_pin_near } from './MixGo';
|
||||
import { sensor_mixgo_pin_near } from './mixgo';
|
||||
|
||||
const SENSOR_HUE = 40;
|
||||
const ACTUATOR_HUE = 100;
|
||||
@@ -1,102 +0,0 @@
|
||||
import * as Blockly from 'blockly/core';
|
||||
|
||||
const TOOLS_HUE = "#555555";
|
||||
let toolsBlocks = {};
|
||||
let toolsGenerators = {};
|
||||
|
||||
const BOARDS_PIN_DEF = {
|
||||
esp32_pin: {
|
||||
path: require("../media/ESP32.png"),
|
||||
height: 270
|
||||
},
|
||||
handbit_A: {
|
||||
path: require("../media/handbit_A.jpg"),
|
||||
height: 260
|
||||
},
|
||||
handbit_B: {
|
||||
path: require("../media/handbit_B.jpg"),
|
||||
height: 260,
|
||||
width: 460
|
||||
},
|
||||
handbit_pin_A: {
|
||||
path: require("../media/handbit_pin_A.jpg"),
|
||||
width: 270
|
||||
},
|
||||
handbit_pin_B: {
|
||||
path: require("../media/handbit_pin_B.jpg"),
|
||||
width: 290
|
||||
},
|
||||
mixgo_pin_A: {
|
||||
path: require("../media/MixGo_pin_A.png")
|
||||
},
|
||||
mixgo_pin_B: {
|
||||
path: require("../media/MixGo_pin_B.png")
|
||||
},
|
||||
PocketCard_A: {
|
||||
path: require("../media/PocketCard_A.jpg")
|
||||
},
|
||||
PocketCard_B: {
|
||||
path: require("../media/PocketCard_B.jpg")
|
||||
},
|
||||
PocketCard_pin: {
|
||||
path: require("../media/PocketCard_pin.png")
|
||||
},
|
||||
esp32_cam_pin: {
|
||||
path: require("../media/ESP32_CAM_pin.png"),
|
||||
height: 270
|
||||
},
|
||||
esp32_pico_kit_1_pin: {
|
||||
path: require("../media/ESP32_pico_kit_1.png"),
|
||||
height: 230
|
||||
},
|
||||
nodemcu_32s_pin: {
|
||||
path: require("../media/nodemcu_32s_pin.png"),
|
||||
width: 380
|
||||
},
|
||||
esp32c3_pin: {
|
||||
path: require("../media/ESP32c3.jpg")
|
||||
},
|
||||
core_esp32c3_pin: {
|
||||
path: require("../media/core_esp32c3_pin.png"),
|
||||
width: 500
|
||||
},
|
||||
esp32s3_pin: {
|
||||
path: require("../media/ESP32s3.jpg"),
|
||||
height: 350,
|
||||
width: 500
|
||||
},
|
||||
esp32s2_pin: {
|
||||
path: require("../media/ESP32s2.jpg"),
|
||||
height: 350,
|
||||
width: 500
|
||||
}
|
||||
}
|
||||
|
||||
for (let i in BOARDS_PIN_DEF) {
|
||||
const defaultDef = {
|
||||
path: require('../media/ESP32.png'),
|
||||
height: 376,
|
||||
width: 525,
|
||||
tooltip: '',
|
||||
helpUrl: ''
|
||||
};
|
||||
let pinDef = {};
|
||||
Object.assign(pinDef, defaultDef, BOARDS_PIN_DEF[i]);
|
||||
|
||||
toolsBlocks[i] = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(pinDef.path, pinDef.width, pinDef.height, "*"));
|
||||
this.setColour(TOOLS_HUE);
|
||||
this.setTooltip(pinDef.tooltip);
|
||||
this.setHelpUrl(pinDef.helpUrl);
|
||||
}
|
||||
};
|
||||
|
||||
toolsGenerators[i] = function () {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
export const blocks = toolsBlocks;
|
||||
export const generators = toolsGenerators;
|
||||
Reference in New Issue
Block a user