minor changes
This commit is contained in:
parent
6a4de9c7a2
commit
42299a374a
@ -33,11 +33,11 @@ class BlocklyWindow extends Component {
|
||||
componentDidUpdate(props) {
|
||||
const workspace = Blockly.getMainWorkspace();
|
||||
var initialXML = this.props.initialXml
|
||||
if(props.initialXml !== initialXml){
|
||||
if (props.initialXml !== initialXml) {
|
||||
// guarantees that the current xml-code (this.props.initialXml) is rendered
|
||||
workspace.clear();
|
||||
if(!initialXML) initialXML = initialXml;
|
||||
Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(initialXML), workspace) ;
|
||||
if (!initialXML) initialXML = initialXml;
|
||||
Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(initialXML), workspace);
|
||||
}
|
||||
Blockly.svgResize(workspace);
|
||||
}
|
||||
@ -48,11 +48,11 @@ class BlocklyWindow extends Component {
|
||||
style={this.props.blocklyCSS}
|
||||
readOnly={this.props.readOnly !== undefined ? this.props.readOnly : false}
|
||||
trashcan={this.props.trashcan !== undefined ? this.props.trashcan : true}
|
||||
renderer='zelos'
|
||||
renderer='geras'
|
||||
zoom={{ // https://developers.google.com/blockly/guides/configure/web/zoom
|
||||
controls: this.props.zoomControls !== undefined ? this.props.zoomControls : true,
|
||||
wheel: false,
|
||||
startScale: 0.8,
|
||||
startScale: 1.0,
|
||||
maxScale: 3,
|
||||
minScale: 0.3,
|
||||
scaleSpeed: 1.2
|
||||
@ -63,14 +63,14 @@ class BlocklyWindow extends Component {
|
||||
length: 1,
|
||||
colour: '#4EAF47', // senseBox-green
|
||||
snap: false
|
||||
}}
|
||||
}}
|
||||
media={'/media/'}
|
||||
move={this.props.move !== undefined && !this.props.move ? {} :
|
||||
{ // https://developers.google.com/blockly/guides/configure/web/move
|
||||
scrollbars: true,
|
||||
drag: true,
|
||||
wheel: false
|
||||
}}
|
||||
}}
|
||||
initialXml={this.props.initialXml ? this.props.initialXml : initialXml}
|
||||
>
|
||||
|
||||
|
@ -14,9 +14,9 @@ Blockly['Arduino']['controls_repeat_ext'] = function (Block) {
|
||||
let branch = Blockly['Arduino'].statementToCode(Block, 'DO');
|
||||
branch = Blockly['Arduino'].addLoopTrap(branch, Block.id);
|
||||
let code = '';
|
||||
const loopVar = 'simple_loop_variable';
|
||||
const loopVar = 'i';
|
||||
code +=
|
||||
'for (' +
|
||||
'for (int ' +
|
||||
loopVar +
|
||||
' = 1; ' +
|
||||
loopVar +
|
||||
@ -36,6 +36,8 @@ Blockly['Arduino']['controls_for'] = function (Block) {
|
||||
Block.getFieldValue('VAR')
|
||||
).name;
|
||||
|
||||
|
||||
|
||||
const branch = Blockly['Arduino'].statementToCode(Block, 'DO');
|
||||
|
||||
const startNumber =
|
||||
|
@ -19,9 +19,9 @@ Blockly.Arduino['arduino_functions'] = function (block) {
|
||||
}
|
||||
|
||||
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) {
|
||||
Blockly.Arduino.setupCode_('userSetupCode', setupBranch, true);
|
||||
Blockly.Arduino.setupCode_['mainsetup'] = setupBranch;
|
||||
}
|
||||
|
||||
var loopBranch = statementToCodeNoTab(block, 'LOOP_FUNC');
|
||||
|
@ -14,7 +14,7 @@ Blockly.Arduino.sensebox_sd_create_file = function (block) {
|
||||
var res = filename.slice(0, 4);
|
||||
Blockly.Arduino.libraries_['library_spi'] = '#include <SPI.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' + filename] = 'dataFile' + res + ' = SD.open("' + filename + '", FILE_WRITE);\ndataFile' + res + '.close();\n';
|
||||
var code = '';
|
||||
|
@ -13,7 +13,7 @@ Blockly.Arduino.sensebox_telegram = function (Block) {
|
||||
|
||||
UniversalTelegramBot bot(BOTtoken, client);`
|
||||
|
||||
let code = 'testcode';
|
||||
let code = '';
|
||||
return code;
|
||||
};
|
||||
|
||||
|
@ -9,7 +9,6 @@ class Toolbox extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<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}>
|
||||
<Block type="sensebox_sensor_temp_hum" />
|
||||
<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_send" />
|
||||
</Category>
|
||||
<Category name="osem" colour={getColour().sensebox}>
|
||||
<Category name="openSenseMap" colour={getColour().sensebox}>
|
||||
<Block type="sensebox_osem_connection" />
|
||||
<Block type="sensebox_send_to_osem" />
|
||||
</Category>
|
||||
<Category id="catSenseBoxOutput_LoRa" name=" LoRa" 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" />
|
||||
</Category>
|
||||
</Category>
|
||||
</Category>
|
||||
<Category name="Logic" colour={getColour().logic}>
|
||||
<Block type="controls_if" />
|
||||
<Block type="controls_ifelse" />
|
||||
|
@ -34,18 +34,18 @@ class Compile extends Component {
|
||||
this.setState({ progress: true });
|
||||
fetch(`${process.env.REACT_APP_COMPILER_URL}/compile`, {
|
||||
method: "POST",
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
this.download(data.data.id)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
this.setState({ progress: false, open: true });
|
||||
});
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
this.download(data.data.id)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
this.setState({ progress: false, open: true });
|
||||
});
|
||||
}
|
||||
|
||||
download = (id) => {
|
||||
@ -60,7 +60,7 @@ class Compile extends Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div style={{display: 'inline'}}>
|
||||
<div style={{ display: 'inline' }}>
|
||||
<Button style={{ float: 'right', color: 'white' }} variant="contained" color="primary" onClick={() => this.compile()}>
|
||||
Kompilieren
|
||||
</Button>
|
||||
@ -91,4 +91,4 @@ const mapStateToProps = state => ({
|
||||
arduino: state.workspace.code.arduino
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, null)(withStyles(styles, {withTheme: true})(Compile));
|
||||
export default connect(mapStateToProps, null)(withStyles(styles, { withTheme: true })(Compile));
|
||||
|
@ -8,7 +8,13 @@
|
||||
"type": "instruction",
|
||||
"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.",
|
||||
"hardware": ["senseboxmcu", "led", "breadboard", "jst-adapter", "resistor"],
|
||||
"hardware": [
|
||||
"senseboxmcu",
|
||||
"led",
|
||||
"breadboard",
|
||||
"jst-adapter",
|
||||
"resistor"
|
||||
],
|
||||
"requirements": []
|
||||
},
|
||||
{
|
||||
@ -49,8 +55,13 @@
|
||||
"type": "instruction",
|
||||
"headline": "Einführung",
|
||||
"text1": "In diesem Tutorial lernst du wie man die senseBox mit dem Internet verbindest.",
|
||||
"hardware": ["senseboxmcu", "wifi-bee"],
|
||||
"requirements": [1]
|
||||
"hardware": [
|
||||
"senseboxmcu",
|
||||
"wifi-bee"
|
||||
],
|
||||
"requirements": [
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
|
Loading…
x
Reference in New Issue
Block a user