feat(boards): 调整micropython下板载RFID图形块
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import * as Blockly from 'blockly/core';
|
||||
import * as Mixly from 'mixly';
|
||||
import { MicroPythonSensorOnBoardBlocks } from '@mixly/micropython';
|
||||
|
||||
const MEG1_HUE = 40;
|
||||
|
||||
@@ -60,6 +61,69 @@ export const me_g1_varistor = {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @override override "@micropython.MicroPythonSensorOnBoardBlocks.rfid_readid"
|
||||
*/
|
||||
export const rfid_readid = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField('ME G1');
|
||||
MicroPythonSensorOnBoardBlocks.rfid_readid.init.call(this);
|
||||
this.setColour(MEG1_HUE);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @override override "@micropython.MicroPythonSensorOnBoardBlocks.rfid_readcontent"
|
||||
*/
|
||||
export const rfid_readcontent = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField('ME G1');
|
||||
MicroPythonSensorOnBoardBlocks.rfid_readcontent.init.call(this);
|
||||
this.setColour(MEG1_HUE);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @override override "@micropython.MicroPythonSensorOnBoardBlocks.rfid_write"
|
||||
*/
|
||||
export const rfid_write = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField('ME G1');
|
||||
MicroPythonSensorOnBoardBlocks.rfid_write.init.call(this);
|
||||
this.setColour(MEG1_HUE);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @override override "@micropython.MicroPythonSensorOnBoardBlocks.rfid_write_return"
|
||||
*/
|
||||
export const rfid_write_return = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField('ME G1');
|
||||
MicroPythonSensorOnBoardBlocks.rfid_write_return.init.call(this);
|
||||
this.setColour(MEG1_HUE);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @override override "@micropython.MicroPythonSensorOnBoardBlocks.rfid_status"
|
||||
*/
|
||||
export const rfid_status = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField('ME G1');
|
||||
MicroPythonSensorOnBoardBlocks.rfid_status.init.call(this);
|
||||
this.setColour(MEG1_HUE);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated To be removed in the future
|
||||
*/
|
||||
export const me_g1_rfid_readid = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
@@ -70,11 +134,17 @@ export const me_g1_rfid_readid = {
|
||||
.appendField("RFID" + Blockly.Msg.MIXLY_RFID_READ_CARD);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_RFID_READ_CARD_UID);
|
||||
this.appendDummyInput()
|
||||
.appendField(`(${Blockly.Msg.MIXLY_DEPRECATED})`);
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
this.setWarningText(Blockly.Msg.MIXLY_DEPRECATED_WARNING_TEXT);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated To be removed in the future
|
||||
*/
|
||||
export const me_g1_rfid_readcontent = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
@@ -87,12 +157,42 @@ export const me_g1_rfid_readcontent = {
|
||||
.appendField(Blockly.Msg.MIXLY_LIST_INDEX)
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL);
|
||||
this.appendDummyInput()
|
||||
.appendField(`(${Blockly.Msg.MIXLY_DEPRECATED})`);
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
this.setWarningText(Blockly.Msg.MIXLY_DEPRECATED_WARNING_TEXT);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated To be removed in the future
|
||||
*/
|
||||
export const me_g1_rfid_write = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
if (version == "mixgo_me") { var name = 'ME G1' }
|
||||
this.setColour(MEG1_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(name)
|
||||
.appendField(Blockly.Msg.MIXLY_COMMUNICATION_RFID_WRITE);
|
||||
this.appendValueInput('SECTOR')
|
||||
.appendField(Blockly.Msg.MIXLY_LIST_INDEX);
|
||||
this.appendValueInput('CONTENT')
|
||||
.appendField(Blockly.Msg.MIXLY_COMMUNICATION_WRITE_NUM);
|
||||
this.appendDummyInput()
|
||||
.appendField(`(${Blockly.Msg.MIXLY_DEPRECATED})`);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setWarningText(Blockly.Msg.MIXLY_DEPRECATED_WARNING_TEXT);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated To be removed in the future
|
||||
*/
|
||||
export const me_g1_rfid_write_outcome = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
if (version == "mixgo_me") { var name = 'ME G1' }
|
||||
@@ -103,32 +203,20 @@ export const me_g1_rfid_write = {
|
||||
this.appendValueInput('SECTOR')
|
||||
.appendField(Blockly.Msg.MIXLY_LIST_INDEX)
|
||||
this.appendValueInput('CONTENT')
|
||||
.appendField(Blockly.Msg.MIXLY_COMMUNICATION_WRITE_NUM)
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
}
|
||||
};
|
||||
|
||||
export const me_g1_rfid_write_outcome = {
|
||||
init: function(){
|
||||
var version=Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
if(version=="mixgo_me"){var name='ME G1'}
|
||||
this.setColour(MEG1_HUE);
|
||||
.appendField(Blockly.Msg.MIXLY_COMMUNICATION_WRITE_NUM);
|
||||
this.appendDummyInput()
|
||||
.appendField(name)
|
||||
.appendField(Blockly.Msg.MIXLY_COMMUNICATION_RFID_WRITE);
|
||||
this.appendValueInput('SECTOR')
|
||||
.appendField(Blockly.Msg.MIXLY_LIST_INDEX)
|
||||
this.appendValueInput('CONTENT')
|
||||
.appendField(Blockly.Msg.MIXLY_COMMUNICATION_WRITE_NUM)
|
||||
.appendField(Blockly.Msg.RETURN_SUCCESS_OR_NOT);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.RETURN_SUCCESS_OR_NOT)
|
||||
.appendField(`(${Blockly.Msg.MIXLY_DEPRECATED})`);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setWarningText(Blockly.Msg.MIXLY_DEPRECATED_WARNING_TEXT);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated To be removed in the future
|
||||
*/
|
||||
export const me_g1_rfid_status = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
@@ -143,7 +231,10 @@ export const me_g1_rfid_status = {
|
||||
[Blockly.Msg.MIXLY_RFID_SCAN_NOTAGERR, "1"],
|
||||
[Blockly.Msg.MIXLY_RFID_SCAN_ERROR, "2"]
|
||||
]), "key");
|
||||
this.appendDummyInput()
|
||||
.appendField(`(${Blockly.Msg.MIXLY_DEPRECATED})`);
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
this.setWarningText(Blockly.Msg.MIXLY_DEPRECATED_WARNING_TEXT);
|
||||
}
|
||||
};
|
||||
@@ -1929,15 +1929,16 @@
|
||||
<block type="me_g1_aht11"></block>
|
||||
<block type="me_g1_hp203"></block>
|
||||
<block type="me_g1_varistor"></block>
|
||||
<block type="me_g1_rfid_readcontent">
|
||||
<block type="rfid_status"></block>
|
||||
<block type="rfid_readid"></block>
|
||||
<block type="rfid_readcontent">
|
||||
<value name="SECTOR">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">0</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="me_g1_rfid_readid"></block>
|
||||
<block type="me_g1_rfid_write">
|
||||
<block type="rfid_write">
|
||||
<value name="SECTOR">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">0</field>
|
||||
@@ -1949,7 +1950,7 @@
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="me_g1_rfid_write_outcome">
|
||||
<block type="rfid_write_return">
|
||||
<value name="SECTOR">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">0</field>
|
||||
@@ -1961,7 +1962,6 @@
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="me_g1_rfid_status"></block>
|
||||
</category>
|
||||
<category id="catCC_G1" colour="40"
|
||||
m-show='micropython:esp32c3:mixgo_cc micropython:esp32c3:mixgo_me'>
|
||||
@@ -3804,7 +3804,14 @@
|
||||
</next>
|
||||
</block>
|
||||
|
||||
<block type="extern_rfid_readcontent" m-hide='micropython:esp32c3:mixgocar_c3'>
|
||||
<block type="extern_rfid_status" m-hide='micropython:esp32c3:mixgocar_c3'>
|
||||
<value name="SUB">
|
||||
<shadow type="variables_get">
|
||||
<field name="VAR">ysensor</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="extern_rfid_readid" m-hide='micropython:esp32c3:mixgocar_c3'>
|
||||
<value name="SUB">
|
||||
<shadow type="variables_get">
|
||||
<field name="VAR">ysensor</field>
|
||||
@@ -3816,7 +3823,7 @@
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="extern_rfid_readid" m-hide='micropython:esp32c3:mixgocar_c3'>
|
||||
<block type="extern_rfid_readcontent" m-hide='micropython:esp32c3:mixgocar_c3'>
|
||||
<value name="SUB">
|
||||
<shadow type="variables_get">
|
||||
<field name="VAR">ysensor</field>
|
||||
@@ -3863,14 +3870,6 @@
|
||||
</value>
|
||||
</block>
|
||||
|
||||
<block type="extern_rfid_status" m-hide='micropython:esp32c3:mixgocar_c3'>
|
||||
<value name="SUB">
|
||||
<shadow type="variables_get">
|
||||
<field name="VAR">ysensor</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
|
||||
<block type="weather_have_data" m-hide='micropython:esp32c3:mixgocar_c3'>
|
||||
<value name="SUB">
|
||||
<shadow type="variables_get">
|
||||
|
||||
Reference in New Issue
Block a user