Skip to content

Commit 6edff27

Browse files
committed
Change serial.print() block input to accept any type
Fixes #162
1 parent 7c5ffcf commit 6edff27

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

ardublockly/ardublockly.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Ardublockly.bindActionFunctions = function() {
6161
$('.button-collapse').sideNav('hide');
6262
});
6363
Ardublockly.bindClick_('menu_example_2', function() {
64-
Ardublockly.loadServerXmlFile('../examples/serial_print_ascii_.xml');
64+
Ardublockly.loadServerXmlFile('../examples/serial_print_ascii.xml');
6565
$('.button-collapse').sideNav('hide');
6666
});
6767
Ardublockly.bindClick_('menu_example_3', function() {

blockly/blocks/arduino/serial.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ Blockly.Blocks['serial_print'] = {
7575
.appendField(new Blockly.FieldDropdown(
7676
Blockly.Arduino.Boards.selected.serial), 'SERIAL_ID')
7777
.appendField(Blockly.Msg.ARD_SERIAL_PRINT);
78-
this.appendValueInput('CONTENT')
79-
.setCheck(Blockly.Types.TEXT.checkList);
78+
this.appendValueInput('CONTENT');
8079
this.appendDummyInput()
8180
.appendField(new Blockly.FieldCheckbox('TRUE'), 'NEW_LINE')
8281
.appendField(Blockly.Msg.ARD_SERIAL_PRINT_NEWLINE);
@@ -111,8 +110,8 @@ Blockly.Blocks['serial_print'] = {
111110
}
112111

113112
if (!setupInstancePresent) {
114-
this.setWarningText(Blockly.Msg.ARD_SERIAL_PRINT_WARN.replace('%1',
115-
thisInstanceName), 'serial_setup');
113+
this.setWarningText(Blockly.Msg.ARD_SERIAL_PRINT_WARN.replace('%1',
114+
thisInstanceName), 'serial_setup');
116115
} else {
117116
this.setWarningText(null, 'serial_setup');
118117
}
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<block type="controls_whileUntil" id="12" inline="false">
1515
<field name="MODE">WHILE</field>
1616
<value name="BOOL">
17-
<block type="logic_compare" id="13" inline="true">
17+
<block type="logic_compare" id="13">
1818
<field name="OP">LT</field>
1919
<value name="A">
2020
<block type="variables_get" id="14">
@@ -29,11 +29,11 @@
2929
</block>
3030
</value>
3131
<statement name="DO">
32-
<block type="serial_print" id="16" inline="true">
32+
<block type="serial_print" id="16">
3333
<field name="SERIAL_ID">Serial</field>
3434
<field name="NEW_LINE">FALSE</field>
3535
<value name="CONTENT">
36-
<block type="variables_set_type" id="17" inline="true">
36+
<block type="variables_set_type" id="17">
3737
<field name="VARIABLE_SETTYPE_TYPE">CHARACTER</field>
3838
<value name="VARIABLE_SETTYPE_INPUT">
3939
<block type="variables_get" id="18">
@@ -43,7 +43,7 @@
4343
</block>
4444
</value>
4545
<next>
46-
<block type="serial_print" id="19" inline="true">
46+
<block type="serial_print" id="19">
4747
<field name="SERIAL_ID">Serial</field>
4848
<field name="NEW_LINE">FALSE</field>
4949
<value name="CONTENT">
@@ -52,17 +52,12 @@
5252
</block>
5353
</value>
5454
<next>
55-
<block type="serial_print" id="21" inline="true">
55+
<block type="serial_print" id="21">
5656
<field name="SERIAL_ID">Serial</field>
5757
<field name="NEW_LINE">TRUE</field>
5858
<value name="CONTENT">
59-
<block type="variables_set_type" id="22" inline="true">
60-
<field name="VARIABLE_SETTYPE_TYPE">NUMBER</field>
61-
<value name="VARIABLE_SETTYPE_INPUT">
62-
<block type="variables_get" id="23">
63-
<field name="VAR">thisByte</field>
64-
</block>
65-
</value>
59+
<block type="variables_get" id="23">
60+
<field name="VAR">thisByte</field>
6661
</block>
6762
</value>
6863
<next>

0 commit comments

Comments
 (0)