add restart to osem block
This commit is contained in:
		
							parent
							
								
									321cba25ba
								
							
						
					
					
						commit
						772797bb6b
					
				| @ -21,6 +21,9 @@ Blockly.Blocks["sensebox_osem_connection"] = { | ||||
|       .appendField(Blockly.Msg.senseBox_osem_connection) | ||||
|       .appendField("SSL") | ||||
|       .appendField(new Blockly.FieldCheckbox(ssl), "SSL"); | ||||
|     this.appendDummyInput() | ||||
|       .appendField(Blockly.Msg.senseBox_osem_restart) | ||||
|       .appendField(new Blockly.FieldCheckbox("TRUE"), "RESTART"); | ||||
|     this.appendDummyInput() | ||||
|       .setAlign(Blockly.ALIGN_LEFT) | ||||
|       .appendField(Blockly.Msg.senseBox_osem_exposure) | ||||
|  | ||||
| @ -33,6 +33,7 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) { | ||||
|   var blocks = this.getDescendants(); | ||||
|   var type = this.getFieldValue("type"); | ||||
|   var ssl = this.getFieldValue("SSL"); | ||||
|   var restart = this.getFieldValue("RESTART"); | ||||
|   var port = 0; | ||||
|   var count = 0; | ||||
|   if (blocks !== undefined) { | ||||
| @ -186,6 +187,12 @@ ${ | ||||
|     } | ||||
|     delay(1000); | ||||
|   } | ||||
| 
 | ||||
|   ${ | ||||
|     restart === "TRUE" | ||||
|       ? "if (connected == false) {\n  delay(5000);\n  noInterrupts();\n NVIC_SystemReset();\n while (1)\n ;\n }" | ||||
|       : "" | ||||
|   } | ||||
|   }`;
 | ||||
| 
 | ||||
|     var code = ""; | ||||
| @ -271,12 +278,20 @@ ${ | ||||
|             client.stop(); | ||||
|             break; | ||||
|           } | ||||
|           delay(1000); | ||||
|         } | ||||
|      | ||||
|         num_measurements = 0; | ||||
|         break; | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     ${ | ||||
|       restart === "TRUE" | ||||
|         ? "if (connected == false) {\n  delay(5000);\n  noInterrupts();\n NVIC_SystemReset();\n while (1)\n ;\n }" | ||||
|         : "" | ||||
|     } | ||||
| 
 | ||||
|   }`;
 | ||||
|     code = ""; | ||||
|     code += branch; | ||||
|  | ||||
| @ -35,6 +35,7 @@ Blockly.Arduino.sensebox_sensor_uv_light = function () { | ||||
|   } | ||||
|   if (dropdown_name === "Illuminance") { | ||||
|     Blockly.Arduino.libraries_["library_ltr329"] = `#include <LTR329.h>`; | ||||
|     Blockly.Arduino.libraries_["library_wire"] = "#include <Wire.h>"; | ||||
|     Blockly.Arduino.codeFunctions_["read_reg"] = ` | ||||
| int read_reg(byte address, uint8_t reg) | ||||
|   { | ||||
|  | ||||
| @ -12,6 +12,9 @@ export const OSEM = { | ||||
|   senseBox_osem_stationary: "Stationär", | ||||
|   senseBox_osem_mobile: "Mobil", | ||||
|   senseBox_osem_access_token: "API Schlüssel", | ||||
|     senseBox_send_mobile_to_osem: "Sende Messwert und Standort an die openSenseMap", | ||||
|     senseBox_send_mobile_to_osem_tip: "Sende Messwert und Standort an die openSenseMap", | ||||
| } | ||||
|   senseBox_send_mobile_to_osem: | ||||
|     "Sende Messwert und Standort an die openSenseMap", | ||||
|   senseBox_send_mobile_to_osem_tip: | ||||
|     "Sende Messwert und Standort an die openSenseMap", | ||||
|   senseBox_osem_restart: "Bei Verbindungsverlust Gerät neustarten?", | ||||
| }; | ||||
|  | ||||
| @ -4,7 +4,8 @@ export const OSEM = { | ||||
|    */ | ||||
| 
 | ||||
|   senseBox_osem_connection_tip: "connect to the openSenseMap", | ||||
|     senseBox_send_to_osem_tip: "sends the measurement to openSenseMap. Make shure to enter the correct BoxID and SensorID", | ||||
|   senseBox_send_to_osem_tip: | ||||
|     "sends the measurement to openSenseMap. Make shure to enter the correct BoxID and SensorID", | ||||
|   senseBox_send_to_osem: "Send measurement to openSenseMap", | ||||
|   senseBox_osem_connection: "Connect to openSenseMap", | ||||
|   senseBox_osem_host: "opensensemap.org", | ||||
| @ -15,6 +16,5 @@ export const OSEM = { | ||||
|   senseBox_osem_access_token: "API Key", | ||||
|   senseBox_send_mobile_to_osem: "Send measurement and location to openSenseMap", | ||||
|   senseBox_send_mobile_to_osem_tip: "Send Value and Location to openSenseMap", | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|   senseBox_osem_restart: "Restart device if disconnected?", | ||||
| }; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user