Commit 7f117a55 authored by Carlos's avatar Carlos

Updated stepper library code generator:

Warnings on config instances are now shown inmediatly
Fixed javascript issue missed during initial testing when adding stepper block in the wrong order would cause it to throw an exception
Set up a better namespace for the drop down construction function
parent b57b7199
......@@ -41,15 +41,15 @@ codepage.messages = function(opt_data, opt_ignored, opt_ijData) {
codepage.start = function(opt_data, opt_ignored, opt_ijData) {
return codepage.messages(null, null, opt_ijData) + '<script type="text/javascript" src="../../blockly_uncompressed.js"><\/script><script type="text/javascript" src="../../blocks_compressed.js"><\/script><script type="text/javascript" src="../../generators/arduino.js"><\/script><script type="text/javascript" src="../../generators/arduino/base.js"><\/script><script type="text/javascript" src="../../generators/arduino/io.js"><\/script><script type="text/javascript" src="../../generators/arduino/lists.js"><\/script><script type="text/javascript" src="../../generators/arduino/logic.js"><\/script><script type="text/javascript" src="../../generators/arduino/loops.js"><\/script><script type="text/javascript" src="../../generators/arduino/math.js"><\/script><script type="text/javascript" src="../../generators/arduino/procedures.js"><\/script><script type="text/javascript" src="../../generators/arduino/servo.js"><\/script><script type="text/javascript" src="../../generators/arduino/stepper.js"><\/script><script type="text/javascript" src="../../generators/arduino/text.js"><\/script><script type="text/javascript" src="../../generators/arduino/time.js"><\/script><script type="text/javascript" src="../../generators/arduino/variables.js"><\/script><script type="text/javascript" src="../../' + soy.$$escapeHtml(opt_ijData.langSrc) + '"><\/script><table width="100%" height="100%"><tr><td><h1><span id="title"><a href="../index.html?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '">Blockly</a> : Code</span></h1></td><td class="farSide"><select id="languageMenu"></select></td></tr><tr><td colspan=2><table width="100%"><tr id="tabRow" height="1em"><td id="tab_blocks" class="tabon">Blocks</td><td class="tabmin">&nbsp;</td><td id="tab_arduino" class="taboff">Arduino</td><td class="tabmin">&nbsp;</td><td id="tab_xml" class="taboff">XML</td><td class="tabmax"><button id="trashButton" class="notext" title="Discard all blocks."><img src=\'../../media/1x1.gif\' class="trash icon21"></button> <button id="linkButton" class="notext" title="Save and link to blocks."><img src=\'../../media/1x1.gif\' class="link icon21"></button> <button id="runButton" class="notext primary" title="Run the program defined by the blocks in the workspace."><img src=\'../../media/1x1.gif\' class="run icon21"></button></td></tr></table></td></tr><tr><td height="99%" colspan=2 id="content_area">' + codepage.toolbox(null, null, opt_ijData) + '</td></tr></table><div id="content_blocks" class="content"></div><pre id="content_arduino" class="content"></pre><textarea id="content_xml" class="content" wrap="off"></textarea>' + apps.dialog(null, null, opt_ijData) + apps.storageDialog(null, null, opt_ijData);
return codepage.messages(null, null, opt_ijData) + '<script type="text/javascript" src="../../blockly_uncompressed.js"><\/script><script type="text/javascript" src="../../blocks_compressed.js"><\/script><script type="text/javascript" src="../../generators/arduino.js"><\/script><script type="text/javascript" src="../../generators/arduino/base.js"><\/script><script type="text/javascript" src="../../generators/arduino/io.js"><\/script><script type="text/javascript" src="../../generators/arduino/lists.js"><\/script><script type="text/javascript" src="../../generators/arduino/logic.js"><\/script><script type="text/javascript" src="../../generators/arduino/loops.js"><\/script><script type="text/javascript" src="../../generators/arduino/math.js"><\/script><script type="text/javascript" src="../../generators/arduino/procedures.js"><\/script><script type="text/javascript" src="../../generators/arduino/servo.js"><\/script><script type="text/javascript" src="../../generators/arduino/spi.js"><\/script><script type="text/javascript" src="../../generators/arduino/stepper.js"><\/script><script type="text/javascript" src="../../generators/arduino/text.js"><\/script><script type="text/javascript" src="../../generators/arduino/time.js"><\/script><script type="text/javascript" src="../../generators/arduino/variables.js"><\/script><script type="text/javascript" src="../../' + soy.$$escapeHtml(opt_ijData.langSrc) + '"><\/script><table width="100%" height="100%"><tr><td><h1><span id="title"><a href="../index.html?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '">Blockly</a> : Code</span></h1></td><td class="farSide"><select id="languageMenu"></select></td></tr><tr><td colspan=2><table width="100%"><tr id="tabRow" height="1em"><td id="tab_blocks" class="tabon">Blocks</td><td class="tabmin">&nbsp;</td><td id="tab_arduino" class="taboff">Arduino</td><td class="tabmin">&nbsp;</td><td id="tab_xml" class="taboff">XML</td><td class="tabmax"><button id="trashButton" class="notext" title="Discard all blocks."><img src=\'../../media/1x1.gif\' class="trash icon21"></button> <button id="linkButton" class="notext" title="Save and link to blocks."><img src=\'../../media/1x1.gif\' class="link icon21"></button> <button id="runButton" class="notext primary" title="Run the program defined by the blocks in the workspace."><img src=\'../../media/1x1.gif\' class="run icon21"></button></td></tr></table></td></tr><tr><td height="99%" colspan=2 id="content_area">' + codepage.toolbox(null, null, opt_ijData) + '</td></tr></table><div id="content_blocks" class="content"></div><pre id="content_arduino" class="content"></pre><textarea id="content_xml" class="content" wrap="off"></textarea>' + apps.dialog(null, null, opt_ijData) + apps.storageDialog(null, null, opt_ijData);
};
codepage.toolbox = function(opt_data, opt_ignored, opt_ijData) {
return '<xml id="toolbox" style="display: none"><category name="Logic"><block type="controls_if"></block><block type="logic_compare"></block><block type="logic_operation"></block><block type="logic_negate"></block><block type="logic_boolean"></block><block type="logic_null"></block><block type="logic_ternary"></block></category><category name="Loops"><block type="controls_repeat_ext"><value name="TIMES"><block type="math_number"><field name="NUM">10</field></block></value></block><block type="controls_whileUntil"></block><block type="controls_for"><value name="FROM"><block type="math_number"><field name="NUM">1</field></block></value><value name="TO"><block type="math_number"><field name="NUM">10</field></block></value><value name="BY"><block type="math_number"><field name="NUM">1</field></block></value></block><block type="controls_forEach"></block><block type="controls_flow_statements"></block></category><category name="Math"><block type="math_number"></block><block type="math_arithmetic"></block><block type="math_single"></block><block type="math_trig"></block><block type="math_constant"></block><block type="math_number_property"></block><block type="math_change"><value name="DELTA"><block type="math_number"><field name="NUM">1</field></block></value></block><block type="math_round"></block><block type="math_on_list"></block><block type="math_modulo"></block><block type="math_constrain"><value name="LOW"><block type="math_number"><field name="NUM">1</field></block></value><value name="HIGH"><block type="math_number"><field name="NUM">100</field></block></value></block><block type="math_random_int"><value name="FROM"><block type="math_number"><field name="NUM">1</field></block></value><value name="TO"><block type="math_number"><field name="NUM">100</field></block></value></block><block type="math_random_float"></block><block type="base_map"></block></category><category name="Text"><block type="text"></block><block type="text_join"></block><block type="text_append"><value name="TEXT"><block type="text"></block></value></block><block type="text_length"></block><block type="text_isEmpty"></block><block type="text_indexOf"><value name="VALUE"><block type="variables_get"><field name="VAR">text</field></block></value></block><block type="text_charAt"><value name="VALUE"><block type="variables_get"><field name="VAR">text</field></block></value></block><block type="text_getSubstring"><value name="STRING"><block type="variables_get"><field name="VAR">text</field></block></value></block><block type="text_changeCase"></block><block type="text_trim"></block><block type="text_print"></block><block type="text_prompt_ext"><value name="TEXT"><block type="text"></block></value></block></category><category name="Lists"><block type="lists_create_empty"></block><block type="lists_create_with"></block><block type="lists_repeat"><value name="NUM"><block type="math_number"><field name="NUM">5</field></block></value></block><block type="lists_length"></block><block type="lists_isEmpty"></block><block type="lists_indexOf"><value name="VALUE"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_getIndex"><value name="VALUE"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_setIndex"><value name="LIST"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_getSublist"><value name="LIST"><block type="variables_get"><field name="VAR">list</field></block></value></block></category><category name="Variables"><block type="variables_get"></block><block type="variables_set"></block><block type="variables_set_type"></block></category><category name="Functions" custom="PROCEDURE"></category><category name="Input/Output"><block type="io_digitalwrite"></block><block type="io_digitalread"></block><block type="io_builtin_led"></block><block type="io_analogwrite"></block><block type="io_analogread"></block><block type="io_highlow"></block></category><category name="Time"><block type="time_delay"></block><block type="time_delaymicros"></block><block type="time_millis"></block><block type="time_micros"></block></category><category name="Servo"><block type="servo_write"></block><block type="servo_read"></block></category><category name="Stepper"><block type="stepper_configure"></block><block type="stepper_step"></block></category></xml>';
return '<xml id="toolbox" style="display: none"><category name="Logic"><block type="controls_if"></block><block type="logic_compare"></block><block type="logic_operation"></block><block type="logic_negate"></block><block type="logic_boolean"></block><block type="logic_null"></block><block type="logic_ternary"></block></category><category name="Loops"><block type="controls_repeat_ext"><value name="TIMES"><block type="math_number"><field name="NUM">10</field></block></value></block><block type="controls_whileUntil"></block><block type="controls_for"><value name="FROM"><block type="math_number"><field name="NUM">1</field></block></value><value name="TO"><block type="math_number"><field name="NUM">10</field></block></value><value name="BY"><block type="math_number"><field name="NUM">1</field></block></value></block><block type="controls_forEach"></block><block type="controls_flow_statements"></block></category><category name="Math"><block type="math_number"></block><block type="math_arithmetic"></block><block type="math_single"></block><block type="math_trig"></block><block type="math_constant"></block><block type="math_number_property"></block><block type="math_change"><value name="DELTA"><block type="math_number"><field name="NUM">1</field></block></value></block><block type="math_round"></block><block type="math_on_list"></block><block type="math_modulo"></block><block type="math_constrain"><value name="LOW"><block type="math_number"><field name="NUM">1</field></block></value><value name="HIGH"><block type="math_number"><field name="NUM">100</field></block></value></block><block type="math_random_int"><value name="FROM"><block type="math_number"><field name="NUM">1</field></block></value><value name="TO"><block type="math_number"><field name="NUM">100</field></block></value></block><block type="math_random_float"></block><block type="base_map"></block></category><category name="Text"><block type="text"></block><block type="text_join"></block><block type="text_append"><value name="TEXT"><block type="text"></block></value></block><block type="text_length"></block><block type="text_isEmpty"></block><block type="text_indexOf"><value name="VALUE"><block type="variables_get"><field name="VAR">text</field></block></value></block><block type="text_charAt"><value name="VALUE"><block type="variables_get"><field name="VAR">text</field></block></value></block><block type="text_getSubstring"><value name="STRING"><block type="variables_get"><field name="VAR">text</field></block></value></block><block type="text_changeCase"></block><block type="text_trim"></block><block type="text_print"></block><block type="text_prompt_ext"><value name="TEXT"><block type="text"></block></value></block></category><category name="Lists"><block type="lists_create_empty"></block><block type="lists_create_with"></block><block type="lists_repeat"><value name="NUM"><block type="math_number"><field name="NUM">5</field></block></value></block><block type="lists_length"></block><block type="lists_isEmpty"></block><block type="lists_indexOf"><value name="VALUE"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_getIndex"><value name="VALUE"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_setIndex"><value name="LIST"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_getSublist"><value name="LIST"><block type="variables_get"><field name="VAR">list</field></block></value></block></category><category name="Variables"><block type="variables_get"></block><block type="variables_set"></block><block type="variables_set_type"></block></category><category name="Functions" custom="PROCEDURE"></category><category name="Input/Output"><block type="io_digitalwrite"></block><block type="io_digitalread"></block><block type="io_builtin_led"></block><block type="io_analogwrite"></block><block type="io_analogread"></block><block type="io_highlow"></block></category><category name="Time"><block type="time_delay"></block><block type="time_delaymicros"></block><block type="time_millis"></block><block type="time_micros"></block></category><category name="Servo"><block type="servo_write"></block><block type="servo_read"></block></category><category name="Stepper"><block type="stepper_config"></block><block type="stepper_step"></block></category></xml>';
};
codepage.readonly = function(opt_data, opt_ignored, opt_ijData) {
return codepage.messages(null, null, opt_ijData) + '<script type="text/javascript" src="../../blockly_compressed.js"><\/script><script type="text/javascript" src="../../blocks_compressed.js"><\/script><script type="text/javascript" src="../../generators/arduino.js"><\/script><script type="text/javascript" src="../../generators/arduino/base.js"><\/script><script type="text/javascript" src="../../generators/arduino/io.js"><\/script><script type="text/javascript" src="../../generators/arduino/lists.js"><\/script><script type="text/javascript" src="../../generators/arduino/logic.js"><\/script><script type="text/javascript" src="../../generators/arduino/loops.js"><\/script><script type="text/javascript" src="../../generators/arduino/math.js"><\/script><script type="text/javascript" src="../../generators/arduino/procedures.js"><\/script><script type="text/javascript" src="../../generators/arduino/servo.js"><\/script><script type="text/javascript" src="../../generators/arduino/stepper.js"><\/script><script type="text/javascript" src="../../generators/arduino/text.js"><\/script><script type="text/javascript" src="../../generators/arduino/time.js"><\/script><script type="text/javascript" src="../../generators/arduino/variables.js"><\/script><script type="text/javascript" src="../../' + soy.$$escapeHtml(opt_ijData.langSrc) + '"><\/script><div id="blockly"></div>';
return codepage.messages(null, null, opt_ijData) + '<script type="text/javascript" src="../../blockly_compressed.js"><\/script><script type="text/javascript" src="../../blocks_compressed.js"><\/script><script type="text/javascript" src="../../generators/arduino.js"><\/script><script type="text/javascript" src="../../generators/arduino/base.js"><\/script><script type="text/javascript" src="../../generators/arduino/io.js"><\/script><script type="text/javascript" src="../../generators/arduino/lists.js"><\/script><script type="text/javascript" src="../../generators/arduino/logic.js"><\/script><script type="text/javascript" src="../../generators/arduino/loops.js"><\/script><script type="text/javascript" src="../../generators/arduino/math.js"><\/script><script type="text/javascript" src="../../generators/arduino/procedures.js"><\/script><script type="text/javascript" src="../../generators/arduino/servo.js"><\/script><script type="text/javascript" src="../../generators/arduino/spi.js"><\/script><script type="text/javascript" src="../../generators/arduino/stepper.js"><\/script><script type="text/javascript" src="../../generators/arduino/text.js"><\/script><script type="text/javascript" src="../../generators/arduino/time.js"><\/script><script type="text/javascript" src="../../generators/arduino/variables.js"><\/script><script type="text/javascript" src="../../' + soy.$$escapeHtml(opt_ijData.langSrc) + '"><\/script><div id="blockly"></div>';
};
......@@ -38,6 +38,7 @@
<script type="text/javascript" src="../../generators/arduino/math.js"></script>
<script type="text/javascript" src="../../generators/arduino/procedures.js"></script>
<script type="text/javascript" src="../../generators/arduino/servo.js"></script>
<script type="text/javascript" src="../../generators/arduino/spi.js"></script>
<script type="text/javascript" src="../../generators/arduino/stepper.js"></script>
<script type="text/javascript" src="../../generators/arduino/text.js"></script>
<script type="text/javascript" src="../../generators/arduino/time.js"></script>
......@@ -290,7 +291,7 @@
<block type="servo_read"></block>
</category>
<category name="{msg meaning="Apps.catStepper" desc="IBID"}Stepper{/msg}">
<block type="stepper_configure"></block>
<block type="stepper_config"></block>
<block type="stepper_step"></block>
</category>
</xml>
......@@ -313,6 +314,7 @@
<script type="text/javascript" src="../../generators/arduino/math.js"></script>
<script type="text/javascript" src="../../generators/arduino/procedures.js"></script>
<script type="text/javascript" src="../../generators/arduino/servo.js"></script>
<script type="text/javascript" src="../../generators/arduino/spi.js"></script>
<script type="text/javascript" src="../../generators/arduino/stepper.js"></script>
<script type="text/javascript" src="../../generators/arduino/text.js"></script>
<script type="text/javascript" src="../../generators/arduino/time.js"></script>
......
......@@ -6,8 +6,8 @@
* able to generate the 'set' drop down menu with all current instaces of the
* Stepper class:
* Blockly.Arduino.stepper.allInstances
* Blockly.Arduino.stepper.FieldSetterInstance
* Blockly.Arduino.stepper.FieldSetterInstance.dropdownCreate
* Blockly.Arduino.stepper.FieldStepperInstance
* Blockly.Arduino.stepper.FieldStepperInstance.dropdownCreate
*
* TODO: Still need to had some kind of handler to refresh the "set" drop down
* menu values if an instance in a 'configure' block is renamed.
......@@ -20,6 +20,11 @@ goog.require('Blockly.Arduino');
goog.require('Blockly.FieldDropdown');
/**
* Strings for easy reference
*/
Blockly.Arduino.stepper.no_instance = 'No_Instances';
Blockly.Arduino.stepper.no_name = 'Empty_input_name';
/**
* Finds all user-created instances of the Stepper block config.
......@@ -32,7 +37,7 @@ Blockly.Arduino.stepper.allInstances = function() {
// Iterate through every block and add each Stetter config name to the hash.
for (var x = 0; x < blocks.length; x++) {
var func = blocks[x].getInstance;
var func = blocks[x].getStepperInstance;
if (func) {
var blockVariables = func.call(blocks[x]);
for (var y = 0; y < blockVariables.length; y++) {
......@@ -61,26 +66,33 @@ Blockly.Arduino.stepper.allInstances = function() {
* @extends {Blockly.FieldDropdown}
* @constructor
*/
Blockly.Arduino.stepper.FieldSetterInstance = function() {
Blockly.Arduino.stepper.FieldSetterInstance.superClass_.constructor.call(this,
Blockly.Arduino.stepper.FieldSetterInstance.dropdownCreate);
Blockly.Arduino.stepper.FieldStepperInstance = function() {
Blockly.Arduino.stepper.FieldStepperInstance.superClass_.constructor.call(this,
Blockly.Arduino.stepper.FieldStepperInstance.dropdownCreate);
};
goog.inherits(Blockly.Arduino.stepper.FieldSetterInstance, Blockly.FieldDropdown);
goog.inherits(Blockly.Arduino.stepper.FieldStepperInstance, Blockly.FieldDropdown);
/**
* Return a sorted list of instances names for set dropdown menu.
* @return {!Array.<string>} Array of variable names.
* @this {!Blockly.FieldSetterInstance}
* @this {!Blockly.Arduino.stepper.FieldStepperInstance}
*/
Blockly.Arduino.stepper.FieldSetterInstance.dropdownCreate = function() {
Blockly.Arduino.stepper.FieldStepperInstance.dropdownCreate = function() {
var variableList = Blockly.Arduino.stepper.allInstances();
var options = [];
if (variableList.length > 0) {
variableList.sort(goog.string.caseInsensitiveCompare);
// Variables are not language-specific, use the name as both the user-facing
// text and the internal representation.
var options = [];
for (var x = 0; x < variableList.length; x++) {
options[x] = [variableList[x], variableList[x]];
}
} else {
// There are no config blocks in the work area
options[0] = [Blockly.Arduino.stepper.no_instance,
Blockly.Arduino.stepper.no_instance];
}
return options;
};
......@@ -89,7 +101,7 @@ Blockly.Arduino.stepper.FieldSetterInstance.dropdownCreate = function() {
* an object instance and setting up the speed. Info in the setHelpUrl link.
* @this Blockly.Block
*/
Blockly.Blocks['stepper_configure'] = {
Blockly.Blocks['stepper_config'] = {
/**
* Block for Stepper configuration.
* @this Blockly.Block
......@@ -115,9 +127,7 @@ Blockly.Blocks['stepper_configure'] = {
this.appendValueInput('STEPPER_NAME')
.setCheck('String')
.appendField('Set name to');
this.setTooltip('');
//this.contextMenuMsg_ = Blockly.Msg.VARIABLES_GET_CREATE_SET;
//this.contextMenuType_ = 'stepper_step';
this.setTooltip('Configures a stepper motor to the pinout and other settings');
},
/**
* Returns the stepper instance name, defined in the 'STEPPER_NAME' input
......@@ -125,18 +135,15 @@ Blockly.Blocks['stepper_configure'] = {
* @return {!Array.<string>} List with the instaces name.
* @this Blockly.Block
*/
getInstance: function() {
var InstanceNamefromBlock;
var targetBlock = this.getInputTargetBlock('STEPPER_NAME');
if (!targetBlock) {
InstanceNamefromBlock = 'Empty_input_name';
this.setWarningText('A STEPPER configuration block needs to have a ' +
'name to set the motor steps!');
getStepperInstance: function() {
var InstanceName;
var instanceNameBlock = this.getInputTargetBlock('STEPPER_NAME');
if (!instanceNameBlock) {
InstanceName = Blockly.Arduino.stepper.no_name;
} else {
InstanceNamefromBlock = targetBlock.getFieldValue('TEXT');
this.setWarningText(null);
InstanceName = instanceNameBlock.getFieldValue('TEXT');
}
return [InstanceNamefromBlock];
return [InstanceName];
}
};
......@@ -147,11 +154,11 @@ Blockly.Blocks['stepper_configure'] = {
* @param {block} block Block to generate the code from.
* @return {string} Empty string as no code goes into 'loop()'
*/
Blockly.Arduino['stepper_configure'] = function(block) {
Blockly.Arduino['stepper_config'] = function(block) {
var pin1 = block.getFieldValue('STEPPER_PIN1');
var pin2 = block.getFieldValue('STEPPER_PIN2');
var pin_type = profile.default.pin_types.STEPPER;
var stepper_name = block.getInstance();
var stepper_name = block.getStepperInstance();
var stepper_steps = Blockly.Arduino.valueToCode(block, 'STEPPER_STEPS',
Blockly.Arduino.ORDER_ATOMIC) || '360';
var stepper_speed = Blockly.Arduino.valueToCode(block, 'STEPPER_SPEED',
......@@ -203,12 +210,34 @@ Blockly.Blocks['stepper_step'] = {
// TODO: Combine these messages instead of using concatenation.
'STEPPER' + ' %1 ' +
'move' + ' %2' + 'steps',
['STEPPER_NAME', new Blockly.Arduino.stepper.FieldSetterInstance()],
['STEPPER_NAME', new Blockly.Arduino.stepper.FieldStepperInstance()],
['STEPPER_STEPS', 'Number', Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip('Turns the stepper motor a specific number of steps.');
},
/**
* Called whenever anything on the workspace changes.
* It checks the instances of stepper_config and attaches a warning to this
* block if not valid data is found.
* @this Blockly.Block
*/
onchange: function() {
if (!this.workspace) {
// Block has been deleted.
return;
}
var instances = Blockly.Arduino.stepper.FieldStepperInstance.dropdownCreate();
if (instances[0][0] === Blockly.Arduino.stepper.no_instance) {
this.setWarningText('A STEPPER configuration block must be added to' +
'use this block!');
} else if (instances[0][0] === Blockly.Arduino.stepper.no_name) {
this.setWarningText('A Name input must be added to the Stepper ' +
'configuration block!');
} else {
this.setWarningText(null);
}
}
};
......@@ -222,15 +251,7 @@ Blockly.Arduino['stepper_step'] = function(block) {
var stepper_steps = Blockly.Arduino.valueToCode(block, 'STEPPER_STEPS',
Blockly.Arduino.ORDER_ATOMIC) || '0';
var code = '';
// Only write the code if an instance has been configured
if (stepper_instance != 'Empty_input_name') {
code = stepper_instance + '.steps(' + stepper_steps + ')';
block.setWarningText(null);
} else {
block.setWarningText('A STEPPER configuration block has to be added in ' +
'to be able to use this block!');
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment