修改外接显示四位数码管

This commit is contained in:
Irene-Maxine
2025-07-22 18:19:56 +08:00
parent 24b5bc4304
commit 78c8b0b9ec
11 changed files with 17 additions and 103 deletions

View File

@@ -837,9 +837,9 @@ export const display_oled_drawPixel = {
export const display_tm_use_i2c_init = {
init: function () {
this.setColour(DISPLAY_EXTERN_HUE);
this.appendValueInput('I2CSUB')
.appendField(Blockly.Msg.CONTROLS_FOR_INPUT_WITH + "I2C")
.setCheck("var");
// this.appendValueInput('I2CSUB')
// .appendField(Blockly.Msg.CONTROLS_FOR_INPUT_WITH + "I2C")
// .setCheck("var");
this.appendValueInput('SUB')
.appendField(Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE)
.setCheck("var");
@@ -847,8 +847,8 @@ export const display_tm_use_i2c_init = {
.appendField(Blockly.Msg.MIXLY_SETUP + Blockly.Msg.LISTS_SET_INDEX_INPUT_TO)
.appendField(new Blockly.FieldDropdown([
// ["MPU9250", "MPU9250"],
// ["TM1637", "TM1637"],
["TM1650", "TM1650"]
["TM1650", "TM1650"],
["TM1637", "TM1637"]
]), "key");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
@@ -859,7 +859,7 @@ export const display_tm_use_i2c_init = {
var mode0 = Blockly.Msg.MIXLY_ESP32_SENSOR_USE_I2C_TOOLTIP;
var TOOLTIPS = {
// "MPU9250": "MPU9250",
// "TM1637": "TM1637",
"TM1637": "TM1637",
"TM1650": "TM1650"
};
return mode0 + TOOLTIPS[mode]

View File

@@ -309,15 +309,15 @@ export const display_oled_drawPixel = function (_, generator) {
//tm1650
export const display_tm_use_i2c_init = function (_, generator) {
var v = generator.valueToCode(this, 'SUB', generator.ORDER_ATOMIC);
var iv = generator.valueToCode(this, 'I2CSUB', generator.ORDER_ATOMIC);
// var iv = generator.valueToCode(this, 'I2CSUB', generator.ORDER_ATOMIC);
var key = this.getFieldValue("key");
var code;
if (key == 'TM1650') {
generator.definitions_['import_tm1650'] = 'import tm1650';
code = v + ' = tm1650.' + key + "(" + iv + ')\n';
code = v + ' = tm1650.' + key + '(clk=3,dio=4)\n';
} else if (key == 'TM1637') {
generator.definitions_['import_tm1637'] = 'import tm1637';
code = v + ' = tm1637.' + key + "(" + iv + ')\n';
code = v + ' = tm1637.' + key + '(clk=3,dio=4)\n';
}
return code;
}

View File

@@ -6797,13 +6797,6 @@
</shadow>
</value>
</block> -->
<block type="storage_is_file">
<value name="FILE">
<shadow type="text">
<field name="TEXT">path</field>
</shadow>
</value>
</block>
<block type="storage_file_tell">
<value name="FILE">
<shadow type="variables_get">

View File

@@ -6669,13 +6669,6 @@
</shadow>
</value>
</block> -->
<block type="storage_is_file">
<value name="FILE">
<shadow type="text">
<field name="TEXT">path</field>
</shadow>
</value>
</block>
<block type="storage_file_tell">
<value name="FILE">
<shadow type="variables_get">

View File

@@ -6574,13 +6574,6 @@
</shadow>
</value>
</block> -->
<block type="storage_is_file">
<value name="FILE">
<shadow type="text">
<field name="TEXT">path</field>
</shadow>
</value>
</block>
<block type="storage_file_tell">
<value name="FILE">
<shadow type="variables_get">

View File

@@ -6475,13 +6475,6 @@
</shadow>
</value>
</block> -->
<block type="storage_is_file">
<value name="FILE">
<shadow type="text">
<field name="TEXT">path</field>
</shadow>
</value>
</block>
<block type="storage_file_tell">
<value name="FILE">
<shadow type="variables_get">

View File

@@ -6205,13 +6205,6 @@
</shadow>
</value>
</block> -->
<block type="storage_is_file">
<value name="FILE">
<shadow type="text">
<field name="TEXT">path</field>
</shadow>
</value>
</block>
<block type="storage_file_tell">
<value name="FILE">
<shadow type="variables_get">

View File

@@ -5265,41 +5265,18 @@
</category>
<category id="cat4Digitdisplay" colour='5BA5A5'>
<block type="communicate_i2c_init">
<block type="display_tm_use_i2c_init">
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">disp</field>
</shadow>
</value>
<!-- <value name="I2CSUB">
<shadow type="variables_get">
<field name="VAR">i2c_extend</field>
</shadow>
</value>
<value name="TX">
<shadow type="pins_digital_pin">
<field name="PIN">4</field>
</shadow>
</value>
<value name="RX">
<shadow type="pins_digital_pin">
<field name="PIN">5</field>
</shadow>
</value>
<value name="freq">
<shadow type="math_number">
<field name="NUM">100000</field>
</shadow>
</value>
<next>
<block type="display_tm_use_i2c_init">
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">disp</field>
</shadow>
</value>
<value name="I2CSUB">
<shadow type="variables_get">
<field name="VAR">i2c_extend</field>
</shadow>
</value>
</block>
</next>
</value> -->
</block>
<block type="display_tm1650_show_num">
@@ -6958,13 +6935,6 @@
</shadow>
</value>
</block> -->
<block type="storage_is_file">
<value name="FILE">
<shadow type="text">
<field name="TEXT">path</field>
</shadow>
</value>
</block>
<block type="storage_file_tell">
<value name="FILE">
<shadow type="variables_get">

View File

@@ -1370,13 +1370,6 @@
</shadow>
</value>
</block>
<block type="storage_is_file">
<value name="FILE">
<shadow type="text">
<field name="TEXT">path</field>
</shadow>
</value>
</block>
<block type="storage_file_tell">
<value name="FILE">
<shadow type="variables_get">

View File

@@ -1758,13 +1758,6 @@
</shadow>
</value>
</block> -->
<block type="storage_is_file">
<value name="FILE">
<shadow type="text">
<field name="TEXT">path</field>
</shadow>
</value>
</block>
<block type="storage_file_tell">
<value name="FILE">
<shadow type="variables_get">

View File

@@ -5236,13 +5236,6 @@
</shadow>
</value>
</block> -->
<block type="storage_is_file">
<value name="FILE">
<shadow type="text">
<field name="TEXT">path</field>
</shadow>
</value>
</block>
<block type="storage_file_tell">
<value name="FILE">
<shadow type="variables_get">