generate dynamic dropdowns

This commit is contained in:
Mario
2020-10-17 14:17:37 +02:00
parent 145c14c0cc
commit 9dedc9ccd1
2 changed files with 71 additions and 14 deletions
@@ -18,17 +18,19 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
var box_id = this.getFieldValue('BoxID');
var host = this.getFieldValue('host');
var branch = Blockly.Arduino.statementToCode(Block, 'DO');
//var blocks = Blockly.Block.getDescendants;
var blocks = this.getDescendants();
var type = this.getFieldValue('type');
var ssl = this.getFieldValue('SSL');
var port = 0;
var count = 0;
// for (var i = 0; i < blocks.length; i++) {
// if (blocks[i].type === 'sensebox_send_to_osem') {
// count++;
if (blocks != undefined) {
for (var i = 0; i < blocks.length; i++) {
if (blocks[i].type === 'sensebox_send_to_osem') {
count++;
// }
// }
}
}
}
var num_sensors = count;
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['num_sensors'] = 'static const uint8_t NUM_SENSORS = ' + num_sensors + ';'