diff --git a/boards/default_src/micropython/blocks/actuator_onboard.js b/boards/default_src/micropython/blocks/actuator_onboard.js index 224018ae..bab24e23 100644 --- a/boards/default_src/micropython/blocks/actuator_onboard.js +++ b/boards/default_src/micropython/blocks/actuator_onboard.js @@ -57,6 +57,21 @@ export const actuator_get_led_bright = { .appendField(Blockly.Msg.MIXLY_BRIGHTNESS) this.setOutput(true); this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_ESP32_LED_GETBRIGHT); + } +}; + +export const actuator_get_led_onoff = { + init: function () { + this.setColour(ACTUATOR_ONBOARD_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET); + this.appendValueInput('led') + .appendField(Blockly.Msg.MIXLY_BUILDIN_LED) + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_PULSEIN_STAT) + this.setOutput(true); + this.setInputsInline(true); this.setTooltip(Blockly.Msg.MIXLY_ESP32_LED_GETONOFF); } }; diff --git a/boards/default_src/micropython/blocks/iot.js b/boards/default_src/micropython/blocks/iot.js index 45fa6fc6..72656c18 100644 --- a/boards/default_src/micropython/blocks/iot.js +++ b/boards/default_src/micropython/blocks/iot.js @@ -353,8 +353,7 @@ export const IOT_MIXIO_PUBLISHEX = { .appendField(Blockly.Msg.MIXLY_Service_quality_display) .appendField(new Blockly.FieldDropdown([ [Blockly.Msg.MIXLY_AT_MOST_ONCE,"0"], - [Blockly.Msg.MIXLY_AT_LEAST_ONCE,"1"], - [Blockly.Msg.MIXLY_ONLY_ONCE,"2"] + [Blockly.Msg.MIXLY_AT_LEAST_ONCE,"1"] ]),"quality") this.setInputsInline(true); this.setPreviousStatement(true); diff --git a/boards/default_src/micropython/generators/actuator_onboard.js b/boards/default_src/micropython/generators/actuator_onboard.js index f0fe2f0b..e325388c 100644 --- a/boards/default_src/micropython/generators/actuator_onboard.js +++ b/boards/default_src/micropython/generators/actuator_onboard.js @@ -120,6 +120,24 @@ export const actuator_get_led_bright = function (_, generator) { return [code, generator.ORDER_ATOMIC]; } +export const actuator_get_led_onoff = function (_, generator) { + var version = Boards.getSelectedBoardKey().split(':')[2] + var op = generator.valueToCode(this, 'led', generator.ORDER_ATOMIC); + if (version == 'mixgo'){ + if(op == 1){ + generator.definitions_['import_' + version + 'led1'] = 'from ' + version + ' import led1'; + var code = "led1.getonoff()"; + }else if (op == 2){ + generator.definitions_['import_' + version + 'led2'] = 'from ' + version + ' import led2'; + var code = "led2.getonff()"; + } + }else{ + generator.definitions_['import_' + version + '_onboard_led'] = 'from ' + version + ' import onboard_led'; + var code = "onboard_led.getonoff(" + op + ")"; + } + return [code, generator.ORDER_ATOMIC]; +} + export const actuator_get_led_state = function (_, generator) { var version = Boards.getSelectedBoardKey().split(':')[2] var op = generator.valueToCode(this, 'led', generator.ORDER_ATOMIC); diff --git a/boards/default_src/micropython_esp32/template.xml b/boards/default_src/micropython_esp32/template.xml index 4a0a15ab..1052d16e 100644 --- a/boards/default_src/micropython_esp32/template.xml +++ b/boards/default_src/micropython_esp32/template.xml @@ -1575,6 +1575,12 @@ + + + + + + diff --git a/boards/default_src/micropython_esp32c2/template.xml b/boards/default_src/micropython_esp32c2/template.xml index ab0d52e9..bae21d91 100644 --- a/boards/default_src/micropython_esp32c2/template.xml +++ b/boards/default_src/micropython_esp32c2/template.xml @@ -1585,6 +1585,12 @@ + + + + + + diff --git a/boards/default_src/micropython_esp32c3/template.xml b/boards/default_src/micropython_esp32c3/template.xml index 78a0b6e7..52fb6c22 100644 --- a/boards/default_src/micropython_esp32c3/template.xml +++ b/boards/default_src/micropython_esp32c3/template.xml @@ -1569,6 +1569,12 @@ + + + + + + diff --git a/boards/default_src/micropython_esp32s2/template.xml b/boards/default_src/micropython_esp32s2/template.xml index 531e9c4a..2100b5c2 100644 --- a/boards/default_src/micropython_esp32s2/template.xml +++ b/boards/default_src/micropython_esp32s2/template.xml @@ -1536,6 +1536,12 @@ + + + + + + diff --git a/boards/default_src/micropython_esp32s3/template.xml b/boards/default_src/micropython_esp32s3/template.xml index 6907f3eb..cfe1c8bf 100644 --- a/boards/default_src/micropython_esp32s3/template.xml +++ b/boards/default_src/micropython_esp32s3/template.xml @@ -1576,6 +1576,12 @@ + + + + + + diff --git a/common/msg/blockly/en.js b/common/msg/blockly/en.js index 2e2e8ea3..8f66a32a 100644 --- a/common/msg/blockly/en.js +++ b/common/msg/blockly/en.js @@ -2140,6 +2140,7 @@ En.MIXLY_ESP32_SERVO_SPEED_TOOLIPS = 'Set the rotation speed of the servo(-100~1 En.MIXLY_ESP32_LED_SETONOFF = "Set the status of the embedded LED light"; En.MIXLY_ESP32_LED_GETONOFF = "Get the current status of the embedded LED light"; En.MIXLY_ESP32_LED_SETBRIGHT = "Set the current brightness of the embedded LED light (0 ~ 1023)"; +En.ZhHans.MIXLY_ESP32_LED_GETBRIGHT = "Get the current brightness of the embedded LED light (0 ~ 1023)"; En.MIXLY_ESP32_MUSIC_PLAYSHOW = "Play the note list and display the corresponding note"; En.MIXLY_ESP32_MUSIC_SET_TEMPO = "Set the resolution and speed of playing music"; En.MIXLY_ESP32_MUSIC_GET_TEMPO = "Get the current rhythm of the music"; diff --git a/common/msg/blockly/zh-hans.js b/common/msg/blockly/zh-hans.js index 80694ab8..4298978f 100644 --- a/common/msg/blockly/zh-hans.js +++ b/common/msg/blockly/zh-hans.js @@ -2157,6 +2157,7 @@ ZhHans.MIXLY_ESP32_SERVO_SPEED_TOOLIPS = '设置舵机的旋转速度(-100~100%) ZhHans.MIXLY_ESP32_LED_SETONOFF = "设置内嵌LED的状态"; ZhHans.MIXLY_ESP32_LED_GETONOFF = "获取内嵌LED当前的状态"; ZhHans.MIXLY_ESP32_LED_SETBRIGHT = "设置内嵌LED的当前亮度(0~65535)"; +ZhHans.MIXLY_ESP32_LED_GETBRIGHT = "获取内嵌LED的当前亮度(0~65535)"; ZhHans.MIXLY_ESP32_EXTERN_LED_SETONOFF = "设置LED的状态"; ZhHans.MIXLY_ESP32_EXTERN_LED_GETONOFF = "获取LED当前的状态"; ZhHans.MIXLY_ESP32_EXTERN_LED_SETBRIGHT = "设置LED的当前亮度(0~65535)"; diff --git a/common/msg/blockly/zh-hant.js b/common/msg/blockly/zh-hant.js index c2283004..c7462ed8 100644 --- a/common/msg/blockly/zh-hant.js +++ b/common/msg/blockly/zh-hant.js @@ -2157,6 +2157,7 @@ ZhHant.MIXLY_ESP32_SERVO_SPEED_TOOLIPS = '設置舵機的旋轉速度(-100~100%) ZhHant.MIXLY_ESP32_LED_SETONOFF = "設置內嵌LED的狀態"; ZhHant.MIXLY_ESP32_LED_GETONOFF = "獲取內嵌LED當前的狀態"; ZhHant.MIXLY_ESP32_LED_SETBRIGHT = "設置內嵌LED的當前亮度(0~65535)"; +ZhHant.MIXLY_ESP32_LED_GETBRIGHT = "獲取內嵌LED的當前亮度(0~65535)"; ZhHant.MIXLY_ESP32_EXTERN_LED_SETONOFF = "設置LED的狀態"; ZhHant.MIXLY_ESP32_EXTERN_LED_GETONOFF = "獲取LED當前的狀態"; ZhHant.MIXLY_ESP32_EXTERN_LED_SETBRIGHT = "設置LED的當前亮度(0~65535)";