add first phyphox blocks
This commit is contained in:
		
							parent
							
								
									bc5cbb6b33
								
							
						
					
					
						commit
						47984fa66c
					
				| @ -1,24 +1,25 @@ | ||||
| import './loops'; | ||||
| import './sensebox'; | ||||
| import './logic'; | ||||
| import './sensebox-sensors'; | ||||
| import './sensebox-telegram'; | ||||
| import './sensebox-osem'; | ||||
| import './sensebox-web'; | ||||
| import './sensebox-display'; | ||||
| import './sensebox-lora'; | ||||
| import './sensebox-led'; | ||||
| import './sensebox-sd'; | ||||
| import './mqtt'; | ||||
| import './text'; | ||||
| import './io'; | ||||
| import './audio'; | ||||
| import './math'; | ||||
| import './map'; | ||||
| import './procedures'; | ||||
| import './time'; | ||||
| import './variables'; | ||||
| import './lists'; | ||||
| import './webserver'; | ||||
| import "./loops"; | ||||
| import "./sensebox"; | ||||
| import "./logic"; | ||||
| import "./sensebox-sensors"; | ||||
| import "./sensebox-telegram"; | ||||
| import "./sensebox-osem"; | ||||
| import "./sensebox-web"; | ||||
| import "./sensebox-display"; | ||||
| import "./sensebox-lora"; | ||||
| import "./sensebox-led"; | ||||
| import "./sensebox-ble"; | ||||
| import "./sensebox-sd"; | ||||
| import "./mqtt"; | ||||
| import "./text"; | ||||
| import "./io"; | ||||
| import "./audio"; | ||||
| import "./math"; | ||||
| import "./map"; | ||||
| import "./procedures"; | ||||
| import "./time"; | ||||
| import "./variables"; | ||||
| import "./lists"; | ||||
| import "./webserver"; | ||||
| 
 | ||||
| import '../helpers/types' | ||||
| import "../helpers/types"; | ||||
|  | ||||
							
								
								
									
										60
									
								
								src/components/Blockly/blocks/sensebox-ble.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								src/components/Blockly/blocks/sensebox-ble.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,60 @@ | ||||
| import * as Blockly from "blockly"; | ||||
| import { getColour } from "../helpers/colour"; | ||||
| import { selectedBoard } from "../helpers/board"; | ||||
| import * as Types from "../helpers/types"; | ||||
| 
 | ||||
| Blockly.Blocks["sensebox_phyphox_init"] = { | ||||
|   init: function () { | ||||
|     this.setColour(getColour().phyphox); | ||||
|     this.appendDummyInput() | ||||
|       .appendField(Blockly.Msg.sensebox_phyphox_init) | ||||
|       .appendField(new Blockly.FieldTextInput("Geräte Name"), "devicename"); | ||||
| 
 | ||||
|     this.setPreviousStatement(true, null); | ||||
|     this.setNextStatement(true, null); | ||||
|     this.setTooltip(Blockly.Msg.senseBox_led_tooltip); | ||||
|   }, | ||||
| }; | ||||
| 
 | ||||
| Blockly.Blocks["sensebox_phyphox_experiment"] = { | ||||
|   init: function () { | ||||
|     this.setColour(getColour().phyphox); | ||||
|     this.appendDummyInput() | ||||
|       .appendField(Blockly.Msg.sensebox_phyphox_createExperiment) | ||||
|       .appendField( | ||||
|         new Blockly.FieldTextInput("Experiment Name"), | ||||
|         "exeperimentname" | ||||
|       ); | ||||
|     this.appendDummyInput() | ||||
|       .appendField(Blockly.Msg.sensebox_phyphox_experimentTitle) | ||||
|       .appendField(new Blockly.FieldTextInput("Experiment Title"), "title"); | ||||
|     this.appendDummyInput() | ||||
|       .appendField(Blockly.Msg.sensebox_phyphox_experimentCategory) | ||||
|       .appendField( | ||||
|         new Blockly.FieldTextInput("senseBox Experiments"), | ||||
|         "category" | ||||
|       ); | ||||
|     this.appendDummyInput() | ||||
|       .appendField(Blockly.Msg.sensebox_phyphox_experimentDescription) | ||||
|       .appendField( | ||||
|         new Blockly.FieldTextInput("Experiment Beschreibung"), | ||||
|         "description" | ||||
|       ); | ||||
|     this.setPreviousStatement(true, null); | ||||
|     this.setNextStatement(true, null); | ||||
|     this.setTooltip(Blockly.Msg.senseBox_led_tooltip); | ||||
|   }, | ||||
| }; | ||||
| 
 | ||||
| Blockly.Blocks["sensebox_phyphox_experiment_send"] = { | ||||
|   init: function () { | ||||
|     this.setColour(getColour().phyphox); | ||||
|     this.appendDummyInput().appendField( | ||||
|       Blockly.Msg.sensebox_phyphox_writeValues | ||||
|     ); | ||||
| 
 | ||||
|     this.setPreviousStatement(true, null); | ||||
|     this.setNextStatement(true, null); | ||||
|     this.setTooltip(Blockly.Msg.senseBox_led_tooltip); | ||||
|   }, | ||||
| }; | ||||
| @ -24,13 +24,13 @@ | ||||
| // More on generating code:
 | ||||
| // https://developers.google.com/blockly/guides/create-custom-blocks/generating-code
 | ||||
| 
 | ||||
| import * as Blockly from 'blockly/core'; | ||||
| import * as Blockly from "blockly/core"; | ||||
| 
 | ||||
| /** | ||||
|  * Arduino code generator. | ||||
|  * @type !Blockly.Generator | ||||
|  */ | ||||
| Blockly['Arduino'] = new Blockly.Generator('Arduino'); | ||||
| Blockly["Arduino"] = new Blockly.Generator("Arduino"); | ||||
| 
 | ||||
