minor changes

This commit is contained in:
Mario 2020-09-17 15:16:41 +02:00
parent 6a4de9c7a2
commit 42299a374a
8 changed files with 44 additions and 32 deletions

View File

@ -48,11 +48,11 @@ class BlocklyWindow extends Component {
style={this.props.blocklyCSS} style={this.props.blocklyCSS}
readOnly={this.props.readOnly !== undefined ? this.props.readOnly : false} readOnly={this.props.readOnly !== undefined ? this.props.readOnly : false}
trashcan={this.props.trashcan !== undefined ? this.props.trashcan : true} trashcan={this.props.trashcan !== undefined ? this.props.trashcan : true}
renderer='zelos' renderer='geras'
zoom={{ // https://developers.google.com/blockly/guides/configure/web/zoom zoom={{ // https://developers.google.com/blockly/guides/configure/web/zoom
controls: this.props.zoomControls !== undefined ? this.props.zoomControls : true, controls: this.props.zoomControls !== undefined ? this.props.zoomControls : true,
wheel: false, wheel: false,
startScale: 0.8, startScale: 1.0,
maxScale: 3, maxScale: 3,
minScale: 0.3, minScale: 0.3,
scaleSpeed: 1.2 scaleSpeed: 1.2

View File

@ -14,9 +14,9 @@ Blockly['Arduino']['controls_repeat_ext'] = function (Block) {
let branch = Blockly['Arduino'].statementToCode(Block, 'DO'); let branch = Blockly['Arduino'].statementToCode(Block, 'DO');
branch = Blockly['Arduino'].addLoopTrap(branch, Block.id); branch = Blockly['Arduino'].addLoopTrap(branch, Block.id);
let code = ''; let code = '';
const loopVar = 'simple_loop_variable'; const loopVar = 'i';
code += code +=
'for (' + 'for (int ' +
loopVar + loopVar +
' = 1; ' + ' = 1; ' +
loopVar + loopVar +
@ -36,6 +36,8 @@ Blockly['Arduino']['controls_for'] = function (Block) {
Block.getFieldValue('VAR') Block.getFieldValue('VAR')
).name; ).name;
const branch = Blockly['Arduino'].statementToCode(Block, 'DO'); const branch = Blockly['Arduino'].statementToCode(Block, 'DO');
const startNumber = const startNumber =

View File

@ -19,9 +19,9 @@ Blockly.Arduino['arduino_functions'] = function (block) {
} }
var setupBranch = Blockly.Arduino.statementToCode(block, 'SETUP_FUNC'); var setupBranch = Blockly.Arduino.statementToCode(block, 'SETUP_FUNC');
//var setupCode = Blockly.Arduino.scrub_(block, setupBranch); No comment block // //var setupCode = Blockly.Arduino.scrub_(block, setupBranch); No comment block
if (setupBranch) { if (setupBranch) {
Blockly.Arduino.setupCode_('userSetupCode', setupBranch, true); Blockly.Arduino.setupCode_['mainsetup'] = setupBranch;
} }
var loopBranch = statementToCodeNoTab(block, 'LOOP_FUNC'); var loopBranch = statementToCodeNoTab(block, 'LOOP_FUNC');

View File

@ -14,7 +14,7 @@ Blockly.Arduino.sensebox_sd_create_file = function (block) {
var res = filename.slice(0, 4); var res = filename.slice(0, 4);
Blockly.Arduino.libraries_['library_spi'] = '#include <SPI.h>'; Blockly.Arduino.libraries_['library_spi'] = '#include <SPI.h>';
Blockly.Arduino.libraries_['library_sd'] = '#include <SD.h>'; Blockly.Arduino.libraries_['library_sd'] = '#include <SD.h>';
Blockly.Arduino.definitions_['define_' + filename] = 'File dataFile' + res + ';'; Blockly.Arduino.definitions_['define_' + res] = 'File dataFile' + res + ';';
Blockly.Arduino.setupCode_['sensebox_sd'] = 'SD.begin(28);'; Blockly.Arduino.setupCode_['sensebox_sd'] = 'SD.begin(28);';
Blockly.Arduino.setupCode_['sensebox_sd' + filename] = 'dataFile' + res + ' = SD.open("' + filename + '", FILE_WRITE);\ndataFile' + res + '.close();\n'; Blockly.Arduino.setupCode_['sensebox_sd' + filename] = 'dataFile' + res + ' = SD.open("' + filename + '", FILE_WRITE);\ndataFile' + res + '.close();\n';
var code = ''; var code = '';

View File

@ -13,7 +13,7 @@ Blockly.Arduino.sensebox_telegram = function (Block) {
UniversalTelegramBot bot(BOTtoken, client);` UniversalTelegramBot bot(BOTtoken, client);`
let code = 'testcode'; let code = '';
return code; return code;
}; };

View File

@ -9,7 +9,6 @@ class Toolbox extends React.Component {
render() { render() {
return ( return (
<xml xmlns="https://developers.google.com/blockly/xml" id="blockly" style={{ display: 'none' }} ref={this.props.toolbox}> <xml xmlns="https://developers.google.com/blockly/xml" id="blockly" style={{ display: 'none' }} ref={this.props.toolbox}>
<Category name="senseBox" colour={getColour().sensebox}>
<Category name="Sensoren" colour={getColour().sensebox}> <Category name="Sensoren" colour={getColour().sensebox}>
<Block type="sensebox_sensor_temp_hum" /> <Block type="sensebox_sensor_temp_hum" />
<Block type="sensebox_sensor_uv_light" /> <Block type="sensebox_sensor_uv_light" />
@ -149,8 +148,9 @@ class Toolbox extends React.Component {
<Block type="sensebox_telegram_do_on_message" /> <Block type="sensebox_telegram_do_on_message" />
<Block type="sensebox_telegram_send" /> <Block type="sensebox_telegram_send" />
</Category> </Category>
<Category name="osem" colour={getColour().sensebox}> <Category name="openSenseMap" colour={getColour().sensebox}>
<Block type="sensebox_osem_connection" /> <Block type="sensebox_osem_connection" />
<Block type="sensebox_send_to_osem" />
</Category> </Category>
<Category id="catSenseBoxOutput_LoRa" name=" LoRa" colour={getColour().sensebox}> <Category id="catSenseBoxOutput_LoRa" name=" LoRa" colour={getColour().sensebox}>
<Category id="catSenseBoxOutput_LoRa_activation" name=" Activation" colour={getColour().sensebox}> <Category id="catSenseBoxOutput_LoRa_activation" name=" Activation" colour={getColour().sensebox}>
@ -172,7 +172,6 @@ class Toolbox extends React.Component {
<Block type="sensebox_lora_cayenne_gps" /> <Block type="sensebox_lora_cayenne_gps" />
</Category> </Category>
</Category> </Category>
</Category>
<Category name="Logic" colour={getColour().logic}> <Category name="Logic" colour={getColour().logic}>
<Block type="controls_if" /> <Block type="controls_if" />
<Block type="controls_ifelse" /> <Block type="controls_ifelse" />

View File

@ -8,7 +8,13 @@
"type": "instruction", "type": "instruction",
"headline": "Erste Schritte", "headline": "Erste Schritte",
"text1": "In diesem Tutorial lernst du die ersten Schritte mit der senseBox kennen. Du erstellst ein erstes Programm, baust einen ersten Schaltkreis auf und lernst, wie du das Programm auf die senseBox MCU überträgst.", "text1": "In diesem Tutorial lernst du die ersten Schritte mit der senseBox kennen. Du erstellst ein erstes Programm, baust einen ersten Schaltkreis auf und lernst, wie du das Programm auf die senseBox MCU überträgst.",
"hardware": ["senseboxmcu", "led", "breadboard", "jst-adapter", "resistor"], "hardware": [
"senseboxmcu",
"led",
"breadboard",
"jst-adapter",
"resistor"
],
"requirements": [] "requirements": []
}, },
{ {
@ -49,8 +55,13 @@
"type": "instruction", "type": "instruction",
"headline": "Einführung", "headline": "Einführung",
"text1": "In diesem Tutorial lernst du wie man die senseBox mit dem Internet verbindest.", "text1": "In diesem Tutorial lernst du wie man die senseBox mit dem Internet verbindest.",
"hardware": ["senseboxmcu", "wifi-bee"], "hardware": [
"requirements": [1] "senseboxmcu",
"wifi-bee"
],
"requirements": [
1
]
}, },
{ {
"id": 2, "id": 2,