feat(boards): 更新micropython下machine.Timer图形块
This commit is contained in:
@@ -133,36 +133,6 @@ export const timer = {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated To be removed in the future
|
||||
*/
|
||||
export const system_timer = {
|
||||
init: function () {
|
||||
this.setColour(SYSTEM_HUE);
|
||||
this.appendValueInput('VAR')
|
||||
.appendField("Timer")
|
||||
.setCheck("var");
|
||||
// .appendField("I2C " + Blockly.Msg.MIXLY_SETUP)
|
||||
this.appendValueInput("period")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_PERIOD_MIL)
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_mSecond)
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_PYTHON_ONE_SHOT, "ONE_SHOT"],
|
||||
[Blockly.Msg.MIXLY_PYTHON_PERIODIC, "PERIODIC"]
|
||||
]), "mode");
|
||||
this.appendValueInput('callback')
|
||||
.appendField(Blockly.Msg.MIXLY_DO)
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_ESP32_SYSTEM_TIMER_TOOLTIP);
|
||||
this.setWarningText(Blockly.Msg.MIXLY_DEPRECATED_WARNING_TEXT);
|
||||
}
|
||||
};
|
||||
|
||||
export const system_ticks_diff = {
|
||||
init: function () {
|
||||
this.setColour(SYSTEM_HUE);
|
||||
@@ -180,24 +150,6 @@ export const system_ticks_diff = {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated To be removed in the future
|
||||
*/
|
||||
export const system_timer_init = {
|
||||
init: function () {
|
||||
this.setColour(SYSTEM_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField("Timer")
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.MIXLY_SETUP)
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_ESP32_SYSTEM_TIMER_INIT_TOOLTIP);
|
||||
this.setWarningText(Blockly.Msg.MIXLY_DEPRECATED_WARNING_TEXT);
|
||||
}
|
||||
};
|
||||
|
||||
export const set_system_timer = {
|
||||
init: function () {
|
||||
this.setColour(SYSTEM_HUE);
|
||||
@@ -227,6 +179,50 @@ export const set_system_timer = {
|
||||
}
|
||||
};
|
||||
|
||||
export const system_timer_init = {
|
||||
init: function () {
|
||||
this.setColour(SYSTEM_HUE);
|
||||
this.appendValueInput('VAR')
|
||||
.appendField("Timer")
|
||||
.setCheck("var");
|
||||
this.appendDummyInput()
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_RESTART);
|
||||
this.appendValueInput("period")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_PERIOD_MIL)
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_mSecond)
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_PYTHON_ONE_SHOT, "ONE_SHOT"],
|
||||
[Blockly.Msg.MIXLY_PYTHON_PERIODIC, "PERIODIC"]
|
||||
]), "mode");
|
||||
this.appendValueInput('callback')
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_DO)
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_ESP32_SYSTEM_TIMER_TOOLTIP);
|
||||
}
|
||||
};
|
||||
|
||||
export const system_timer_deinit = {
|
||||
init: function () {
|
||||
this.setColour(SYSTEM_HUE);
|
||||
this.appendValueInput('VAR')
|
||||
.appendField("Timer")
|
||||
.setCheck("var");
|
||||
this.appendDummyInput()
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_STOP);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip('');
|
||||
}
|
||||
};
|
||||
|
||||
export const system_wdt_init = {
|
||||
init: function () {
|
||||
this.setColour(SYSTEM_HUE);
|
||||
@@ -287,6 +283,7 @@ export const system_bitbot_shutdown = {
|
||||
};
|
||||
|
||||
export const Timer_init = system_timer_init;
|
||||
export const timer2 = system_timer;
|
||||
export const system_timer = system_timer_init;
|
||||
export const timer2 = system_timer_init;
|
||||
export const time_ticks_diff = system_ticks_diff;
|
||||
export const base_delay = controls_delay;
|
||||
Reference in New Issue
Block a user