| /** | ||||
|  * List of illegal variable names. | ||||
| @ -39,49 +39,46 @@ Blockly['Arduino'] = new Blockly.Generator('Arduino'); | ||||
|  * accidentally clobbering a built-in object or function. | ||||
|  * @private | ||||
|  */ | ||||
| Blockly['Arduino'].addReservedWords( | ||||
| Blockly["Arduino"].addReservedWords( | ||||
|   // http://arduino.cc/en/Reference/HomePage
 | ||||
|     'setup,loop,if,else,for,switch,case,while,' + | ||||
|     'do,break,continue,return,goto,define,include,' + | ||||
|     'HIGH,LOW,INPUT,OUTPUT,INPUT_PULLUP,true,false,' + | ||||
|     'interger, constants,floating,point,void,boolean,char,' + | ||||
|     'unsigned,byte,int,word,long,float,double,string,String,array,' + | ||||
|     'static, volatile,const,sizeof,pinMode,digitalWrite,digitalRead,' + | ||||
|     'analogReference,analogRead,analogWrite,tone,noTone,shiftOut,shitIn,' + | ||||
|     'pulseIn,millis,micros,delay,delayMicroseconds,min,max,abs,constrain,' + | ||||
|     'map,pow,sqrt,sin,cos,tan,randomSeed,random,lowByte,highByte,bitRead,' + | ||||
|     'bitWrite,bitSet,bitClear,ultraSonicDistance,parseDouble,setNeoPixelColor,' + | ||||
|     'bit,attachInterrupt,detachInterrupt,interrupts,noInterrupts', | ||||
|     'short', | ||||
|     'isBtnPressed' | ||||
|   "setup,loop,if,else,for,switch,case,while," + | ||||
|     "do,break,continue,return,goto,define,include," + | ||||
|     "HIGH,LOW,INPUT,OUTPUT,INPUT_PULLUP,true,false," + | ||||
|     "interger, constants,floating,point,void,boolean,char," + | ||||
|     "unsigned,byte,int,word,long,float,double,string,String,array," + | ||||
|     "static, volatile,const,sizeof,pinMode,digitalWrite,digitalRead," + | ||||
|     "analogReference,analogRead,analogWrite,tone,noTone,shiftOut,shitIn," + | ||||
|     "pulseIn,millis,micros,delay,delayMicroseconds,min,max,abs,constrain," + | ||||
|     "map,pow,sqrt,sin,cos,tan,randomSeed,random,lowByte,highByte,bitRead," + | ||||
|     "bitWrite,bitSet,bitClear,ultraSonicDistance,parseDouble,setNeoPixelColor," + | ||||
|     "bit,attachInterrupt,detachInterrupt,interrupts,noInterrupts", | ||||
|   "short", | ||||
|   "isBtnPressed" | ||||
| ); | ||||
| 
 | ||||
| /** | ||||
|  * Order of operation ENUMs. | ||||
|  * | ||||
|  */ | ||||
| Blockly['Arduino'].ORDER_ATOMIC = 0; // 0 "" ...
 | ||||
| Blockly['Arduino'].ORDER_UNARY_POSTFIX = 1; // expr++ expr-- () [] .
 | ||||
| Blockly['Arduino'].ORDER_UNARY_PREFIX = 2; // -expr !expr ~expr ++expr --expr
 | ||||
| Blockly['Arduino'].ORDER_MULTIPLICATIVE = 3; // * / % ~/
 | ||||
| Blockly['Arduino'].ORDER_ADDITIVE = 4; // + -
 | ||||
| Blockly['Arduino'].ORDER_LOGICAL_NOT = 4.4; // !
 | ||||
| Blockly['Arduino'].ORDER_SHIFT = 5; // << >>
 | ||||
| Blockly['Arduino'].ORDER_MODULUS = 5.3; // %
 | ||||
| Blockly['Arduino'].ORDER_RELATIONAL = 6; // is is! >= > <= <
 | ||||
| Blockly['Arduino'].ORDER_EQUALITY = 7; // === !== === !==
 | ||||
| Blockly['Arduino'].ORDER_BITWISE_AND = 8; // &
 | ||||
| Blockly['Arduino'].ORDER_BITWISE_XOR = 9; // ^
 | ||||
| Blockly['Arduino'].ORDER_BITWISE_OR = 10; // |
 | ||||
| Blockly['Arduino'].ORDER_LOGICAL_AND = 11; // &&
 | ||||
| Blockly['Arduino'].ORDER_LOGICAL_OR = 12; // ||
 | ||||
| Blockly['Arduino'].ORDER_CONDITIONAL = 13; // expr ? expr : expr
 | ||||
| Blockly['Arduino'].ORDER_ASSIGNMENT = 14; // = *= /= ~/= %= += -= <<= >>= &= ^= |=
 | ||||
| Blockly['Arduino'].ORDER_COMMA = 18; // ,
 | ||||
| Blockly['Arduino'].ORDER_NONE = 99; // (...)
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| Blockly["Arduino"].ORDER_ATOMIC = 0; // 0 "" ...
 | ||||
| Blockly["Arduino"].ORDER_UNARY_POSTFIX = 1; // expr++ expr-- () [] .
 | ||||
| Blockly["Arduino"].ORDER_UNARY_PREFIX = 2; // -expr !expr ~expr ++expr --expr
 | ||||
| Blockly["Arduino"].ORDER_MULTIPLICATIVE = 3; // * / % ~/
 | ||||
| Blockly["Arduino"].ORDER_ADDITIVE = 4; // + -
 | ||||
| Blockly["Arduino"].ORDER_LOGICAL_NOT = 4.4; // !
 | ||||
| Blockly["Arduino"].ORDER_SHIFT = 5; // << >>
 | ||||
| Blockly["Arduino"].ORDER_MODULUS = 5.3; // %
 | ||||
| Blockly["Arduino"].ORDER_RELATIONAL = 6; // is is! >= > <= <
 | ||||
| Blockly["Arduino"].ORDER_EQUALITY = 7; // === !== === !==
 | ||||
| Blockly["Arduino"].ORDER_BITWISE_AND = 8; // &
 | ||||
| Blockly["Arduino"].ORDER_BITWISE_XOR = 9; // ^
 | ||||
| Blockly["Arduino"].ORDER_BITWISE_OR = 10; // |
 | ||||
| Blockly["Arduino"].ORDER_LOGICAL_AND = 11; // &&
 | ||||
| Blockly["Arduino"].ORDER_LOGICAL_OR = 12; // ||
 | ||||
| Blockly["Arduino"].ORDER_CONDITIONAL = 13; // expr ? expr : expr
 | ||||
| Blockly["Arduino"].ORDER_ASSIGNMENT = 14; // = *= /= ~/= %= += -= <<= >>= &= ^= |=
 | ||||
| Blockly["Arduino"].ORDER_COMMA = 18; // ,
 | ||||
| Blockly["Arduino"].ORDER_NONE = 99; // (...)
 | ||||
| 
 | ||||
| /** | ||||
|  * | ||||
| @ -90,49 +87,46 @@ Blockly['Arduino'].ORDER_NONE = 99; // (...) | ||||
|  * Blockly Types | ||||
|  */ | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * Initialise the database of variable names. | ||||
|  * @param {!Blockly.Workspace} workspace Workspace to generate code from. | ||||
|  */ | ||||
| Blockly['Arduino'].init = function (workspace) { | ||||
| Blockly["Arduino"].init = function (workspace) { | ||||
|   // Create a dictionary of definitions to be printed before the code.
 | ||||
|     Blockly['Arduino'].libraries_ = Object.create(null); | ||||
|   Blockly["Arduino"].libraries_ = Object.create(null); | ||||
| 
 | ||||
|     Blockly['Arduino'].definitions_ = Object.create(null); | ||||
|   Blockly["Arduino"].definitions_ = Object.create(null); | ||||
| 
 | ||||
|   // creates a list of code to be setup before the setup block
 | ||||
|     Blockly['Arduino'].setupCode_ = Object.create(null); | ||||
|   Blockly["Arduino"].setupCode_ = Object.create(null); | ||||
| 
 | ||||
|   // creates a list of code to be setup before the setup block
 | ||||
|     Blockly['Arduino'].loraSetupCode_ = Object.create(null); | ||||
|   Blockly["Arduino"].loraSetupCode_ = Object.create(null); | ||||
| 
 | ||||
|   // creates a list of code for the loop to be runned once
 | ||||
|     Blockly['Arduino'].loopCodeOnce_ = Object.create(null) | ||||
|   Blockly["Arduino"].loopCodeOnce_ = Object.create(null); | ||||
| 
 | ||||
|   // creates a list of code for the loop to be runned once
 | ||||
|     Blockly['Arduino'].codeFunctions_ = Object.create(null) | ||||
|   Blockly["Arduino"].codeFunctions_ = Object.create(null); | ||||
| 
 | ||||
|   // creates a list of code variables
 | ||||
|     Blockly['Arduino'].variables_ = Object.create(null) | ||||
|   Blockly["Arduino"].variables_ = Object.create(null); | ||||
| 
 | ||||
|   // Create a dictionary mapping desired function names in definitions_
 | ||||
|   // to actual function names (to avoid collisions with user functions).
 | ||||
|     Blockly['Arduino'].functionNames_ = Object.create(null); | ||||
|   Blockly["Arduino"].functionNames_ = Object.create(null); | ||||
| 
 | ||||
|     Blockly['Arduino'].variablesInitCode_ = ''; | ||||
|   Blockly["Arduino"].variablesInitCode_ = ""; | ||||
| 
 | ||||
|     if (!Blockly['Arduino'].variableDB_) { | ||||
|         Blockly['Arduino'].variableDB_ = new Blockly.Names( | ||||
|             Blockly['Arduino'].RESERVED_WORDS_ | ||||
|   if (!Blockly["Arduino"].variableDB_) { | ||||
|     Blockly["Arduino"].variableDB_ = new Blockly.Names( | ||||
|       Blockly["Arduino"].RESERVED_WORDS_ | ||||
|     ); | ||||
|   } else { | ||||
|         Blockly['Arduino'].variableDB_.reset(); | ||||
|     Blockly["Arduino"].variableDB_.reset(); | ||||
|   } | ||||
| 
 | ||||
|     Blockly['Arduino'].variableDB_.setVariableMap(workspace.getVariableMap()); | ||||
|   Blockly["Arduino"].variableDB_.setVariableMap(workspace.getVariableMap()); | ||||
| 
 | ||||
|   // We don't have developer variables for now
 | ||||
|   // // Add developer variables (not created or named by the user).
 | ||||
| @ -142,53 +136,53 @@ Blockly['Arduino'].init = function (workspace) { | ||||
|   //         Blockly.Names.DEVELOPER_VARIABLE_TYPE));
 | ||||
|   // }
 | ||||
| 
 | ||||
|     const doubleVariables = workspace.getVariablesOfType('Number'); | ||||
|   const doubleVariables = workspace.getVariablesOfType("Number"); | ||||
|   let i = 0; | ||||
|     let variableCode = ''; | ||||
|   let variableCode = ""; | ||||
|   for (i = 0; i < doubleVariables.length; i += 1) { | ||||
|     variableCode += | ||||
|             'double ' + | ||||
|             Blockly['Arduino'].variableDB_.getName( | ||||
|       "double " + | ||||
|       Blockly["Arduino"].variableDB_.getName( | ||||
|         doubleVariables[i].getId(), | ||||
|         Blockly.Variables.NAME_TYPE | ||||
|       ) + | ||||
|             ' = 0; \n\n'; | ||||
|       " = 0; \n\n"; | ||||
|   } | ||||
| 
 | ||||
|     const stringVariables = workspace.getVariablesOfType('String'); | ||||
|   const stringVariables = workspace.getVariablesOfType("String"); | ||||
|   for (i = 0; i < stringVariables.length; i += 1) { | ||||
|     variableCode += | ||||
|             'String ' + | ||||
|             Blockly['Arduino'].variableDB_.getName( | ||||
|       "String " + | ||||
|       Blockly["Arduino"].variableDB_.getName( | ||||
|         stringVariables[i].getId(), | ||||
|         Blockly.Variables.NAME_TYPE | ||||
|       ) + | ||||
|       ' = ""; \n\n'; | ||||
|   } | ||||
| 
 | ||||
|     const booleanVariables = workspace.getVariablesOfType('Boolean'); | ||||
|   const booleanVariables = workspace.getVariablesOfType("Boolean"); | ||||
|   for (i = 0; i < booleanVariables.length; i += 1) { | ||||
|     variableCode += | ||||
|             'boolean ' + | ||||
|             Blockly['Arduino'].variableDB_.getDistinctName( | ||||
|       "boolean " + | ||||
|       Blockly["Arduino"].variableDB_.getDistinctName( | ||||
|         booleanVariables[i].getId(), | ||||
|         Blockly.Variables.NAME_TYPE | ||||
|       ) + | ||||
|             ' = false; \n\n'; | ||||
|       " = false; \n\n"; | ||||
|   } | ||||
| 
 | ||||
|     const colourVariables = workspace.getVariablesOfType('Colour'); | ||||
|   const colourVariables = workspace.getVariablesOfType("Colour"); | ||||
|   for (i = 0; i < colourVariables.length; i += 1) { | ||||
|     variableCode += | ||||
|             'RGB ' + | ||||
|             Blockly['Arduino'].variableDB_.getName( | ||||
|       "RGB " + | ||||
|       Blockly["Arduino"].variableDB_.getName( | ||||
|         colourVariables[i].getId(), | ||||
|         Blockly.Variables.NAME_TYPE | ||||
|       ) + | ||||
|             ' = {0, 0, 0}; \n\n'; | ||||
|       " = {0, 0, 0}; \n\n"; | ||||
|   } | ||||
| 
 | ||||
|     Blockly['Arduino'].variablesInitCode_ = variableCode; | ||||
|   Blockly["Arduino"].variablesInitCode_ = variableCode; | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
| @ -196,86 +190,82 @@ Blockly['Arduino'].init = function (workspace) { | ||||
|  * @param {string} code Generated code. | ||||
|  * @return {string} Completed code. | ||||
|  */ | ||||
| Blockly['Arduino'].finish = function (code) { | ||||
|     let libraryCode = ''; | ||||
|     let variablesCode = ''; | ||||
|     let codeFunctions = ''; | ||||
|     let functionsCode = ''; | ||||
|     let definitionsCode = ''; | ||||
|     let loopCodeOnce = ''; | ||||
|     let setupCode = ''; | ||||
|     let preSetupCode = ''; | ||||
|     let loraSetupCode = ''; | ||||
|     let devVariables = '\n'; | ||||
| Blockly["Arduino"].finish = function (code) { | ||||
|   let libraryCode = ""; | ||||
|   let variablesCode = ""; | ||||
|   let codeFunctions = ""; | ||||
|   let functionsCode = ""; | ||||
|   let definitionsCode = ""; | ||||
|   let loopCodeOnce = ""; | ||||
|   let setupCode = ""; | ||||
|   let preSetupCode = ""; | ||||
|   let loraSetupCode = ""; | ||||
|   let devVariables = "\n"; | ||||
| 
 | ||||
|     for (const key in Blockly['Arduino'].libraries_) { | ||||
|         libraryCode += Blockly['Arduino'].libraries_[key] + '\n'; | ||||
|   for (const key in Blockly["Arduino"].libraries_) { | ||||
|     libraryCode += Blockly["Arduino"].libraries_[key] + "\n"; | ||||
|   } | ||||
| 
 | ||||
|     for (const key in Blockly['Arduino'].variables_) { | ||||
|         variablesCode += Blockly['Arduino'].variables_[key] + '\n'; | ||||
|   for (const key in Blockly["Arduino"].variables_) { | ||||
|     variablesCode += Blockly["Arduino"].variables_[key] + "\n"; | ||||
|   } | ||||
| 
 | ||||
|     for (const key in Blockly['Arduino'].definitions_) { | ||||
|         definitionsCode += Blockly['Arduino'].definitions_[key] + '\n'; | ||||
|   for (const key in Blockly["Arduino"].definitions_) { | ||||
|     definitionsCode += Blockly["Arduino"].definitions_[key] + "\n"; | ||||
|   } | ||||
| 
 | ||||
|     for (const key in Blockly['Arduino'].loopCodeOnce_) { | ||||
|         loopCodeOnce += Blockly['Arduino'].loopCodeOnce_[key] + '\n'; | ||||
|   for (const key in Blockly["Arduino"].loopCodeOnce_) { | ||||
|     loopCodeOnce += Blockly["Arduino"].loopCodeOnce_[key] + "\n"; | ||||
|   } | ||||
| 
 | ||||
|     for (const key in Blockly['Arduino'].codeFunctions_) { | ||||
|         codeFunctions += Blockly['Arduino'].codeFunctions_[key] + '\n'; | ||||
|   for (const key in Blockly["Arduino"].codeFunctions_) { | ||||
|     codeFunctions += Blockly["Arduino"].codeFunctions_[key] + "\n"; | ||||
|   } | ||||
| 
 | ||||
|     for (const key in Blockly['Arduino'].functionNames_) { | ||||
|         functionsCode += Blockly['Arduino'].functionNames_[key] + '\n'; | ||||
|   for (const key in Blockly["Arduino"].functionNames_) { | ||||
|     functionsCode += Blockly["Arduino"].functionNames_[key] + "\n"; | ||||
|   } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     for (const key in Blockly['Arduino'].setupCode_) { | ||||
|         preSetupCode += Blockly['Arduino'].setupCode_[key] || ''; | ||||
|   for (const key in Blockly["Arduino"].setupCode_) { | ||||
|     preSetupCode += Blockly["Arduino"].setupCode_[key] + "\n" || ""; | ||||
|   } | ||||
| 
 | ||||
|     for (const key in Blockly['Arduino'].loraSetupCode_) { | ||||
|         loraSetupCode += Blockly['Arduino'].loraSetupCode_[key] || ''; | ||||
|   for (const key in Blockly["Arduino"].loraSetupCode_) { | ||||
|     loraSetupCode += Blockly["Arduino"].loraSetupCode_[key] + "\n" || ""; | ||||
|   } | ||||
| 
 | ||||
|   setupCode = | ||||
|     "\nvoid setup() { \n" + preSetupCode + "\n" + loraSetupCode + "\n}\n"; | ||||
| 
 | ||||
|     setupCode = '\nvoid setup() { \n' + preSetupCode + '\n' + loraSetupCode + '\n}\n'; | ||||
| 
 | ||||
|     let loopCode = '\nvoid loop() { \n' + loopCodeOnce + code + '\n}\n'; | ||||
| 
 | ||||
|   let loopCode = "\nvoid loop() { \n" + loopCodeOnce + code + "\n}\n"; | ||||
| 
 | ||||
|   // Convert the definitions dictionary into a list.
 | ||||
|   code = | ||||
|     devVariables + | ||||
|         '\n' + | ||||
|     "\n" + | ||||
|     libraryCode + | ||||
|         '\n' + | ||||
|     "\n" + | ||||
|     variablesCode + | ||||
|         '\n' + | ||||
|     "\n" + | ||||
|     definitionsCode + | ||||
|         '\n' + | ||||
|     "\n" + | ||||
|     codeFunctions + | ||||
|         '\n' + | ||||
|         Blockly['Arduino'].variablesInitCode_ + | ||||
|         '\n' + | ||||
|     "\n" + | ||||
|     Blockly["Arduino"].variablesInitCode_ + | ||||
|     "\n" + | ||||
|     functionsCode + | ||||
|         '\n' + | ||||
|     "\n" + | ||||
|     setupCode + | ||||
|         '\n' + | ||||
|         loopCode | ||||
|         ; | ||||
|     "\n" + | ||||
|     loopCode; | ||||
| 
 | ||||
|   // Clean up temporary data.
 | ||||
|     delete Blockly['Arduino'].definitions_; | ||||
|     delete Blockly['Arduino'].functionNames_; | ||||
|     delete Blockly['Arduino'].loopCodeOnce_; | ||||
|     delete Blockly['Arduino'].variablesInitCode_; | ||||
|     delete Blockly['Arduino'].libraries_; | ||||
|     Blockly['Arduino'].variableDB_.reset(); | ||||
|   delete Blockly["Arduino"].definitions_; | ||||
|   delete Blockly["Arduino"].functionNames_; | ||||
|   delete Blockly["Arduino"].loopCodeOnce_; | ||||
|   delete Blockly["Arduino"].variablesInitCode_; | ||||
|   delete Blockly["Arduino"].libraries_; | ||||
|   Blockly["Arduino"].variableDB_.reset(); | ||||
| 
 | ||||
|   return code; | ||||
| }; | ||||
| @ -286,8 +276,8 @@ Blockly['Arduino'].finish = function (code) { | ||||
|  * @param {string} line Line of generated code. | ||||
|  * @return {string} Legal line of code. | ||||
|  */ | ||||
| Blockly['Arduino'].scrubNakedValue = function (line) { | ||||
|     return line + ';\n'; | ||||
| Blockly["Arduino"].scrubNakedValue = function (line) { | ||||
|   return line + ";\n"; | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
| @ -297,12 +287,12 @@ Blockly['Arduino'].scrubNakedValue = function (line) { | ||||
|  * @return {string} Arduino string. | ||||
|  * @private | ||||
|  */ | ||||
| Blockly['Arduino'].quote_ = function (string) { | ||||
| Blockly["Arduino"].quote_ = function (string) { | ||||
|   // Can't use goog.string.quote since Google's style guide recommends
 | ||||
|   // JS string literals use single quotes.
 | ||||
|   string = string | ||||
|         .replace(/\\/g, '\\\\') | ||||
|         .replace(/\n/g, '\\\n') | ||||
|     .replace(/\\/g, "\\\\") | ||||
|     .replace(/\n/g, "\\\n") | ||||
|     .replace(/'/g, "\\'"); | ||||
|   return '"' + string + '"'; | ||||
| }; | ||||
| @ -317,26 +307,25 @@ Blockly['Arduino'].quote_ = function (string) { | ||||
|  * @return {string} Arduino code with comments and subsequent blocks added. | ||||
|  * @private | ||||
|  */ | ||||
| Blockly['Arduino'].scrub_ = function (block, code) { | ||||
|     let commentCode = ''; | ||||
| Blockly["Arduino"].scrub_ = function (block, code) { | ||||
|   let commentCode = ""; | ||||
|   // Only collect comments for blocks that aren't inline.
 | ||||
|   if (!block.outputConnection || !block.outputConnection.targetConnection) { | ||||
|     // Collect comment for this block.
 | ||||
|     let comment = block.getCommentText(); | ||||
|     //@ts-ignore
 | ||||
|         comment = comment ? Blockly.utils.string.wrap( | ||||
|             comment, | ||||
|             Blockly['Arduino'].COMMENT_WRAP - 3 | ||||
|         ) : null; | ||||
|     comment = comment | ||||
|       ? Blockly.utils.string.wrap(comment, Blockly["Arduino"].COMMENT_WRAP - 3) | ||||
|       : null; | ||||
|     if (comment) { | ||||
|       if (block.getProcedureDef) { | ||||
|         // Use a comment block for function comments.
 | ||||
|         commentCode += | ||||
|                     '/**\n' + | ||||
|                     Blockly['Arduino'].prefixLines(comment + '\n', ' * ') + | ||||
|                     ' */\n'; | ||||
|           "/**\n" + | ||||
|           Blockly["Arduino"].prefixLines(comment + "\n", " * ") + | ||||
|           " */\n"; | ||||
|       } else { | ||||
|                 commentCode += Blockly['Arduino'].prefixLines(comment + '\n', '// '); | ||||
|         commentCode += Blockly["Arduino"].prefixLines(comment + "\n", "// "); | ||||
|       } | ||||
|     } | ||||
|     // Collect comments for all value arguments.
 | ||||
| @ -345,15 +334,15 @@ Blockly['Arduino'].scrub_ = function (block, code) { | ||||
|       if (block.inputList[i].type === Blockly.INPUT_VALUE) { | ||||
|         const childBlock = block.inputList[i].connection.targetBlock(); | ||||
|         if (childBlock) { | ||||
|                     const comment = Blockly['Arduino'].allNestedComments(childBlock); | ||||
|           const comment = Blockly["Arduino"].allNestedComments(childBlock); | ||||
|           if (comment) { | ||||
|                         commentCode += Blockly['Arduino'].prefixLines(comment, '// '); | ||||
|             commentCode += Blockly["Arduino"].prefixLines(comment, "// "); | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   const nextBlock = block.nextConnection && block.nextConnection.targetBlock(); | ||||
|     const nextCode = Blockly['Arduino'].blockToCode(nextBlock); | ||||
|   const nextCode = Blockly["Arduino"].blockToCode(nextBlock); | ||||
|   return commentCode + code + nextCode; | ||||
| }; | ||||
| @ -1,24 +1,23 @@ | ||||
| import './generator'; | ||||
| import './loops'; | ||||
| import './sensebox-sensors'; | ||||
| import './sensebox-telegram'; | ||||
| import './sensebox-osem'; | ||||
| import './sensebox-web'; | ||||
| import './sensebox-display'; | ||||
| import './sensebox-lora'; | ||||
| import './sensebox-led'; | ||||
| import './sensebox-sd'; | ||||
| import './mqtt'; | ||||
| import './logic'; | ||||
| import './text'; | ||||
| import './math'; | ||||
| import './map'; | ||||
| import './io'; | ||||
| import './audio'; | ||||
| import './procedures'; | ||||
| import './time'; | ||||
| import './variables'; | ||||
| import './lists'; | ||||
| import './webserver'; | ||||
| 
 | ||||
| 
 | ||||
| import "./generator"; | ||||
| import "./loops"; | ||||
| import "./sensebox-sensors"; | ||||
| import "./sensebox-telegram"; | ||||
| import "./sensebox-osem"; | ||||
| import "./sensebox-web"; | ||||
| import "./sensebox-display"; | ||||
| import "./sensebox-lora"; | ||||
| import "./sensebox-led"; | ||||
| import "./sensebox-ble"; | ||||
| import "./sensebox-sd"; | ||||
| import "./mqtt"; | ||||
| import "./logic"; | ||||
| import "./text"; | ||||
| import "./math"; | ||||
| import "./map"; | ||||
| import "./io"; | ||||
| import "./audio"; | ||||
| import "./procedures"; | ||||
| import "./time"; | ||||
| import "./variables"; | ||||
| import "./lists"; | ||||
| import "./webserver"; | ||||
|  | ||||
							
								
								
									
										39
									
								
								src/components/Blockly/generator/sensebox-ble.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								src/components/Blockly/generator/sensebox-ble.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,39 @@ | ||||
| import * as Blockly from "blockly/core"; | ||||
| 
 | ||||
| Blockly.Arduino.sensebox_phyphox_init = function () { | ||||
|   var name = this.getFieldValue("devicename"); | ||||
|   Blockly.Arduino.libraries_["phyphox_library"] = `#include <phyphoxBle.h>`; | ||||
|   Blockly.Arduino.libraries_["library_senseBoxMCU"] = | ||||
|     '#include "SenseBoxMCU.h"'; | ||||
|   Blockly.Arduino.setupCode_["phyphox_start"] = `PhyphoxBLE::start("${name}");`; | ||||
|   var code = ``; | ||||
|   return code; | ||||
| }; | ||||
| 
 | ||||
| Blockly.Arduino.sensebox_phyphox_experiment = function () { | ||||
|   var experimentname = this.getFieldValue("exeperimentname"); | ||||
|   var title = this.getFieldValue("title"); | ||||
|   var category = this.getFieldValue("category"); | ||||
|   var description = this.getFieldValue("description"); | ||||
|   Blockly.Arduino.setupCode_[ | ||||
|     `PhyphoxBleExperiment_${experimentname}` | ||||
|   ] = `PhyphoxBleExperiment ${experimentname};`; | ||||
|   Blockly.Arduino.setupCode_[ | ||||
|     `setTitle_${title}` | ||||
|   ] = `${experimentname}.setTitle("${title}")`; | ||||
|   Blockly.Arduino.setupCode_[ | ||||
|     `setCategory_${category}` | ||||
|   ] = `${experimentname}.setCategory("${category}")`; | ||||
|   Blockly.Arduino.setupCode_[ | ||||
|     `setDescription_${description}` | ||||
|   ] = `${experimentname}.setDescription("${description}")`; | ||||
|   var code = ``; | ||||
|   return code; | ||||
| }; | ||||
| 
 | ||||
| Blockly.Arduino.sensebox_phyphox_experiment_send = function () { | ||||
|   var data = ""; | ||||
|   Blockly.Arduino.loopCodeOnce_["phyphox_poll"] = `PhyphoxBLE::poll()`; | ||||
|   var code = `PhyphoxBLE::write()`; | ||||
|   return code; | ||||
| }; | ||||
| @ -1,4 +1,3 @@ | ||||
| 
 | ||||
| const colours = { | ||||
|   sensebox: 120, | ||||
|   logic: 210, | ||||
| @ -12,11 +11,10 @@ const colours = { | ||||
|   audio: 250, | ||||
|   arrays: 33, | ||||
|   mqtt: 90, | ||||
|     webserver: 40 | ||||
| } | ||||
| 
 | ||||
|   webserver: 40, | ||||
|   phyphox: 25, | ||||
| }; | ||||
| 
 | ||||
| export const getColour = () => { | ||||
|   return colours; | ||||
| }; | ||||
| 
 | ||||
|  | ||||
| @ -1,29 +1,30 @@ | ||||
| 
 | ||||
| import { AUDIO } from './de/audio'; | ||||
| import { FAQ } from './de/faq'; | ||||
| import { IO } from './de/io'; | ||||
| import { LOGIC } from './de/logic'; | ||||
| import { LOOPS } from './de/loops'; | ||||
| import { MATH } from './de/math'; | ||||
| import { MQTT } from './de/mqtt'; | ||||
| import { DISPLAY } from './de/sensebox-display'; | ||||
| import { LED } from './de/sensebox-led'; | ||||
| import { LORA } from './de/sensebox-lora'; | ||||
| import { OSEM } from './de/sensebox-osem'; | ||||
| import { SD } from './de/sensebox-sd'; | ||||
| import { SENSORS } from './de/sensebox-sensors'; | ||||
| import { TELEGRAM } from './de/sensebox-telegram'; | ||||
| import { WEB } from './de/sensebox-web'; | ||||
| import { TEXT } from './de/text'; | ||||
| import { TIME } from './de/time'; | ||||
| import { TOURS } from './de/tours'; | ||||
| import { TRANSLATIONS } from './de/translations'; | ||||
| import { UI } from './de/ui'; | ||||
| import { VARIABLES } from './de/variables'; | ||||
| import { WEBSERVER } from './de/webserver'; | ||||
| import { AUDIO } from "./de/audio"; | ||||
| import { BLE } from "./de/sensebox-ble"; | ||||
| import { FAQ } from "./de/faq"; | ||||
| import { IO } from "./de/io"; | ||||
| import { LOGIC } from "./de/logic"; | ||||
| import { LOOPS } from "./de/loops"; | ||||
| import { MATH } from "./de/math"; | ||||
| import { MQTT } from "./de/mqtt"; | ||||
| import { DISPLAY } from "./de/sensebox-display"; | ||||
| import { LED } from "./de/sensebox-led"; | ||||
| import { LORA } from "./de/sensebox-lora"; | ||||
| import { OSEM } from "./de/sensebox-osem"; | ||||
| import { SD } from "./de/sensebox-sd"; | ||||
| import { SENSORS } from "./de/sensebox-sensors"; | ||||
| import { TELEGRAM } from "./de/sensebox-telegram"; | ||||
| import { WEB } from "./de/sensebox-web"; | ||||
| import { TEXT } from "./de/text"; | ||||
| import { TIME } from "./de/time"; | ||||
| import { TOURS } from "./de/tours"; | ||||
| import { TRANSLATIONS } from "./de/translations"; | ||||
| import { UI } from "./de/ui"; | ||||
| import { VARIABLES } from "./de/variables"; | ||||
| import { WEBSERVER } from "./de/webserver"; | ||||
| 
 | ||||
| export const De = { | ||||
|   ...AUDIO, | ||||
|   ...BLE, | ||||
|   ...FAQ, | ||||
|   ...IO, | ||||
|   ...LOGIC, | ||||
| @ -44,5 +45,5 @@ export const De = { | ||||
|   ...TRANSLATIONS, | ||||
|   ...UI, | ||||
|   ...VARIABLES, | ||||
|     ...WEBSERVER | ||||
| } | ||||
|   ...WEBSERVER, | ||||
| }; | ||||
|  | ||||
							
								
								
									
										12
									
								
								src/components/Blockly/msg/de/sensebox-ble.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/components/Blockly/msg/de/sensebox-ble.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| export const BLE = { | ||||
|   /** | ||||
|    * Phyphox Init | ||||
|    */ | ||||
|   sensebox_phyphox_init: "Phyphox Experiment", | ||||
|   sensebox_phyphox_createExperiment: "Erstelle Experiment", | ||||
|   sensebox_phyphox_experimentName: "Name des Experiments", | ||||
|   sensebox_phyphox_experimentTitle: "Titel", | ||||
|   sensebox_phyphox_experimentCategory: "Kategorie", | ||||
|   sensebox_phyphox_experimentDescription: "Beschreibung", | ||||
|   sensebox_phyphox_writeValues: "Sende Werte", | ||||
| }; | ||||
| @ -6,8 +6,10 @@ export const LED = { | ||||
|   senseBox_ws2818_rgb_led_init: "RGB LED (WS2818) initialisieren", | ||||
|   senseBox_ws2818_rgb_led_position: "Position", | ||||
|   senseBox_ws2818_rgb_led_brightness: "Helligkeit", | ||||
|     senseBox_ws2818_rgb_led_tooltip: "Verändere mit diesem Block die Farbe deiner RGB-LED. Verbinde einen Block für die Farbe. Wenn mehrere RGB-LEDs miteinander verkettet werden kannst du über die Position bestimmen welche LED angesteuert wird. ", | ||||
|     senseBox_ws2818_rgb_led_init_tooltip: "Schließe die RGB-LED an einen der drei **digital/analog Ports** an. Wenn mehrere RGB-LEDs miteinander verkettet werden kannst du über die Position bestimmen welche LED angesteuert wird. ", | ||||
|   senseBox_ws2818_rgb_led_tooltip: | ||||
|     "Verändere mit diesem Block die Farbe deiner RGB-LED. Verbinde einen Block für die Farbe. Wenn mehrere RGB-LEDs miteinander verkettet werden kannst du über die Position bestimmen welche LED angesteuert wird. ", | ||||
|   senseBox_ws2818_rgb_led_init_tooltip: | ||||
|     "Schließe die RGB-LED an einen der drei **digital/analog Ports** an. Wenn mehrere RGB-LEDs miteinander verkettet werden kannst du über die Position bestimmen welche LED angesteuert wird. ", | ||||
|   senseBox_ws2818_rgb_led_color: "Farbe", | ||||
|   senseBox_ws2818_rgb_led_number: "Anzahl", | ||||
| 
 | ||||
| @ -20,9 +22,11 @@ export const LED = { | ||||
|   COLOUR_BLEND_HELPURL: "http://meyerweb.com/eric/tools/color-blend/", | ||||
|   COLOUR_BLEND_RATIO: "im Verhältnis", | ||||
|   COLOUR_BLEND_TITLE: "mische", | ||||
|     COLOUR_BLEND_TOOLTIP: "Vermische 2 Farben mit konfigurierbaren Farbverhältnis (0.0 - 1.0).", | ||||
|   COLOUR_BLEND_TOOLTIP: | ||||
|     "Vermische 2 Farben mit konfigurierbaren Farbverhältnis (0.0 - 1.0).", | ||||
|   COLOUR_PICKER_HELPURL: "https://de.wikipedia.org/wiki/Farbe", | ||||
|     COLOUR_PICKER_TOOLTIP: "Wähle eine Farbe aus der Palette. Die Farbe wird automatisch in RGB-Werte konvertiert.", | ||||
|   COLOUR_PICKER_TOOLTIP: | ||||
|     "Wähle eine Farbe aus der Palette. Die Farbe wird automatisch in RGB-Werte konvertiert.", | ||||
|   COLOUR_RANDOM_HELPURL: "http://randomcolour.com", // untranslated
 | ||||
|   COLOUR_RANDOM_TITLE: "zufällige Farbe", | ||||
|   COLOUR_RANDOM_TOOLTIP: "Erstelle eine Farbe nach dem Zufallsprinzip.", | ||||
| @ -31,6 +35,6 @@ export const LED = { | ||||
|   COLOUR_RGB_HELPURL: "https://de.wikipedia.org/wiki/RGB-Farbraum", | ||||
|   COLOUR_RGB_RED: "rot", | ||||
|   COLOUR_RGB_TITLE: "Farbe mit", | ||||
|     COLOUR_RGB_TOOLTIP: "Erstelle eine Farbe mit selbst definierten Rot-, Grün- und Blauwerten. Alle Werte müssen zwischen 0 und 255 liegen. 0 ist hierbei die geringte Intensität der Farbe 255 die höchste.", | ||||
| 
 | ||||
| } | ||||
|   COLOUR_RGB_TOOLTIP: | ||||
|     "Erstelle eine Farbe mit selbst definierten Rot-, Grün- und Blauwerten. Alle Werte müssen zwischen 0 und 255 liegen. 0 ist hierbei die geringte Intensität der Farbe 255 die höchste.", | ||||
| }; | ||||
|  | ||||
| @ -1,30 +1,42 @@ | ||||
| import React from 'react'; | ||||
| import { Block, Value, Field, Shadow, Category } from '../'; | ||||
| import { getColour } from '../helpers/colour' | ||||
| import '@blockly/block-plus-minus'; | ||||
| import { TypedVariableModal } from '@blockly/plugin-typed-variable-modal'; | ||||
| import * as Blockly from 'blockly/core'; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import React from "react"; | ||||
| import { Block, Value, Field, Shadow, Category } from "../"; | ||||
| import { getColour } from "../helpers/colour"; | ||||
| import "@blockly/block-plus-minus"; | ||||
| import { TypedVariableModal } from "@blockly/plugin-typed-variable-modal"; | ||||
| import * as Blockly from "blockly/core"; | ||||
| 
 | ||||
| class Toolbox extends React.Component { | ||||
| 
 | ||||
|   componentDidUpdate() { | ||||
|         this.props.workspace.registerToolboxCategoryCallback('CREATE_TYPED_VARIABLE', this.createFlyout); | ||||
|     this.props.workspace.registerToolboxCategoryCallback( | ||||
|       "CREATE_TYPED_VARIABLE", | ||||
|       this.createFlyout | ||||
|     ); | ||||
| 
 | ||||
|         const typedVarModal = new TypedVariableModal(this.props.workspace, 'callbackName', [['SHORT_NUMBER', 'char'], ['NUMBER', 'int'], ['DECIMAL', 'float'], ['TEXT', 'String'], ['ARRAY', 'Array'], ['CHARACTER', 'char'], ['BOOLEAN', 'boolean'], ['NULL', 'void'], ['UNDEF', 'undefined']]); | ||||
|     const typedVarModal = new TypedVariableModal( | ||||
|       this.props.workspace, | ||||
|       "callbackName", | ||||
|       [ | ||||
|         ["SHORT_NUMBER", "char"], | ||||
|         ["NUMBER", "int"], | ||||
|         ["DECIMAL", "float"], | ||||
|         ["TEXT", "String"], | ||||
|         ["ARRAY", "Array"], | ||||
|         ["CHARACTER", "char"], | ||||
|         ["BOOLEAN", "boolean"], | ||||
|         ["NULL", "void"], | ||||
|         ["UNDEF", "undefined"], | ||||
|       ] | ||||
|     ); | ||||
|     typedVarModal.init(); | ||||
|   } | ||||
| 
 | ||||
|   createFlyout(workspace) { | ||||
| 
 | ||||
|     let xmlList = []; | ||||
| 
 | ||||
|     // Add your button and give it a callback name.
 | ||||
|         const button = document.createElement('button'); | ||||
|         button.setAttribute('text', 'Create Typed Variable'); | ||||
|         button.setAttribute('callbackKey', 'callbackName'); | ||||
|     const button = document.createElement("button"); | ||||
|     button.setAttribute("text", "Create Typed Variable"); | ||||
|     button.setAttribute("callbackKey", "callbackName"); | ||||
| 
 | ||||
|     xmlList.push(button); | ||||
| 
 | ||||
| @ -33,12 +45,20 @@ class Toolbox extends React.Component { | ||||
|     const blockList = Blockly.VariablesDynamic.flyoutCategoryBlocks(workspace); | ||||
|     xmlList = xmlList.concat(blockList); | ||||
|     return xmlList; | ||||
|     }; | ||||
|   } | ||||
| 
 | ||||
|   render() { | ||||
|     return ( | ||||
|             <xml xmlns="https://developers.google.com/blockly/xml" id="blockly" style={{ display: 'none' }} ref={this.props.toolbox}> | ||||
|                 <Category name={Blockly.Msg.toolbox_sensors} colour={getColour().sensebox}> | ||||
|       <xml | ||||
|         xmlns="https://developers.google.com/blockly/xml" | ||||
|         id="blockly" | ||||
|         style={{ display: "none" }} | ||||
|         ref={this.props.toolbox} | ||||
|       > | ||||
|         <Category | ||||
|           name={Blockly.Msg.toolbox_sensors} | ||||
|           colour={getColour().sensebox} | ||||
|         > | ||||
|           <Block type="sensebox_sensor_temp_hum" /> | ||||
|           <Block type="sensebox_sensor_uv_light" /> | ||||
|           <Block type="sensebox_sensor_bmx055_accelerometer" /> | ||||
| @ -54,7 +74,7 @@ class Toolbox extends React.Component { | ||||
|           <Block type="sensebox_sensor_watertemperature" /> | ||||
|           {/* <Block type="sensebox_windspeed" /> */} | ||||
|           <Block type="sensebox_soundsensor_dfrobot" /> | ||||
|                 </Category > | ||||
|         </Category> | ||||
|         <Category name="WIFI" colour={getColour().sensebox}> | ||||
|           <Block type="sensebox_wifi" /> | ||||
|           <Block type="sensebox_startap" /> | ||||
| @ -157,19 +177,16 @@ class Toolbox extends React.Component { | ||||
|                 <Field name="TEXT">Unit</Field> | ||||
|               </Block> | ||||
|             </Value> | ||||
|                     </Block > | ||||
|           </Block> | ||||
|           <Block type="sensebox_display_plotDisplay"> | ||||
|             <Value name="Title"> | ||||
|                             <Block type="text"> | ||||
|                             </Block> | ||||
|               <Block type="text"></Block> | ||||
|             </Value> | ||||
|             <Value name="YLabel"> | ||||
|                             <Block type="text"> | ||||
|                             </Block> | ||||
|               <Block type="text"></Block> | ||||
|             </Value> | ||||
|             <Value name="XLabel"> | ||||
|                             <Block type="text"> | ||||
|                             </Block> | ||||
|               <Block type="text"></Block> | ||||
|             </Value> | ||||
|             <Value name="XRange1"> | ||||
|               <Block type="math_number"> | ||||
| @ -261,16 +278,32 @@ class Toolbox extends React.Component { | ||||
|           </Block> | ||||
|           <Block type="sensebox_send_to_osem" /> | ||||
|         </Category> | ||||
|                 <Category id="catSenseBoxOutput_LoRa" name="  LoRa" colour={getColour().sensebox}> | ||||
|                     <Category id="catSenseBoxOutput_LoRa_activation" name="    Aktivierung" colour={getColour().sensebox}> | ||||
|         <Category | ||||
|           id="catSenseBoxOutput_LoRa" | ||||
|           name="  LoRa" | ||||
|           colour={getColour().sensebox} | ||||
|         > | ||||
|           <Category | ||||
|             id="catSenseBoxOutput_LoRa_activation" | ||||
|             name="    Aktivierung" | ||||
|             colour={getColour().sensebox} | ||||
|           > | ||||
|             <Block type="sensebox_lora_initialize_otaa" /> | ||||
|             <Block type="sensebox_lora_initialize_abp" /> | ||||
|           </Category> | ||||
|                     <Category id="catSenseBoxOutput_LoRa_loramessage" name="    Lora Message" colour={getColour().sensebox}> | ||||
|           <Category | ||||
|             id="catSenseBoxOutput_LoRa_loramessage" | ||||
|             name="    Lora Message" | ||||
|             colour={getColour().sensebox} | ||||
|           > | ||||
|             <Block type="sensebox_lora_message_send" /> | ||||
|             <Block type="sensebox_send_lora_sensor_value" /> | ||||
|           </Category> | ||||
|                     <Category id="catSenseBoxOutput_Map" name="    TTN Mapper" colour={getColour().sensebox}> | ||||
|           <Category | ||||
|             id="catSenseBoxOutput_Map" | ||||
|             name="    TTN Mapper" | ||||
|             colour={getColour().sensebox} | ||||
|           > | ||||
|             <Block type="sensebox_lora_ttn_mapper"> | ||||
|               <Value name="Latitude"> | ||||
|                 <Block type="sensebox_gps"> | ||||
| @ -299,7 +332,11 @@ class Toolbox extends React.Component { | ||||
|               </Value> | ||||
|             </Block> | ||||
|           </Category> | ||||
|                     <Category id="catSenseBoxOutput_LoRa_cayenne" name="    Cayenne LPP" colour={getColour().sensebox}> | ||||
|           <Category | ||||
|             id="catSenseBoxOutput_LoRa_cayenne" | ||||
|             name="    Cayenne LPP" | ||||
|             colour={getColour().sensebox} | ||||
|           > | ||||
|             <Block type="sensebox_lora_cayenne_send" /> | ||||
|             <Block type="sensebox_lora_cayenne_temperature" /> | ||||
|             <Block type="sensebox_lora_cayenne_humidity" /> | ||||
| @ -310,7 +347,16 @@ class Toolbox extends React.Component { | ||||
|             <Block type="sensebox_lora_cayenne_gps" /> | ||||
|           </Category> | ||||
|         </Category> | ||||
|                 <Category id="webserver" name="Webserver" colour={getColour().webserver}> | ||||
|         <Category id="phyphox" name="Phyphox" colour={getColour().phyphox}> | ||||
|           <Block type="sensebox_phyphox_init"></Block> | ||||
|           <Block type="sensebox_phyphox_experiment"></Block> | ||||
|           <Block type="sensebox_phyphox_experiment_send"></Block> | ||||
|         </Category> | ||||
|         <Category | ||||
|           id="webserver" | ||||
|           name="Webserver" | ||||
|           colour={getColour().webserver} | ||||
|         > | ||||
|           <Block type="sensebox_initialize_http_server"></Block> | ||||
|           <Block type="sensebox_http_on_client_connect"></Block> | ||||
|           <Block type="sensebox_ip_address"></Block> | ||||
| @ -338,7 +384,11 @@ class Toolbox extends React.Component { | ||||
|           <Block type="logic_boolean" /> | ||||
|           <Block type="switch_case" /> | ||||
|         </Category> | ||||
|                 <Category id="loops" name={Blockly.Msg.toolbox_loops} colour={getColour().loops}> | ||||
|         <Category | ||||
|           id="loops" | ||||
|           name={Blockly.Msg.toolbox_loops} | ||||
|           colour={getColour().loops} | ||||
|         > | ||||
|           <Block type="controls_repeat_ext"> | ||||
|             <Value name="TIMES"> | ||||
|               <Block type="math_number"> | ||||
| @ -353,13 +403,13 @@ class Toolbox extends React.Component { | ||||
|                 <Field name="NUM">1</Field> | ||||
|               </Block> | ||||
|             </Value> | ||||
|                         <Value name="TO" > | ||||
|                             <Block type="math_number" > | ||||
|             <Value name="TO"> | ||||
|               <Block type="math_number"> | ||||
|                 <Field name="NUM">10</Field> | ||||
|               </Block> | ||||
|             </Value> | ||||
|                         <Value name="BY" > | ||||
|                             <Block Type="math_number" > | ||||
|             <Value name="BY"> | ||||
|               <Block Type="math_number"> | ||||
|                 <Field name="NUM">1</Field> | ||||
|               </Block> | ||||
|             </Value> | ||||
| @ -377,7 +427,11 @@ class Toolbox extends React.Component { | ||||
|           <Block type="text_length" /> | ||||
|           <Block type="text_isEmpty" /> | ||||
|         </Category> | ||||
|                 <Category id="time" name={Blockly.Msg.toolbox_time} colour={getColour().time}> | ||||
|         <Category | ||||
|           id="time" | ||||
|           name={Blockly.Msg.toolbox_time} | ||||
|           colour={getColour().time} | ||||
|         > | ||||
|           <Block type="time_delay"> | ||||
|             <Value name="DELAY_TIME_MILI"> | ||||
|               <Block type="math_number"> | ||||
| @ -397,7 +451,11 @@ class Toolbox extends React.Component { | ||||
|           <Block type="infinite_loop"></Block> | ||||
|           <Block type="sensebox_interval_timer"></Block> | ||||
|         </Category> | ||||
|                 <Category id="math" name={Blockly.Msg.toolbox_math} colour={getColour().math}> | ||||
|         <Category | ||||
|           id="math" | ||||
|           name={Blockly.Msg.toolbox_math} | ||||
|           colour={getColour().math} | ||||
|         > | ||||
|           <Block type="math_number"></Block> | ||||
|           <Block type="math_arithmetic"></Block> | ||||
|           <Block type="math_single"></Block> | ||||
| @ -450,13 +508,21 @@ class Toolbox extends React.Component { | ||||
|           </Block> | ||||
|           <Block type="io_notone"></Block> | ||||
|         </Category> | ||||
|                 <Category name={Blockly.Msg.toolbox_variables} colour={getColour().variables} custom="CREATE_TYPED_VARIABLE"></Category> | ||||
|                 <Category name="Arrays" colour={getColour().arrays} > | ||||
|         <Category | ||||
|           name={Blockly.Msg.toolbox_variables} | ||||
|           colour={getColour().variables} | ||||
|           custom="CREATE_TYPED_VARIABLE" | ||||
|         ></Category> | ||||
|         <Category name="Arrays" colour={getColour().arrays}> | ||||
|           <Block type="lists_create_empty" /> | ||||
|           <Block type="array_getIndex" /> | ||||
|           <Block type="lists_length" /> | ||||
|         </Category> | ||||
|                 <Category name={Blockly.Msg.toolbox_functions} colour={getColour().procedures} custom="PROCEDURE"></Category> | ||||
|         <Category | ||||
|           name={Blockly.Msg.toolbox_functions} | ||||
|           colour={getColour().procedures} | ||||
|           custom="PROCEDURE" | ||||
|         ></Category> | ||||
|         <sep></sep> | ||||
|         <Category name={Blockly.Msg.toolbox_io} colour={getColour().io}> | ||||
|           <Block type="io_digitalwrite"></Block> | ||||
| @ -489,7 +555,7 @@ class Toolbox extends React.Component { | ||||
|                 */} | ||||
|       </xml> | ||||
|     ); | ||||
|     }; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| export default Toolbox; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user