init implementation of procedures

This commit is contained in:
Mario
2020-11-05 11:05:14 +01:00
parent 4601439ae3
commit 8e2deed1d5
16 changed files with 1299 additions and 42 deletions
+1 -2
View File
@@ -1,5 +1,4 @@
import Blockly, { FieldDropdown } from 'blockly/core';
import { selectedBoard } from '../helpers/board'
import Blockly, { FieldDropdown } from 'blockly/core'
import * as Types from '../helpers/types'
import { getColour } from '../helpers/colour';
File diff suppressed because it is too large Load Diff
@@ -50,8 +50,6 @@ Blockly.Blocks['sensebox_display_printDisplay'] = {
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
let variableName = this.getField('COLOR');
console.log(variableName.getValue());
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tip);
this.setHelpUrl('https://sensebox.de/books');
},
@@ -103,13 +103,10 @@ Blockly.Blocks['sensebox_send_to_osem'] = {
for (var i = 0; i < apiData.sensors.length; i++) {
options.push([apiData.sensors[i].title, apiData.sensors[i]._id]);
}
console.log(options);
}
if (options.length > 1) {
var dropdown = options.slice(1)
console.log(dropdown);
return dropdown;
} else
return options;
@@ -309,7 +309,7 @@ Blockly.Blocks['sensebox_button'] = {
Blockly.Blocks['sensebox_scd30'] = {
init: function () {
var dropdownOptions = [[Blockly.Msg.senseBox_temp, "temperature"], [Blockly.Msg.senseBox_hum, "humidity"], [Blockly.Msg.senseBox_bme_co2, "CO2"]];
var dropdownOptions = [[Blockly.Msg.senseBox_scd_co2, "CO2"], [Blockly.Msg.senseBox_temp, "temperature"], [Blockly.Msg.senseBox_hum, "humidity"]];
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_scd30);
this.appendDummyInput()
@@ -318,6 +318,14 @@ Blockly.Blocks['sensebox_scd30'] = {
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown")
this.setOutput(true, Types.NUMBER.typeName);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_bme_tip);
this.setTooltip(Blockly.Msg.senseBox_scd_tip);
},
onchange: function (e) {
var dropdown = this.getFieldValue('dropdown');
if (dropdown === 'temperature' || dropdown === 'humidity') {
this.setOutput(true, Types.DECIMAL.typeName);
} else if (dropdown === 'CO2') {
this.setOutput(true, Types.NUMBER.typeName);
}
}
};