From 90c2972861e1cf090bd59f09d116a2efe7fe9095 Mon Sep 17 00:00:00 2001
From: Irene-Maxine <114802521+Irene-Maxine@users.noreply.github.com>
Date: Sun, 7 Sep 2025 14:22:26 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9mixio=20=E5=8F=91=E5=B8=83?=
=?UTF-8?q?=E6=B6=88=E6=81=AF=E6=9C=8D=E5=8A=A1=E8=B4=A8=E9=87=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
boards/default_src/micropython/blocks/iot.js | 17 +++++++++++++++++
.../default_src/micropython/generators/iot.js | 8 ++++++++
.../default_src/micropython_esp32/template.xml | 12 ++++++++++++
.../micropython_esp32c2/template.xml | 12 ++++++++++++
.../micropython_esp32c3/template.xml | 12 ++++++++++++
.../micropython_esp32s2/template.xml | 12 ++++++++++++
.../micropython_esp32s3/template.xml | 12 ++++++++++++
.../default_src/micropython_robot/template.xml | 12 ++++++++++++
boards/default_src/python_mixpy/template.xml | 12 ++++++++++++
9 files changed, 109 insertions(+)
diff --git a/boards/default_src/micropython/blocks/iot.js b/boards/default_src/micropython/blocks/iot.js
index e909daba..45fa6fc6 100644
--- a/boards/default_src/micropython/blocks/iot.js
+++ b/boards/default_src/micropython/blocks/iot.js
@@ -323,6 +323,23 @@ export const iot_mixio_connect = {
};
export const IOT_MIXIO_PUBLISH = {
+ init: function () {
+ this.setColour(IOT_HUE);
+ this.appendDummyInput()
+ .appendField("MixIO")
+ this.appendValueInput('TOPIC')
+ .appendField(Blockly.Msg.MIXLY_EMQX_PUBLISH_NEW)
+ .appendField(Blockly.Msg.MIXLY_EMQX_PUBLISH_TOPIC);
+ this.appendValueInput('MSG')
+ .appendField(Blockly.Msg.HTML_BODY);
+ this.setInputsInline(true);
+ this.setPreviousStatement(true);
+ this.setNextStatement(true);
+ this.setTooltip(Blockly.Msg.MIXLY_ESP32_IOT_EMQX_PUBLISH_TOOLTIP);
+ }
+};
+
+export const IOT_MIXIO_PUBLISHEX = {
init: function () {
this.setColour(IOT_HUE);
this.appendDummyInput()
diff --git a/boards/default_src/micropython/generators/iot.js b/boards/default_src/micropython/generators/iot.js
index 94f49720..1c30b2de 100644
--- a/boards/default_src/micropython/generators/iot.js
+++ b/boards/default_src/micropython/generators/iot.js
@@ -88,6 +88,14 @@ export const iot_mixio_connect = function (_, generator) {
}
export const IOT_MIXIO_PUBLISH = function (_, generator) {
+ var topic = generator.valueToCode(this, 'TOPIC', generator.ORDER_ATOMIC);
+ var msg = generator.valueToCode(this, 'MSG', generator.ORDER_ATOMIC);
+ generator.definitions_['import_mixiot'] = "import mixiot";
+ var code = 'mqtt_client.publish(MQTT_USR_PRJ + ' + topic + ', ' + msg + ')\n';
+ return code;
+}
+
+export const IOT_MIXIO_PUBLISHEX = function (_, generator) {
var topic = generator.valueToCode(this, 'TOPIC', generator.ORDER_ATOMIC);
var msg = generator.valueToCode(this, 'MSG', generator.ORDER_ATOMIC);
var q = this.getFieldValue('quality');
diff --git a/boards/default_src/micropython_esp32/template.xml b/boards/default_src/micropython_esp32/template.xml
index 36b15f0d..d2d1c92c 100644
--- a/boards/default_src/micropython_esp32/template.xml
+++ b/boards/default_src/micropython_esp32/template.xml
@@ -2385,6 +2385,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+
diff --git a/boards/default_src/micropython_esp32c2/template.xml b/boards/default_src/micropython_esp32c2/template.xml
index c3132a87..9d2a84c4 100644
--- a/boards/default_src/micropython_esp32c2/template.xml
+++ b/boards/default_src/micropython_esp32c2/template.xml
@@ -2281,6 +2281,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+
diff --git a/boards/default_src/micropython_esp32c3/template.xml b/boards/default_src/micropython_esp32c3/template.xml
index 66dbd688..19f5ae97 100644
--- a/boards/default_src/micropython_esp32c3/template.xml
+++ b/boards/default_src/micropython_esp32c3/template.xml
@@ -2166,6 +2166,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+
diff --git a/boards/default_src/micropython_esp32s2/template.xml b/boards/default_src/micropython_esp32s2/template.xml
index 91157fce..db2b6100 100644
--- a/boards/default_src/micropython_esp32s2/template.xml
+++ b/boards/default_src/micropython_esp32s2/template.xml
@@ -2196,6 +2196,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+
diff --git a/boards/default_src/micropython_esp32s3/template.xml b/boards/default_src/micropython_esp32s3/template.xml
index cb01617d..f4006f3c 100644
--- a/boards/default_src/micropython_esp32s3/template.xml
+++ b/boards/default_src/micropython_esp32s3/template.xml
@@ -2680,6 +2680,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+
diff --git a/boards/default_src/micropython_robot/template.xml b/boards/default_src/micropython_robot/template.xml
index 9546ea3d..89f53a59 100644
--- a/boards/default_src/micropython_robot/template.xml
+++ b/boards/default_src/micropython_robot/template.xml
@@ -2033,6 +2033,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+
diff --git a/boards/default_src/python_mixpy/template.xml b/boards/default_src/python_mixpy/template.xml
index 8797774b..79d3cfab 100644
--- a/boards/default_src/python_mixpy/template.xml
+++ b/boards/default_src/python_mixpy/template.xml
@@ -1595,6 +1595,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+