板卡补充颜色和气压传感器、修改radar块

This commit is contained in:
Irene-Maxine
2024-11-19 16:51:48 +08:00
parent 448fa016d2
commit cab3df0d17
10 changed files with 106 additions and 22 deletions

View File

@@ -341,8 +341,8 @@ export const sensor_use_i2c_init = {
this.appendDummyInput("")
.appendField(Blockly.Msg.MIXLY_SETUP + Blockly.Msg.LISTS_SET_INDEX_INPUT_TO)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.MIXLY_ESP32_EXTERN_LIGHT+"(LTR-308-ALS)", "LTR308"],
[Blockly.Msg.MIXLY_COLOR_SENSOR+"(LTR-381-RGB)", "LTR381RGB"],
[Blockly.Msg.MIXLY_ESP32_EXTERN_LIGHT+"(LTR308ALS)", "LTR308"],
[Blockly.Msg.MIXLY_COLOR_SENSOR+"(LTR381RGB)", "LTR381RGB"],
[Blockly.Msg.MIXLY_COLOR_SENSOR+"(UCS12071)","UCS12071"],
[Blockly.Msg.MIXLY_EXTERN_LIGHTUV +"(LTR390UV)","LTR390UV"],
[Blockly.Msg.MIXLY_ALTITUDE_SENSOR+"(HP203X)", "HP203X"],
@@ -391,8 +391,11 @@ export const radar_set_DETECTION_THRESHOLD = {
export const interaction_whether_to_interaction = {
init:function(){
this.setColour(SENSOR_EXTERN_HUE);
this.appendValueInput('SUB')
.appendField(Blockly.Msg.MIXLY_RADAR)
.setCheck("var");
this.appendDummyInput("")
.appendField(Blockly.Msg.MIXLY_RADAR + Blockly.Msg.MIXLY_GET_TO_INTERACTION)
.appendField(Blockly.Msg.MIXLY_GET_TO_INTERACTION)
this.setOutput(true);
this.setInputsInline(true);
}
@@ -442,7 +445,7 @@ export const sensor_LTR308_extern = {
init: function () {
this.setColour(SENSOR_EXTERN_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_ESP32_EXTERN_LIGHT + " LTR308");
.appendField(Blockly.Msg.MIXLY_ESP32_EXTERN_LIGHT + " LTR308ALS");
this.appendValueInput('SUB')
//.appendField("BMP280")
.setCheck("var");

View File

@@ -222,19 +222,14 @@ export const sensor_use_i2c_init = function (_, generator) {
export const radar_set_DETECTION_THRESHOLD = function (_, generator) {
var sub = generator.valueToCode(this, 'SUB', generator.ORDER_ATOMIC);
var value = generator.valueToCode(this, 'VAR', generator.ORDER_ATOMIC);
var key = this.getFieldValue('key');
if(key=='threshold'){
var code = sub + '.threshold(' + value +')\n';
return code;
}else if(key=='delay_ms'){
var code = sub + '.delay_ms(' + value +')\n';
return code;
}
var value2 = generator.valueToCode(this, 'VAR2', generator.ORDER_ATOMIC);
var code = sub + '.threshold(' + value +')\n'+sub + '.delay_ms(' + value2 +')\n';
return code;
}
export const interaction_whether_to_interaction = function(_,generator){
var code = 'radar.result()';
var sub = generator.valueToCode(this, 'SUB', generator.ORDER_ATOMIC);
var code = sub+'.result()';
return [code,generator.ORDER_ATOMIC];
}

View File

@@ -3759,6 +3759,13 @@
</shadow>
</value>
</block>
<block type="sensor_spl06_001_extern" m-hide='micropython:esp32c3:mixgocar_c3'>
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="sensor_shtc3_extern">
<value name="SUB">
<shadow type="variables_get">
@@ -3780,6 +3787,13 @@
</shadow>
</value>
</block>
<block type="sensor_ucs12071_extern" m-hide='micropython:esp32c3:mixgocar_c3'>
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="sensor_VL530LX_extern">
<value name="SUB">
<shadow type="variables_get">
@@ -3825,7 +3839,13 @@
</shadow>
</value>
</block>
<block type="interaction_whether_to_interaction"></block>
<block type="interaction_whether_to_interaction">
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="communicate_spi_init">
<value name="VAR">
<shadow type="variables_get">

View File

@@ -3684,7 +3684,13 @@
</shadow>
</value>
</block>
<block type="interaction_whether_to_interaction"></block>
<block type="interaction_whether_to_interaction">
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="communicate_spi_init" m-hide='micropython:esp32c3:mixgocar_c3'>
<value name="VAR">
<shadow type="variables_get">

View File

@@ -3556,6 +3556,13 @@
</shadow>
</value>
</block>
<block type="sensor_spl06_001_extern" m-hide='micropython:esp32c3:mixgocar_c3'>
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="sensor_shtc3_extern" m-hide='micropython:esp32c3:mixgocar_c3'>
<value name="SUB">
<shadow type="variables_get">
@@ -3577,6 +3584,13 @@
</shadow>
</value>
</block>
<block type="sensor_ucs12071_extern" m-hide='micropython:esp32c3:mixgocar_c3'>
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="sensor_VL530LX_extern" m-hide='micropython:esp32c3:mixgocar_c3'>
<value name="SUB">
<shadow type="variables_get">
@@ -3622,7 +3636,13 @@
</shadow>
</value>
</block>
<block type="interaction_whether_to_interaction"></block>
<block type="interaction_whether_to_interaction">
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="communicate_spi_init" m-hide='micropython:esp32c3:mixgocar_c3'>
<value name="VAR">
<shadow type="variables_get">

View File

@@ -3352,6 +3352,13 @@
</shadow>
</value>
</block>
<block type="sensor_spl06_001_extern" m-hide='micropython:esp32c3:mixgocar_c3'>
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="sensor_shtc3_extern">
<value name="SUB">
<shadow type="variables_get">
@@ -3373,6 +3380,13 @@
</shadow>
</value>
</block>
<block type="sensor_ucs12071_extern" m-hide='micropython:esp32c3:mixgocar_c3'>
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="sensor_VL530LX_extern">
<value name="SUB">
<shadow type="variables_get">
@@ -3418,7 +3432,13 @@
</shadow>
</value>
</block>
<block type="interaction_whether_to_interaction"></block>
<block type="interaction_whether_to_interaction">
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="communicate_spi_init">
<value name="VAR">
<shadow type="variables_get">

View File

@@ -3991,6 +3991,13 @@
</shadow>
</value>
</block>
<block type="sensor_spl06_001_extern" m-hide='micropython:esp32c3:mixgocar_c3'>
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="sensor_shtc3_extern">
<value name="SUB">
<shadow type="variables_get">
@@ -4012,6 +4019,13 @@
</shadow>
</value>
</block>
<block type="sensor_ucs12071_extern" m-hide='micropython:esp32c3:mixgocar_c3'>
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="sensor_VL530LX_extern">
<value name="SUB">
<shadow type="variables_get">
@@ -4057,7 +4071,13 @@
</shadow>
</value>
</block>
<block type="interaction_whether_to_interaction"></block>
<block type="interaction_whether_to_interaction">
<value name="SUB">
<shadow type="variables_get">
<field name="VAR">xsensor</field>
</shadow>
</value>
</block>
<block type="communicate_spi_init">
<value name="VAR">
<shadow type="variables_get">