educore 物联网部分修改

This commit is contained in:
Irene-Maxine
2025-01-21 22:00:17 +08:00
parent e82af3bead
commit 4eaf8cbbe0
5 changed files with 26 additions and 143 deletions

View File

@@ -22,6 +22,9 @@ export const display_show_image_or_string_delay = function (_, generator) {
generator.definitions_['import_' + version + '_onboard_tft'] = "from " + version + " import onboard_tft";
var code = "onboard_tft.shows(" + data + ",space = " + space + ',center = ' + op + ")\n";
return code;
}else if (version == "educore"){
generator.definitions_['import_' + version + 'oled'] = "from " + version + " import oled";
var code = "oled.print(" + data + ',space = ' + space + ',center = ' + op + ")\n";
}
generator.definitions_['import_' + version + '_onboard_matrix'] = "from " + version + " import onboard_matrix";
var code = "onboard_matrix.shows(" + data + ',space = ' + space + ',center = ' + op + ")\n";
@@ -30,7 +33,7 @@ export const display_show_image_or_string_delay = function (_, generator) {
export const display_show_frame_string = function (_, generator) {
var version = Boards.getSelectedBoardKey().split(':')[2];
if (version == 'mpython') {
if (version == 'mpython' || version == 'educore') {
generator.definitions_['import_' + version + '_onboard_oled'] = "from " + version + " import onboard_oled";
var data = generator.valueToCode(this, 'data', generator.ORDER_ASSIGNMENT);
var code = "onboard_oled.frame(" + data + ")\n";
@@ -44,16 +47,22 @@ export const display_show_frame_string = function (_, generator) {
export const display_show_frame_string_delay = function (_, generator) {
var version = Boards.getSelectedBoardKey().split(':')[2];
generator.definitions_['import_' + version + '_onboard_matrix'] = "from " + version + " import onboard_matrix";
var data = generator.valueToCode(this, 'data', generator.ORDER_ASSIGNMENT);
var time = generator.valueToCode(this, 'time', generator.ORDER_ASSIGNMENT);
var code = "onboard_matrix.frame(" + data + ',delay = ' + time + ")\n";
if (version == 'mpython' || version == 'educore') {
generator.definitions_['import_' + version + '_onboard_oled'] = "from " + version + " import onboard_oled";
var data = generator.valueToCode(this, 'data', generator.ORDER_ASSIGNMENT);
var code = "onboard_oled.frame(" + data + ',delay = ' + time + ")\n";
} else {
generator.definitions_['import_' + version + '_onboard_matrix'] = "from " + version + " import onboard_matrix";
var code = "onboard_matrix.frame(" + data + ',delay = ' + time + ")\n";
}
return code;
}
export const display_scroll_string = function (_, generator) {
var version = Boards.getSelectedBoardKey().split(':')[2];
if (version == 'mpython') {
if (version == 'mpython'|| version == 'educore') {
generator.definitions_['import_' + version + '_onboard_oled'] = "from " + version + " import onboard_oled";
var data = generator.valueToCode(this, 'data', generator.ORDER_ASSIGNMENT);
var code = "onboard_oled.scroll(" + data + ")\n";
@@ -67,11 +76,16 @@ export const display_scroll_string = function (_, generator) {
export const display_scroll_string_delay = function (_, generator) {
var version = Boards.getSelectedBoardKey().split(':')[2];
generator.definitions_['import_' + version + '_onboard_matrix'] = "from " + version + " import onboard_matrix";
var data = generator.valueToCode(this, 'data', generator.ORDER_ASSIGNMENT);
var time = generator.valueToCode(this, 'time', generator.ORDER_ASSIGNMENT);
var space = generator.valueToCode(this, 'space', generator.ORDER_ASSIGNMENT);
var code = "onboard_matrix.scroll(" + data + ',speed =' + time + ',space = ' + space + ")\n";
if (version == 'mpython'|| version == 'educore') {
generator.definitions_['import_' + version + '_onboard_oled'] = "from " + version + " import onboard_oled";
var code = "onboard_oled.scroll(" + data + ',speed =' + time + ',space = ' + space + ")\n";
}else{
generator.definitions_['import_' + version + '_onboard_matrix'] = "from " + version + " import onboard_matrix";
var code = "onboard_matrix.scroll(" + data + ',speed =' + time + ',space = ' + space + ")\n";
}
return code;
}

View File

@@ -2,7 +2,7 @@ import { Profile } from 'mixly';
const pins = {};
pins["Edu Core"] = {
pins["mpython"] = {
description: "MicroPython[EDUCORE Edu Core]",
digital_pin: Profile.generate(['0-10', '18']),
input_pin: Profile.generate(['0-10', '18']),

View File

@@ -2360,7 +2360,7 @@
<block type="educore_mqtt_connect">
<value name="SERVER">
<shadow type="text">
<field name="TEXT">mqtt.mypep.cn</field>
<field name="TEXT">mixio.mixly.cn</field>
</shadow>
</value>
<value name="PORT">
@@ -2445,117 +2445,7 @@
<block type="educore_mqtt_connect_success"></block>
<block type="iot_wifi_connect">
<value name="WIFINAME">
<shadow type="text">
<field name="TEXT">wifiname</field>
</shadow>
</value>
<value name="PASSWORD">
<shadow type="text">
<field name="TEXT">wifipassword</field>
</shadow>
</value>
</block>
<block type="IOT_EMQX_INIT_AND_CONNECT_BY_MIXLY_CODE">
<value name="SERVER">
<shadow type="text">
<field name="TEXT">mixio.mixly.cn</field>
</shadow>
</value>
<value name="KEY">
<shadow type="iot_mixly_key">
<field name="TEXT"></field>
</shadow>
</value>
</block>
<block type="IOT_EMQX_INIT_AND_CONNECT_BY_SHARE_CODE">
<value name="SERVER">
<shadow type="text">
<field name="TEXT">mixio.mixly.cn</field>
</shadow>
</value>
<value name="KEY">
<shadow type="factory_block_return">
<field name="VALUE">A1B2C3</field>
</shadow>
</value>
</block>
<block type="iot_mixio_connect">
<value name="SERVER">
<shadow type="text">
<field name="TEXT">mixio.mixly.cn</field>
</shadow>
</value>
<value name="USERNAME">
<shadow type="text">
<field name="TEXT">username</field>
</shadow>
</value>
<value name="PASSWORD">
<shadow type="text">
<field name="TEXT">password</field>
</shadow>
</value>
<value name="PROJECT">
<shadow type="text">
<field name="TEXT">MyProject</field>
</shadow>
</value>
</block>
<block type="IOT_MIXIO_PUBLISH">
<value name="TOPIC">
<shadow type="text">
<field name="TEXT">topic</field>
</shadow>
</value>
<value name="MSG">
<shadow type="text">
<field name="TEXT">msg</field>
</shadow>
</value>
</block>
<block type="IOT_MIXIO_SUBSCRIBE">
<value name="TOPIC">
<shadow type="text">
<field name="TEXT">topic</field>
</shadow>
</value>
<value name="METHOD">
<shadow type="factory_block_return">
<field name="VALUE">method</field>
</shadow>
</value>
</block>
<block type="procedures_defnoreturn">
<mutation>
<arg name="client"></arg>
<arg name="topic"></arg>
<arg name="msg"></arg>
</mutation>
<field name="NAME">method</field>
<statement name="STACK">
<block type="controls_if">
<value name="IF0">
<block type="logic_compare">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get">
<field name="VAR">msg</field>
</block>
</value>
<value name="B">
<block type="text">
<field name="TEXT">1</field>
</block>
</value>
</block>
</statement>
</block>
<block type="iot_mixio_check"></block>
<!-- <block type="iot_mixio_check"></block>
<block type="iot_client_onboard"></block>
<block type="IOT_FORMATTING">
<value name="VAR">
@@ -2612,27 +2502,6 @@
<block type="iot_mixio_connect_only"></block>
<block type="iot_mixio_disconnect"></block>
<block type="IOT_EMQX_PING"></block>
<!-- <block type="IOT_MIXIO_NTP">
<value name="addr">
<shadow type="text">
<field name="TEXT">mixio.mixly.cn</field>
</shadow>
</value>
</block>
<block type="iot_mixio_format_topic">
<value name="VAR">
<shadow type="variables_get">
<field name="VAR">topic</field>
</shadow>
</value>
</block>
<block type="iot_mixio_format_msg">
<value name="VAR">
<shadow type="variables_get">
<field name="VAR">msg</field>
</shadow>
</value>
</block> -->
<block type="iot_http_client">
<value name="addr">
<shadow type="text">
@@ -2648,7 +2517,7 @@
</shadow>
</value>
</block>
<block type="iot_mqtt_data"></block>
<block type="iot_mqtt_data"></block> -->
</category>
<category id="catOnenet" colour="#78AAE0">
<block type="iot_wifi_connect">

View File

@@ -168,7 +168,7 @@ ZhHans.MSG = {
catAudio: "音频",
catNeopixel: "RGB灯",
catOneWire: "OneWire通信",
catBLE: "蓝牙透",
catBLE: "蓝牙透",
catBLEC:"蓝牙遥控",
catBLEKM:"蓝牙键鼠",
catBLE_HID: "外围设备(从机)",

View File

@@ -156,7 +156,7 @@ ZhHant.MSG = {
catAudio: "音頻",
catNeopixel: "RGB燈",
catOneWire: "OneWire通信",
catBLE: "藍牙透",
catBLE: "藍牙透",
catBLEC:"藍牙遙控",
catBLEKM:"藍牙鍵鼠",
catBLE_HID: "外圍設備(從機)",