small code fixes
This commit is contained in:
parent
13d2d3d301
commit
c17fc8a50f
@ -115,7 +115,7 @@ Blockly.Blocks['controls_if'] = {
|
|||||||
elseStatementConnection = clauseBlock.statementConnection_;
|
elseStatementConnection = clauseBlock.statementConnection_;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw 'Unknown block type.';
|
throw new Error('Unknown block type.');
|
||||||
}
|
}
|
||||||
clauseBlock = clauseBlock.nextConnection &&
|
clauseBlock = clauseBlock.nextConnection &&
|
||||||
clauseBlock.nextConnection.targetBlock();
|
clauseBlock.nextConnection.targetBlock();
|
||||||
@ -153,7 +153,7 @@ Blockly.Blocks['controls_if'] = {
|
|||||||
inputDo && inputDo.connection.targetConnection;
|
inputDo && inputDo.connection.targetConnection;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw 'Unknown block type.';
|
throw new Error('Unknown block type.');
|
||||||
}
|
}
|
||||||
clauseBlock = clauseBlock.nextConnection &&
|
clauseBlock = clauseBlock.nextConnection &&
|
||||||
clauseBlock.nextConnection.targetBlock();
|
clauseBlock.nextConnection.targetBlock();
|
||||||
|
@ -74,14 +74,14 @@ Blockly.Arduino['controls_if'] = function (Block) {
|
|||||||
conditionCode +
|
conditionCode +
|
||||||
') {\n' +
|
') {\n' +
|
||||||
branchCode +
|
branchCode +
|
||||||
'}';
|
'}\n';
|
||||||
|
|
||||||
++n;
|
++n;
|
||||||
} while (Block.getInput('IF' + n));
|
} while (Block.getInput('IF' + n));
|
||||||
|
|
||||||
if (Block.getInput('ELSE')) {
|
if (Block.getInput('ELSE')) {
|
||||||
branchCode = Blockly.Arduino.statementToCode(Block, 'ELSE');
|
branchCode = Blockly.Arduino.statementToCode(Block, 'ELSE');
|
||||||
code += ' else {\n' + branchCode + '}';
|
code += ' else {\n' + branchCode + '}\n';
|
||||||
}
|
}
|
||||||
return code + '\n';
|
return code + '\n';
|
||||||
};
|
};
|
||||||
@ -106,14 +106,14 @@ Blockly.Arduino['controls_ifelse'] = function (Block) {
|
|||||||
conditionCode +
|
conditionCode +
|
||||||
') {\n' +
|
') {\n' +
|
||||||
branchCode +
|
branchCode +
|
||||||
'}';
|
'}\n';
|
||||||
|
|
||||||
++n;
|
++n;
|
||||||
} while (Block.getInput('IF' + n));
|
} while (Block.getInput('IF' + n));
|
||||||
|
|
||||||
if (Block.getInput('ELSE')) {
|
if (Block.getInput('ELSE')) {
|
||||||
branchCode = Blockly.Arduino.statementToCode(Block, 'ELSE');
|
branchCode = Blockly.Arduino.statementToCode(Block, 'ELSE');
|
||||||
code += ' else {\n' + branchCode + '}';
|
code += ' else {\n' + branchCode + '}\n';
|
||||||
}
|
}
|
||||||
return code + '\n';
|
return code + '\n';
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,10 @@ Blockly.Arduino.sensebox_display_clearDisplay = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_display_printDisplay = function () {
|
Blockly.Arduino.sensebox_display_printDisplay = function () {
|
||||||
var x = Blockly.Arduino.valueToCode(this, 'X', Blockly.Arduino.ORDER_ATOMIC) || '0'
|
var x = this.getFieldValue('X');
|
||||||
var y = Blockly.Arduino.valueToCode(this, 'Y', Blockly.Arduino.ORDER_ATOMIC) || '0'
|
var y = this.getFieldValue('Y');
|
||||||
var printDisplay = Blockly.Arduino.valueToCode(this, 'printDisplay', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
|
var printDisplay = Blockly.Arduino.valueToCode(this, 'printDisplay', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
|
||||||
var size = Blockly.Arduino.valueToCode(this, 'SIZE', Blockly.Arduino.ORDER_ATOMIC) || '1'
|
var size = this.getFieldValue('SIZE');
|
||||||
var color = this.getFieldValue('COLOR');
|
var color = this.getFieldValue('COLOR');
|
||||||
var code = 'display.setCursor(' + x + ',' + y + ');\n';
|
var code = 'display.setCursor(' + x + ',' + y + ');\n';
|
||||||
code += 'display.setTextSize(' + size + ');\n';
|
code += 'display.setTextSize(' + size + ');\n';
|
||||||
|
@ -272,13 +272,13 @@ Blockly.Arduino.sensebox_scd30 = function () {
|
|||||||
var code = '';
|
var code = '';
|
||||||
switch (dropdown) {
|
switch (dropdown) {
|
||||||
case 'temperature':
|
case 'temperature':
|
||||||
code = 'aireSensor.getTemperature()';
|
code = 'airSensor.getTemperature()';
|
||||||
break;
|
break;
|
||||||
case 'humidity':
|
case 'humidity':
|
||||||
code = 'airSensor.getHumiditiy()';
|
code = 'airSensor.getHumiditiy()';
|
||||||
break;
|
break;
|
||||||
case 'CO2':
|
case 'CO2':
|
||||||
code = 'aireSensor.getCO2()';
|
code = 'airSensor.getCO2()';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
code = ''
|
code = ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user