Compare commits

...
Author SHA1 Message Date
Bjoern Luig 0388e5c627 change order of phenomenons 2023-06-09 11:03:28 +02:00
Bjoern Luig 9c33bc4c0d small bugfix to use multiple sensors 2022-11-16 14:18:27 +01:00
Bjoern 32372bc222 finished english language and testing of compiling 2022-10-28 01:37:16 +02:00
Bjoern Luig dbc7fdc7ab added rainsensor 2022-08-28 16:25:52 +02:00
Mario PeschandGitHub 426b87e84d Merge pull request #180 from sensebox/fix/spelling-humidity
fix #179
2022-07-14 09:41:29 +02:00
Mario Pesch 51c4df2e64 fix #179
closes #179
2022-07-14 09:36:41 +02:00
Mario PeschandGitHub ef72dc8033 Merge pull request #173 from sensebox/fix/missing-senseboxIO
fix missing senseBoxIO Lib in LED Category
2022-05-03 14:40:00 +02:00
Mario Pesch 28114b9a20 fix missing senseBoxIO Lib in LED Category 2022-05-03 10:03:42 +02:00
Mario PeschandGitHub 16c463508f Merge pull request #169 from sensebox/fix/sds-queryMode
change sds from active to query mode
2022-04-28 11:20:54 +02:00
Mario Pesch 8f0c61fe38 change sds from active to query mode 2022-04-28 10:52:04 +02:00
Mario PeschandGitHub 198782d106 Merge pull request #168 from sensebox/fix/phyphox-view-style
fix phyphox view style to use lines as default
2022-04-26 10:32:49 +02:00
Mario Pesch 43aa53fb84 fix phyphox view style to use lines as default 2022-04-26 10:28:52 +02:00
Mario PeschandGitHub 31efce44e7 Merge pull request #166 from sensebox/fix/code-fixes
Fix/code fixes
2022-04-18 18:40:19 +02:00
Mario Pesch 526e65afe0 return ip 2022-04-18 18:04:05 +02:00
Mario Pesch 1c43a403d6 fix include adafruit mqtt 2022-04-18 11:20:03 +02:00
Mario PeschandGitHub f1e9a5cc78 Merge pull request #162 from sensebox/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-04-10 15:03:11 +02:00
Mario Pesch 5472b4fc0b remove button as switch
closes #165
2022-04-10 14:52:25 +02:00
Mario Pesch 43c3961090 change OLED_RESET
change OLED_RESET Pin to -1
closes #164
2022-04-10 14:51:08 +02:00
dependabot[bot]andGitHub a4a1b9da75 Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-01 20:27:51 +00:00
Mario PeschandGitHub d8b0cad74c Merge pull request #160 from sensebox/fix/bmp-adress
fix bmp i2c adress
2022-03-22 14:09:24 +01:00
Mario Pesch aa7d81b742 fix bmp i2c adress 2022-03-22 13:39:28 +01:00
Felix ErdmannandGitHub 0608e2efaa Update .env 2022-03-07 12:05:57 +01:00
Mario Pesch 146d278912 change compiler url 2022-03-04 18:16:24 +01:00
Mario Pesch de9ec5b0a4 update text 2022-03-04 17:04:49 +01:00
Mario Pesch 0e825c610b change compiler url 2022-03-04 17:00:55 +01:00
Mario PeschandGitHub 77c8080c27 Update README.md 2022-03-03 20:09:58 +01:00
Mario PeschandGitHub cbb58e1341 Merge pull request #155 from sensebox/dependabot/npm_and_yarn/url-parse-1.5.10
Bump url-parse from 1.5.6 to 1.5.10
2022-02-28 10:15:23 +01:00
Mario PeschandGitHub 265befd1eb Merge pull request #154 from sensebox/dependabot/npm_and_yarn/prismjs-1.27.0
Bump prismjs from 1.25.0 to 1.27.0
2022-02-28 10:15:09 +01:00
dependabot[bot]andGitHub 1c6572bcf8 Bump url-parse from 1.5.6 to 1.5.10
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.6 to 1.5.10.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.5.6...1.5.10)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-28 03:53:57 +00:00
dependabot[bot]andGitHub a0ca85fd4e Bump prismjs from 1.25.0 to 1.27.0
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.25.0 to 1.27.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PrismJS/prism/compare/v1.25.0...v1.27.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-26 02:36:11 +00:00
Mario PeschandGitHub 68f4fbf961 Merge pull request #152 from sensebox/fix-output-types
fix output types
2022-02-18 10:20:04 +01:00
Mario Pesch da3f909312 fix output types 2022-02-18 10:16:08 +01:00
Mario PeschandGitHub 34f16ee4cf Merge pull request #151 from sensebox/dependabot/npm_and_yarn/nanoid-3.3.1
Bump nanoid from 3.1.30 to 3.3.1
2022-02-17 10:56:25 +01:00
dependabot[bot]andGitHub edfbbb667a Bump nanoid from 3.1.30 to 3.3.1
Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.30 to 3.3.1.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.1.30...3.3.1)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-17 09:35:08 +00:00
Mario PeschandGitHub 72a88e4a1c Merge pull request #132 from sensebox/remove-senseboxmcu-lib
Remove senseboxmcu lib
2022-02-17 10:34:04 +01:00
Mario Pesch f9d90f4375 add some help urls and tooltip 📚 2022-02-17 09:57:42 +01:00
Mario Pesch 059f4534ec sensors blocks compile fine now 💻 2022-02-17 09:25:37 +01:00
Mario Pesch 772797bb6b add restart to osem block 2022-02-16 20:01:22 +01:00
Mario Pesch 321cba25ba add ttn mapper decoder
closes #60
2022-02-16 16:11:07 +01:00
Mario Pesch d3ca85d2e4 fix ssl problems 🚒 2022-02-16 16:06:59 +01:00
Mario Pesch c525127a9b Merge branch 'master' into remove-senseboxmcu-lib 2022-02-16 10:44:30 +01:00
Mario Pesch 058b5fb680 add librarymanager urls 2022-02-16 10:36:29 +01:00
Mario PeschandGitHub 690ad36d42 Merge pull request #150 from sensebox/dependabot/npm_and_yarn/ws-6.2.2
Bump ws from 6.2.1 to 6.2.2
2022-02-14 10:59:29 +01:00
dependabot[bot]andGitHub 4b20035323 Bump ws from 6.2.1 to 6.2.2
Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/6.2.1...6.2.2)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-14 09:55:15 +00:00
Mario PeschandGitHub 034ce26297 Merge pull request #149 from sensebox/dependabot/npm_and_yarn/path-parse-1.0.7
Bump path-parse from 1.0.6 to 1.0.7
2022-02-14 10:54:14 +01:00
Mario PeschandGitHub e11399f941 Merge pull request #148 from sensebox/dependabot/npm_and_yarn/url-parse-1.5.6
Bump url-parse from 1.5.1 to 1.5.6
2022-02-14 10:54:03 +01:00
dependabot[bot]andGitHub 510dbd91cb Bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-14 09:16:56 +00:00
dependabot[bot]andGitHub d1fe65ff02 Bump url-parse from 1.5.1 to 1.5.6
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.1 to 1.5.6.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.5.1...1.5.6)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-14 09:16:41 +00:00
Mario PeschandGitHub 45ff2e87de Merge pull request #147 from sensebox/dependabot/npm_and_yarn/tar-6.1.11
Bump tar from 6.1.0 to 6.1.11
2022-02-14 10:14:13 +01:00
Mario PeschandGitHub 0f36714e72 Merge pull request #146 from sensebox/dependabot/npm_and_yarn/tmpl-1.0.5
Bump tmpl from 1.0.4 to 1.0.5
2022-02-14 10:13:53 +01:00
dependabot[bot]andGitHub 385dfd1efa Bump tar from 6.1.0 to 6.1.11
Bumps [tar](https://github.com/npm/node-tar) from 6.1.0 to 6.1.11.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v6.1.0...v6.1.11)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-14 08:59:51 +00:00
dependabot[bot]andGitHub 16657cc777 Bump tmpl from 1.0.4 to 1.0.5
Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-14 08:59:50 +00:00
Mario PeschandGitHub dc8f8ef89a Merge pull request #145 from sensebox/dependabot/npm_and_yarn/follow-redirects-1.14.8
Bump follow-redirects from 1.14.4 to 1.14.8
2022-02-14 09:58:41 +01:00
dependabot[bot]andGitHub 52483dd2d4 Bump follow-redirects from 1.14.4 to 1.14.8
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.4 to 1.14.8.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.4...v1.14.8)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 20:16:30 +00:00
Mario Pesch 4cece27830 remove interval from maxInstances 2022-02-08 11:03:03 +01:00
Mario Pesch e44cab49fb add cayenne concentration block 2022-02-07 12:38:58 +01:00
Mario Pesch 514680252b remove telegram for now 2022-02-03 17:15:48 +01:00
Mario Pesch 80811fa573 add multi interval feature
closes #74
2022-02-03 17:09:06 +01:00
Mario Pesch 221c149ea6 fix veml6070 2022-02-03 15:59:48 +01:00
Mario Pesch c57ca3509b fix wifi code 2022-02-01 11:05:40 +01:00
Mario Pesch 42595be9a4 Update sensebox-sensors.js 2022-01-31 16:57:54 +01:00
Mario Pesch a5059f9369 fix osem block code generator 2022-01-31 16:07:32 +01:00
Mario Pesch 2cc4d9e84d remove last mcu library includes 2022-01-31 15:58:47 +01:00
Mario Pesch 787d4058fc fixes after merging 2022-01-31 15:56:03 +01:00
Mario PeschandGitHub df9abdc826 Merge pull request #143 from sensebox/block/add-ethernet-bee
Block/add ethernet bee
2022-01-31 15:36:46 +01:00
Mario PeschandGitHub 54b4c47303 Merge branch 'remove-senseboxmcu-lib' into block/add-ethernet-bee 2022-01-31 15:33:12 +01:00
Mario Pesch c711596285 update generated code 2022-01-29 10:50:30 +01:00
Mario Pesch 0c8ae90124 add watchdog 2022-01-26 09:52:50 +01:00
Mario Pesch 3e3956b185 add translations 2022-01-25 19:39:23 +01:00
Mario Pesch 405b7fd465 init adding ethernet bee 2022-01-24 14:48:35 +01:00
Mario Pesch 6f9e4bd79f add DPS310 Sensor
closes #137
2022-01-19 11:39:58 +01:00
Mario Pesch d4ad3ad915 fix bmp switch case 2022-01-17 16:01:22 +01:00
Mario Pesch 9b5059b7ce change to test compiler 2022-01-17 15:51:44 +01:00
Mario PeschandGitHub 1519a7f58b Merge pull request #136 from sensebox/fix-negative-gps-values
Fix negative gps values
2022-01-14 08:13:12 +01:00
Mario Pesch 62b728cf49 fix #135 2022-01-13 11:26:12 +01:00
Mario Pesch d34c5714e7 fix problem with negativ lat/lng 2022-01-13 11:25:59 +01:00
Mario Pesch e4fdb542bf Merge branch 'remove-senseboxmcu-lib' of https://github.com/sensebox/React-Ardublockly into remove-senseboxmcu-lib 2021-12-21 09:32:19 +01:00
Mario Pesch f38e21a94b update blocks and code 2021-12-21 09:31:48 +01:00
Mario Pesch 6a6f0c0304 small fixes 2021-12-21 08:25:16 +01:00
Mario PeschandGitHub 94aba6d176 Merge pull request #131 from sensebox/add-sound-selector
add sound selector
2021-12-20 15:16:47 +01:00
Mario Pesch 6fe4c3aab3 update code generators 2021-12-15 10:08:31 +01:00
Mario Pesch 258f0f0841 add sound selector 2021-12-13 15:35:25 +01:00
Mario Pesch 59a226f22e fix loading of blocks with dynamic extra fields 2021-12-09 10:44:38 +01:00
Mario Pesch 9487a490e0 update code generation to replace mcu library 2021-12-09 09:52:41 +01:00
Mario Pesch 279defa7f9 Update sensebox-osem.js 2021-11-30 10:30:49 +01:00
Mario PeschandGitHub 13ce43072d Merge pull request #129 from sensebox/fix/rtc-code-generation
fix rtc generation
2021-11-29 09:46:52 +01:00
Mario Pesch b2b03b8a1b fix rtc generation 2021-11-29 09:42:42 +01:00
Mario PeschandGitHub 3e617deaa8 Merge pull request #128 from sensebox/quick-fix
quick fix
2021-11-26 19:21:35 +01:00
Mario Pesch 36b1fc06d9 quick fix 2021-11-26 18:16:58 +00:00
Mario PeschandGitHub a26f2a2f89 Merge pull request #127 from sensebox/development
Development
2021-11-25 13:53:49 +01:00
Mario Pesch d21847454a replace more senseBox MCU includes 2021-11-24 18:33:35 +01:00
Mario Pesch 8acc89b99e start replacing mcu lib 2021-11-24 13:08:42 +01:00
Mario Pesch 1ac11ea796 fix issue 2021-11-23 12:00:53 +01:00
Mario PeschandGitHub 181df84d2c Merge pull request #118 from sensebox/feat/senseBoxConnect
init senseBox connect features
2021-11-23 11:56:11 +01:00
Mario PeschandGitHub d167d883b1 Merge branch 'development' into feat/senseBoxConnect 2021-11-23 11:55:15 +01:00
Mario Pesch 56c39e9a9d add translations and maxInstances
fixes #126
fixes #125
2021-11-23 11:48:02 +01:00
Mario Pesch 3c62635332 Create CITATION.cff 2021-11-23 11:47:36 +01:00
Mario PeschandGitHub bc89b40815 Merge pull request #124 from sensebox/fix-mobile-sd
add linebreak
2021-11-16 14:51:01 +01:00
Mario Pesch 82220687ab add linebreak 2021-11-16 14:45:12 +01:00
Mario Pesch faaabf907b update code generator 2021-11-03 12:31:30 +01:00
Mario Pesch d67cb74401 add translations and informations 2021-11-03 12:22:51 +01:00
Mario Pesch 0e33361ee8 added a new comment 2021-10-27 15:27:27 +02:00
Mario PeschandGitHub c47cb0a02e Merge pull request #119 from sensebox/random-small-fixes
Multiple Issue fixes
2021-10-18 10:43:19 +02:00
Mario PeschandGitHub a23f504eec Merge pull request #122 from sensebox/update-login-button
Update login Button
2021-10-17 17:51:26 +02:00
Mario Pesch 9da3d9041d Update login Button 2021-10-17 17:46:54 +02:00
Mario Pesch 69f2277c6c fixes #113 2021-10-14 13:38:48 +02:00
Mario Pesch 1b4a4225de add ble-bee image 2021-10-14 11:34:21 +02:00
Mario Pesch bcfe15f4cf update Pin labels
fixes #115
2021-10-14 10:29:20 +02:00
Mario Pesch b18b56ab68 fix #114 2021-10-13 09:57:09 +02:00
Mario Pesch c60d2ddba6 add ota settings 2021-10-07 11:11:14 +02:00
Matthias Pfeil 508591f685 Adjust link with correct filename 2021-10-06 10:33:04 +02:00
Mario PeschandGitHub 5a07197290 Merge pull request #117 from sensebox/fix/login-not-working
update axios
2021-10-03 18:08:53 +02:00
Mario Pesch eb4cfa9c24 update axios
Fixes #116
2021-10-03 18:04:46 +02:00
Mario Pesch faabd9e693 init senseBox connect features 2021-10-01 15:06:22 +02:00
Mario PeschandGitHub e528a78e77 Merge pull request #111 from sensebox/dependabot/npm_and_yarn/axios-0.21.2
Bump axios from 0.21.1 to 0.21.2
2021-09-21 11:45:54 +02:00
dependabot[bot]andGitHub 26abf81a9d Bump axios from 0.21.1 to 0.21.2
Bumps [axios](https://github.com/axios/axios) from 0.21.1 to 0.21.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.21.1...v0.21.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-21 09:44:57 +00:00
Mario PeschandGitHub 3e3237d338 Merge pull request #110 from sensebox/dependabot/npm_and_yarn/prismjs-1.25.0
Bump prismjs from 1.24.0 to 1.25.0
2021-09-21 11:43:51 +02:00
dependabot[bot]andGitHub 1e7d7c9fec Bump prismjs from 1.24.0 to 1.25.0
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.24.0 to 1.25.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PrismJS/prism/compare/v1.24.0...v1.25.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-20 22:07:03 +00:00
Mario PeschandGitHub 5ad1fcd526 Merge pull request #109 from sensebox/fix/rename-variableDB
rename variableDB to nameDB
2021-09-17 12:46:30 +02:00
Mario Pesch a8cf038821 rename variableDB to nameDB
rename variableDB_ to nameDB_ as it is deprecated
2021-09-17 12:26:18 +02:00
Mario PeschandGitHub abfa5d0bed Merge pull request #108 from sensebox/improve-sd-blocks
Improve sd blocks
2021-09-17 11:18:04 +02:00
Mario Pesch 6fc640159b add missing translations and update toolbox 2021-09-17 11:00:09 +02:00
Mario PeschandGitHub f6eeed7d75 Merge pull request #101 from sensebox/fix/gps-code
update gps code
2021-09-17 10:49:06 +02:00
Mario Pesch f20766d489 fix #83 2021-09-17 10:23:05 +02:00
Mario Pesch 5e21a28eb2 rearrange toolbox 2021-09-16 16:32:23 +02:00
Mario Pesch d54ed3254c add linebreak 2021-09-16 16:29:03 +02:00
Mario PeschandGitHub df739320d2 Merge pull request #107 from sensebox/add-new-components
add new components
2021-09-16 15:56:10 +02:00
Mario Pesch bd0748f882 add new components 2021-09-16 15:49:29 +02:00
Mario Pesch e79319c86a add mobile measurments 2021-09-16 13:23:46 +02:00
Mario Pesch 26fd899156 add GPS speed 2021-09-15 20:09:48 +02:00
Mario Pesch 0e0dbed77a update gps code
make gps blocks to osem block compatible
2021-09-10 09:53:35 +02:00
90 changed files with 12993 additions and 24369 deletions
+26
View File
@@ -0,0 +1,26 @@
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: senseBox Learn- and Programming Environment
message: Please cite this software using these metadata.
type: software
version: 1.0.0
date-released: 2021-09-30
url: "https://github.com/sensebox/React-Ardublockly"
authors:
- given-names: Mario
family-names: Pesch
email: mario.pesch@uni-muenster.de
affiliation: >-
Institute for geoinformatics University of
Muenster
- given-names: Luc
family-names: Niski
affiliation: >-
Institute for geoinformatics University of
Muenster
- given-names: Felix
family-names: Erdmann
email: f.erdmann@reedu.de
affiliation: Reedu GmbH & Co. KG
+1 -4
View File
@@ -22,7 +22,4 @@ This project was created with [Create React App](https://github.com/facebook/cre
Ensure that line 14 in [store.js](https://github.com/sensebox/React-Ardublockly/blob/master/src/store.js#L14) is commented out or otherwise you have installed [Redux DevTools Extension](http://extension.remotedev.io/).
## Demo
A demo of the current status of the master branch can be accessed via [sensebox-ardublockly.netlify.app](https://sensebox-ardublockly.netlify.app/) :rocket:.
* [Home](https://sensebox-ardublockly.netlify.app/)
* [Tutorial Overview](https://sensebox-ardublockly.netlify.app/tutorial)
* [Tutorial-Builder](https://sensebox-ardublockly.netlify.app/tutorial/builder)
A demo of the current status of the master branch can be accessed via [https://blockly-react.netlify.app/](https://blockly-react.netlify.app/) :rocket:.
+6384 -7200
View File
File diff suppressed because it is too large Load Diff
+6 -5
View File
@@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@blockly/block-plus-minus": "^2.0.10",
"@blockly/field-grid-dropdown": "^1.0.25",
"@blockly/field-slider": "^2.1.1",
"@blockly/plugin-scroll-options": "^1.0.2",
"@blockly/plugin-typed-variable-modal": "^3.1.26",
@@ -14,17 +15,17 @@
"@material-ui/core": "^4.11.0",
"@sentry/react": "^6.0.0",
"@sentry/tracing": "^6.0.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.21.0",
"axios": "^0.22.0",
"blockly": "^6.20210701.0",
"file-saver": "^2.0.2",
"mnemonic-id": "^3.2.7",
"moment": "^2.28.0",
"prismjs": "^1.24.0",
"prismjs": "^1.27.0",
"react": "^17.0.2",
"react-cookie-consent": "^5.2.0",
"react-cookie-consent": "^7.0.0",
"react-dom": "^17.0.2",
"react-markdown": "^5.0.2",
"react-mde": "^11.5.0",
Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 KiB

+28 -8
View File
@@ -1,32 +1,52 @@
import { VISIT, LANGUAGE, RENDERER, STATISTICS } from './types';
import {
VISIT,
LANGUAGE,
RENDERER,
SOUNDS,
STATISTICS,
PLATFORM,
} from "./types";
export const visitPage = () => (dispatch) => {
dispatch({
type: VISIT
type: VISIT,
});
};
export const setPlatform = (platform) => (dispatch) => {
dispatch({
type: PLATFORM,
payload: platform,
});
};
export const setLanguage = (language) => (dispatch, getState) => {
if(!getState().auth.progress && !getState().auth.isAuthenticated){
window.localStorage.setItem('locale', language);
if (!getState().auth.progress && !getState().auth.isAuthenticated) {
window.localStorage.setItem("locale", language);
}
dispatch({
type: LANGUAGE,
payload: language
payload: language,
});
};
export const setRenderer = (renderer) => (dispatch) => {
dispatch({
type: RENDERER,
payload: renderer
payload: renderer,
});
};
export const setSounds = (sounds) => (dispatch) => {
dispatch({
type: SOUNDS,
payload: sounds,
});
};
export const setStatistics = (showStatistics) => (dispatch) => {
dispatch({
type: STATISTICS,
payload: showStatistics
payload: showStatistics,
});
};
+2
View File
@@ -43,7 +43,9 @@ export const PROGRESS = "PROGRESS";
export const VISIT = "VISIT";
export const LANGUAGE = "LANGUAGE";
export const PLATFORM = "PLATFORM";
export const RENDERER = "RENDERER";
export const SOUNDS = "SOUNDS";
export const STATISTICS = "STATISTICS";
// messages
+7
View File
@@ -11,6 +11,7 @@ import "./blocks/index";
import "./generator/index";
import { ZoomToFitControl } from "@blockly/zoom-to-fit";
import { initialXml } from "./initialXml.js";
import { getMaxInstances } from "./helpers/maxInstances";
class BlocklyWindow extends Component {
constructor(props) {
@@ -24,6 +25,7 @@ class BlocklyWindow extends Component {
this.props.clearStats();
workspace.addChangeListener((event) => {
this.props.onChangeWorkspace(event);
// switch on that a block is displayed disabled or not depending on whether it is correctly connected
// for SVG display, a deactivated block in the display is undesirable
if (this.props.blockDisabled) {
@@ -37,6 +39,7 @@ class BlocklyWindow extends Component {
componentDidUpdate(props) {
const workspace = Blockly.getMainWorkspace();
var xml = this.props.initialXml;
// if svg is true, then the update process is done in the BlocklySvg component
if (props.initialXml !== xml && !this.props.svg) {
@@ -69,6 +72,8 @@ class BlocklyWindow extends Component {
this.props.trashcan !== undefined ? this.props.trashcan : true
}
renderer={this.props.renderer}
sounds={this.props.sounds}
maxInstances={getMaxInstances()}
zoom={{
// https://developers.google.com/blockly/guides/configure/web/zoom
controls:
@@ -119,11 +124,13 @@ BlocklyWindow.propTypes = {
onChangeWorkspace: PropTypes.func.isRequired,
clearStats: PropTypes.func.isRequired,
renderer: PropTypes.string.isRequired,
sounds: PropTypes.string.isRequired,
language: PropTypes.string.isRequired,
};
const mapStateToProps = (state) => ({
renderer: state.general.renderer,
sounds: state.general.sounds,
language: state.general.language,
});
+2
View File
@@ -18,9 +18,11 @@ import "./audio";
import "./math";
import "./map";
import "./procedures";
import "./serial";
import "./time";
import "./variables";
import "./lists";
import "./watchdog";
import "./webserver";
import "../helpers/types";
+252 -229
View File
@@ -10,248 +10,271 @@
*
* TODO: maybe change this to a "PIN" BlocklyType
*/
import Blockly from 'blockly/core';
import { selectedBoard } from '../helpers/board'
import * as Types from '../helpers/types'
import Blockly from "blockly/core";
import { selectedBoard } from "../helpers/board";
import * as Types from "../helpers/types";
Blockly.Blocks['io_digitalwrite'] = {
/**
* Block for creating a 'set pin' to a state.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/DigitalWrite');
this.setColour(250);
this.appendValueInput('STATE')
.appendField(Blockly.Msg.ARD_DIGITALWRITE)
.appendField(new Blockly.FieldDropdown(
selectedBoard().digitalPins), 'PIN')
.appendField(Blockly.Msg.ARD_WRITE_TO)
.setCheck(Types.BOOLEAN.checkList);
this.setInputsInline(false);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_DIGITALWRITE_TIP);
},
/**
* Updates the content of the the pin related fields.
* @this Blockly.Block
*/
updateFields: function () {
Blockly.Arduino.Boards.refreshBlockFieldDropdown(
this, 'PIN', 'digitalPins');
}
Blockly.Blocks["io_digitalwrite"] = {
/**
* Block for creating a 'set pin' to a state.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/DigitalWrite");
this.setColour(250);
this.appendValueInput("STATE")
.appendField(Blockly.Msg.ARD_DIGITALWRITE)
.appendField(
new Blockly.FieldDropdown(selectedBoard().digitalPins),
"PIN"
)
.appendField(Blockly.Msg.ARD_WRITE_TO)
.setCheck(Types.BOOLEAN.checkList);
this.setInputsInline(false);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_DIGITALWRITE_TIP);
},
/**
* Updates the content of the the pin related fields.
* @this Blockly.Block
*/
updateFields: function () {
Blockly.Arduino.Boards.refreshBlockFieldDropdown(
this,
"PIN",
"digitalPins"
);
},
};
Blockly.Blocks['io_digitalread'] = {
/**
* Block for creating a 'read pin'.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/DigitalRead');
this.setColour(250);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_DIGITALREAD)
.appendField(new Blockly.FieldDropdown(
selectedBoard().digitalPins), 'PIN');
this.setOutput(true, 'boolean');
this.setTooltip(Blockly.Msg.ARD_DIGITALREAD_TIP);
},
/** @return {!string} The type of return value for the block, an integer. */
getBlockType: function () {
return Types.BOOLEAN;
},
/**
* Updates the content of the the pin related fields.
* @this Blockly.Block
*/
updateFields: function () {
Blockly.Arduino.Boards.refreshBlockFieldDropdown(
this, 'PIN', 'digitalPins');
}
Blockly.Blocks["io_digitalread"] = {
/**
* Block for creating a 'read pin'.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/DigitalRead");
this.setColour(250);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_DIGITALREAD)
.appendField(
new Blockly.FieldDropdown(selectedBoard().digitalPins),
"PIN"
);
this.setOutput(true, "boolean");
this.setTooltip(Blockly.Msg.ARD_DIGITALREAD_TIP);
},
/** @return {!string} The type of return value for the block, an integer. */
getBlockType: function () {
return Types.BOOLEAN;
},
/**
* Updates the content of the the pin related fields.
* @this Blockly.Block
*/
updateFields: function () {
Blockly.Arduino.Boards.refreshBlockFieldDropdown(
this,
"PIN",
"digitalPins"
);
},
};
Blockly.Blocks['io_builtin_led'] = {
/**
* Block for setting built-in LED to a state.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/DigitalWrite');
this.setColour(250);
this.appendValueInput('STATE')
.appendField(Blockly.Msg.ARD_BUILTIN_LED)
.appendField(new Blockly.FieldDropdown(
selectedBoard().builtinLed), 'BUILT_IN_LED')
.appendField(Blockly.Msg.ARD_WRITE_TO)
.setCheck(Types.BOOLEAN.compatibleTypes);
this.setInputsInline(false);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_BUILTIN_LED_TIP);
},
/**
* Updates the content of the the pin related fields.
* @this Blockly.Block
*/
updateFields: function () {
Blockly.Arduino.Boards.refreshBlockFieldDropdown(
this, 'BUILT_IN_LED', 'builtinLed');
},
/** @return {!string} The type of input value for the block, an integer. */
getBlockType: function () {
return Types.BOOLEAN;
},
Blockly.Blocks["io_builtin_led"] = {
/**
* Block for setting built-in LED to a state.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/DigitalWrite");
this.setColour(250);
this.appendValueInput("STATE")
.appendField(Blockly.Msg.ARD_BUILTIN_LED)
.appendField(
new Blockly.FieldDropdown(selectedBoard().builtinLed),
"BUILT_IN_LED"
)
.appendField(Blockly.Msg.ARD_WRITE_TO)
.setCheck(Types.BOOLEAN.compatibleTypes);
this.setInputsInline(false);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_BUILTIN_LED_TIP);
},
/**
* Updates the content of the the pin related fields.
* @this Blockly.Block
*/
updateFields: function () {
Blockly.Arduino.Boards.refreshBlockFieldDropdown(
this,
"BUILT_IN_LED",
"builtinLed"
);
},
/** @return {!string} The type of input value for the block, an integer. */
getBlockType: function () {
return Types.BOOLEAN;
},
};
Blockly.Blocks['io_analogwrite'] = {
/**
* Block for creating a 'set pin' to an analogue value.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/AnalogWrite');
this.setColour(250);
this.appendValueInput('NUM')
.appendField(Blockly.Msg.ARD_ANALOGWRITE)
.appendField(new Blockly.FieldDropdown(
selectedBoard().pwmPins), 'PIN')
.appendField(Blockly.Msg.ARD_WRITE_TO)
.setCheck(Types.NUMBER.compatibleTypes);
this.setInputsInline(false);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_ANALOGWRITE_TIP);
},
/**
* Updates the content of the the pin related fields.
* @this Blockly.Block
*/
updateFields: function () {
Blockly.Arduino.Boards.refreshBlockFieldDropdown(this, 'PIN', 'pwmPins');
},
/** @return {!string} The type of input value for the block, an integer. */
getBlockType: function () {
return Types.NUMBER;
},
Blockly.Blocks["io_analogwrite"] = {
/**
* Block for creating a 'set pin' to an analogue value.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/AnalogWrite");
this.setColour(250);
this.appendValueInput("NUM")
.appendField(Blockly.Msg.ARD_ANALOGWRITE)
.appendField(new Blockly.FieldDropdown(selectedBoard().pwmPins), "PIN")
.appendField(Blockly.Msg.ARD_WRITE_TO)
.setCheck(Types.NUMBER.compatibleTypes);
this.setInputsInline(false);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_ANALOGWRITE_TIP);
},
/**
* Updates the content of the the pin related fields.
* @this Blockly.Block
*/
updateFields: function () {
Blockly.Arduino.Boards.refreshBlockFieldDropdown(this, "PIN", "pwmPins");
},
/** @return {!string} The type of input value for the block, an integer. */
getBlockType: function () {
return Types.NUMBER;
},
};
Blockly.Blocks['io_analogread'] = {
/**
* Block for reading an analogue input.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/AnalogRead');
this.setColour(250);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_ANALOGREAD)
.appendField(new Blockly.FieldDropdown(
selectedBoard().analogPins), 'PIN');
this.setOutput(true, Types.NUMBER.typeId);
this.setTooltip(Blockly.Msg.ARD_ANALOGREAD_TIP);
},
/** @return {!string} The type of return value for the block, an integer. */
getBlockType: function () {
return Types.NUMBER.typeId;
},
/**
* Updates the content of the the pin related fields.
* @this Blockly.Block
*/
updateFields: function () {
Blockly.Arduino.Boards.refreshBlockFieldDropdown(this, 'PIN', 'analogPins');
}
Blockly.Blocks["io_analogread"] = {
/**
* Block for reading an analogue input.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/AnalogRead");
this.setColour(250);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_ANALOGREAD)
.appendField(
new Blockly.FieldDropdown(selectedBoard().analogPins),
"PIN"
);
this.setOutput(true, Types.NUMBER.typeName);
this.setTooltip(Blockly.Msg.ARD_ANALOGREAD_TIP);
},
/** @return {!string} The type of return value for the block, an integer. */
getBlockType: function () {
return Types.NUMBER.typeName;
},
/**
* Updates the content of the the pin related fields.
* @this Blockly.Block
*/
updateFields: function () {
Blockly.Arduino.Boards.refreshBlockFieldDropdown(this, "PIN", "analogPins");
},
};
Blockly.Blocks['io_highlow'] = {
/**
* Block for creating a pin state.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/Constants');
this.setColour(250);
this.appendDummyInput()
.appendField(
new Blockly.FieldDropdown([[Blockly.Msg.ARD_HIGH, 'HIGH'], [Blockly.Msg.ARD_LOW, 'LOW']]),
'STATE');
this.setOutput(true, Types.BOOLEAN.typeId);
this.setTooltip(Blockly.Msg.ARD_HIGHLOW_TIP);
},
/** @return {!string} The type of return value for the block, an integer. */
getBlockType: function () {
return Types.BOOLEAN;
}
Blockly.Blocks["io_highlow"] = {
/**
* Block for creating a pin state.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/Constants");
this.setColour(250);
this.appendDummyInput().appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.ARD_HIGH, "HIGH"],
[Blockly.Msg.ARD_LOW, "LOW"],
]),
"STATE"
);
this.setOutput(true, Types.BOOLEAN.typeName);
this.setTooltip(Blockly.Msg.ARD_HIGHLOW_TIP);
},
/** @return {!string} The type of return value for the block, an integer. */
getBlockType: function () {
return Types.BOOLEAN;
},
};
Blockly.Blocks['io_pulsein'] = {
/**
* Block for measuring the duration of a pulse in an input pin.
* @this Blockly.Block
*/
init: function () {
this.jsonInit({
"type": "math_foo",
"message0": Blockly.Msg.ARD_PULSE_READ,
"args0": [{
"type": "input_value",
"name": "PULSETYPE",
"check": Types.BOOLEAN.compatibleTypes
}, {
"type": "field_dropdown",
"name": "PULSEPIN",
"options": selectedBoard().digitalPins,
}
],
"output": Types.NUMBER.typeId,
"inputsInline": true,
"colour": 250,
"tooltip": Blockly.Msg.ARD_PULSE_TIP,
"helpUrl": 'https://www.arduino.cc/en/Reference/PulseIn'
});
},
/** @return {!string} The type of input value for the block, an integer. */
getBlockType: function () {
return Types.NUMBER.typeId;
}
Blockly.Blocks["io_pulsein"] = {
/**
* Block for measuring the duration of a pulse in an input pin.
* @this Blockly.Block
*/
init: function () {
this.jsonInit({
type: "math_foo",
message0: Blockly.Msg.ARD_PULSE_READ,
args0: [
{
type: "input_value",
name: "PULSETYPE",
check: Types.BOOLEAN.compatibleTypes,
},
{
type: "field_dropdown",
name: "PULSEPIN",
options: selectedBoard().digitalPins,
},
],
output: Types.NUMBER.typeName,
inputsInline: true,
colour: 250,
tooltip: Blockly.Msg.ARD_PULSE_TIP,
helpUrl: "https://www.arduino.cc/en/Reference/PulseIn",
});
},
/** @return {!string} The type of input value for the block, an integer. */
getBlockType: function () {
return Types.NUMBER.typeName;
},
};
Blockly.Blocks['io_pulsetimeout'] = {
/**
* Block for measuring (with a time-out) the duration of a pulse in an input
* pin.
* @this Blockly.Block
*/
init: function () {
this.jsonInit({
"type": "math_foo",
"message0": Blockly.Msg.ARD_PULSE_READ_TIMEOUT,
"args0": [{
"type": "input_value",
"name": "PULSETYPE",
"check": Types.BOOLEAN.compatibleTypes
}, {
"type": "field_dropdown",
"name": "PULSEPIN",
"options": selectedBoard().digitalPins,
}, {
"type": "input_value",
"name": "TIMEOUT",
"check": Types.NUMBER.compatibleTypes
}
],
"output": Types.NUMBER.typeId,
"inputsInline": true,
"colour": 250,
"tooltip": Blockly.Msg.ARD_PULSETIMEOUT_TIP,
"helpUrl": 'https://www.arduino.cc/en/Reference/PulseIn'
});
},
/** @return {!string} The type of input value for the block, an integer. */
getBlockType: function () {
return Types.NUMBER.typeId;
}
Blockly.Blocks["io_pulsetimeout"] = {
/**
* Block for measuring (with a time-out) the duration of a pulse in an input
* pin.
* @this Blockly.Block
*/
init: function () {
this.jsonInit({
type: "math_foo",
message0: Blockly.Msg.ARD_PULSE_READ_TIMEOUT,
args0: [
{
type: "input_value",
name: "PULSETYPE",
check: Types.BOOLEAN.compatibleTypes,
},
{
type: "field_dropdown",
name: "PULSEPIN",
options: selectedBoard().digitalPins,
},
{
type: "input_value",
name: "TIMEOUT",
check: Types.NUMBER.compatibleTypes,
},
],
output: Types.NUMBER.typeName,
inputsInline: true,
colour: 250,
tooltip: Blockly.Msg.ARD_PULSETIMEOUT_TIP,
helpUrl: "https://www.arduino.cc/en/Reference/PulseIn",
});
},
/** @return {!string} The type of input value for the block, an integer. */
getBlockType: function () {
return Types.NUMBER.typeName;
},
};
+49 -54
View File
@@ -1,59 +1,54 @@
import Blockly, { FieldDropdown } from 'blockly/core'
import * as Types from '../helpers/types'
import { getColour } from '../helpers/colour';
import Blockly, { FieldDropdown } from "blockly/core";
import * as Types from "../helpers/types";
import { getColour } from "../helpers/colour";
Blockly.Blocks['lists_create_empty'] = {
/**
* Elapsed time in milliseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/Millis');
this.setColour(getColour().arrays);
this.appendDummyInput()
.appendField("create List with")
this.appendValueInput('NUMBER');
this.appendDummyInput()
.appendField("Items of Type")
.appendField(new FieldDropdown(Types.VARIABLE_TYPES), 'type');
this.setOutput(true, Types.ARRAY.typeId);
this.setTooltip(Blockly.Msg.ARD_TIME_MILLIS_TIP);
},
Blockly.Blocks["lists_create_empty"] = {
/**
* Elapsed time in milliseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/Millis");
this.setColour(getColour().arrays);
this.appendDummyInput().appendField("create List with");
this.appendValueInput("NUMBER");
this.appendDummyInput()
.appendField("Items of Type")
.appendField(new FieldDropdown(Types.VARIABLE_TYPES), "type");
this.setOutput(true, Types.ARRAY.typeName);
this.setTooltip(Blockly.Msg.ARD_TIME_MILLIS_TIP);
},
};
Blockly.Blocks['array_getIndex'] = {
/**
* Elapsed time in milliseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/Millis');
this.setColour(getColour().arrays);
this.appendDummyInput()
.appendField(new Blockly.FieldVariable(
'X',
null,
['Array'],
'Array'
), 'FIELDNAME');
this.setOutput(true, Types.ARRAY.typeId);
this.setTooltip(Blockly.Msg.ARD_TIME_MILLIS_TIP);
},
Blockly.Blocks["array_getIndex"] = {
/**
* Elapsed time in milliseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/Millis");
this.setColour(getColour().arrays);
this.appendDummyInput().appendField(
new Blockly.FieldVariable("X", null, ["Array"], "Array"),
"FIELDNAME"
);
this.setOutput(true, Types.ARRAY.typeName);
this.setTooltip(Blockly.Msg.ARD_TIME_MILLIS_TIP);
},
};
Blockly.Blocks['lists_length'] = {
/**
* Elapsed time in milliseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/Millis');
this.setColour(getColour().arrays);
this.appendValueInput('ARRAY')
.appendField('length of')
.setCheck(Types.ARRAY.compatibleTypes);
this.setOutput(true, Types.NUMBER.typeName);
this.setTooltip(Blockly.Msg.ARD_TIME_MILLIS_TIP);
},
};
Blockly.Blocks["lists_length"] = {
/**
* Elapsed time in milliseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/Millis");
this.setColour(getColour().arrays);
this.appendValueInput("ARRAY")
.appendField("length of")
.setCheck(Types.ARRAY.compatibleTypes);
this.setOutput(true, Types.NUMBER.typeName);
this.setTooltip(Blockly.Msg.ARD_TIME_MILLIS_TIP);
},
};
File diff suppressed because it is too large Load Diff
+34 -35
View File
@@ -11,40 +11,39 @@
* TODO: This block can be improved to set the new range properly.
*/
import * as Blockly from "blockly/core";
import { getColour } from "../helpers/colour";
import * as Types from "../helpers/types";
import * as Blockly from 'blockly/core';
import { getColour } from '../helpers/colour';
import * as Types from '../helpers/types'
Blockly.Blocks['base_map'] = {
/**
* Block for creating a the map function.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/map');
this.setColour(getColour().math);
this.appendValueInput('NUM')
.appendField(Blockly.Msg.ARD_MAP)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput('FMIN')
.appendField(Blockly.Msg.ARD_MAP_FROMMIN)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput('FMAX')
.appendField(Blockly.Msg.ARD_MAP_FROMMAX)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput('DMIN')
.appendField(Blockly.Msg.ARD_MAP_TOMIN)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput('DMAX')
.appendField(Blockly.Msg.ARD_MAP_TOMAX)
.setCheck(Types.NUMBER.compatibleTypes);
this.setOutput(true);
this.setInputsInline(false);
this.setTooltip(Blockly.Msg.ARD_MAP_TIP);
},
/** @return {string} The type of return value for the block, an integer. */
getBlockType: function () {
return Types.NUMBER.typeId;
}
Blockly.Blocks["base_map"] = {
/**
* Block for creating a the map function.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/map");
this.setColour(getColour().math);
this.appendValueInput("NUM")
.appendField(Blockly.Msg.ARD_MAP)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput("FMIN")
.appendField(Blockly.Msg.ARD_MAP_FROMMIN)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput("FMAX")
.appendField(Blockly.Msg.ARD_MAP_FROMMAX)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput("DMIN")
.appendField(Blockly.Msg.ARD_MAP_TOMIN)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput("DMAX")
.appendField(Blockly.Msg.ARD_MAP_TOMAX)
.setCheck(Types.NUMBER.compatibleTypes);
this.setOutput(true);
this.setInputsInline(false);
this.setTooltip(Blockly.Msg.ARD_MAP_TIP);
},
/** @return {string} The type of return value for the block, an integer. */
getBlockType: function () {
return Types.NUMBER.typeName;
},
};
@@ -4,6 +4,7 @@ import { getColour } from "../helpers/colour";
Blockly.Blocks["sensebox_phyphox_init"] = {
init: function () {
this.setColour(getColour().phyphox);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_phyphox_init)
.appendField(new Blockly.FieldTextInput("Geräte Name"), "devicename");
@@ -37,6 +38,7 @@ Blockly.Blocks["sensebox_phyphox_experiment"] = {
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.sensebox_phyphox_experiment_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
},
};
@@ -63,8 +65,8 @@ Blockly.Blocks["sensebox_phyphox_graph"] = {
.appendField(Blockly.Msg.sensebox_phyphox_graphStyle)
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.sensebox_phyphox_style_dots, "dots"],
[Blockly.Msg.sensebox_phyphox_style_line, "line"],
[Blockly.Msg.sensebox_phyphox_style_dots, "dots"],
]),
"style"
);
@@ -77,6 +79,7 @@ Blockly.Blocks["sensebox_phyphox_graph"] = {
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.sensebox_phyphox_graph_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
},
};
@@ -86,6 +89,7 @@ Blockly.Blocks["sensebox_phyphox_timestamp"] = {
this.appendDummyInput().appendField(Blockly.Msg.sensebox_phyphox_timestamp);
this.setOutput(true);
this.setTooltip(Blockly.Msg.sensebox_phyphox_timestamp_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
},
};
@@ -107,6 +111,7 @@ Blockly.Blocks["sensebox_phyphox_channel"] = {
this.setOutput(true);
this.setTooltip(Blockly.Msg.sensebox_phyphox_channel_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
},
};
@@ -129,6 +134,7 @@ Blockly.Blocks["sensebox_phyphox_sendchannel"] = {
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.sensebox_phyphox_sendchannel_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
},
};
@@ -141,5 +147,6 @@ Blockly.Blocks["sensebox_phyphox_experiment_send"] = {
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.sensebox_phyphox_experiment_send_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
},
};
+303 -278
View File
@@ -1,304 +1,329 @@
import * as Blockly from 'blockly/core';
import { getColour } from '../helpers/colour';
import * as Types from '../helpers/types'
import { FieldSlider } from '@blockly/field-slider';
import * as Blockly from "blockly/core";
import { getColour } from "../helpers/colour";
import * as Types from "../helpers/types";
import { FieldSlider } from "@blockly/field-slider";
Blockly.Blocks['sensebox_display_beginDisplay'] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_beginDisplay)
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_display_beginDisplay_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
}
Blockly.Blocks["sensebox_display_beginDisplay"] = {
init: function () {
this.appendDummyInput().appendField(
Blockly.Msg.senseBox_display_beginDisplay
);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_display_beginDisplay_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
},
};
Blockly.Blocks['sensebox_display_clearDisplay'] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_clearDisplay)
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_display_clearDisplay_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
}
Blockly.Blocks["sensebox_display_clearDisplay"] = {
init: function () {
this.appendDummyInput().appendField(
Blockly.Msg.senseBox_display_clearDisplay
);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_display_clearDisplay_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
},
};
Blockly.Blocks['sensebox_display_printDisplay'] = {
init: function (block) {
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_printDisplay);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_color)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_display_white, "WHITE,BLACK"], [Blockly.Msg.senseBox_display_black, "BLACK,WHITE"]]), "COLOR");
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_setSize)
.appendField(new FieldSlider(1, 1, 4), "SIZE");
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_printDisplay_x)
.appendField(new FieldSlider(0, 0, 64), "X");
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_printDisplay_y)
.appendField(new FieldSlider(0, 0, 128), "Y");
this.appendValueInput('printDisplay')
.appendField(Blockly.Msg.senseBox_display_printDisplay_value)
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ['sensebox_display_show'],
};
Blockly.Blocks['sensebox_display_fastPrint'] = {
init: function (block) {
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_fastPrint_show);
this.appendValueInput("Title1", 'Title1')
.appendField(Blockly.Msg.senseBox_display_fastPrint_title);
this.appendValueInput("Value1", 'Value1')
.appendField(Blockly.Msg.senseBox_display_fastPrint_value);
this.appendValueInput("Dimension1", 'Dimension1')
.appendField(Blockly.Msg.senseBox_display_fastPrint_dimension);
this.appendValueInput("Title2", 'Title2')
.appendField(Blockly.Msg.senseBox_display_fastPrint_title);
this.appendValueInput("Value2", 'Value2')
.appendField(Blockly.Msg.senseBox_display_fastPrint_value);
this.appendValueInput("Dimension2", 'Dimension2')
.appendField(Blockly.Msg.senseBox_display_fastPrint_dimension);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.sensebox_display_fastPrint_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
},
/**
Blockly.Blocks["sensebox_display_printDisplay"] = {
init: function (block) {
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(
Blockly.Msg.senseBox_display_printDisplay
);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_color)
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_display_white, "WHITE,BLACK"],
[Blockly.Msg.senseBox_display_black, "BLACK,WHITE"],
]),
"COLOR"
);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_setSize)
.appendField(new FieldSlider(1, 1, 4), "SIZE");
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_printDisplay_x)
.appendField(new FieldSlider(0, 0, 127), "X");
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_printDisplay_y)
.appendField(new FieldSlider(0, 0, 63), "Y");
this.appendValueInput("printDisplay")
.appendField(Blockly.Msg.senseBox_display_printDisplay_value)
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ['sensebox_display_show'],
};
Blockly.Blocks['sensebox_display_plotDisplay'] = {
init: function () {
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_display_plotDisplay)
this.appendValueInput("Title", 'Text')
.appendField(Blockly.Msg.senseBox_display_plotTitle);
this.appendValueInput("YLabel", 'Text')
.appendField(Blockly.Msg.senseBox_display_plotYLabel);
this.appendValueInput("XLabel", 'Text')
.appendField(Blockly.Msg.senseBox_display_plotXLabel);
this.appendValueInput("XRange1", 'Number')
.appendField(Blockly.Msg.senseBox_display_plotXRange1);
this.appendValueInput("XRange2", 'Number')
.appendField(Blockly.Msg.senseBox_display_plotXRange2)
this.appendValueInput("YRange1", 'Number')
.appendField(Blockly.Msg.senseBox_display_plotYRange1);
this.appendValueInput("YRange2", 'Number')
.appendField(Blockly.Msg.senseBox_display_plotYRange2);
this.setInputsInline(false);
this.appendValueInput("XTick", 'Number')
.appendField(Blockly.Msg.senseBox_display_plotXTick);
this.appendValueInput("YTick", 'Number')
.appendField(Blockly.Msg.senseBox_display_plotYTick);
this.appendValueInput("TimeFrame", 'Number')
.appendField(Blockly.Msg.senseBox_display_plotTimeFrame);
this.appendValueInput('plotDisplay')
.appendField(Blockly.Msg.senseBox_display_printDisplay_value)
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ['sensebox_display_show'],
};
Blockly.Blocks['sensebox_display_show'] = {
init: function () {
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_display_show);
this.appendStatementInput('SHOW');
this.setTooltip(Blockly.Msg.sensebox_display_show_tip);
this.setHelpUrl('');
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ["sensebox_display_show"],
};
Blockly.Blocks['sensebox_display_fillCircle'] = {
init: function () {
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_display_fillCircle);
this.appendValueInput('X')
.appendField(Blockly.Msg.senseBox_display_printDisplay_x)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput('Y')
.appendField(Blockly.Msg.senseBox_display_printDisplay_y)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput('Radius')
.appendField(Blockly.Msg.sensebox_display_fillCircle_radius)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendDummyInput('fill')
.appendField(Blockly.Msg.senseBox_display_filled)
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
this.setInputsInline(false);
this.setTooltip(Blockly.Msg.senseBox_display_fillCircle_tooltip)
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl)
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
/**
Blockly.Blocks["sensebox_display_fastPrint"] = {
init: function (block) {
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(
Blockly.Msg.senseBox_display_fastPrint_show
);
this.appendValueInput("Title1", "Title1").appendField(
Blockly.Msg.senseBox_display_fastPrint_title
);
this.appendValueInput("Value1", "Value1").appendField(
Blockly.Msg.senseBox_display_fastPrint_value
);
this.appendValueInput("Dimension1", "Dimension1").appendField(
Blockly.Msg.senseBox_display_fastPrint_dimension
);
this.appendValueInput("Title2", "Title2").appendField(
Blockly.Msg.senseBox_display_fastPrint_title
);
this.appendValueInput("Value2", "Value2").appendField(
Blockly.Msg.senseBox_display_fastPrint_value
);
this.appendValueInput("Dimension2", "Dimension2").appendField(
Blockly.Msg.senseBox_display_fastPrint_dimension
);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.sensebox_display_fastPrint_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ['sensebox_display_show'],
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ["sensebox_display_show"],
};
Blockly.Blocks['sensebox_display_drawRectangle'] = {
init: function () {
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_display_drawRectangle);
this.appendValueInput('X')
.appendField(Blockly.Msg.senseBox_display_printDisplay_x)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput('Y')
.appendField(Blockly.Msg.senseBox_display_printDisplay_y)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput('width')
.appendField(Blockly.Msg.sensebox_display_drawRectangle_width)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput('height')
.appendField(Blockly.Msg.sensebox_display_drawRectangle_height)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendDummyInput('fill')
.appendField(Blockly.Msg.senseBox_display_filled)
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
this.setInputsInline(false);
this.setTooltip(Blockly.Msg.senseBox_display_drawRectangle_tooltip)
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl)
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
/**
Blockly.Blocks["sensebox_display_plotDisplay"] = {
init: function () {
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(
Blockly.Msg.senseBox_display_plotDisplay
);
this.appendValueInput("Title", "Text").appendField(
Blockly.Msg.senseBox_display_plotTitle
);
this.appendValueInput("YLabel", "Text").appendField(
Blockly.Msg.senseBox_display_plotYLabel
);
this.appendValueInput("XLabel", "Text").appendField(
Blockly.Msg.senseBox_display_plotXLabel
);
this.appendValueInput("XRange1", "Number").appendField(
Blockly.Msg.senseBox_display_plotXRange1
);
this.appendValueInput("XRange2", "Number").appendField(
Blockly.Msg.senseBox_display_plotXRange2
);
this.appendValueInput("YRange1", "Number").appendField(
Blockly.Msg.senseBox_display_plotYRange1
);
this.appendValueInput("YRange2", "Number").appendField(
Blockly.Msg.senseBox_display_plotYRange2
);
this.setInputsInline(false);
this.appendValueInput("XTick", "Number").appendField(
Blockly.Msg.senseBox_display_plotXTick
);
this.appendValueInput("YTick", "Number").appendField(
Blockly.Msg.senseBox_display_plotYTick
);
this.appendValueInput("TimeFrame", "Number").appendField(
Blockly.Msg.senseBox_display_plotTimeFrame
);
this.appendValueInput("plotDisplay")
.appendField(Blockly.Msg.senseBox_display_printDisplay_value)
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ['sensebox_display_show'],
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ["sensebox_display_show"],
};
Blockly.Blocks["sensebox_display_show"] = {
init: function () {
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.sensebox_display_show);
this.appendStatementInput("SHOW");
this.setTooltip(Blockly.Msg.sensebox_display_show_tip);
this.setHelpUrl("");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
};
Blockly.Blocks["sensebox_display_fillCircle"] = {
init: function () {
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(
Blockly.Msg.sensebox_display_fillCircle
);
this.appendValueInput("X")
.appendField(Blockly.Msg.senseBox_display_printDisplay_x)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput("Y")
.appendField(Blockly.Msg.senseBox_display_printDisplay_y)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput("Radius")
.appendField(Blockly.Msg.sensebox_display_fillCircle_radius)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendDummyInput("fill")
.appendField(Blockly.Msg.senseBox_display_filled)
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
this.setInputsInline(false);
this.setTooltip(Blockly.Msg.senseBox_display_fillCircle_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ["sensebox_display_show"],
};
Blockly.Blocks["sensebox_display_drawRectangle"] = {
init: function () {
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(
Blockly.Msg.sensebox_display_drawRectangle
);
this.appendValueInput("X")
.appendField(Blockly.Msg.senseBox_display_printDisplay_x)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput("Y")
.appendField(Blockly.Msg.senseBox_display_printDisplay_y)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput("width")
.appendField(Blockly.Msg.sensebox_display_drawRectangle_width)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendValueInput("height")
.appendField(Blockly.Msg.sensebox_display_drawRectangle_height)
.setCheck(Types.NUMBER.compatibleTypes);
this.appendDummyInput("fill")
.appendField(Blockly.Msg.senseBox_display_filled)
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
this.setInputsInline(false);
this.setTooltip(Blockly.Msg.senseBox_display_drawRectangle_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ["sensebox_display_show"],
};
+20 -1
View File
@@ -158,7 +158,8 @@ Blockly.Blocks["sensebox_lora_ttn_mapper"] = {
this.appendValueInput("Fix Type").appendField("Fix Type").setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tip);
this.setTooltip(Blockly.Msg.sensebox_lora_ttn_mapper_tip);
this.setHelpUrl(Blockly.Msg.sensebox_lora_ttn_mapper_helpurl);
},
};
@@ -299,3 +300,21 @@ Blockly.Blocks["sensebox_lora_cayenne_gps"] = {
},
LOOP_TYPES: ["sensebox_lora_cayenne_send"],
};
Blockly.Blocks["sensebox_lora_cayenne_concentration"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_concentration_tip);
this.setHelpUrl("");
this.setColour(getColour().sensebox);
this.appendValueInput("Value").appendField(
Blockly.Msg.senseBox_LoRa_cayenne_concentration
);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
.appendField(new Blockly.FieldTextInput("1"), "CHANNEL");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
LOOP_TYPES: ["sensebox_lora_cayenne_send"],
};
+188 -191
View File
@@ -1,202 +1,199 @@
import * as Blockly from 'blockly/core';
import { getColour } from '../helpers/colour';
import * as Blockly from "blockly/core";
import { getColour } from "../helpers/colour";
import store from '../../../store';
import store from "../../../store";
var boxes = store.getState().auth.user ? store.getState().auth.user.boxes : null;
var boxes = store.getState().auth.user
? store.getState().auth.user.boxes
: null;
store.subscribe(() => {
boxes = store.getState().auth.user ? store.getState().auth.user.boxes : null;
boxes = store.getState().auth.user ? store.getState().auth.user.boxes : null;
});
var selectedBox = '';
var selectedBox = "";
Blockly.Blocks["sensebox_osem_connection"] = {
init: function () {
var ssl = "TRUE";
this.setTooltip(Blockly.Msg.senseBox_osem_connection_tip);
this.setHelpUrl(Blockly.Msg.senseBox_osem_connection_helpurl);
this.setColour(getColour().sensebox);
this.appendDummyInput()
.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)
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_osem_stationary, "Stationary"],
[Blockly.Msg.senseBox_osem_mobile, "Mobile"],
]),
"type"
);
if (!boxes) {
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField("senseBox ID")
.appendField(new Blockly.FieldTextInput("senseBox ID"), "BoxID");
} else {
var dropdown = [];
for (var i = 0; i < boxes.length; i++) {
dropdown.push([boxes[i].name, boxes[i]._id]);
}
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField("senseBox ID")
.appendField(new Blockly.FieldDropdown(dropdown), "BoxID");
}
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_osem_access_token)
.appendField(new Blockly.FieldTextInput("access_token"), "access_token");
this.appendStatementInput("DO")
.appendField(Blockly.Msg.senseBox_sensor)
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.getField("type").setValidator(
function (val) {
this.updateShape_(val === "Mobile");
}.bind(this)
);
},
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
Blockly.Blocks['sensebox_osem_connection'] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_osem_connection_tip);
this.setHelpUrl('');
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_osem_connection)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_osem_host, '"ingress.opensensemap.org"'], [Blockly.Msg.senseBox_osem_host_workshop, '"ingress.workshop.opensensemap.org"']]), "host")
.appendField('SSL')
.appendField(new Blockly.FieldCheckbox("TRUE"), "SSL");
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_osem_exposure)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_osem_stationary, 'Stationary'], [Blockly.Msg.senseBox_osem_mobile, 'Mobile']]), "type");
if (!boxes) {
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField("senseBox ID")
.appendField(new Blockly.FieldTextInput("senseBox ID"), "BoxID");
} else {
var dropdown = []
for (var i = 0; i < boxes.length; i++) {
dropdown.push([boxes[i].name, boxes[i]._id])
}
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField("senseBox ID")
.appendField(new Blockly.FieldDropdown(dropdown), 'BoxID');
}
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_osem_access_token)
.appendField(new Blockly.FieldTextInput("access_token"), "access_token");
this.appendStatementInput('DO')
.appendField(Blockly.Msg.senseBox_sensor)
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
/**
* List of block types that are loops and thus do not need warnings.
* To add a new loop type add this to your code:
* Blockly.Blocks['controls_flow_statements'].LOOP_TYPES.push('custom_loop');
*/
selectedBox = this.getFieldValue('BoxID');
if (selectedBox !== '' && boxes) {
var accessToken = boxes.find(element => element._id === selectedBox).access_token
if (accessToken !== undefined) {
this.getField('access_token').setValue(accessToken)
} else {
this.getField('access_token').setValue('access_token')
}
}
},
mutationToDom: function () {
var container = document.createElement('mutation');
var input = this.getFieldValue('type');
this.updateShape_(input);
container.setAttribute('type', input);
return container;
},
domToMutation: function (xmlElement) {
var connections = xmlElement.getAttribute('connections');
this.updateShape_(connections);
},
/**
* Modify this block to have the correct number of pins available.
* @param {boolean}
* @private
* @this Blockly.Block
* List of block types that are loops and thus do not need warnings.
* To add a new loop type add this to your code:
* Blockly.Blocks['controls_flow_statements'].LOOP_TYPES.push('custom_loop');
*/
updateShape_: function () {
var extraFieldExist = this.getFieldValue('gps');
var input = this.getFieldValue('type');
if ((input === 'Mobile') && extraFieldExist === null) {
this.appendValueInput('lat', 'Number')
.appendField(Blockly.Msg.senseBox_gps_lat, 'gps');
this.appendValueInput('lng', 'Number')
.appendField(Blockly.Msg.senseBox_gps_lng);
this.appendValueInput('altitude', 'Number')
.appendField(Blockly.Msg.senseBox_gps_alt);
this.appendValueInput('timeStamp', 'Number')
.appendField(Blockly.Msg.senseBox_gps_timeStamp);
}
if (input === 'Stationary' && extraFieldExist !== null) {
this.removeInput('lat');
this.removeInput('lng');
this.removeInput('altitude');
this.removeInput('timeStamp');
}
},
LOOP_TYPES: ['sensebox_interval_timer']
selectedBox = this.getFieldValue("BoxID");
if (selectedBox !== "" && boxes) {
var accessToken = boxes.find(
(element) => element._id === selectedBox
).access_token;
if (accessToken !== undefined) {
this.getField("access_token").setValue(accessToken);
} else {
this.getField("access_token").setValue("access_token");
}
}
},
updateShape_(isMobile) {
if (isMobile) {
if (this.getInput("lat") == null) {
this.appendValueInput("lat", "Number").appendField(
Blockly.Msg.senseBox_gps_lat,
"gps"
);
this.appendValueInput("lng", "Number").appendField(
Blockly.Msg.senseBox_gps_lng
);
this.appendValueInput("altitude", "Number").appendField(
Blockly.Msg.senseBox_gps_alt
);
this.appendValueInput("timeStamp", "Number").appendField(
Blockly.Msg.senseBox_gps_timeStamp
);
}
} else {
this.removeInput("lat", true);
this.removeInput("lng", true);
this.removeInput("altitude", true);
this.removeInput("timeStamp", true);
}
},
LOOP_TYPES: ["sensebox_interval_timer"],
};
Blockly.Blocks['sensebox_send_to_osem'] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_send_to_osem_tip);
this.setHelpUrl('');
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_send_to_osem);
if (boxes) {
this.appendValueInput('Value')
.appendField('Phänomen')
.appendField(new Blockly.FieldDropdown(
this.generateOptions), 'SensorID');
} else {
this.appendValueInput('Value')
.setAlign(Blockly.ALIGN_LEFT)
.appendField('Phänomen')
.appendField(new Blockly.FieldTextInput(
'sensorID'), 'SensorID')
Blockly.Blocks["sensebox_send_to_osem"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_send_to_osem_tip);
this.setHelpUrl("");
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_send_to_osem);
if (boxes) {
this.appendValueInput("Value")
.appendField("Phänomen")
.appendField(
new Blockly.FieldDropdown(this.generateOptions),
"SensorID"
);
} else {
this.appendValueInput("Value")
.setAlign(Blockly.ALIGN_LEFT)
.appendField("Phänomen")
.appendField(new Blockly.FieldTextInput("sensorID"), "SensorID");
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
generateOptions: function () {
var dropdown = [["", ""]];
var boxID = selectedBox;
if (boxID !== "" && boxes) {
let box = boxes.find((el) => el._id === boxID);
if (box !== undefined) {
for (var i = 0; i < box.sensors.length; i++) {
dropdown.push([box.sensors[i].title, box.sensors[i]._id]);
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
generateOptions: function () {
var dropdown = [['', '']];
var boxID = selectedBox;
if (boxID !== '' && boxes) {
let box = boxes.find(el => el._id === boxID);
if (box !== undefined) {
for (var i = 0; i < box.sensors.length; i++) {
dropdown.push([box.sensors[i].title, box.sensors[i]._id])
}
}
if (dropdown.length > 1) {
var options = dropdown.slice(1)
return options
} else {
return dropdown
}
}
return dropdown
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function () {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
/**
* List of block types that are loops and thus do not need warnings.
* To add a new loop type add this to your code:
* Blockly.Blocks['controls_flow_statements'].LOOP_TYPES.push('custom_loop');
*/
LOOP_TYPES: ['sensebox_osem_connection']
}
if (dropdown.length > 1) {
var options = dropdown.slice(1);
return options;
} else {
return dropdown;
}
}
return dropdown;
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function () {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
/**
* List of block types that are loops and thus do not need warnings.
* To add a new loop type add this to your code:
* Blockly.Blocks['controls_flow_statements'].LOOP_TYPES.push('custom_loop');
*/
LOOP_TYPES: ["sensebox_osem_connection"],
};
@@ -62,7 +62,7 @@ Blockly.Blocks["sensebox_rtc_get"] = {
]),
"dropdown"
);
this.setOutput(true, Types.LARGE_NUMBER.typeId);
this.setOutput(true, Types.LARGE_NUMBER.typeName);
this.setTooltip(Blockly.Msg.sensebox_rtc_get_tooltip);
},
};
+165 -71
View File
@@ -1,80 +1,174 @@
import * as Blockly from 'blockly/core';
import { getColour } from '../helpers/colour';
import * as Blockly from "blockly/core";
import { getColour } from "../helpers/colour";
var checkFileName = function (filename) {
var length = filename.length;
if (length > 8) {
alert("dateiname sollte kleiner als 8 Zeichen sein");
return filename.slice(0, 8);
}
return filename;
};
Blockly.Blocks['sensebox_sd_open_file'] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_sd_open_file)
.setAlign(Blockly.ALIGN_LEFT)
.appendField(
new Blockly.FieldTextInput('Data.txt'),
'Filename');
this.appendStatementInput('SD')
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_sd_open_file_tooltip);
this.setHelpUrl('https://docs.sensebox.de/hardware/bee-sd/');
Blockly.Blocks["sensebox_sd_open_file"] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_sd_open_file)
.setAlign(Blockly.ALIGN_LEFT)
.appendField(
new Blockly.FieldTextInput("Data", checkFileName),
"Filename"
)
.appendField(".")
.appendField(
new Blockly.FieldDropdown([
["txt", "txt"],
["csv", "csv"],
]),
"extension"
);
this.appendStatementInput("SD").setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_sd_open_file_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_sd_helpurl);
},
};
Blockly.Blocks["sensebox_sd_create_file"] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_sd_create_file)
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_output_filename)
.appendField(
new Blockly.FieldTextInput("Data", checkFileName),
"Filename"
)
.appendField(".")
.appendField(
new Blockly.FieldDropdown([
["txt", "txt"],
["csv", "csv"],
]),
"extension"
);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_sd_create_file_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_sd_helpurl);
},
};
Blockly.Blocks["sensebox_sd_write_file"] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_sd_write_file)
.setAlign(Blockly.ALIGN_LEFT);
this.appendValueInput("DATA").setCheck(null);
this.appendDummyInput("CheckboxText")
.appendField(Blockly.Msg.senseBox_output_linebreak)
.appendField(new Blockly.FieldCheckbox("TRUE"), "linebreak");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_sd_write_file_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_sd_helpurl);
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ["sensebox_sd_open_file"],
};
Blockly.Blocks['sensebox_sd_create_file'] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_sd_create_file)
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_output_filename)
.appendField(
new Blockly.FieldTextInput('Data.txt'),
'Filename');
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_sd_create_file_tooltip);
this.setHelpUrl('https://docs.sensebox.de/hardware/bee-sd/');
Blockly.Blocks["sensebox_sd_osem"] = {
init: function () {
this.setTooltip(Blockly.Msg.sensebox_sd_osem_tip);
this.setHelpUrl(Blockly.Msg.sensebox_sd_helpurl);
this.setColour(getColour().sensebox);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.sensebox_sd_osem);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_osem_exposure)
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_osem_stationary, "Stationary"],
[Blockly.Msg.senseBox_osem_mobile, "Mobile"],
]),
"type"
);
this.appendValueInput("timeStamp", "Number").appendField(
Blockly.Msg.senseBox_gps_timeStamp
);
this.appendStatementInput("DO")
.appendField(Blockly.Msg.sensebox_sd_measurement)
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.getField("type").setValidator(
function (val) {
this.updateShape_(val === "Mobile");
}.bind(this)
);
},
updateShape_(isMobile) {
if (isMobile) {
if (this.getInput("lat") == null) {
this.appendValueInput("lat", "Number").appendField(
Blockly.Msg.senseBox_gps_lat,
"gps"
);
this.appendValueInput("lng", "Number").appendField(
Blockly.Msg.senseBox_gps_lng
);
this.appendValueInput("altitude", "Number").appendField(
Blockly.Msg.senseBox_gps_alt
);
}
} else {
this.removeInput("lat", true);
this.removeInput("lng", true);
this.removeInput("altitude", true);
}
},
};
Blockly.Blocks['sensebox_sd_write_file'] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_sd_write_file)
.setAlign(Blockly.ALIGN_LEFT);
this.appendValueInput('DATA')
.setCheck(null);
this.appendDummyInput('CheckboxText')
.appendField(Blockly.Msg.senseBox_output_linebreak)
.appendField(new Blockly.FieldCheckbox('TRUE'), 'linebreak');
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_sd_write_file_tooltip);
this.setHelpUrl('https://docs.sensebox.de/hardware/bee-sd/');
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ['sensebox_sd_open_file'],
Blockly.Blocks["sensebox_sd_save_for_osem"] = {
init: function () {
this.setTooltip(Blockly.Msg.sensebox_sd_save_for_osem_tip);
this.setHelpUrl(Blockly.Msg.sensebox_sd_helpurl);
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.sensebox_sd_save_for_osem);
this.appendValueInput("Value")
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.sensebox_sd_save_for_osem_id)
.appendField(new Blockly.FieldTextInput("sensorID"), "SensorID");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
};
+340 -175
View File
@@ -1,110 +1,154 @@
import Blockly from 'blockly';
import { getColour } from '../helpers/colour'
import * as Types from '../helpers/types'
import { selectedBoard } from '../helpers/board'
import Blockly from "blockly";
import { getColour } from "../helpers/colour";
import * as Types from "../helpers/types";
import { selectedBoard } from "../helpers/board";
import { FieldGridDropdown } from "@blockly/field-grid-dropdown";
/**
* HDC1080 Temperature and Humidity Sensor
*
*
*/
Blockly.Blocks['sensebox_sensor_temp_hum'] = {
Blockly.Blocks["sensebox_sensor_temp_hum"] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_temp_hum);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_temp_hum);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_value)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_temp, "Temperature"], [Blockly.Msg.senseBox_hum, "Humidity"]]), "NAME");
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_temp, "Temperature"],
[Blockly.Msg.senseBox_hum, "Humidity"],
]),
"NAME"
);
this.setOutput(true, Types.DECIMAL.typeName);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_temp_hum_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_temp_hum_helpurl);
}
},
};
/**
* VEML6070 and TSL4513
*
* VEML6070 and TSL4513
*
*/
Blockly.Blocks['sensebox_sensor_uv_light'] = {
Blockly.Blocks["sensebox_sensor_uv_light"] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_uv_light);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_uv_light);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_value)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_light, "Illuminance"], [Blockly.Msg.senseBox_uv, "UvIntensity"]]), "NAME");
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_light, "Illuminance"],
[Blockly.Msg.senseBox_uv, "UvIntensity"],
]),
"NAME"
);
this.setOutput(true, Types.DECIMAL.typeName);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_uv_light_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_uv_light_helpurl);
}
},
};
/*
BMX055 Three differen Blocks for Accelerometer, Gyroscope, Compass
*/
Blockly.Blocks['sensebox_sensor_bmx055_accelerometer'] = {
Blockly.Blocks["sensebox_sensor_bmx055_accelerometer"] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_bmx055_accelerometer);
this.appendDummyInput().appendField(
Blockly.Msg.senseBox_bmx055_accelerometer
);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_bmx055_accelerometer_direction)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_bmx055_accelerometer_direction_x, "X"], [Blockly.Msg.senseBox_bmx055_accelerometer_direction_y, "Y"], [Blockly.Msg.senseBox_bmx055_accelerometer_direction_z, "Z"], [Blockly.Msg.senseBox_bmx055_accelerometer_direction_total, "Total"]]), "VALUE");
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_bmx055_accelerometer_direction_x, "X"],
[Blockly.Msg.senseBox_bmx055_accelerometer_direction_y, "Y"],
[Blockly.Msg.senseBox_bmx055_accelerometer_direction_z, "Z"],
[Blockly.Msg.senseBox_bmx055_accelerometer_direction_total, "Total"],
]),
"VALUE"
);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_bmx055_accelerometer_range)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_bmx055_accelerometer_range_2g, "0x3"], [Blockly.Msg.senseBox_bmx055_accelerometer_range_4g, "0x5"], [Blockly.Msg.senseBox_bmx055_accelerometer_range_8g, "0x8"], [Blockly.Msg.senseBox_bmx055_accelerometer_range_16g, "0x0C"]]), "RANGE");
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_bmx055_accelerometer_range_2g, "0x3"],
[Blockly.Msg.senseBox_bmx055_accelerometer_range_4g, "0x5"],
[Blockly.Msg.senseBox_bmx055_accelerometer_range_8g, "0x8"],
[Blockly.Msg.senseBox_bmx055_accelerometer_range_16g, "0x0C"],
]),
"RANGE"
);
this.setOutput(true, Types.DECIMAL.typeName);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_bmx055_accelerometer_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_bmx055_helpurl);
}
},
};
/**
* SDS011 Fine Particular Matter Sensor
*
*
*/
Blockly.Blocks['sensebox_sensor_sds011'] = {
Blockly.Blocks["sensebox_sensor_sds011"] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_sds011);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_sds011);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_value)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_sds011_pm25, "Pm25"], [Blockly.Msg.senseBox_sds011_pm10, "Pm10"]]), "NAME")
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_sds011_pm25, "pm25"],
[Blockly.Msg.senseBox_sds011_pm10, "pm10"],
]),
"NAME"
)
.appendField(Blockly.Msg.senseBox_sds011_dimension)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_sds011_serial1, "Serial1"], [Blockly.Msg.senseBox_sds011_serial2, "Serial2"]]), "SERIAL");
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_sds011_serial1, "Serial1"],
[Blockly.Msg.senseBox_sds011_serial2, "Serial2"],
]),
"SERIAL"
);
this.setOutput(true, Types.DECIMAL.typeName);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_sds011_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_sds011_helpurl);
}
},
};
/**
* BMP280 Pressure Sensor
*
*
*/
Blockly.Blocks['sensebox_sensor_pressure'] = {
Blockly.Blocks["sensebox_sensor_pressure"] = {
init: function () {
var dropdownOptions = [[Blockly.Msg.senseBox_pressure, "Pressure"], [Blockly.Msg.senseBox_temp, "Temperature"], [Blockly.Msg.senseBox_gps_alt, "Altitude"]];
var dropdown = new Blockly.FieldDropdown(dropdownOptions, function (option) {
var input = (option === 'Pressure') || (option === 'Temperature') || (option === 'Altitude');
var dropdownOptions = [
[Blockly.Msg.senseBox_pressure, "Pressure"],
[Blockly.Msg.senseBox_temp, "Temperature"],
[Blockly.Msg.senseBox_gps_alt, "Altitude"],
];
var dropdown = new Blockly.FieldDropdown(dropdownOptions, function (
option
) {
var input =
option === "Pressure" ||
option === "Temperature" ||
option === "Altitude";
this.sourceBlock_.updateShape_(input);
});
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_pressure_sensor);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_pressure_sensor);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_value)
@@ -113,88 +157,70 @@ Blockly.Blocks['sensebox_sensor_pressure'] = {
this.setOutput(true, Types.DECIMAL.typeName);
this.setTooltip(Blockly.Msg.senseBox_pressure_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_pressure_helpurl);
this.getField("NAME").setValidator(
function (val) {
this.updateShape_(val === "Altitude");
}.bind(this)
);
},
/**
* Parse XML to restore the number of pins available.
* @param {!Element} xmlElement XML storage element.
* @this Blockly.Block
*/
domToMutation: function (xmlElement) {
(xmlElement.getAttribute('port'));
},
/**
* Create XML to represent number of pins selection.
* @return {!Element} XML storage element.
* @this Blockly.Block
*/
mutationToDom: function () {
var container = document.createElement('mutation');
var input = this.getFieldValue('NAME');
this.updateShape_(input);
container.setAttribute('NAME', input);
return container;
},
/**
* Modify this block to have the correct number of pins available.
* @param {boolean}
* @private
* @this Blockly.Block
*/
updateShape_: function () {
var extraFieldExist = this.getFieldValue('referencePressure');
var input = this.getFieldValue('NAME');
if (input === 'Altitude' && extraFieldExist === null) {
this.appendDummyInput('extraField')
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_pressure_referencePressure)
.appendField(new Blockly.FieldTextInput("1013"), "referencePressure")
.appendField(Blockly.Msg.senseBox_pressure_referencePressure_dim);
updateShape_(isAltitude) {
if (isAltitude) {
if (this.getInput("extraField") == null) {
this.appendDummyInput("extraField")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_pressure_referencePressure)
.appendField(new Blockly.FieldTextInput("1013"), "referencePressure")
.appendField(Blockly.Msg.senseBox_pressure_referencePressure_dim);
}
} else {
this.removeInput("extraField", true);
}
if ((input === 'Pressure' || input === 'Temperature') && extraFieldExist !== null) {
this.removeInput('extraField');
}
}
},
};
/**
* BME680 Environmental Sensor
*
*
*/
Blockly.Blocks['sensebox_sensor_bme680_bsec'] = {
Blockly.Blocks["sensebox_sensor_bme680_bsec"] = {
init: function () {
var dropdownOptions = [[Blockly.Msg.senseBox_temp, "temperature"], [Blockly.Msg.senseBox_hum, "humidity"], [Blockly.Msg.senseBox_pressure, "pressure"], [Blockly.Msg.senseBox_bme_iaq, "IAQ"], [Blockly.Msg.senseBox_bme_iaq_accuracy, "IAQAccuracy"], [Blockly.Msg.senseBox_bme_co2, "CO2"], [Blockly.Msg.senseBox_bme_breatheVocEquivalent, "breathVocEquivalent"]];
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_bme680);
var dropdownOptions = [
[Blockly.Msg.senseBox_temp, "temperature"],
[Blockly.Msg.senseBox_hum, "humidity"],
[Blockly.Msg.senseBox_pressure, "pressure"],
[Blockly.Msg.senseBox_bme_iaq, "IAQ"],
[Blockly.Msg.senseBox_bme_iaq_accuracy, "IAQAccuracy"],
[Blockly.Msg.senseBox_bme_co2, "CO2"],
[Blockly.Msg.senseBox_bme_breatheVocEquivalent, "breathVocEquivalent"],
];
this.appendDummyInput().appendField(Blockly.Msg.senseBox_bme680);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_value)
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown")
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown");
this.setOutput(true, Types.DECIMAL.typeName);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_bme_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_bme680_helpurl)
}
this.setHelpUrl(Blockly.Msg.senseBox_bme680_helpurl);
},
};
/**
* Ultrasonic Sensor
*
*
*
*
*/
Blockly.Blocks['sensebox_sensor_ultrasonic_ranger'] = {
Blockly.Blocks["sensebox_sensor_ultrasonic_ranger"] = {
init: function () {
var dropdownOptions = [[Blockly.Msg.senseBox_ultrasonic_port_A, 'A'],
[Blockly.Msg.senseBox_ultrasonic_port_B, 'B'], [Blockly.Msg.senseBox_ultrasonic_port_C, 'C']];
var dropdown = new Blockly.FieldDropdown(dropdownOptions, function (option) {
var input = (option === 'A') || (option === 'B') || (option === 'C');
var dropdownOptions = [
[Blockly.Msg.senseBox_ultrasonic_port_A, "A"],
[Blockly.Msg.senseBox_ultrasonic_port_B, "B"],
[Blockly.Msg.senseBox_ultrasonic_port_C, "C"],
];
var dropdown = new FieldGridDropdown(dropdownOptions, function (option) {
var input = option === "A" || option === "B" || option === "C";
this.sourceBlock_.updateShape_(input);
});
@@ -202,14 +228,22 @@ Blockly.Blocks['sensebox_sensor_ultrasonic_ranger'] = {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_ultrasonic)
.appendField(dropdown, "port");
this.appendDummyInput('TrigEcho')
this.appendDummyInput("TrigEcho")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_ultrasonic_trigger)
.appendField(new Blockly.FieldDropdown(
selectedBoard().digitalPins), 'ultrasonic_trigger')
.appendField(
new Blockly.FieldDropdown(selectedBoard().digitalPins),
"ultrasonic_trigger"
)
.appendField(Blockly.Msg.senseBox_ultrasonic_echo)
.appendField(new Blockly.FieldDropdown(
selectedBoard().digitalPins), 'ultrasonic_echo');
.appendField(
new Blockly.FieldDropdown(selectedBoard().digitalPins),
"ultrasonic_echo"
);
this.appendDummyInput("maxDistance")
.appendField(Blockly.Msg.senseBox_ultrasonic_maxDistance)
.appendField(new Blockly.FieldTextInput("250"), "maxDistance")
.appendField("cm");
this.setOutput(true, Types.NUMBER.typeName);
this.setTooltip(Blockly.Msg.senseBox_ultrasonic_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_ultrasonic_helpurl);
@@ -220,8 +254,7 @@ Blockly.Blocks['sensebox_sensor_ultrasonic_ranger'] = {
* @this Blockly.Block
*/
domToMutation: function (xmlElement) {
(xmlElement.getAttribute('port'));
xmlElement.getAttribute("port");
},
/**
* Create XML to represent number of pins selection.
@@ -229,8 +262,8 @@ Blockly.Blocks['sensebox_sensor_ultrasonic_ranger'] = {
* @this Blockly.Block
*/
mutationToDom: function () {
var container = document.createElement('mutation');
var input = this.getFieldValue('port');
var container = document.createElement("mutation");
var input = this.getFieldValue("port");
this.updateShape_(input);
container.setAttribute("port", input);
return container;
@@ -242,159 +275,204 @@ Blockly.Blocks['sensebox_sensor_ultrasonic_ranger'] = {
* @this Blockly.Block
*/
updateShape_: function () {
var input = this.getFieldValue('port');
var input = this.getFieldValue("port");
switch (input) {
case 'A':
this.setFieldValue('1', 'ultrasonic_trigger');
this.setFieldValue('2', 'ultrasonic_echo');
case "A":
this.setFieldValue("1", "ultrasonic_trigger");
this.setFieldValue("2", "ultrasonic_echo");
break;
case 'B':
this.setFieldValue('3', 'ultrasonic_trigger');
this.setFieldValue('4', 'ultrasonic_echo');
case "B":
this.setFieldValue("3", "ultrasonic_trigger");
this.setFieldValue("4", "ultrasonic_echo");
break;
case 'C':
this.setFieldValue('5', 'ultrasonic_trigger');
this.setFieldValue('6', 'ultrasonic_echo');
case "C":
this.setFieldValue("5", "ultrasonic_trigger");
this.setFieldValue("6", "ultrasonic_echo");
break;
default:
break;
}
}
},
};
/**
* Microphone
*
*
*/
Blockly.Blocks['sensebox_sensor_sound'] = {
Blockly.Blocks["sensebox_sensor_sound"] = {
init: function () {
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_sound)
.appendField("Pin:")
.appendField(new Blockly.FieldDropdown(selectedBoard().analogPins), "PIN")
.appendField(
new Blockly.FieldDropdown(selectedBoard().analogPins),
"PIN"
);
this.setOutput(true, Types.NUMBER.typeName);
this.setHelpUrl(Blockly.Msg.senseBox_sound_helpurl);
this.setTooltip(Blockly.Msg.senseBox_sound_tooltip);
}
},
};
/**
* Button
*
*
*
*
*/
Blockly.Blocks['sensebox_button'] = {
Blockly.Blocks["sensebox_button"] = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_button)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_button_isPressed, "isPressed"], [Blockly.Msg.senseBox_button_wasPressed, "wasPressed"], [Blockly.Msg.senseBox_button_switch, "Switch"]]), "FUNCTION")
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_button_isPressed, "isPressed"],
[Blockly.Msg.senseBox_button_wasPressed, "wasPressed"],
[Blockly.Msg.senseBox_button_longPress, "longPress"],
]),
"FUNCTION"
)
.appendField("Pin:")
.appendField(new Blockly.FieldDropdown(selectedBoard().digitalPinsButton), "PIN");
.appendField(
new Blockly.FieldDropdown(selectedBoard().digitalPinsButton),
"PIN"
);
this.setOutput(true, Types.BOOLEAN.typeName);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_button_tooltip);
}
this.getField("FUNCTION").setValidator(
function (val) {
this.updateShape_(val === "longPress");
}.bind(this)
);
},
updateShape_(isLongPress) {
if (isLongPress) {
if (this.getInput("extraField") == null) {
this.appendDummyInput("extraField")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_button_longPress_time)
.appendField(new Blockly.FieldTextInput("1000"), "time")
.appendField("ms");
}
} else {
this.removeInput("extraField", true);
}
},
};
/**
* SCD30 CO2 Sensor
*
*
*/
Blockly.Blocks['sensebox_scd30'] = {
Blockly.Blocks["sensebox_scd30"] = {
init: function () {
var dropdownOptions = [[Blockly.Msg.senseBox_scd_co2, "CO2"], [Blockly.Msg.senseBox_temp, "temperature"], [Blockly.Msg.senseBox_hum, "humidity"]];
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_scd30);
var dropdownOptions = [
[Blockly.Msg.senseBox_scd_co2, "CO2"],
[Blockly.Msg.senseBox_temp, "temperature"],
[Blockly.Msg.senseBox_hum, "humidity"],
];
this.appendDummyInput().appendField(Blockly.Msg.senseBox_scd30);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_value)
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown")
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown");
this.setOutput(true, Types.NUMBER.typeName);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_scd_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_scd_helpurl);
},
onchange: function (e) {
var dropdown = this.getFieldValue('dropdown');
if (dropdown === 'temperature' || dropdown === 'humidity') {
var dropdown = this.getFieldValue("dropdown");
if (dropdown === "temperature" || dropdown === "humidity") {
this.setOutput(true, Types.DECIMAL.typeName);
} else if (dropdown === 'CO2') {
} else if (dropdown === "CO2") {
this.setOutput(true, Types.NUMBER.typeName);
}
}
},
};
/**
* GPS Module
*
*
*/
Blockly.Blocks['sensebox_gps'] = {
Blockly.Blocks["sensebox_gps"] = {
init: function () {
var dropdownOptions = [[Blockly.Msg.senseBox_gps_lat, "latitude"], [Blockly.Msg.senseBox_gps_lng, "longitude"], [Blockly.Msg.senseBox_gps_alt, "altitude"], ["pDOP", "pDOP"], ["Fix Type", "fixType"]];
this.appendDummyInput()
.appendField("GPS Modul");
var dropdownOptions = [
[Blockly.Msg.senseBox_gps_lat, "latitude"],
[Blockly.Msg.senseBox_gps_lng, "longitude"],
[Blockly.Msg.senseBox_gps_alt, "altitude"],
[Blockly.Msg.senseBox_gps_timeStamp, "timestamp"],
[Blockly.Msg.senseBox_gps_speed, "speed"],
["pDOP", "pDOP"],
["Fix Type", "fixType"],
];
this.appendDummyInput().appendField("GPS Modul");
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_value)
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown")
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown");
this.setOutput(true, Types.NUMBER.typeName);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_gps_tooltip);
}
},
};
/**
* Block for Truebner STM50
*/
Blockly.Blocks['sensebox_sensor_truebner_smt50'] = {
Blockly.Blocks["sensebox_sensor_truebner_smt50"] = {
init: function () {
var dropdownOptions = [[Blockly.Msg.senseBox_ultrasonic_port_A, 'A'],
[Blockly.Msg.senseBox_ultrasonic_port_B, 'B'], [Blockly.Msg.senseBox_ultrasonic_port_C, 'C']];
var dropdownOptions = [
[Blockly.Msg.senseBox_ultrasonic_port_A, "A"],
[Blockly.Msg.senseBox_ultrasonic_port_B, "B"],
[Blockly.Msg.senseBox_ultrasonic_port_C, "C"],
];
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_smt50);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_smt50);
this.appendDummyInput()
.appendField("Port:")
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port")
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port");
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_value)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_temp, "temp"], [Blockly.Msg.senseBox_soil, "soil"]]), 'value')
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_temp, "temp"],
[Blockly.Msg.senseBox_soil, "soil"],
]),
"value"
);
this.setOutput(true, Types.NUMBER.typeName);
this.setTooltip(Blockly.Msg.senseBox_smt50_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_smt50_helpurl);
}
},
};
/**
* DS18B20 Watertemperature
*
*/
Blockly.Blocks['sensebox_sensor_watertemperature'] = {
Blockly.Blocks["sensebox_sensor_watertemperature"] = {
init: function () {
var dropdownOptions = [[Blockly.Msg.senseBox_ultrasonic_port_A, 'A'],
[Blockly.Msg.senseBox_ultrasonic_port_B, 'B'], [Blockly.Msg.senseBox_ultrasonic_port_C, 'C']];
var dropdownOptions = [
[Blockly.Msg.senseBox_ultrasonic_port_A, "A"],
[Blockly.Msg.senseBox_ultrasonic_port_B, "B"],
[Blockly.Msg.senseBox_ultrasonic_port_C, "C"],
];
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_watertemperature)
.appendField("Port:")
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port")
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port");
this.setOutput(true, Types.NUMBER.typeName);
this.setTooltip(Blockly.Msg.senseBox_watertemperature_tip);
}
},
};
/**
@@ -418,18 +496,105 @@ Blockly.Blocks['sensebox_windspeed'] = {
* DF Robot Soundsensor
*/
Blockly.Blocks['sensebox_soundsensor_dfrobot'] = {
Blockly.Blocks["sensebox_soundsensor_dfrobot"] = {
init: function () {
var dropdownOptions = [[Blockly.Msg.senseBox_ultrasonic_port_A, 'A'],
[Blockly.Msg.senseBox_ultrasonic_port_B, 'B'], [Blockly.Msg.senseBox_ultrasonic_port_C, 'C']];
var dropdownOptions = [
[Blockly.Msg.senseBox_ultrasonic_port_A, "A"],
[Blockly.Msg.senseBox_ultrasonic_port_B, "B"],
[Blockly.Msg.senseBox_ultrasonic_port_C, "C"],
];
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_soundsensor_dfrobot)
.appendField("Port:")
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port")
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port");
this.setOutput(true, Types.DECIMAL.typeName);
this.setTooltip(Blockly.Msg.senseBox_soundsensor_dfrobot_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_soundsensor_dfrobot_helpurl)
}
};
this.setHelpUrl(Blockly.Msg.senseBox_soundsensor_dfrobot_helpurl);
},
};
/**
* rainsensor hydreon rg-15
*/
Blockly.Blocks["sensebox_rainsensor_hydreon_rg15"] = {
init: function () {
var dropdownOptionsPorts = [
[Blockly.Msg.sensebox_rainsensor_hydreon_rg15_serial1, "Serial1"],
[Blockly.Msg.sensebox_rainsensor_hydreon_rg15_serial2, "Serial2"],
];
var dropdownOptionsValues = [
[Blockly.Msg.sensebox_rainsensor_hydreon_rg15_acc, "getAccumulation"],
[Blockly.Msg.sensebox_rainsensor_hydreon_rg15_totalAcc, "getTotalAccumulation"],
[Blockly.Msg.sensebox_rainsensor_hydreon_rg15_eventAcc, "getEventAccumulation"],
[Blockly.Msg.sensebox_rainsensor_hydreon_rg15_rainInt, "getRainfallIntensity"],
];
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_rainsensor_hydreon_rg15);
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_rainsensor_hydreon_rg15_port)
.appendField(new Blockly.FieldDropdown(dropdownOptionsPorts), "SERIAL");
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_rainsensor_hydreon_rg15_value)
.appendField(new Blockly.FieldDropdown(dropdownOptionsValues), "VALUE");
this.setOutput(true, Types.DECIMAL.typeName);
this.setTooltip(Blockly.Msg.sensebox_rainsensor_hydreon_rg15_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_rainsensor_hydreon_rg15_helpurl);
},
};
/**
* Infineon DPS310 Pressure Sensor
*
*/
Blockly.Blocks["sensebox_sensor_dps310"] = {
init: function () {
var dropdownOptions = [
[Blockly.Msg.senseBox_pressure, "Pressure"],
[Blockly.Msg.senseBox_temp, "Temperature"],
[Blockly.Msg.senseBox_gps_alt, "Altitude"],
];
var dropdown = new Blockly.FieldDropdown(dropdownOptions, function (
option
) {
var input =
option === "Pressure" ||
option === "Temperature" ||
option === "Altitude";
this.sourceBlock_.updateShape_(input);
});
this.appendDummyInput().appendField(Blockly.Msg.senseBox_sensor_dps310);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_value)
.appendField(dropdown, "NAME");
this.setColour(getColour().sensebox);
this.setOutput(true, Types.DECIMAL.typeName);
this.setTooltip(Blockly.Msg.senseBox_sensor_dps310_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_sensor_dps310_helpurl);
this.getField("NAME").setValidator(
function (val) {
this.updateShape_(val === "Altitude");
}.bind(this)
);
},
updateShape_(isAltitude) {
if (isAltitude) {
if (this.getInput("extraField") == null) {
this.appendDummyInput("extraField")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_pressure_referencePressure)
.appendField(new Blockly.FieldTextInput("1013"), "referencePressure")
.appendField(Blockly.Msg.senseBox_pressure_referencePressure_dim);
}
} else {
this.removeInput("extraField", true);
}
},
};
+149 -56
View File
@@ -1,60 +1,153 @@
import Blockly from 'blockly';
import { getColour } from '../helpers/colour'
import Blockly from "blockly";
import { getColour } from "../helpers/colour";
import * as Types from "../helpers/types";
Blockly.Blocks['sensebox_wifi'] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_tooltip);
this.setHelpUrl('');
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_wifi_connect);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_wifi_ssid)
.appendField(new Blockly.FieldTextInput("SSID"), "SSID");
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_output_password)
.appendField(new Blockly.FieldTextInput("Password"), "Password");
this.setHelpUrl(Blockly.Msg.senseBox_wifi_helpurl)
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ['arduino_functions'],
Blockly.Blocks["sensebox_wifi"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_tooltip);
this.setHelpUrl("");
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_wifi_connect);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_wifi_ssid)
.appendField(new Blockly.FieldTextInput("SSID"), "SSID");
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_output_password)
.appendField(new Blockly.FieldTextInput("Password"), "Password");
this.setHelpUrl(Blockly.Msg.senseBox_wifi_helpurl);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ["arduino_functions"],
};
Blockly.Blocks['sensebox_startap'] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_startap_tooltip);
this.setHelpUrl('');
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_wifi_startap);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_wifi_ssid)
.appendField(new Blockly.FieldTextInput("SSID"), "SSID");
this.setHelpUrl(Blockly.Msg.senseBox_wifi_helpurl)
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
Blockly.Blocks["sensebox_startap"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_startap_tooltip);
this.setHelpUrl("");
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_wifi_startap);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_wifi_ssid)
.appendField(new Blockly.FieldTextInput("SSID"), "SSID");
this.setHelpUrl(Blockly.Msg.senseBox_wifi_helpurl);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
};
Blockly.Blocks["sensebox_ethernet"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_ethernet_tooltip);
this.setHelpUrl("");
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_ethernet)
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_ethernet_dhcp, "Dhcp"],
[Blockly.Msg.senseBox_ethernet_manuel_config, "Manual"],
]),
"dhcp"
);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_ethernet_mac)
.appendField(
new Blockly.FieldTextInput("0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED"),
"mac"
);
this.setHelpUrl(Blockly.Msg.senseBox_ethernet_helpurl);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.getField("dhcp").setValidator(
function (val) {
this.updateShape_(val === "Manual");
}.bind(this)
);
},
updateShape_(isManual) {
if (isManual) {
this.appendDummyInput("ip-field")
.appendField(Blockly.Msg.senseBox_ethernet_ip)
.appendField(new Blockly.FieldTextInput("192.168.1.100"), "ip");
this.appendDummyInput("subnetmask-field")
.appendField(Blockly.Msg.senseBox_ethernet_subnetmask)
.appendField(new Blockly.FieldTextInput("255.255.255.0"), "subnetmask");
this.appendDummyInput("gateway-field")
.appendField(Blockly.Msg.senseBox_ethernet_gateway)
.appendField(new Blockly.FieldTextInput("192.168.1.1"), "gateway");
this.appendDummyInput("dns-field")
.appendField(Blockly.Msg.senseBox_ethernet_dns)
.appendField(new Blockly.FieldTextInput("8.8.8.8"), "dns");
} else {
this.removeInput("ip-field", true);
this.removeInput("subnetmask-field", true);
this.removeInput("gateway-field", true);
this.removeInput("dns-field", true);
}
};
},
};
Blockly.Blocks["sensebox_ethernetIp"] = {
init: function () {
this.appendDummyInput().appendField(Blockly.Msg.senseBox_ethernet_ip);
this.setColour(getColour().sensebox);
this.setHelpUrl(Blockly.Msg.senseBox_ethernetIp_helpurl);
this.setTooltip(Blockly.Msg.senseBox_ethernet_ip_tooltip);
this.setOutput(true, null);
}
};
Blockly.Blocks["sensebox_wifi_status"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_status_tooltip);
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_wifi_status);
this.setOutput(true, Types.BOOLEAN.typeName);
this.setHelpUrl(Blockly.Msg.senseBox_wifi_status_helpurl);
},
};
Blockly.Blocks["sensebox_get_ip"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_ip_tooltip);
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_wifi_ip);
this.setOutput(true, Types.TEXT.typeName);
this.setHelpUrl(Blockly.Msg.senseBox_wifi_ip_helpurl);
},
};
Blockly.Blocks["sensebox_wifi_rssi"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_rssi_tooltip);
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_wifi_rssi);
this.setOutput(true, Types.NUMBER.typeName);
this.setHelpUrl(Blockly.Msg.senseBox_wifi_rssi_helpurl);
},
};
+47
View File
@@ -0,0 +1,47 @@
import * as Blockly from "blockly/core";
import { getColour } from "../helpers/colour";
import { selectedBoard } from "../helpers/board";
Blockly.Blocks["init_serial_monitor"] = {
init: function () {
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setColour(getColour().serial);
this.setHelpUrl("http://arduino.cc/en/Serial/Begin");
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_SERIAL_SETUP)
.appendField(
new Blockly.FieldDropdown(selectedBoard().serial),
"SERIAL_ID"
)
.appendField(Blockly.Msg.ARD_SERIAL_SPEED)
.appendField(
new Blockly.FieldDropdown(selectedBoard().serialSpeed),
"SPEED"
)
.appendField(Blockly.Msg.ARD_SERIAL_BPS);
this.setInputsInline(true);
this.setTooltip(Blockly.Msg.ARD_SERIAL_SETUP_TIP);
},
};
Blockly.Blocks["print_serial_monitor"] = {
init: function () {
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setColour(getColour().serial);
this.setHelpUrl("http://www.arduino.cc/en/Serial/Print");
this.appendDummyInput()
.appendField(
new Blockly.FieldDropdown(selectedBoard().serial),
"SERIAL_ID"
)
.appendField(Blockly.Msg.ARD_SERIAL_PRINT);
this.appendValueInput("CONTENT");
this.appendDummyInput()
.appendField(new Blockly.FieldCheckbox("TRUE"), "NEW_LINE")
.appendField(Blockly.Msg.ARD_SERIAL_PRINT_NEWLINE);
this.setInputsInline(true);
this.setTooltip(Blockly.Msg.ARD_SERIAL_PRINT_TIP);
},
};
+120 -108
View File
@@ -8,123 +8,135 @@
* The arduino built in functions syntax can be found in
* http://arduino.cc/en/Reference/HomePage
*/
import Blockly from 'blockly';
import { getColour } from '../helpers/colour'
import * as Types from '../helpers/types'
import Blockly from "blockly";
import { getColour } from "../helpers/colour";
import * as Types from "../helpers/types";
Blockly.Blocks['time_delay'] = {
/**
* Delay block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/Delay');
this.setColour(getColour().time);
this.appendValueInput('DELAY_TIME_MILI')
.setCheck(Types.NUMBER.checkList)
.appendField(Blockly.Msg.ARD_TIME_DELAY);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_TIME_MS);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_TIME_DELAY_TIP);
}
Blockly.Blocks["time_delay"] = {
/**
* Delay block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/Delay");
this.setColour(getColour().time);
this.appendValueInput("DELAY_TIME_MILI")
.setCheck(Types.NUMBER.checkList)
.appendField(Blockly.Msg.ARD_TIME_DELAY);
this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_MS);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_TIME_DELAY_TIP);
},
};
Blockly.Blocks['time_delaymicros'] = {
/**
* delayMicroseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/DelayMicroseconds');
this.setColour(getColour().time);
this.appendValueInput('DELAY_TIME_MICRO')
.setCheck(Types.NUMBER.checkList)
.appendField(Blockly.Msg.ARD_TIME_DELAY);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_TIME_DELAY_MICROS);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_TIME_DELAY_MICRO_TIP);
}
Blockly.Blocks["time_delaymicros"] = {
/**
* delayMicroseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/DelayMicroseconds");
this.setColour(getColour().time);
this.appendValueInput("DELAY_TIME_MICRO")
.setCheck(Types.NUMBER.checkList)
.appendField(Blockly.Msg.ARD_TIME_DELAY);
this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_DELAY_MICROS);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_TIME_DELAY_MICRO_TIP);
},
};
Blockly.Blocks['time_millis'] = {
/**
* Elapsed time in milliseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/Millis');
this.setColour(getColour().time);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_TIME_MILLIS);
this.setOutput(true, Types.LARGE_NUMBER.typeId);
this.setTooltip(Blockly.Msg.ARD_TIME_MILLIS_TIP);
},
/** @return {string} The type of return value for the block, an integer. */
getBlockType: function () {
return Blockly.Types.LARGE_NUMBER;
}
Blockly.Blocks["time_millis"] = {
/**
* Elapsed time in milliseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/Millis");
this.setColour(getColour().time);
this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_MILLIS);
this.setOutput(true, Types.LARGE_NUMBER.typeName);
this.setTooltip(Blockly.Msg.ARD_TIME_MILLIS_TIP);
},
/** @return {string} The type of return value for the block, an integer. */
getBlockType: function () {
return Blockly.Types.LARGE_NUMBER;
},
};
Blockly.Blocks['time_micros'] = {
/**
* Elapsed time in microseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/Micros');
this.setColour(getColour().time);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_TIME_MICROS);
this.setOutput(true, Types.LARGE_NUMBER.typeId);
this.setTooltip(Blockly.Msg.ARD_TIME_MICROS_TIP);
},
/**
* Should be a long (32bit), but for for now an int.
* @return {string} The type of return value for the block, an integer.
*/
getBlockType: function () {
return Types.LARGE_NUMBER;
}
Blockly.Blocks["time_micros"] = {
/**
* Elapsed time in microseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/Micros");
this.setColour(getColour().time);
this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_MICROS);
this.setOutput(true, Types.LARGE_NUMBER.typeName);
this.setTooltip(Blockly.Msg.ARD_TIME_MICROS_TIP);
},
/**
* Should be a long (32bit), but for for now an int.
* @return {string} The type of return value for the block, an integer.
*/
getBlockType: function () {
return Types.LARGE_NUMBER;
},
};
Blockly.Blocks['infinite_loop'] = {
/**
* Waits forever, end of program.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('');
this.setColour(getColour().time);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_TIME_INF);
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setTooltip(Blockly.Msg.ARD_TIME_INF_TIP);
}
Blockly.Blocks["infinite_loop"] = {
/**
* Waits forever, end of program.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("");
this.setColour(getColour().time);
this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_INF);
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setTooltip(Blockly.Msg.ARD_TIME_INF_TIP);
},
};
Blockly.Blocks['sensebox_interval_timer'] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_interval_timer_tip);
this.setInputsInline(true);
this.setHelpUrl('');
this.setColour(getColour().time);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_interval_timer);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(new Blockly.FieldTextInput("10000"), "interval")
.appendField(Blockly.Msg.senseBox_interval);
this.appendStatementInput('DO')
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
}
// Blockly.Blocks["sensebox_interval_timer"] = {
// init: function () {
// this.setTooltip(Blockly.Msg.senseBox_interval_timer_tip);
// this.setInputsInline(true);
// this.setHelpUrl("");
// this.setColour(getColour().time);
// this.appendDummyInput().appendField(Blockly.Msg.senseBox_interval_timer);
// this.appendDummyInput()
// .setAlign(Blockly.ALIGN_LEFT)
// .appendField(new Blockly.FieldTextInput("10000"), "interval")
// .appendField(Blockly.Msg.senseBox_interval);
// this.appendStatementInput("DO").setCheck(null);
// this.setPreviousStatement(true, null);
// this.setNextStatement(true, null);
// },
// };
Blockly.Blocks["sensebox_interval_timer"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_interval_timer_tip);
this.setInputsInline(true);
this.setHelpUrl("");
this.setColour(getColour().time);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_interval_timer)
.appendField(new Blockly.FieldTextInput("Interval"), "name");
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_interval_time)
.setAlign(Blockly.ALIGN_LEFT)
.appendField(new Blockly.FieldTextInput("10000"), "interval")
.appendField(Blockly.Msg.senseBox_interval);
this.appendStatementInput("DO").setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
};
+28
View File
@@ -0,0 +1,28 @@
import Blockly from "blockly/core";
import { getColour } from "../helpers/colour";
Blockly.Blocks["watchdog_enable"] = {
init: function () {
this.appendDummyInput()
.appendField("Watchdog aktivieren")
.appendField(new Blockly.FieldTextInput("10000"), "TIME")
.appendField("ms");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().io);
this.setTooltip("");
this.setHelpUrl("");
},
};
Blockly.Blocks["watchdog_reset"] = {
init: function () {
this.appendDummyInput().appendField("Watchdog zurücksetzen");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().io);
this.setTooltip("");
this.setHelpUrl("");
},
};
+65 -33
View File
@@ -26,6 +26,17 @@
import * as Blockly from "blockly/core";
import store from "../../../store";
var ota = store.getState().general.platform
? store.getState().general.platform
: null;
store.subscribe(() => {
ota = store.getState().general.platform
? store.getState().general.platform
: null;
});
/**
* Arduino code generator.
* @type !Blockly.Generator
@@ -51,9 +62,7 @@ Blockly["Arduino"].addReservedWords(
"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"
"bit,attachInterrupt,detachInterrupt,interrupts,noInterrupts,short,isBtnPressed"
);
/**
@@ -121,21 +130,21 @@ Blockly["Arduino"].init = function (workspace) {
Blockly["Arduino"].variablesInitCode_ = "";
if (!Blockly["Arduino"].variableDB_) {
Blockly["Arduino"].variableDB_ = new Blockly.Names(
if (!Blockly["Arduino"].nameDB_) {
Blockly["Arduino"].nameDB_ = new Blockly.Names(
Blockly["Arduino"].RESERVED_WORDS_
);
} else {
Blockly["Arduino"].variableDB_.reset();
Blockly["Arduino"].nameDB_.reset();
}
Blockly["Arduino"].variableDB_.setVariableMap(workspace.getVariableMap());
Blockly["Arduino"].nameDB_.setVariableMap(workspace.getVariableMap());
// We don't have developer variables for now
// // Add developer variables (not created or named by the user).
// var devVarList = Blockly.Variables.allDeveloperVariables(workspace);
// for (var i = 0; i < devVarList.length; i++) {
// defvars.push(Blockly['Arduino'].variableDB_.getName(devVarList[i],
// defvars.push(Blockly['Arduino'].nameDB_.getName(devVarList[i],
// Blockly.Names.DEVELOPER_VARIABLE_TYPE));
// }
@@ -145,7 +154,7 @@ Blockly["Arduino"].init = function (workspace) {
for (i = 0; i < doubleVariables.length; i += 1) {
variableCode +=
"double " +
Blockly["Arduino"].variableDB_.getName(
Blockly["Arduino"].nameDB_.getName(
doubleVariables[i].getId(),
Blockly.Variables.NAME_TYPE
) +
@@ -156,7 +165,7 @@ Blockly["Arduino"].init = function (workspace) {
for (i = 0; i < stringVariables.length; i += 1) {
variableCode +=
"String " +
Blockly["Arduino"].variableDB_.getName(
Blockly["Arduino"].nameDB_.getName(
stringVariables[i].getId(),
Blockly.Variables.NAME_TYPE
) +
@@ -167,7 +176,7 @@ Blockly["Arduino"].init = function (workspace) {
for (i = 0; i < booleanVariables.length; i += 1) {
variableCode +=
"boolean " +
Blockly["Arduino"].variableDB_.getDistinctName(
Blockly["Arduino"].nameDB_.getDistinctName(
booleanVariables[i].getId(),
Blockly.Variables.NAME_TYPE
) +
@@ -178,7 +187,7 @@ Blockly["Arduino"].init = function (workspace) {
for (i = 0; i < colourVariables.length; i += 1) {
variableCode +=
"RGB " +
Blockly["Arduino"].variableDB_.getName(
Blockly["Arduino"].nameDB_.getName(
colourVariables[i].getId(),
Blockly.Variables.NAME_TYPE
) +
@@ -254,26 +263,49 @@ Blockly["Arduino"].finish = function (code) {
"\n}\n";
let loopCode = "\nvoid loop() { \n" + loopCodeOnce + code + "\n}\n";
// Convert the definitions dictionary into a list.
code =
devVariables +
"\n" +
libraryCode +
"\n" +
variablesCode +
"\n" +
definitionsCode +
"\n" +
codeFunctions +
"\n" +
Blockly["Arduino"].variablesInitCode_ +
"\n" +
functionsCode +
"\n" +
setupCode +
"\n" +
loopCode;
// only add OTA code if tablet mode is enabled
if (ota === true) {
code =
devVariables +
"\n" +
"#include <SenseBoxOTA.h>" +
"\n" +
libraryCode +
"\n" +
variablesCode +
"\n" +
definitionsCode +
"\n" +
codeFunctions +
"\n" +
Blockly["Arduino"].variablesInitCode_ +
"\n" +
functionsCode +
"\n" +
setupCode +
"\n" +
loopCode;
} else {
// Convert the definitions dictionary into a list.
code =
devVariables +
"\n" +
libraryCode +
"\n" +
variablesCode +
"\n" +
definitionsCode +
"\n" +
codeFunctions +
"\n" +
Blockly["Arduino"].variablesInitCode_ +
"\n" +
functionsCode +
"\n" +
setupCode +
"\n" +
loopCode;
}
// Clean up temporary data.
delete Blockly["Arduino"].definitions_;
@@ -281,7 +313,7 @@ Blockly["Arduino"].finish = function (code) {
delete Blockly["Arduino"].loopCodeOnce_;
delete Blockly["Arduino"].variablesInitCode_;
delete Blockly["Arduino"].libraries_;
Blockly["Arduino"].variableDB_.reset();
Blockly["Arduino"].nameDB_.reset();
return code;
};
@@ -19,7 +19,9 @@ import "./map";
import "./io";
import "./audio";
import "./procedures";
import "./serial";
import "./time";
import "./variables";
import "./lists";
import "./watchdog";
import "./webserver";
+1 -1
View File
@@ -275,7 +275,7 @@ Blockly.Arduino["math_change"] = function (block) {
"DELTA",
Blockly.Arduino.ORDER_ADDITIVE
) || "0";
var varName = Blockly.Arduino.variableDB_.getName(
var varName = Blockly.Arduino.nameDB_.getName(
block.getFieldValue("VAR"),
Blockly.Variables.NAME_TYPE
);
+89 -53
View File
@@ -1,52 +1,77 @@
import * as Blockly from 'blockly/core';
import * as Blockly from "blockly/core";
/**
* MQTT Blocks
*/
* MQTT Blocks
*/
let service;
Blockly.Arduino.sensebox_mqtt_setup = function () {
var server = this.getFieldValue('server');
var port = this.getFieldValue('port');
var username = this.getFieldValue('username');
var pass = this.getFieldValue('password');
service = this.getFieldValue('service');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.libraries_['library_adafruitmqtt'] = '#include "Adafruit_MQTT.h"';
Blockly.Arduino.libraries_['library_adafruitmqttclient'] = '#include "Adafruit_MQTT_Client.h"';
Blockly.Arduino.definitions_['mqtt_server'] = '#define SERVER "' + server + '"';
Blockly.Arduino.definitions_['mqtt_port'] = '#define SERVERPORT ' + port + '';
Blockly.Arduino.definitions_['mqtt_username'] = '#define USERNAME "' + username + '"';
Blockly.Arduino.definitions_['mqtt_pass'] = '#define PASS "' + pass + '"';
Blockly.Arduino.definitions_['wifi_client'] = 'WiFiClient client;';
Blockly.Arduino.definitions_['mqtt_client'] = 'Adafruit_MQTT_Client mqtt(&client, SERVER, SERVERPORT, USERNAME, PASS);'
var code = '';
return code;
var server = this.getFieldValue("server");
var port = this.getFieldValue("port");
var username = this.getFieldValue("username");
var pass = this.getFieldValue("password");
service = this.getFieldValue("service");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_adafruitmqtt"] =
'#include <Adafruit_MQTT.h> //http://librarymanager/All#Adafruit_MQTT_Library"';
Blockly.Arduino.libraries_["library_adafruitmqttclient"] =
'#include <Adafruit_MQTT_Client.h>';
Blockly.Arduino.definitions_["mqtt_server"] =
'#define SERVER "' + server + '"';
Blockly.Arduino.definitions_["mqtt_port"] =
"#define SERVERPORT " + port + "";
Blockly.Arduino.definitions_["mqtt_username"] =
'#define USERNAME "' + username + '"';
Blockly.Arduino.definitions_["mqtt_pass"] =
'#define PASS "' + pass + '"';
Blockly.Arduino.definitions_["wifi_client"] = "WiFiClient client;";
Blockly.Arduino.definitions_["mqtt_client"] =
"Adafruit_MQTT_Client mqtt(&client, SERVER, SERVERPORT, USERNAME, PASS);";
var code = "";
return code;
};
Blockly.Arduino.sensebox_mqtt_publish = function (block) {
var feedname = this.getFieldValue('publishfeed');
var res = feedname.split("/");
var feed_client = res[res.length - 1];
var value = Blockly.Arduino.valueToCode(this, 'value', Blockly.Arduino.ORDER_ATOMIC) || '"No Block connected"';
var feedname = this.getFieldValue("publishfeed");
var res = feedname.split("/");
var feed_client = res[res.length - 1];
var value =
Blockly.Arduino.valueToCode(this, "value", Blockly.Arduino.ORDER_ATOMIC) ||
'"No Block connected"';
switch (service) {
case 'adafruitio':
Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, USERNAME "/feeds/' + feedname + '");'
break;
case 'dioty':
Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, "/"USERNAME"/' + feedname + '");'
break;
case 'custom':
Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, "' + feedname + '");'
break;
default:
break;
switch (service) {
case "adafruitio":
Blockly.Arduino.definitions_["mqtt_" + feed_client + ""] =
"Adafruit_MQTT_Publish " +
feed_client +
' = Adafruit_MQTT_Publish(&mqtt, USERNAME "/feeds/' +
feedname +
'");';
break;
case "dioty":
Blockly.Arduino.definitions_["mqtt_" + feed_client + ""] =
"Adafruit_MQTT_Publish " +
feed_client +
' = Adafruit_MQTT_Publish(&mqtt, "/"USERNAME"/' +
feedname +
'");';
break;
case "custom":
Blockly.Arduino.definitions_["mqtt_" + feed_client + ""] =
"Adafruit_MQTT_Publish " +
feed_client +
' = Adafruit_MQTT_Publish(&mqtt, "' +
feedname +
'");';
break;
default:
break;
}
}
//Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, USERNAME "/feeds/' + feedname + '");'
Blockly.Arduino.codeFunctions_['mqtt_connect_function'] = `// Function to connect and reconnect as necessary to the MQTT server.
//Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, USERNAME "/feeds/' + feedname + '");'
Blockly.Arduino.codeFunctions_[
"mqtt_connect_function"
] = `// Function to connect and reconnect as necessary to the MQTT server.
// Should be called in the loop function and it will take care if connecting.
void MQTT_connect() {
int8_t ret;
@@ -59,23 +84,34 @@ void MQTT_connect() {
delay(5000); // wait 5 seconds
}
}`;
Blockly.Arduino.loopCodeOnce_['mqtt_connect'] = 'MQTT_connect();';
var code = '' + feed_client + '.publish(' + value + ');';
return code
Blockly.Arduino.loopCodeOnce_["mqtt_connect"] = "MQTT_connect();";
var code = "" + feed_client + ".publish(" + value + ");";
return code;
};
Blockly.Arduino.sensebox_mqtt_subscribe = function (block) {
var feedname = this.getFieldValue('subscribefeed');
var x = 5, feed_client;
feed_client = feedname.substr(feedname.length - x, x);
Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Subscribe ' + feed_client + '= Adafruit_MQTT_Subscribe(&mqtt,' + feedname + ');';
Blockly.Arduino.codeFunctions_['mqtt_' + feed_client + 'callbackFunction'] = `void ` + feed_client + `Callback (double x){
var feedname = this.getFieldValue("subscribefeed");
var x = 5,
feed_client;
feed_client = feedname.substr(feedname.length - x, x);
Blockly.Arduino.definitions_["mqtt_" + feed_client + ""] =
"Adafruit_MQTT_Subscribe " +
feed_client +
"= Adafruit_MQTT_Subscribe(&mqtt," +
feedname +
");";
Blockly.Arduino.codeFunctions_["mqtt_" + feed_client + "callbackFunction"] =
`void ` +
feed_client +
`Callback (double x){
Serial.println(x);
}`;
Blockly.Arduino.setupCode_['mqtt_' + feed_client + '_callback'] = '' + feed_client + '.setCallback(' + feed_client + 'Callback);';
Blockly.Arduino.setupCode_['mqtt_' + feed_client + '_subscribe'] = 'mqtt.subscribe(&' + feed_client + ');';
Blockly.Arduino.loopCodeOnce_['mqtt_processPackages'] = 'mqtt.processPackets(10);';
var code = '';
return code;
Blockly.Arduino.setupCode_["mqtt_" + feed_client + "_callback"] =
"" + feed_client + ".setCallback(" + feed_client + "Callback);";
Blockly.Arduino.setupCode_["mqtt_" + feed_client + "_subscribe"] =
"mqtt.subscribe(&" + feed_client + ");";
Blockly.Arduino.loopCodeOnce_["mqtt_processPackages"] =
"mqtt.processPackets(10);";
var code = "";
return code;
};
+105 -105
View File
@@ -1,5 +1,4 @@
import * as Blockly from 'blockly/core';
import * as Blockly from "blockly/core";
/**
* Code generator to add code into the setup() and loop() functions.
@@ -7,121 +6,122 @@ import * as Blockly from 'blockly/core';
* @param {!Blockly.Block} block Block to generate the code from.
* @return {string} Completed code.
*/
Blockly.Arduino['arduino_functions'] = function (block) {
// Edited version of Blockly.Generator.prototype.statementToCode
function statementToCodeNoTab(block, name) {
var targetBlock = block.getInputTargetBlock(name);
var code = Blockly.Arduino.blockToCode(targetBlock);
if (typeof code != 'string') {
throw new Error('Expecting code from statement block "' + targetBlock.type + '".');
}
return code;
Blockly.Arduino["arduino_functions"] = function (block) {
// Edited version of Blockly.Generator.prototype.statementToCode
function statementToCodeNoTab(block, name) {
var targetBlock = block.getInputTargetBlock(name);
var code = Blockly.Arduino.blockToCode(targetBlock);
if (typeof code != "string") {
throw new Error(
'Expecting code from statement block "' + targetBlock.type + '".'
);
}
return code;
}
var setupBranch = Blockly.Arduino.statementToCode(block, 'SETUP_FUNC');
// //var setupCode = Blockly.Arduino.scrub_(block, setupBranch); No comment block
if (setupBranch) {
Blockly.Arduino.setupCode_['mainsetup'] = setupBranch;
}
var setupBranch = Blockly.Arduino.statementToCode(block, "SETUP_FUNC");
// //var setupCode = Blockly.Arduino.scrub_(block, setupBranch); No comment block
if (setupBranch) {
Blockly.Arduino.setupCode_["mainsetup"] = setupBranch;
}
var loopBranch = statementToCodeNoTab(block, 'LOOP_FUNC');
//var loopcode = Blockly.Arduino.scrub_(block, loopBranch); No comment block
return loopBranch;
var loopBranch = statementToCodeNoTab(block, "LOOP_FUNC");
//var loopcode = Blockly.Arduino.scrub_(block, loopBranch); No comment block
return loopBranch;
};
Blockly.Arduino['procedures_defreturn'] = function (block) {
// Define a procedure with a return value.
const funcName = Blockly.Arduino.variableDB_.getName(
block.getFieldValue('NAME'),
Blockly.Procedures.NAME_TYPE
);
const branch = Blockly.Arduino.statementToCode(block, 'STACK');
const returnType = block.getFieldValue('RETURN TYPE') || 'void';
Blockly.Arduino["procedures_defreturn"] = function (block) {
// Define a procedure with a return value.
const funcName = Blockly.Arduino.nameDB_.getName(
block.getFieldValue("NAME"),
Blockly.Procedures.NAME_TYPE
);
const branch = Blockly.Arduino.statementToCode(block, "STACK");
const returnType = block.getFieldValue("RETURN TYPE") || "void";
let returnValue =
Blockly.Arduino.valueToCode(block, 'RETURN', Blockly.Arduino.ORDER_NONE) ||
'';
if (returnValue) {
returnValue = Blockly.Arduino.INDENT + 'return ' + returnValue + ';\n';
}
const args = [];
for (let i = 0; i < block.argumentVarModels_.length; i++) {
args[i] =
translateType(block.argumentVarModels_[i].type) +
' ' +
block.argumentVarModels_[i].name;
}
let code =
translateType(returnType) +
' ' +
funcName +
'(' +
args.join(', ') +
') {\n' +
branch +
returnValue +
'}';
code = Blockly.Arduino.scrub_(block, code);
// Add % so as not to collide with helper functions in definitions list.
Blockly.Arduino.functionNames_['%' + funcName] = code;
return null;
let returnValue =
Blockly.Arduino.valueToCode(block, "RETURN", Blockly.Arduino.ORDER_NONE) ||
"";
if (returnValue) {
returnValue = Blockly.Arduino.INDENT + "return " + returnValue + ";\n";
}
const args = [];
for (let i = 0; i < block.argumentVarModels_.length; i++) {
args[i] =
translateType(block.argumentVarModels_[i].type) +
" " +
block.argumentVarModels_[i].name;
}
let code =
translateType(returnType) +
" " +
funcName +
"(" +
args.join(", ") +
") {\n" +
branch +
returnValue +
"}";
code = Blockly.Arduino.scrub_(block, code);
// Add % so as not to collide with helper functions in definitions list.
Blockly.Arduino.functionNames_["%" + funcName] = code;
return null;
};
function translateType(type) {
switch (type) {
case 'int':
return 'int';
case 'String':
return 'String';
case 'void':
return 'void';
case 'boolean':
return 'boolean';
case 'float':
return 'float'
default:
throw new Error('Invalid Parameter Type');
}
switch (type) {
case "int":
return "int";
case "String":
return "String";
case "void":
return "void";
case "boolean":
return "boolean";
case "float":
return "float";
default:
throw new Error("Invalid Parameter Type");
}
}
Blockly.Arduino['procedures_defnoreturn'] =
Blockly.Arduino['procedures_defreturn'];
Blockly.Arduino["procedures_defnoreturn"] =
Blockly.Arduino["procedures_defreturn"];
Blockly.Arduino['procedures_callreturn'] = function (block) {
// Call a procedure with a return value.
const funcName = Blockly.Arduino.variableDB_.getName(
block.getFieldValue('NAME'),
Blockly.Procedures.NAME_TYPE
);
const args = [];
for (let i = 0; i < block.arguments_.length; i++) {
args[i] =
Blockly.Arduino.valueToCode(
block,
'ARG' + i,
Blockly.Arduino.ORDER_COMMA
) || 'null';
}
const code = funcName + '(' + args.join(', ') + ')';
return [code, Blockly.Arduino.ORDER_ATOMIC];
Blockly.Arduino["procedures_callreturn"] = function (block) {
// Call a procedure with a return value.
const funcName = Blockly.Arduino.nameDB_.getName(
block.getFieldValue("NAME"),
Blockly.Procedures.NAME_TYPE
);
const args = [];
for (let i = 0; i < block.arguments_.length; i++) {
args[i] =
Blockly.Arduino.valueToCode(
block,
"ARG" + i,
Blockly.Arduino.ORDER_COMMA
) || "null";
}
const code = funcName + "(" + args.join(", ") + ")";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino['procedures_callnoreturn'] = function (block) {
// Call a procedure with no return value.
const funcName = Blockly.Arduino.variableDB_.getName(
block.getFieldValue('NAME'),
Blockly.Procedures.NAME_TYPE
);
const args = [];
for (let i = 0; i < block.arguments_.length; i++) {
args[i] =
Blockly.Arduino.valueToCode(
block,
'ARG' + i,
Blockly.Arduino.ORDER_COMMA
) || 'null';
}
Blockly.Arduino["procedures_callnoreturn"] = function (block) {
// Call a procedure with no return value.
const funcName = Blockly.Arduino.nameDB_.getName(
block.getFieldValue("NAME"),
Blockly.Procedures.NAME_TYPE
);
const args = [];
for (let i = 0; i < block.arguments_.length; i++) {
args[i] =
Blockly.Arduino.valueToCode(
block,
"ARG" + i,
Blockly.Arduino.ORDER_COMMA
) || "null";
}
return funcName + '(' + args.join(', ') + ');\n';
};
return funcName + "(" + args.join(", ") + ");\n";
};
@@ -2,9 +2,8 @@ import * as Blockly from "blockly/core";
Blockly.Arduino.sensebox_phyphox_init = function () {
var name = this.getFieldValue("devicename");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["phyphox_library"] = `#include <phyphoxBle.h>`;
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.phyphoxSetupCode_[
"phyphox_start"
] = `PhyphoxBLE::start("${name}");`;
@@ -91,7 +90,9 @@ Blockly.Arduino.sensebox_phyphox_graph = function () {
code += `${label}.setUnitY("${unity}");\n`;
code += `${label}.setLabelX("${labelx}");\n`;
code += `${label}.setLabelY("${labely}");\n`;
code += `${label}.setStyle("${style}");\n`;
if (style === "dots"){
code += `${label}.setStyle("${style}");\n`;
}
code += `${label}.setChannel(${channelX}, ${channelY});\n`;
code += `firstView.addElement(${label});\n`;
return code;
@@ -1,45 +1,79 @@
import * as Blockly from 'blockly/core';
import * as Blockly from "blockly/core";
/*Display Blocks*/
Blockly.Arduino.sensebox_display_beginDisplay = function () {
Blockly.Arduino.libraries_['library_spi'] = '#include <SPI.h>';
Blockly.Arduino.libraries_['library_wire'] = '#include <Wire.h>';
Blockly.Arduino.libraries_['library_AdafruitGFX'] = '#include <Adafruit_GFX.h>';
Blockly.Arduino.libraries_['library_AdafruitSSD1306'] = '#include <Adafruit_SSD1306.h>';
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['define_display'] = '#define OLED_RESET 4\nAdafruit_SSD1306 display(OLED_RESET);';
Blockly.Arduino.setupCode_['sensebox_display_begin'] = 'senseBoxIO.powerI2C(true);\ndelay(2000);\ndisplay.begin(SSD1306_SWITCHCAPVCC, 0x3D);\ndisplay.display();\ndelay(100);\ndisplay.clearDisplay();';
var code = '';
return code;
Blockly.Arduino.libraries_["library_spi"] = "#include <SPI.h>";
Blockly.Arduino.libraries_["library_wire"] = "#include <Wire.h>";
Blockly.Arduino.libraries_["library_AdafruitGFX"] =
"#include <Adafruit_GFX.h> // http://librarymanager/All#Adafruit_GFX_Library";
Blockly.Arduino.libraries_["library_AdafruitSSD1306"] =
"#include <Adafruit_SSD1306.h> // http://librarymanager/All#Adafruit_SSD1306";
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.definitions_[
"define_display_size"
] = `#define SCREEN_WIDTH 128\n#define SCREEN_HEIGHT 64`;
Blockly.Arduino.definitions_["define_display"] =
"#define OLED_RESET -1\nAdafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);";
Blockly.Arduino.setupCode_["sensebox_display_begin"] =
"senseBoxIO.powerI2C(true);\ndelay(2000);\ndisplay.begin(SSD1306_SWITCHCAPVCC, 0x3D);\ndisplay.display();\ndelay(100);\ndisplay.clearDisplay();";
var code = "";
return code;
};
Blockly.Arduino.sensebox_display_clearDisplay = function () {
var code = 'display.clearDisplay();\n';
return code;
var code = "display.clearDisplay();\n";
return code;
};
Blockly.Arduino.sensebox_display_printDisplay = function () {
var x = this.getFieldValue('X');
var y = this.getFieldValue('Y');
var printDisplay = Blockly.Arduino.valueToCode(this, 'printDisplay', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
var size = this.getFieldValue('SIZE');
var color = this.getFieldValue('COLOR');
var code = 'display.setCursor(' + x + ',' + y + ');\n';
code += 'display.setTextSize(' + size + ');\n';
code += 'display.setTextColor(' + color + ');\n';
code += 'display.println(' + printDisplay + ');\n';
return code;
var x = this.getFieldValue("X");
var y = this.getFieldValue("Y");
var printDisplay =
Blockly.Arduino.valueToCode(
this,
"printDisplay",
Blockly.Arduino.ORDER_ATOMIC
) || '"Keine Eingabe"';
var size = this.getFieldValue("SIZE");
var color = this.getFieldValue("COLOR");
var code = "display.setCursor(" + x + "," + y + ");\n";
code += "display.setTextSize(" + size + ");\n";
code += "display.setTextColor(" + color + ");\n";
code += "display.println(" + printDisplay + ");\n";
return code;
};
Blockly.Arduino.sensebox_display_fastPrint = function () {
var title1 = Blockly.Arduino.valueToCode(this, 'Title1', Blockly.Arduino.ORDER_ATOMIC) || '0'
var value1 = Blockly.Arduino.valueToCode(this, 'Value1', Blockly.Arduino.ORDER_ATOMIC);
var dimension1 = Blockly.Arduino.valueToCode(this, 'Dimension1', Blockly.Arduino.ORDER_ATOMIC) || '0'
var title2 = Blockly.Arduino.valueToCode(this, 'Title2', Blockly.Arduino.ORDER_ATOMIC) || '0'
var value2 = Blockly.Arduino.valueToCode(this, 'Value2', Blockly.Arduino.ORDER_ATOMIC);
var dimension2 = Blockly.Arduino.valueToCode(this, 'Dimension2', Blockly.Arduino.ORDER_ATOMIC) || '0'
Blockly.Arduino.codeFunctions_['sensebox_fastPrint'] = `
var title1 =
Blockly.Arduino.valueToCode(this, "Title1", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var value1 = Blockly.Arduino.valueToCode(
this,
"Value1",
Blockly.Arduino.ORDER_ATOMIC
);
var dimension1 =
Blockly.Arduino.valueToCode(
this,
"Dimension1",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var title2 =
Blockly.Arduino.valueToCode(this, "Title2", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var value2 = Blockly.Arduino.valueToCode(
this,
"Value2",
Blockly.Arduino.ORDER_ATOMIC
);
var dimension2 =
Blockly.Arduino.valueToCode(
this,
"Dimension2",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
Blockly.Arduino.codeFunctions_["sensebox_fastPrint"] = `
void printOnDisplay(String title1, String measurement1, String unit1, String title2, String measurement2, String unit2) {
display.setCursor(0, 0);
@@ -62,67 +96,141 @@ Blockly.Arduino.sensebox_display_fastPrint = function () {
display.setTextSize(1);
display.println(unit2);
}
`
var code = ` printOnDisplay(${title1}, String(${value1}), ${dimension1}, ${title2}, String(${value2}), ${dimension2});\n`;
return code;
`;
var code = ` printOnDisplay(${title1}, String(${value1}), ${dimension1}, ${title2}, String(${value2}), ${dimension2});\n`;
return code;
};
Blockly.Arduino.sensebox_display_show = function (block) {
var show = Blockly.Arduino.statementToCode(block, 'SHOW');
var code = '';
code += show;
code += 'display.display();\n';
return code;
var show = Blockly.Arduino.statementToCode(block, "SHOW");
var code = "";
code += show;
code += "display.display();\n";
return code;
};
Blockly.Arduino.sensebox_display_plotDisplay = function () {
var YLabel = Blockly.Arduino.valueToCode(this, 'YLabel', Blockly.Arduino.ORDER_ATOMIC) || 'Y'
var XLabel = Blockly.Arduino.valueToCode(this, 'XLabel', Blockly.Arduino.ORDER_ATOMIC) || 'X'
var Title = Blockly.Arduino.valueToCode(this, 'Title', Blockly.Arduino.ORDER_ATOMIC) || 'Title'
var XRange1 = Blockly.Arduino.valueToCode(this, 'XRange1', Blockly.Arduino.ORDER_ATOMIC) || '0'
var XRange2 = Blockly.Arduino.valueToCode(this, 'XRange2', Blockly.Arduino.ORDER_ATOMIC) || '0'
var YRange1 = Blockly.Arduino.valueToCode(this, 'YRange1', Blockly.Arduino.ORDER_ATOMIC) || '0'
var YRange2 = Blockly.Arduino.valueToCode(this, 'YRange2', Blockly.Arduino.ORDER_ATOMIC) || '0'
var XTick = Blockly.Arduino.valueToCode(this, 'XTick', Blockly.Arduino.ORDER_ATOMIC) || '0'
var YTick = Blockly.Arduino.valueToCode(this, 'YTick', Blockly.Arduino.ORDER_ATOMIC) || '0'
var TimeFrame = Blockly.Arduino.valueToCode(this, 'TimeFrame', Blockly.Arduino.ORDER_ATOMIC) || '0'
var plotDisplay = Blockly.Arduino.valueToCode(this, 'plotDisplay', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
Blockly.Arduino.libraries_['library_plot'] = '#include <Plot.h>';
Blockly.Arduino.definitions_['define_plot_class'] = 'Plot DataPlot(&display);\n';
Blockly.Arduino.variables_['define_plot_class'] = 'const double TIMEFRAME = ' + TimeFrame + ';\n';
Blockly.Arduino.setupCode_['sensebox_plot_setup'] = 'DataPlot.setTitle(' + Title + ');\nDataPlot.setXLabel(' + XLabel + ');\nDataPlot.setYLabel(' + YLabel + ');\nDataPlot.setXRange(' + XRange1 + ',' + XRange2 + ');\nDataPlot.setYRange(' + YRange1 + ',' + YRange2 + ');\nDataPlot.setXTick(' + XTick + ');\nDataPlot.setYTick(' + YTick + ');\nDataPlot.setXPrecision(0);\nDataPlot.setYPrecision(0);\n';
var code = 'DataPlot.clear();'
code += 'double starttime = millis();\ndouble t = 0;\nwhile (t <= TIMEFRAME) {\nt = (millis() - starttime) / 1000.0;\nfloat value = ' + plotDisplay + ';\n';
code += 'DataPlot.addDataPoint(t,value);\n}\n';
return code;
var YLabel =
Blockly.Arduino.valueToCode(this, "YLabel", Blockly.Arduino.ORDER_ATOMIC) ||
"Y";
var XLabel =
Blockly.Arduino.valueToCode(this, "XLabel", Blockly.Arduino.ORDER_ATOMIC) ||
"X";
var Title =
Blockly.Arduino.valueToCode(this, "Title", Blockly.Arduino.ORDER_ATOMIC) ||
"Title";
var XRange1 =
Blockly.Arduino.valueToCode(
this,
"XRange1",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var XRange2 =
Blockly.Arduino.valueToCode(
this,
"XRange2",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var YRange1 =
Blockly.Arduino.valueToCode(
this,
"YRange1",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var YRange2 =
Blockly.Arduino.valueToCode(
this,
"YRange2",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var XTick =
Blockly.Arduino.valueToCode(this, "XTick", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var YTick =
Blockly.Arduino.valueToCode(this, "YTick", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var TimeFrame =
Blockly.Arduino.valueToCode(
this,
"TimeFrame",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var plotDisplay =
Blockly.Arduino.valueToCode(
this,
"plotDisplay",
Blockly.Arduino.ORDER_ATOMIC
) || '"Keine Eingabe"';
Blockly.Arduino.libraries_["library_plot"] = "#include <Plot.h>";
Blockly.Arduino.definitions_["define_plot_class"] =
"Plot DataPlot(&display);\n";
Blockly.Arduino.variables_["define_plot_class"] =
"const double TIMEFRAME = " + TimeFrame + ";\n";
Blockly.Arduino.setupCode_["sensebox_plot_setup"] =
"DataPlot.setTitle(" +
Title +
");\nDataPlot.setXLabel(" +
XLabel +
");\nDataPlot.setYLabel(" +
YLabel +
");\nDataPlot.setXRange(" +
XRange1 +
"," +
XRange2 +
");\nDataPlot.setYRange(" +
YRange1 +
"," +
YRange2 +
");\nDataPlot.setXTick(" +
XTick +
");\nDataPlot.setYTick(" +
YTick +
");\nDataPlot.setXPrecision(0);\nDataPlot.setYPrecision(0);\n";
var code = "DataPlot.clear();";
code +=
"double starttime = millis();\ndouble t = 0;\nwhile (t <= TIMEFRAME) {\nt = (millis() - starttime) / 1000.0;\nfloat value = " +
plotDisplay +
";\n";
code += "DataPlot.addDataPoint(t,value);\n}\n";
return code;
};
Blockly.Arduino.sensebox_display_fillCircle = function () {
let code = '';
var x = Blockly.Arduino.valueToCode(this, 'X', Blockly.Arduino.ORDER_ATOMIC) || '0'
var y = Blockly.Arduino.valueToCode(this, 'Y', Blockly.Arduino.ORDER_ATOMIC) || '0'
var radius = Blockly.Arduino.valueToCode(this, 'Radius', Blockly.Arduino.ORDER_ATOMIC) || '0'
var fill = this.getFieldValue('FILL');
if (fill === 'TRUE') {
code = 'display.fillCircle(' + x + ',' + y + ',' + radius + ',1);\n';
}
else {
code = 'display.drawCircle(' + x + ',' + y + ',' + radius + ',1);\n';
}
return code;
}
let code = "";
var x =
Blockly.Arduino.valueToCode(this, "X", Blockly.Arduino.ORDER_ATOMIC) || "0";
var y =
Blockly.Arduino.valueToCode(this, "Y", Blockly.Arduino.ORDER_ATOMIC) || "0";
var radius =
Blockly.Arduino.valueToCode(this, "Radius", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var fill = this.getFieldValue("FILL");
if (fill === "TRUE") {
code = "display.fillCircle(" + x + "," + y + "," + radius + ",1);\n";
} else {
code = "display.drawCircle(" + x + "," + y + "," + radius + ",1);\n";
}
return code;
};
Blockly.Arduino.sensebox_display_drawRectangle = function () {
let code = '';
var x = Blockly.Arduino.valueToCode(this, 'X', Blockly.Arduino.ORDER_ATOMIC) || '0'
var y = Blockly.Arduino.valueToCode(this, 'Y', Blockly.Arduino.ORDER_ATOMIC) || '0'
var width = Blockly.Arduino.valueToCode(this, 'width', Blockly.Arduino.ORDER_ATOMIC) || '0'
var height = Blockly.Arduino.valueToCode(this, 'height', Blockly.Arduino.ORDER_ATOMIC) || '0'
var fill = this.getFieldValue('FILL');
if (fill === 'TRUE') {
code = 'display.fillRect(' + x + ',' + y + ',' + width + ',' + height + ',1);\n';
}
else {
code = 'display.drawRect(' + x + ',' + y + ',' + width + ',' + height + ',1);\n';
}
return code;
}
let code = "";
var x =
Blockly.Arduino.valueToCode(this, "X", Blockly.Arduino.ORDER_ATOMIC) || "0";
var y =
Blockly.Arduino.valueToCode(this, "Y", Blockly.Arduino.ORDER_ATOMIC) || "0";
var width =
Blockly.Arduino.valueToCode(this, "width", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var height =
Blockly.Arduino.valueToCode(this, "height", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var fill = this.getFieldValue("FILL");
if (fill === "TRUE") {
code =
"display.fillRect(" + x + "," + y + "," + width + "," + height + ",1);\n";
} else {
code =
"display.drawRect(" + x + "," + y + "," + width + "," + height + ",1);\n";
}
return code;
};
@@ -3,6 +3,7 @@ import * as Blockly from 'blockly/core';
Blockly.Arduino.sensebox_led = function () {
var dropdown_pin = this.getFieldValue('PIN');
var dropdown_stat = this.getFieldValue('STAT');
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.setupCode_['setup_led_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', OUTPUT);';
var code = 'digitalWrite(' + dropdown_pin + ',' + dropdown_stat + ');\n'
return code;
@@ -11,6 +12,7 @@ Blockly.Arduino.sensebox_led = function () {
Blockly.Arduino.sensebox_rgb_led = function () {
var dropdown_pin = this.getFieldValue('PIN');
var color = Blockly.Arduino.valueToCode(this, 'COLOR', Blockly.Arduino.ORDER_ATOMIC) || '0'
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_['define_rgb_led' + dropdown_pin] = '#include <Adafruit_NeoPixel.h>\n Adafruit_NeoPixel rgb_led_' + dropdown_pin + ' = Adafruit_NeoPixel(1,' + dropdown_pin + ',NEO_RGB + NEO_KHZ800);\n';
Blockly.Arduino.setupCode_['setup_rgb_led' + dropdown_pin] = 'rgb_led_' + dropdown_pin + '.begin();';
var code = 'rgb_led_' + dropdown_pin + '.setPixelColor(0,rgb_led_' + dropdown_pin + '.Color(' + color + '));\n';
@@ -23,6 +25,7 @@ Blockly.Arduino.sensebox_ws2818_led_init = function () {
var dropdown_pin = this.getFieldValue('Port');
var numPixel = Blockly.Arduino.valueToCode(this, 'NUMBER', Blockly.Arduino.ORDER_ATOMIC) || '1';
var brightness = Blockly.Arduino.valueToCode(this, 'BRIGHTNESS', Blockly.Arduino.ORDER_ATOMIC) || '50'
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.definitions_['define_rgb_led' + dropdown_pin] = `#include <Adafruit_NeoPixel.h>\n Adafruit_NeoPixel rgb_led_${dropdown_pin}= Adafruit_NeoPixel(${numPixel}, ${dropdown_pin},NEO_GRB + NEO_KHZ800);\n`;
Blockly.Arduino.setupCode_['setup_rgb_led' + dropdown_pin] = 'rgb_led_' + dropdown_pin + '.begin();\n';
Blockly.Arduino.setupCode_['setup_rgb_led_brightness' + dropdown_pin] = `rgb_led_${dropdown_pin}.setBrightness(${brightness});\n`;
@@ -30,6 +33,7 @@ Blockly.Arduino.sensebox_ws2818_led_init = function () {
};
Blockly.Arduino.sensebox_ws2818_led = function () {
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
var dropdown_pin = this.getFieldValue('Port');
var position = Blockly.Arduino.valueToCode(this, 'POSITION', Blockly.Arduino.ORDER_ATOMIC) || '0';
var color = Blockly.Arduino.valueToCode(this, 'COLOR', Blockly.Arduino.ORDER_ATOMIC) || '0'
@@ -48,6 +52,7 @@ function hexToRgb(hex) {
}
Blockly.Arduino['colour_picker'] = function (block) {
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
const rgb = hexToRgb(block.getFieldValue('COLOUR'));
return [rgb.r + ', ' + rgb.g + ', ' + rgb.b, Blockly.Arduino.ORDER_ATOMIC];
@@ -58,6 +63,7 @@ Blockly.Arduino['colour_random'] = function (block) {
};
Blockly.Arduino['colour_rgb'] = function (block) {
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
const red = Blockly.Arduino.valueToCode(block, 'RED', Blockly.Arduino.ORDER_ATOMIC);
const green = Blockly.Arduino.valueToCode(block, 'GREEN', Blockly.Arduino.ORDER_ATOMIC);
const blue = Blockly.Arduino.valueToCode(block, 'BLUE', Blockly.Arduino.ORDER_ATOMIC);
@@ -5,10 +5,10 @@ Blockly.Arduino.sensebox_lora_initialize_otaa = function (block) {
var appID = this.getFieldValue("APPID");
var appKey = this.getFieldValue("APPKEY");
var interval = this.getFieldValue("INTERVAL");
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_spi"] = "#include <SPI.h>";
Blockly.Arduino.libraries_["library_lmic"] = "#include <lmic.h>";
Blockly.Arduino.libraries_["library_lmic"] =
"#include <lmic.h> // http://librarymanager/All#IBM_LMIC_framework";
Blockly.Arduino.libraries_["library_hal"] = "#include <hal/hal.h>";
Blockly.Arduino.definitions_["define_LoRaVariablesOTAA"] = `
static const u1_t PROGMEM APPEUI[8]= {${appID}};
@@ -177,7 +177,8 @@ Blockly.Arduino.sensebox_send_lora_sensor_value = function (block) {
};
Blockly.Arduino.sensebox_lora_cayenne_send = function (block) {
Blockly.Arduino.libraries_["library_cayene"] = "#include <CayenneLPP.h>";
Blockly.Arduino.libraries_["library_cayene"] =
"#include <CayenneLPP.h> // http://librarymanager/All#CayenneLPP";
Blockly.Arduino.variables_["variable_cayenne"] = "CayenneLPP lpp(51);";
var lora_sensor_values = Blockly.Arduino.statementToCode(block, "DO");
Blockly.Arduino.functionNames_["functions_do_send"] = `
@@ -278,8 +279,7 @@ Blockly.Arduino.sensebox_lora_initialize_abp = function (block) {
var appskey = this.getFieldValue("APPSKEY");
var devaddr = this.getFieldValue("DEVADDR");
var interval = this.getFieldValue("INTERVAL");
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_spi"] = "#include <SPI.h>";
Blockly.Arduino.libraries_["library_lmic"] = "#include <lmic.h>";
Blockly.Arduino.libraries_["library_hal"] = "#include <hal/hal.h>";
@@ -525,3 +525,12 @@ Blockly.Arduino.sensebox_lora_cayenne_gps = function (block) {
var code = `lpp.addGPS(${channel}, ${lat}, ${lng}, ${alt});\n`;
return code;
};
Blockly.Arduino.sensebox_lora_cayenne_concentration = function (block) {
var value =
Blockly.Arduino.valueToCode(this, "Value", Blockly.Arduino.ORDER_ATOMIC) ||
0;
var channel = this.getFieldValue("CHANNEL");
var code = `lpp.addConcentration(${channel}, ${value});\n`;
return code;
};
+186 -55
View File
@@ -1,66 +1,125 @@
import Blockly from 'blockly';
import Blockly from "blockly";
/**
* Block send Data to the openSenseMap
*/
* Block send Data to the openSenseMap
*/
Blockly.Arduino.sensebox_send_to_osem = function (block) {
var code = '';
var sensor_id = this.getFieldValue('SensorID');
var code = "";
var sensor_id = this.getFieldValue("SensorID");
var id = sensor_id.slice(-3).toUpperCase();
var sensor_value = Blockly.Arduino.valueToCode(this, 'Value', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
Blockly.Arduino.definitions_['SENSOR_ID' + id + ''] = 'const char SENSOR_ID' + id + '[] PROGMEM = "' + sensor_id + '";';
code += 'addMeasurement(SENSOR_ID' + id + ',' + sensor_value + ');\n';
var sensor_value =
Blockly.Arduino.valueToCode(this, "Value", Blockly.Arduino.ORDER_ATOMIC) ||
'"Keine Eingabe"';
Blockly.Arduino.definitions_["SENSOR_ID" + id + ""] =
"const char SENSOR_ID" + id + '[] PROGMEM = "' + sensor_id + '";';
code += "addMeasurement(SENSOR_ID" + id + "," + sensor_value + ");\n";
return code;
};
Blockly.Arduino.sensebox_osem_connection = function (Block) {
var box_id = this.getFieldValue('BoxID');
var host = this.getFieldValue('host');
var branch = Blockly.Arduino.statementToCode(Block, 'DO');
var access_token = this.getFieldValue('access_token');
var workspace = Blockly.getMainWorkspace();
var wifi = false;
var ethernet = false;
if (workspace.getBlocksByType("sensebox_wifi").length > 0) {
wifi = true;
ethernet = false;
} else if (workspace.getBlocksByType("sensebox_ethernet").length > 0) {
ethernet = true;
wifi = false;
}
var box_id = this.getFieldValue("BoxID");
var branch = Blockly.Arduino.statementToCode(Block, "DO");
var access_token = this.getFieldValue("access_token");
var blocks = this.getDescendants();
var type = this.getFieldValue('type');
var ssl = this.getFieldValue('SSL');
var type = this.getFieldValue("type");
var ssl = this.getFieldValue("SSL");
var restart = this.getFieldValue("RESTART");
var port = 0;
var count = 0;
if (blocks !== undefined) {
for (var i = 0; i < blocks.length; i++) {
if (blocks[i].type === 'sensebox_send_to_osem') {
if (blocks[i].type === "sensebox_send_to_osem") {
count++;
}
}
}
var num_sensors = count;
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['num_sensors'] = 'static const uint8_t NUM_SENSORS = ' + num_sensors + ';'
Blockly.Arduino.definitions_['SenseBoxID'] = 'const char SENSEBOX_ID [] PROGMEM = "' + box_id + '";';
Blockly.Arduino.definitions_['host'] = 'const char server [] PROGMEM =' + host + ';';
if (ssl === 'TRUE') {
Blockly.Arduino.definitions_['WiFiSSLClient'] = 'WiFiSSLClient client;';
port = 443;
} else if (ssl === 'FALSE') {
Blockly.Arduino.definitions_['WiFiClient'] = 'WiFiClient client;';
port = 80;
}
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.definitions_["num_sensors"] =
"static const uint8_t NUM_SENSORS = " + num_sensors + ";";
Blockly.Arduino.definitions_["SenseBoxID"] =
'const char SENSEBOX_ID [] PROGMEM = "' + box_id + '";';
Blockly.Arduino.definitions_["host"] =
'const char server [] PROGMEM ="ingress.opensensemap.org";';
if (wifi === true) {
if (ssl === "TRUE") {
Blockly.Arduino.libraries_["library_bearSSL"] =
"#include <ArduinoBearSSL.h>";
Blockly.Arduino.libraries_["library_arduinoECC08"] =
"#include <ArduinoECCX08.h>";
Blockly.Arduino.definitions_["WiFiClient"] = "WiFiClient wifiClient;";
Blockly.Arduino.definitions_["BearSSLClient"] =
"BearSSLClient client(wifiClient);";
Blockly.Arduino.functionNames_["getTime"] = `unsigned long getTime() {
return WiFi.getTime();
}`;
Blockly.Arduino.setupCode_["initBearSSL"] =
"ArduinoBearSSL.onGetTime(getTime);";
port = 443;
} else if (ssl === "FALSE") {
Blockly.Arduino.definitions_["WiFiClient"] = "WiFiClient client;";
port = 80;
}
} else if (ethernet === true) {
if (ssl === "TRUE") {
Blockly.Arduino.libraries_["library_bearSSL"] =
"#include <ArduinoBearSSL.h>";
Blockly.Arduino.libraries_["library_arduinoECC08"] =
"#include <ArduinoECCX08.h>";
Blockly.Arduino.libraries_["library_ethernetUdp"] =
"#include <EthernetUdp.h>";
Blockly.Arduino.libraries_["library_NTPClient"] =
"#include <NTPClient.h>";
Blockly.Arduino.definitions_["EthernetClient"] =
"EthernetClient eclient;";
Blockly.Arduino.definitions_["BearSSLClient"] =
"BearSSLClient client(eclient);";
Blockly.Arduino.definitions_["EthernetUDP"] = "EthernetUDP Udp;";
Blockly.Arduino.definitions_["NTPClient"] = "NTPClient timeClient(Udp);";
Blockly.Arduino.functionNames_["getTime"] = `
unsigned long getTime() {
timeClient.update();
return timeClient.getEpochTime();
}`;
Blockly.Arduino.definitions_['measurement'] = `typedef struct measurement {
Blockly.Arduino.setupCode_["timeClient_begin"] = "timeClient.begin();";
Blockly.Arduino.setupCode_["initBearSSL"] =
"ArduinoBearSSL.onGetTime(getTime);";
port = 443;
} else if (ssl === "FALSE") {
Blockly.Arduino.definitions_["EthernetClient"] = "EthernetClient client;";
port = 80;
}
}
Blockly.Arduino.definitions_["measurement"] = `typedef struct measurement {
const char *sensorId;
float value;
} measurement;`;
Blockly.Arduino.definitions_['buffer'] = 'char buffer[750];';
Blockly.Arduino.definitions_['num_measurement'] = `measurement measurements[NUM_SENSORS];
Blockly.Arduino.definitions_["buffer"] = "char buffer[750];";
Blockly.Arduino.definitions_[
"num_measurement"
] = `measurement measurements[NUM_SENSORS];
uint8_t num_measurements = 0;`;
Blockly.Arduino.definitions_['lengthMultiplikator'] = 'const int lengthMultiplikator = 35;';
Blockly.Arduino.functionNames_['addMeasurement'] = `
Blockly.Arduino.definitions_["lengthMultiplikator"] =
"const int lengthMultiplikator = 35;";
Blockly.Arduino.functionNames_["addMeasurement"] = `
void addMeasurement(const char *sensorId, float value) {
measurements[num_measurements].sensorId = sensorId;
measurements[num_measurements].value = value;
num_measurements++;
}`;
if (type === 'Stationary') {
Blockly.Arduino.functionNames_['writeMeasurementsToClient'] = `
if (type === "Stationary") {
Blockly.Arduino.functionNames_["writeMeasurementsToClient"] = `
void writeMeasurementsToClient() {
// iterate throug the measurements array
for (uint8_t i = 0; i < num_measurements; i++) {
@@ -72,18 +131,26 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
// reset num_measurements
num_measurements = 0;
}`;
Blockly.Arduino.functionNames_['submitValues'] = `
void submitValues() {
Blockly.Arduino.functionNames_["submitValues"] =
`
void submitValues() {
${
wifi === true
? "if (WiFi.status() != WL_CONNECTED) {\nWiFi.disconnect();\ndelay(1000); // wait 1s\nWiFi.begin(ssid, pass);\ndelay(5000); // wait 5s\n}"
: ""
}
if (client.connected()) {
client.stop();
delay(10);
}
client.stop();
delay(1000);
}
bool connected = false;
char _server[strlen_P(server)];
strcpy_P(_server, server);
for (uint8_t timeout = 2; timeout != 0; timeout--) {
Serial.println(F("connecting..."));
connected = client.connect(_server, `+ port + `);
connected = client.connect(_server, ` +
port +
`);
if (connected == true) {
// construct the HTTP POST request:
sprintf_P(buffer,
@@ -105,22 +172,56 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
break;
}
}
while (client.available()) {
char c = client.read();
// if the server's disconnected, stop the client:
if (!client.connected()) {
client.stop();
break;
}
}
num_measurements = 0;
break;
}
delay(1000);
}
${
restart === "TRUE"
? "if (connected == false) {\n delay(5000);\n noInterrupts();\n NVIC_SystemReset();\n while (1)\n ;\n }"
: ""
}
}`;
var code = '';
var code = "";
code += branch;
code += "submitValues();\n";
}
else if (type === 'Mobile') {
var lat = Blockly.Arduino.valueToCode(Block, 'lat', Blockly.Arduino.ORDER_ATOMIC);
var lng = Blockly.Arduino.valueToCode(Block, 'lng', Blockly.Arduino.ORDER_ATOMIC);
var timestamp = Blockly.Arduino.valueToCode(Block, 'timeStamp', Blockly.Arduino.ORDER_ATOMIC);
var altitude = Blockly.Arduino.valueToCode(Block, 'altitude', Blockly.Arduino.ORDER_ATOMIC);
Blockly.Arduino.definitions_['lengthMultiplikator'] = 'const int lengthMultiplikator = 77;';
Blockly.Arduino.functionNames_['writeMeasurementsToClient'] = `
} else if (type === "Mobile") {
var lat = Blockly.Arduino.valueToCode(
Block,
"lat",
Blockly.Arduino.ORDER_ATOMIC
);
var lng = Blockly.Arduino.valueToCode(
Block,
"lng",
Blockly.Arduino.ORDER_ATOMIC
);
var timestamp = Blockly.Arduino.valueToCode(
Block,
"timeStamp",
Blockly.Arduino.ORDER_ATOMIC
);
var altitude = Blockly.Arduino.valueToCode(
Block,
"altitude",
Blockly.Arduino.ORDER_ATOMIC
);
Blockly.Arduino.definitions_["lengthMultiplikator"] =
"const int lengthMultiplikator = 77;";
Blockly.Arduino.functionNames_["writeMeasurementsToClient"] = `
void writeMeasurementsToClient(float lat, float lng, float altitude, char* timeStamp) {
// iterate throug the measurements array
for (uint8_t i = 0; i < num_measurements; i++) {
@@ -132,7 +233,10 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
// reset num_measurements
num_measurements = 0;
}`;
Blockly.Arduino.functionNames_['submitValues'] = `
Blockly.Arduino.variables_["latitude"] = "float latitude;";
Blockly.Arduino.variables_["longitude"] = "float longitude;";
Blockly.Arduino.functionNames_["submitValues"] =
`
void submitValues(float lat, float lng, float altitude, char* timeStamp) {
if (client.connected()) {
client.stop();
@@ -143,7 +247,9 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
strcpy_P(_server, server);
for (uint8_t timeout = 2; timeout != 0; timeout--) {
Serial.println(F("connecting..."));
connected = client.connect(_server, `+ port + `);
connected = client.connect(_server, ` +
port +
`);
if (connected == true) {
// construct the HTTP POST request:
sprintf_P(buffer,
@@ -165,15 +271,40 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
break;
}
}
while (client.available()) {
char c = client.read();
// if the server's disconnected, stop the client:
if (!client.connected()) {
client.stop();
break;
}
delay(1000);
}
num_measurements = 0;
break;
}
}
}`
code = '';
${
restart === "TRUE"
? "if (connected == false) {\n delay(5000);\n noInterrupts();\n NVIC_SystemReset();\n while (1)\n ;\n }"
: ""
}
}`;
code = "";
code += branch;
code += 'submitValues(' + lat + ',' + lng + ',' + altitude + ',' + timestamp + ');\n';
code +=
"submitValues((" +
lat +
"/float(10000000)),(" +
lng +
"/float(10000000)),(" +
altitude +
"/float(100))," +
timestamp +
");\n";
}
return code;
};
@@ -3,8 +3,7 @@ import Blockly from "blockly";
Blockly.Arduino.sensebox_rtc_init = function () {
Blockly.Arduino.libraries_["RV8523"] = `#include <RV8523.h>`;
Blockly.Arduino.definitions_["RTC"] = `RV8523 rtc;`;
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.setupCode_["rtc.begin"] = `rtc.begin();`;
var code = ``;
return code;
@@ -15,19 +14,22 @@ Blockly.Arduino.sensebox_rtc_set = function () {
Blockly.Arduino.valueToCode(this, "second", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var minutes =
Blockly.Arduino.valueToCode(this, "second", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
Blockly.Arduino.valueToCode(
this,
"minutes",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var hour =
Blockly.Arduino.valueToCode(this, "second", Blockly.Arduino.ORDER_ATOMIC) ||
Blockly.Arduino.valueToCode(this, "hour", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var day =
Blockly.Arduino.valueToCode(this, "second", Blockly.Arduino.ORDER_ATOMIC) ||
Blockly.Arduino.valueToCode(this, "day", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var month =
Blockly.Arduino.valueToCode(this, "second", Blockly.Arduino.ORDER_ATOMIC) ||
Blockly.Arduino.valueToCode(this, "month", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var year =
Blockly.Arduino.valueToCode(this, "second", Blockly.Arduino.ORDER_ATOMIC) ||
Blockly.Arduino.valueToCode(this, "year", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
Blockly.Arduino.libraries_["RV8523"] = `#include <RV8523.h>`;
Blockly.Arduino.setupCode_["rtc.start"] = `rtc.start();`;
@@ -79,18 +81,16 @@ Blockly.Arduino.sensebox_rtc_get_timestamp = function () {
Blockly.Arduino.setupCode_[
"rtc.batterySwitchOver"
] = `rtc.batterySwitchOver(1);`;
Blockly.Arduino.loopCodeOnce_[
"rtc_variables"
] = `uint8_t sec, min, hour, day, month;\nuint16_t year;`;
Blockly.Arduino.variables_["rtc_timestamp"] = `char timestamp[20];`;
Blockly.Arduino.loopCodeOnce_[
"rtc_get"
] = `rtc.get(&sec, &min, &hour, &day, &month, &year);`;
Blockly.Arduino.loopCodeOnce_[
""
] = `sprintf(timestamp, "%02d-%02d-%02dT%02d:%02d:%02dZ", year, month, day, hour, min, sec);`;
var code = `timestamp`;
Blockly.Arduino.codeFunctions_["getTimeStamp"] = `
char* getTimeStamp() {
uint8_t sec, min, hour, day, month;
uint16_t year;
rtc.get(&sec, &min, &hour, &day, &month, &year);
sprintf(timestamp, "%02d-%02d-%02dT%02d:%02d:%02dZ", year, month, day, hour, min, sec);
return timestamp;
}
`;
var code = `getTimeStamp()`;
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
+188 -34
View File
@@ -1,5 +1,4 @@
import Blockly from 'blockly';
import Blockly from "blockly";
/* SD-Card Blocks using the Standard SD Library*/
/**
@@ -10,45 +9,200 @@ import Blockly from 'blockly';
*/
Blockly.Arduino.sensebox_sd_create_file = function (block) {
var filename = this.getFieldValue('Filename');
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_' + 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 = '';
return code;
var filename = this.getFieldValue("Filename");
var extension = this.getFieldValue("extension");
var newFileName = filename.concat(".", extension);
Blockly.Arduino.libraries_["library_spi"] = "#include <SPI.h>";
Blockly.Arduino.libraries_["library_sd"] = "#include <SD.h>";
Blockly.Arduino.definitions_["define_" + filename] = `File ${filename};`;
Blockly.Arduino.setupCode_["sensebox_sd"] = "SD.begin(28);\n";
Blockly.Arduino.setupCode_[
"sensebox_sd" + filename
] = `${filename} = SD.open("${newFileName}", FILE_WRITE);\n${filename}.close();\n`;
var code = "";
return code;
};
Blockly.Arduino.sensebox_sd_open_file = function (block) {
var filename = this.getFieldValue('Filename');
var res = filename.slice(0, 4);
var branch = Blockly.Arduino.statementToCode(block, 'SD');
var code = 'dataFile' + res + ' = SD.open("' + filename + '", FILE_WRITE);\n'
code += branch;
code += 'dataFile' + res + '.close();\n'
return code;
var filename = this.getFieldValue("Filename");
var extension = this.getFieldValue("extension");
var newFileName = filename.concat(".", extension);
var branch = Blockly.Arduino.statementToCode(block, "SD");
var code = `${filename} = SD.open("${newFileName}", FILE_WRITE);\n`;
code += branch;
code += `${filename}.close();\n`;
return code;
};
Blockly.Arduino.sensebox_sd_write_file = function (block) {
if (this.parentBlock_ != null) {
var filename = this.getSurroundParent().getFieldValue('Filename');
if (this.parentBlock_ != null) {
var filename = this.getSurroundParent().getFieldValue("Filename");
}
var branch =
Blockly.Arduino.valueToCode(this, "DATA", Blockly.Arduino.ORDER_ATOMIC) ||
'"Keine Eingabe"';
var linebreak = this.getFieldValue("linebreak");
if (linebreak === "TRUE") {
linebreak = "ln";
} else {
linebreak = "";
}
var code = "";
if (branch === "gps.getLongitude()" || branch === "gps.getLatitude()") {
code = `${filename}.print${linebreak}(${branch},5);\n`;
} else {
code = `${filename}.print${linebreak}(${branch});\n`;
}
return code;
};
Blockly.Arduino.sensebox_sd_osem = function () {
if (this.parentBlock_ != null) {
var filename = this.getSurroundParent().getFieldValue("Filename");
}
var type = this.getFieldValue("type");
var blocks = this.getDescendants();
var branch = Blockly.Arduino.statementToCode(this, "DO");
var count = 0;
if (blocks !== undefined) {
for (var i = 0; i < blocks.length; i++) {
if (blocks[i].type === "sensebox_sd_save_for_osem") {
count++;
}
}
var res = filename.slice(0, 4);
var text = Blockly.Arduino.valueToCode(this, 'DATA', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
var linebreak = this.getFieldValue('linebreak');
if (linebreak === "TRUE") {
linebreak = "ln";
} else {
linebreak = "";
}
var num_sensors = count;
var timestamp = Blockly.Arduino.valueToCode(
this,
"timeStamp",
Blockly.Arduino.ORDER_ATOMIC
);
Blockly.Arduino.definitions_["num_sensors"] =
"static const uint8_t NUM_SENSORS = " + num_sensors + ";";
Blockly.Arduino.definitions_["measurement"] = `typedef struct measurement {
const char *sensorId;
float value;
} measurement;`;
Blockly.Arduino.definitions_["buffer"] = "char buffer[750];";
Blockly.Arduino.definitions_[
"num_measurement"
] = `measurement measurements[NUM_SENSORS];
uint8_t num_measurements = 0;`;
if (type === "Stationary") {
Blockly.Arduino.functionNames_["addMeasurement"] = `
void addMeasurement(const char *sensorId, float value) {
measurements[num_measurements].sensorId = sensorId;
measurements[num_measurements].value = value;
num_measurements++;
}
var code = '';
if (text === "gps.getLongitude()" || text === "gps.getLatitude()") {
code = 'dataFile' + res + '.print' + linebreak + '(' + text + ',5);\n'
`;
Blockly.Arduino.functionNames_["writeMeasurementsToSdCard"] = `
void writeMeasurementsToSdCard(char* timeStamp) {
// iterate throug the measurements array
for (uint8_t i = 0; i < num_measurements; i++) {
sprintf_P(buffer, PSTR("%s,%9.2f,%s"), measurements[i].sensorId, measurements[i].value, timeStamp);
// transmit buffer to client
${filename}.println(buffer);
}
else {
code = 'dataFile' + res + '.print' + linebreak + '(' + text + ');\n'
}
return code;
// reset num_measurements
num_measurements = 0;
}
`;
Blockly.Arduino.functionNames_["saveValues"] = `
void saveValues() {
// send measurements
writeMeasurementsToSdCard(${timestamp});
num_measurements = 0;
}
`;
var code = "";
code += branch;
code += "saveValues();";
} else if (type === "Mobile") {
/**
* add mobile functions here
*/
Blockly.Arduino.libraries_["dtostrf.h"] = "#include <avr/dtostrf.h>";
var lat = Blockly.Arduino.valueToCode(
this,
"lat",
Blockly.Arduino.ORDER_ATOMIC
);
var lng = Blockly.Arduino.valueToCode(
this,
"lng",
Blockly.Arduino.ORDER_ATOMIC
);
// var altitude = Blockly.Arduino.valueToCode(
// this,
// "altitude",
// Blockly.Arduino.ORDER_ATOMIC
// );
Blockly.Arduino.definitions_["num_sensors"] =
"static const uint8_t NUM_SENSORS = " + num_sensors + ";";
Blockly.Arduino.definitions_["measurement"] = `typedef struct measurement {
const char *sensorId;
float value;
} measurement;`;
Blockly.Arduino.definitions_["buffer"] = "char buffer[750];";
Blockly.Arduino.definitions_[
"num_measurement"
] = `measurement measurements[NUM_SENSORS];
uint8_t num_measurements = 0;`;
Blockly.Arduino.functionNames_["addMeasurement"] = `
void addMeasurement(const char *sensorId, float value) {
measurements[num_measurements].sensorId = sensorId;
measurements[num_measurements].value = value;
num_measurements++;
}
`;
Blockly.Arduino.functionNames_["writeMeasurementsToSdCard"] = `
void writeMeasurementsToSdCard(char* timeStamp, int32_t latitudes, int32_t longitudes) {
// iterate throug the measurements array
for (uint8_t i = 0; i < num_measurements; i++) {
char lng[20];
char lat[20];
float longitude = longitudes / (float)10000000;
float latitude = latitudes / (float)10000000;
dtostrf(longitude, 8, 7, lng);
dtostrf(latitude, 8, 7, lat);
sprintf_P(buffer, PSTR("%s,%9.2f,%s,%02s,%02s"), measurements[i].sensorId, measurements[i].value, timeStamp, lng, lat);
// transmit buffer to client
${filename}.println(buffer);
}
// reset num_measurements
num_measurements = 0;
}
`;
Blockly.Arduino.functionNames_["saveValues"] = `
void saveValues() {
// send measurements
writeMeasurementsToSdCard(${timestamp}, ${lat}, ${lng});
num_measurements = 0;
}
`;
code = "";
code += branch;
code += "saveValues();\n";
}
return code;
};
Blockly.Arduino.sensebox_sd_save_for_osem = function (block) {
var code = "";
var sensor_id = this.getFieldValue("SensorID");
var id = sensor_id.slice(-3).toUpperCase();
var sensor_value =
Blockly.Arduino.valueToCode(block, "Value", Blockly.Arduino.ORDER_ATOMIC) ||
'"Keine Eingabe"';
Blockly.Arduino.definitions_["SENSOR_ID" + id + ""] =
"const char SENSOR_ID" + id + '[] PROGMEM = "' + sensor_id + '";';
code += "addMeasurement(SENSOR_ID" + id + "," + sensor_value + ");\n";
console.log(code);
return code;
};
@@ -1,123 +1,234 @@
import Blockly from 'blockly';
import Blockly from "blockly";
/**
* HDC1080 Temperature and Humidity Sensor
*
*
*/
Blockly.Arduino.sensebox_sensor_temp_hum = function () {
var dropdown_name = this.getFieldValue('NAME');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['define_hdc'] = 'HDC1080 hdc;';
Blockly.Arduino.setupCode_['sensebox_sensor_temp_hum'] = 'hdc.begin();';
var code = 'hdc.get' + dropdown_name + '()';
var dropdown_name = this.getFieldValue("NAME");
Blockly.Arduino.libraries_["library_adafruithdc1000"] =
"#include <Adafruit_HDC1000.h> // http://librarymanager/All#Adafruit_HDC1000_Library";
Blockly.Arduino.definitions_["define_hdc"] =
"Adafruit_HDC1000 hdc = Adafruit_HDC1000();";
Blockly.Arduino.setupCode_["sensebox_sensor_temp_hum"] = "hdc.begin();";
var code = `hdc.read${dropdown_name}()`;
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* VEML 6070 and TSL4513 UV-Light/Illuminance Sensor
*
*
*/
Blockly.Arduino.sensebox_sensor_uv_light = function () {
var dropdown_name = this.getFieldValue('NAME');
let code = '';
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
if (dropdown_name === 'UvIntensity') {
Blockly.Arduino.definitions_['define_veml'] = 'VEML6070 veml;'
Blockly.Arduino.setupCode_['sensebox_sensor_uv_light'] = 'veml.begin();'
code = 'veml.get' + dropdown_name + '()';
var dropdown_name = this.getFieldValue("NAME");
let code = "";
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
if (dropdown_name === "UvIntensity") {
Blockly.Arduino.libraries_["library_veml6070"] = "#include <VEML6070.h>";
Blockly.Arduino.definitions_["define_veml"] = "VEML6070 veml;";
Blockly.Arduino.setupCode_["sensebox_sensor_uv_light"] = "veml.begin();";
code = "veml.getUV()";
}
// if (dropdown_name === 'Illuminance') {
// Blockly.Arduino.definitions_['define_tsl'] = 'TSL45315 tsl;'
// Blockly.Arduino.setupCode_['sensebox_sensor_illuminance'] = 'tsl.begin();'
// code = 'tsl.get' + dropdown_name + '()';
// }
if (dropdown_name === 'Illuminance') {
Blockly.Arduino.definitions_['define_lightsensor'] = 'Lightsensor lightsensor;'
Blockly.Arduino.setupCode_['sensebox_sensor_illuminance'] = 'lightsensor.begin();'
code = 'lightsensor.get' + dropdown_name + '()';
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)
{
int i = 0;
Wire.beginTransmission(address);
Wire.write(reg);
Wire.endTransmission();
Wire.requestFrom((uint8_t)address, (uint8_t)1);
delay(1);
if(Wire.available())
i = Wire.read();
return i;
}
`;
Blockly.Arduino.codeFunctions_["write_reg"] = `
void write_reg(byte address, uint8_t reg, uint8_t val)
{
Wire.beginTransmission(address);
Wire.write(reg);
Wire.write(val);
Wire.endTransmission();
}`;
Blockly.Arduino.codeFunctions_["Lightsensor_begin"] = `
void Lightsensor_begin()
{
Wire.begin();
unsigned int u = 0;
u = read_reg(0x29, 0x80 | 0x0A); //id register
if ((u & 0xF0) == 0xA0) // TSL45315
{
write_reg(0x29, 0x80 | 0x00, 0x03); //control: power on
write_reg(0x29, 0x80 | 0x01, 0x02); //config: M=4 T=100ms
delay(120);
lightsensortype = 0; //TSL45315
}
else
{
LTR.begin();
LTR.setControl(gain, false, false);
LTR.setMeasurementRate(integrationTime, measurementRate);
LTR.setPowerUp(); //power on with default settings
delay(10); //Wait 10 ms (max) - wakeup time from standby
lightsensortype = 1; //
}
}
`;
Blockly.Arduino.codeFunctions_["Lightsensor_getIlluminance"] = `
unsigned int Lightsensor_getIlluminance()
{
unsigned int lux = 0;
if (lightsensortype == 0) // TSL45315
{
unsigned int u = (read_reg(0x29, 0x80 | 0x04) << 0); //data low
u |= (read_reg(0x29, 0x80 | 0x05) << 8); //data high
lux = u * 4; // calc lux with M=4 and T=100ms
}
else if (lightsensortype == 1) //LTR-329ALS-01
{
delay(100);
unsigned int data0, data1;
for (int i = 0; i < 5; i++) {
if (LTR.getData(data0, data1)) {
if(LTR.getLux(gain, integrationTime, data0, data1, lux));
if(lux > 0) break;
else delay(10);
}
else {
byte error = LTR.getError();
}
}
}
return lux;
}
`;
Blockly.Arduino.definitions_["define_lightsensor"] = `
bool lightsensortype = 0; //0 for tsl - 1 for ltr
//settings for LTR sensor
LTR329 LTR;
unsigned char gain = 1;
unsigned char integrationTime = 0;
unsigned char measurementRate = 3;
`;
Blockly.Arduino.setupCode_["sensebox_sensor_illuminance"] =
"Lightsensor_begin();";
code = "Lightsensor_getIlluminance()";
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* BMX055 Accelerometer
*
*
*/
Blockly.Arduino.sensebox_sensor_bmx055_accelerometer = function () {
var dropdown_value = this.getFieldValue('VALUE');
var range = this.getFieldValue('RANGE');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['define_bmx'] = 'BMX055 bmx;';
Blockly.Arduino.setupCode_['sensebox_sensor_bmx055'] = 'bmx.beginAcc(' + range + ');';
var code = 'bmx.getAcceleration' + dropdown_value + '()';
var dropdown_value = this.getFieldValue("VALUE");
var range = this.getFieldValue("RANGE");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_bmx055"] = `#include <BMX055.h>`;
Blockly.Arduino.definitions_["define_bmx"] = "BMX055 bmx;";
Blockly.Arduino.setupCode_["sensebox_sensor_bmx055"] =
"bmx.beginAcc(" + range + ");";
var code = "bmx.getAcceleration" + dropdown_value + "()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* SDS011 Fine Particlar Matter
*
*
*/
Blockly.Arduino.sensebox_sensor_sds011 = function () {
var dropdown_name = this.getFieldValue('NAME');
var serial_name = this.getFieldValue('SERIAL');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.codeFunctions_['define_sds011'] = 'SDS011 my_sds(' + serial_name + ');';
Blockly.Arduino.variables_['variables_sds011'] = 'float p10,p25;\n';
Blockly.Arduino.setupCode_['sensebox_sensor_sds011'] = serial_name + '.begin(9600);';
var code = 'my_sds.get' + dropdown_name + '()';
var dropdown_name = this.getFieldValue("NAME");
var serial_name = this.getFieldValue("SERIAL");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_[
"SdsDustSensor"
] = `#include <SdsDustSensor.h> // http://librarymanager/All#Nova_Fitness_Sds_dust_sensors_library`;
Blockly.Arduino.definitions_["define_sds011"] =
"SdsDustSensor sds(" + serial_name + ");";
Blockly.Arduino.setupCode_["sds011_begin"] = "sds.begin();";
Blockly.Arduino.setupCode_["sds011_setQueryReportingMode"] =
"sds.setQueryReportingMode();";
Blockly.Arduino.loopCodeOnce_[
"sds011_getData"
] = `PmResult pm = sds.queryPm();`;
var code = `pm.${dropdown_name}`;
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* BMP280 Pressure Sensor
*
*
*/
Blockly.Arduino.sensebox_sensor_pressure = function () {
var dropdown_name = this.getFieldValue('NAME');
var code = '';
var referencePressure = this.getFieldValue('referencePressure');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['define_pressure'] = 'BMP280 bmp_sensor;';
Blockly.Arduino.setupCode_['sensebox_bmp_sensor'] = 'bmp_sensor.begin();';
if (dropdown_name === 'Pressure' || dropdown_name === 'Temperature') {
code = 'bmp_sensor.get' + dropdown_name + '()';
}
else if (dropdown_name === 'Altitude') {
code = 'bmp_sensor.getAltitude(' + referencePressure + ')';
var dropdown_name = this.getFieldValue("NAME");
var code = "";
var referencePressure = this.getFieldValue("referencePressure");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_[
"adafruit_bmp280"
] = `#include <Adafruit_BMP280.h> // http://librarymanager/All#Adafruit_BMP280_Library`;
Blockly.Arduino.definitions_["define_pressure"] = "Adafruit_BMP280 bmp;";
Blockly.Arduino.setupCode_["sensebox_bmp_sensor"] = "bmp.begin(0x76);";
Blockly.Arduino.setupCode_["bmp_setSampling"] = `
bmp.setSampling(Adafruit_BMP280::MODE_NORMAL,
Adafruit_BMP280::SAMPLING_X2,
Adafruit_BMP280::SAMPLING_X16,
Adafruit_BMP280::FILTER_X16,
Adafruit_BMP280::STANDBY_MS_500);
`;
switch (dropdown_name) {
case "Temperature":
code = "bmp.readTemperature()";
break;
case "Pressure":
code = "bmp.readPressure()/100";
break;
case "Altitude":
code = "bmp.readAltitude(" + referencePressure + ")";
break;
default:
code = "";
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* BME680 Environmental Sensor
*
*
*/
Blockly.Arduino.sensebox_sensor_bme680_bsec = function () {
var dropdown_name = this.getFieldValue('dropdown');
let code = '';
Blockly.Arduino.libraries_['library_bsec'] = '#include "bsec.h"';
Blockly.Arduino.definitions_['bsec_iaqSensor'] = 'Bsec iaqSensor;'
Blockly.Arduino.variables_['bmeTemperatur'] = 'float bmeTemperatur;';
Blockly.Arduino.variables_['bmeHumidity'] = 'float bmeHumidity;';
Blockly.Arduino.variables_['bmePressure'] = 'double bmePressure;';
Blockly.Arduino.variables_['bmeIAQ'] = 'float bmeIAQ;';
Blockly.Arduino.variables_['bmeIAQAccuracy'] = 'float bmeIAQAccuracy;';
Blockly.Arduino.variables_['bmeCO2'] = 'int bmeCO2;';
Blockly.Arduino.variables_['bmeBreathVocEquivalent'] = 'float bmeBreathVocEquivalent;'
var dropdown_name = this.getFieldValue("dropdown");
let code = "";
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_bsec"] =
"#include <bsec.h> // http://librarymanager/All#BSEC_Software_Library";
Blockly.Arduino.definitions_["bsec_iaqSensor"] = "Bsec iaqSensor;";
Blockly.Arduino.variables_["bmeTemperatur"] = "float bmeTemperatur;";
Blockly.Arduino.variables_["bmeHumidity"] = "float bmeHumidity;";
Blockly.Arduino.variables_["bmePressure"] = "double bmePressure;";
Blockly.Arduino.variables_["bmeIAQ"] = "float bmeIAQ;";
Blockly.Arduino.variables_["bmeIAQAccuracy"] = "float bmeIAQAccuracy;";
Blockly.Arduino.variables_["bmeCO2"] = "int bmeCO2;";
Blockly.Arduino.variables_["bmeBreathVocEquivalent"] =
"float bmeBreathVocEquivalent;";
Blockly.Arduino.functionNames_['checkIaqSensorStatus'] = `
Blockly.Arduino.functionNames_["checkIaqSensorStatus"] = `
void checkIaqSensorStatus(void)
{
if (iaqSensor.status != BSEC_OK) {
@@ -135,7 +246,7 @@ Blockly.Arduino.sensebox_sensor_bme680_bsec = function () {
}
}
`;
Blockly.Arduino.functionNames_['errLeds'] = `
Blockly.Arduino.functionNames_["errLeds"] = `
void errLeds(void)
{
pinMode(LED_BUILTIN, OUTPUT);
@@ -145,10 +256,12 @@ Blockly.Arduino.sensebox_sensor_bme680_bsec = function () {
delay(100);
}`;
//Setup Code
Blockly.Arduino.setupCode_['Wire.begin'] = 'Wire.begin();';
Blockly.Arduino.setupCode_['iaqSensor.begin'] = 'iaqSensor.begin(BME680_I2C_ADDR_PRIMARY, Wire);';
Blockly.Arduino.setupCode_['checkIaqSensorStatus'] = 'checkIaqSensorStatus();';
Blockly.Arduino.setupCode_['bsec_sensorlist'] = `
Blockly.Arduino.setupCode_["Wire.begin"] = "Wire.begin();";
Blockly.Arduino.setupCode_["iaqSensor.begin"] =
"iaqSensor.begin(BME680_I2C_ADDR_PRIMARY, Wire);";
Blockly.Arduino.setupCode_["checkIaqSensorStatus"] =
"checkIaqSensorStatus();";
Blockly.Arduino.setupCode_["bsec_sensorlist"] = `
bsec_virtual_sensor_t sensorList[10] = {
BSEC_OUTPUT_RAW_TEMPERATURE,
BSEC_OUTPUT_RAW_PRESSURE,
@@ -162,9 +275,10 @@ Blockly.Arduino.sensebox_sensor_bme680_bsec = function () {
BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY,
};
`;
Blockly.Arduino.setupCode_['iaqSensorUpdateSubscription'] = 'iaqSensor.updateSubscription(sensorList, 10, BSEC_SAMPLE_RATE_LP);\ncheckIaqSensorStatus();';
Blockly.Arduino.setupCode_["iaqSensorUpdateSubscription"] =
"iaqSensor.updateSubscription(sensorList, 10, BSEC_SAMPLE_RATE_LP);\ncheckIaqSensorStatus();";
//Loop Code
Blockly.Arduino.loopCodeOnce_['iaqloop'] = `
Blockly.Arduino.loopCodeOnce_["iaqloop"] = `
if (iaqSensor.run()) {
bmeTemperatur = iaqSensor.temperature;
bmeHumidity = iaqSensor.humidity;
@@ -178,26 +292,26 @@ Blockly.Arduino.sensebox_sensor_bme680_bsec = function () {
}
`;
switch (dropdown_name) {
case 'temperature':
code = 'bmeTemperatur';
case "temperature":
code = "bmeTemperatur";
break;
case 'humidity':
code = 'bmeHumidity';
case "humidity":
code = "bmeHumidity";
break;
case 'pressure':
code = 'bmePressure'
case "pressure":
code = "bmePressure";
break;
case 'IAQ':
code = 'bmeIAQ';
case "IAQ":
code = "bmeIAQ";
break;
case 'IAQAccuracy':
code = 'bmeIAQAccuracy';
case "IAQAccuracy":
code = "bmeIAQAccuracy";
break;
case 'CO2':
code = 'bmeCO2';
case "CO2":
code = "bmeCO2";
break;
case 'breathVocEquivalent':
code = 'bmeBreathVocEquivalent';
case "breathVocEquivalent":
code = "bmeBreathVocEquivalent";
break;
default:
break;
@@ -205,109 +319,151 @@ Blockly.Arduino.sensebox_sensor_bme680_bsec = function () {
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* Ultrasonic Distance Sensor
*
*
*/
Blockly.Arduino.sensebox_sensor_ultrasonic_ranger = function () {
var dropdown_pin_RX = this.getFieldValue('ultrasonic_trigger');
var dropdown_pin_TX = this.getFieldValue('ultrasonic_echo');
var port = this.getFieldValue('port');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['var_ultrasonic' + port] = 'Ultrasonic Ultrasonic' + port + '(' + dropdown_pin_RX + ',' + dropdown_pin_TX + ');';
var dropdown_pin_RX = this.getFieldValue("ultrasonic_trigger");
var dropdown_pin_TX = this.getFieldValue("ultrasonic_echo");
var port = this.getFieldValue("port");
var maxDistance = this.getFieldValue("maxDistance");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_[
"library_newPing"
] = `#include <NewPing.h> // http://librarymanager/All#NewPing`;
Blockly.Arduino.variables_["define_newPingVariables" + port] = `
#define TRIGGER_PIN_${port} ${dropdown_pin_RX}
#define ECHO_PIN_${port} ${dropdown_pin_TX}
#define MAX_DISTANCE_${port} ${maxDistance}
`;
Blockly.Arduino.definitions_[
"define_newPing" + port
] = `NewPing sonar${port}(TRIGGER_PIN_${port}, ECHO_PIN_${port}, MAX_DISTANCE_${port});`;
var code;
code = 'Ultrasonic' + port + '.getDistance()';
code = `sonar${port}.ping_cm()`;
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* Microphone
*
*
*/
Blockly.Arduino.sensebox_sensor_sound = function () {
var dropdown_pin = this.getFieldValue('PIN');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['define_microphone'] = 'Microphone microphone(' + dropdown_pin + ');'
var code = 'microphone.getValue()';
var dropdown_pin = this.getFieldValue("PIN");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.codeFunctions_["define_sound"] = `
float getSoundValue(int pin) {
unsigned long start = millis(); // Start des Messintervalls
unsigned int peakToPeak = 0; // Abstand von maximalem zu minimalem Amplitudenausschlag
unsigned int signalMax = 0;
unsigned int signalMin = 1023;
const int sampleTime = 100;
unsigned int micValue;
// Sammle Daten für 100 Millisekunden
while (millis() - start < sampleTime)
{
micValue = analogRead(pin); // Messe den aktuellen Wert
if (micValue < 1023) // sortiere Fehlmessungen aus, deren Werte über dem max Wert 1024 liegen
{
if (micValue > signalMax)
{
signalMax = micValue; // speichere den maximal gemessenen Wert
}
else if (micValue < signalMin)
{
signalMin = micValue; // speichere den minimal gemessenen Wert
}
}
}
peakToPeak = signalMax - signalMin; // max - min = Abstand von maximalem zu minimalem Amplitudenausschlag
double volts = (peakToPeak * 5.0) / 1023; // wandle in Volt um
return volts;
}`;
var code = "getSoundValue(" + dropdown_pin + ")";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* Button
*
*
*/
Blockly.Arduino.sensebox_button = function () {
var dropdown_pin = this.getFieldValue('PIN');
var dropown_function = this.getFieldValue('FUNCTION');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['define_button' + dropdown_pin + ''] = 'Button button_' + dropdown_pin + '(' + dropdown_pin + ');';
Blockly.Arduino.setupCode_['setup_button' + dropdown_pin + ''] = 'button_' + dropdown_pin + '.begin();';
var code = '';
if (dropown_function === 'isPressed') {
code = 'button_' + dropdown_pin + '.isPressed()';
}
else if (dropown_function === 'Switch') {
code = 'button_' + dropdown_pin + '.getSwitch()';
}
else if (dropown_function === 'wasPressed') {
code = 'button_' + dropdown_pin + '.wasPressed()';
var dropdown_pin = this.getFieldValue("PIN");
var dropown_function = this.getFieldValue("FUNCTION");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_[
"library_jcButtons"
] = `#include <JC_Button.h> // http://librarymanager/All#JC_Button`;
Blockly.Arduino.definitions_["define_button" + dropdown_pin + ""] =
"Button button_" + dropdown_pin + "(" + dropdown_pin + ");";
Blockly.Arduino.setupCode_["setup_button" + dropdown_pin + ""] =
"button_" + dropdown_pin + ".begin();";
Blockly.Arduino.loopCodeOnce_["loop_button" + dropdown_pin + ""] =
"button_" + dropdown_pin + ".read();";
var code = "";
if (dropown_function === "isPressed") {
code = "button_" + dropdown_pin + ".isPressed()";
} else if (dropown_function === "wasPressed") {
code = "button_" + dropdown_pin + ".wasPressed()";
} else if (dropown_function === "longPress") {
var time = this.getFieldValue("time");
code = "button_" + dropdown_pin + ".pressedFor(" + time + ")";
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* SCD30 CO2 Sensor
*
*
*/
Blockly.Arduino.sensebox_scd30 = function () {
var dropdown = this.getFieldValue('dropdown');
Blockly.Arduino.libraries_['scd30_library'] = '#include "SparkFun_SCD30_Arduino_Library.h"'
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['SCD30'] = 'SCD30 airSensor;';
Blockly.Arduino.setupCode_['init_scd30'] = ` Wire.begin();
var dropdown = this.getFieldValue("dropdown");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["scd30_library"] =
"#include <SparkFun_SCD30_Arduino_Library.h> // http://librarymanager/All#SparkFun_SCD30_Arduino_Library";
Blockly.Arduino.definitions_["SCD30"] = "SCD30 airSensor;";
Blockly.Arduino.setupCode_["init_scd30"] = ` Wire.begin();
if (airSensor.begin() == false)
{
while (1)
;
}`;
var code = '';
var code = "";
switch (dropdown) {
case 'temperature':
code = 'airSensor.getTemperature()';
case "temperature":
code = "airSensor.getTemperature()";
break;
case 'humidity':
code = 'airSensor.getHumiditiy()';
case "humidity":
code = "airSensor.getHumidity()";
break;
case 'CO2':
code = 'airSensor.getCO2()';
case "CO2":
code = "airSensor.getCO2()";
break;
default:
code = ''
code = "";
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
}
};
/**
* GPS Module
*
*
*/
Blockly.Arduino.sensebox_gps = function () {
var dropdown = this.getFieldValue('dropdown');
Blockly.Arduino.libraries_['gps_library'] = '#include <SparkFun_u-blox_GNSS_Arduino_Library.h>'
Blockly.Arduino.libraries_['library_wire'] = '#include <Wire.h>';
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['GPS'] = 'SFE_UBLOX_GNSS myGNSS;';
Blockly.Arduino.setupCode_['init_gps'] = ` Wire.begin();
var dropdown = this.getFieldValue("dropdown");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["gps_library"] =
"#include <SparkFun_u-blox_GNSS_Arduino_Library.h> // http://librarymanager/All#SparkFun_u-blox_GNSS_Arduino_Library";
Blockly.Arduino.libraries_["library_wire"] = "#include <Wire.h>";
Blockly.Arduino.definitions_["GPS"] = "SFE_UBLOX_GNSS myGNSS;";
Blockly.Arduino.setupCode_["init_gps"] = ` Wire.begin();
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
{
@@ -317,95 +473,120 @@ Blockly.Arduino.sensebox_gps = function () {
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGNSS.saveConfiguration(); //Save the current settings to flash and BBR`;
var code = '';
var code = "";
switch (dropdown) {
case 'latitude':
code = 'myGNSS.getLatitude()';
case "latitude":
code = "myGNSS.getLatitude()";
break;
case 'longitude':
code = 'myGNSS.getLongitude()';
case "longitude":
code = "myGNSS.getLongitude()";
break;
case 'altitude':
code = 'myGNSS.getAltitudeMSL()';
case "altitude":
code = "myGNSS.getAltitudeMSL()";
break;
case 'pDOP':
code = 'myGNSS.getPDOP()';
case "pDOP":
code = "myGNSS.getPDOP()";
break;
case 'fixType':
code = 'myGNSS.getFixType()';
case "fixType":
code = "myGNSS.getFixType()";
break;
case "timestamp":
Blockly.Arduino.variables_["timestampVars"] = `
char tsBuffer[21];
`;
Blockly.Arduino.codeFunctions_["getTimeStamp()"] = `
char* getTimeStamp()
{
if (myGNSS.getTimeValid() == true)
{
sprintf(tsBuffer, "%04d-%02d-%02dT%02d:%02d:%02dZ",
myGNSS.getYear(), myGNSS.getMonth(), myGNSS.getDay(), myGNSS.getHour(), myGNSS.getMinute(), myGNSS.getSecond());
}
return tsBuffer;
}
`;
code = "getTimeStamp()";
break;
case "speed":
code = "myGNSS.getGroundSpeed()";
break;
default:
code = ''
code = "";
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
}
};
/**
* Block for Truebner STM50
*/
Blockly.Arduino.sensebox_sensor_truebner_smt50 = function () {
var dropdown_port = this.getFieldValue('Port')
var dropdown_value = this.getFieldValue('value');
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
var dropdown_port = this.getFieldValue("Port");
var dropdown_value = this.getFieldValue("value");
var dropdown_pin = 1;
var code = '';
if (dropdown_value === 'temp') {
if (dropdown_port === 'A') {
var code = "";
if (dropdown_value === "temp") {
if (dropdown_port === "A") {
dropdown_pin = 1;
}
if (dropdown_port === 'B') {
if (dropdown_port === "B") {
dropdown_pin = 3;
}
if (dropdown_port === 'C') {
if (dropdown_port === "C") {
dropdown_pin = 5;
}
Blockly.Arduino.codeFunctions_['sensebox_smt50_temp'] = 'float getSMT50Temperature(int analogPin){\n int sensorValue = analogRead(analogPin);\n float voltage = sensorValue * (3.3 / 1024.0);\n return (voltage - 0.5) * 100;\n}';
code = 'getSMT50Temperature(' + dropdown_pin + ')';
Blockly.Arduino.codeFunctions_["sensebox_smt50_temp"] =
"float getSMT50Temperature(int analogPin){\n int sensorValue = analogRead(analogPin);\n float voltage = sensorValue * (3.3 / 1024.0);\n return (voltage - 0.5) * 100;\n}";
code = "getSMT50Temperature(" + dropdown_pin + ")";
return [code, Blockly.Arduino.ORDER_ATOMIC];
}
else if (dropdown_value === 'soil') {
if (dropdown_port === 'A') {
} else if (dropdown_value === "soil") {
if (dropdown_port === "A") {
dropdown_pin = 2;
}
if (dropdown_port === 'B') {
if (dropdown_port === "B") {
dropdown_pin = 4;
}
if (dropdown_port === 'C') {
if (dropdown_port === "C") {
dropdown_pin = 6;
}
Blockly.Arduino.codeFunctions_['sensebox_smt50_soil'] = 'float getSMT50Moisture(int analogPin){\n int sensorValue = analogRead(analogPin);\n float voltage = sensorValue * (3.3 / 1024.0);\n return (voltage * 50) / 3;\n}';
code = 'getSMT50Moisture(' + dropdown_pin + ')';
Blockly.Arduino.codeFunctions_["sensebox_smt50_soil"] =
"float getSMT50Moisture(int analogPin){\n int sensorValue = analogRead(analogPin);\n float voltage = sensorValue * (3.3 / 1024.0);\n return (voltage * 50) / 3;\n}";
code = "getSMT50Moisture(" + dropdown_pin + ")";
return [code, Blockly.Arduino.ORDER_ATOMIC];
}
};
/**
* DS18B20 Watertemperature
*
*
*/
Blockly.Arduino.sensebox_sensor_watertemperature = function () {
var dropdown_port = this.getFieldValue('Port');
var dropdown_port = this.getFieldValue("Port");
var dropdown_pin = 1;
if (dropdown_port === 'A') {
if (dropdown_port === "A") {
dropdown_pin = 1;
}
if (dropdown_port === 'B') {
if (dropdown_port === "B") {
dropdown_pin = 3;
}
if (dropdown_port === 'C') {
if (dropdown_port === "C") {
dropdown_pin = 5;
}
Blockly.Arduino.libraries_['library_oneWire'] = '#include "OneWire.h"';
Blockly.Arduino.libraries_['library_oneDallasTemperature'] = '#include "DallasTemperature.h"';
Blockly.Arduino.definitions_['define_OneWire'] = '#define ONE_WIRE_BUS ' + dropdown_pin + '\nOneWire oneWire(ONE_WIRE_BUS);\nDallasTemperature sensors(&oneWire);';
Blockly.Arduino.setupCode_['sensebox_oneWireSetup'] = 'sensors.begin();';
Blockly.Arduino.codeFunctions_['sensebox_requestTemp'] = 'float getWaterTemp(){\nsensors.requestTemperatures();\nsensors.getTempCByIndex(0);\n}';
var code = 'getWaterTemp()';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_oneWire"] =
"#include <OneWire.h> // http://librarymanager/All#OneWire";
Blockly.Arduino.libraries_["library_oneDallasTemperature"] =
"#include <DallasTemperature.h> // http://librarymanager/All#DallasTemperature";
Blockly.Arduino.definitions_["define_OneWire"] =
"#define ONE_WIRE_BUS " +
dropdown_pin +
"\nOneWire oneWire(ONE_WIRE_BUS);\nDallasTemperature sensors(&oneWire);";
Blockly.Arduino.setupCode_["sensebox_oneWireSetup"] = "sensors.begin();";
Blockly.Arduino.codeFunctions_["sensebox_requestTemp"] =
"float getWaterTemp(){\nsensors.requestTemperatures();\nsensors.getTempCByIndex(0);\n}";
var code = "getWaterTemp()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
@@ -443,28 +624,88 @@ float getWindspeed(){
*/
/**
*
*
*/
*
*
*/
Blockly.Arduino.sensebox_soundsensor_dfrobot = function () {
var dropdown_port = this.getFieldValue('Port');
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
var dropdown_port = this.getFieldValue("Port");
var dropdown_pin = 1;
if (dropdown_port === 'A') {
if (dropdown_port === "A") {
dropdown_pin = 1;
}
if (dropdown_port === 'B') {
if (dropdown_port === "B") {
dropdown_pin = 3;
}
if (dropdown_port === 'C') {
if (dropdown_port === "C") {
dropdown_pin = 5;
}
Blockly.Arduino.codeFunctions_['soundsensor'] = `
Blockly.Arduino.codeFunctions_["soundsensor"] =
`
float getSoundValue(){
float v = analogRead(`+ dropdown_pin + `) * (3.3 / 1024.0);
float v = analogRead(` +
dropdown_pin +
`) * (3.3 / 1024.0);
float decibel = v * 50;
return decibel;
}`
var code = 'getSoundValue()';
}`;
var code = "getSoundValue()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
};
/**
* rainsensor hydreon rg-15
*/
Blockly.Arduino.sensebox_rainsensor_hydreon_rg15 = function () {
var port = this.getFieldValue("SERIAL");
var value = this.getFieldValue("VALUE");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_rainsensor_rg15"] = "#include <hydreon.h>";
Blockly.Arduino.definitions_["def_rainsensor_rg15_" + port] = "HYDREON rainsensor_" + port + "(" + port + ");";
Blockly.Arduino.setupCode_["setup_rainsensor_rg15_" + port] = "rainsensor_" + port + ".begin();";
Blockly.Arduino.loopCodeOnce_["loop_rainsensor_rg15_" + port] = "rainsensor_" + port + ".readAllData();"
var code = "rainsensor_" + port + "." + value + "()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* Infineon DPS310 Pressure Sensor
*
*/
Blockly.Arduino.sensebox_sensor_dps310 = function () {
var dropdown_name = this.getFieldValue("NAME");
var code = "";
var referencePressure = this.getFieldValue("referencePressure");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_[
"adafruit_dps310"
] = `#include <Adafruit_DPS310.h> // http://librarymanager/All#Adafruit_DPS310`;
Blockly.Arduino.definitions_["define_dps"] = "Adafruit_DPS310 dps;";
Blockly.Arduino.setupCode_["dps_begin"] = "dps.begin_I2C(0x76);";
Blockly.Arduino.setupCode_["dps_configuration"] = `
dps.configurePressure(DPS310_64HZ, DPS310_64SAMPLES);
dps.configureTemperature(DPS310_64HZ, DPS310_64SAMPLES);
`;
Blockly.Arduino.loopCodeOnce_["dps_events"] =
"sensors_event_t temp_event, pressure_event;";
Blockly.Arduino.loopCodeOnce_["dps_getEvents"] =
"dps.getEvents(&temp_event, &pressure_event);";
switch (dropdown_name) {
case "Temperature":
code = "temp_event.temperature";
break;
case "Pressure":
code = "pressure_event.pressure";
break;
case "Altitude":
code = "dps.readAltitude(" + referencePressure + ")";
break;
default:
code = "";
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
@@ -1,29 +1,40 @@
import * as Blockly from 'blockly/core';
import * as Blockly from "blockly/core";
/**
* Telegram Bot by re:edu
*/
Blockly.Arduino.sensebox_telegram = function (Block) {
let token = Block.getFieldValue('telegram_token');
Blockly['Arduino'].libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly['Arduino'].libraries_['library_telegram'] = `#include <UniversalTelegramBot.h>`
Blockly['Arduino'].functionNames_['WiFiSSLClient'] = 'WiFiSSLClient client;';
Blockly['Arduino'].functionNames_['telegram_objects'] = `#define BOTtoken "${token}" // your Bot Token (Get from Botfather)
let token = Block.getFieldValue("telegram_token");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly["Arduino"].libraries_[
"library_telegram"
] = `#include <UniversalTelegramBot.h>`;
Blockly["Arduino"].functionNames_["WiFiSSLClient"] = "WiFiSSLClient client;";
Blockly["Arduino"].functionNames_[
"telegram_objects"
] = `#define BOTtoken "${token}" // your Bot Token (Get from Botfather)
UniversalTelegramBot bot(BOTtoken, client);`
UniversalTelegramBot bot(BOTtoken, client);`;
let code = '';
let code = "";
return code;
};
Blockly.Arduino.sensebox_telegram_do = function (block) {
var messageProcessing = Blockly.Arduino.statementToCode(block, 'telegram_do', Blockly.Arduino.ORDER_ATOMIC);
var messageProcessing = Blockly.Arduino.statementToCode(
block,
"telegram_do",
Blockly.Arduino.ORDER_ATOMIC
);
Blockly.Arduino.definitions_['telegram_variables'] = `int Bot_mtbs = 1000; //mean time between scan messages
long Bot_lasttime; //last time messages' scan has been done`
Blockly.Arduino.definitions_[
"telegram_variables"
] = `int Bot_mtbs = 1000; //mean time between scan messages
long Bot_lasttime; //last time messages' scan has been done`;
Blockly.Arduino.loopCodeOnce_['sensebox_telegram_loop'] = `if (millis() > Bot_lasttime + Bot_mtbs) {
Blockly.Arduino.loopCodeOnce_[
"sensebox_telegram_loop"
] = `if (millis() > Bot_lasttime + Bot_mtbs) {
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
while(numNewMessages) {
for(int i=0; i<numNewMessages; i++) {
@@ -36,13 +47,17 @@ Blockly.Arduino.sensebox_telegram_do = function (block) {
}
Bot_lasttime = millis();
}`;
var code = '';
var code = "";
return code;
};
Blockly.Arduino.sensebox_telegram_do_on_message = function (block) {
var message = this.getFieldValue('telegram_message');
var stuffToDo = Blockly.Arduino.statementToCode(block, 'telegram_do_on_message', Blockly.Arduino.ORDER_ATOMIC);
var message = this.getFieldValue("telegram_message");
var stuffToDo = Blockly.Arduino.statementToCode(
block,
"telegram_do_on_message",
Blockly.Arduino.ORDER_ATOMIC
);
var code = `
if (text == "${message}") {
${stuffToDo}
@@ -51,7 +66,12 @@ Blockly.Arduino.sensebox_telegram_do_on_message = function (block) {
};
Blockly.Arduino.sensebox_telegram_send = function (block) {
var textToSend = Blockly.Arduino.valueToCode(this, 'telegram_text_to_send', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
var textToSend =
Blockly.Arduino.valueToCode(
this,
"telegram_text_to_send",
Blockly.Arduino.ORDER_ATOMIC
) || '"Keine Eingabe"';
var code = `bot.sendMessage(chat_id, String(${textToSend}), "");\n`;
return code;
};
+106 -19
View File
@@ -1,25 +1,112 @@
import Blockly from 'blockly';
import Blockly from "blockly";
/* Wifi connection and openSenseMap Blocks*/
Blockly.Arduino.sensebox_wifi = function (block) {
var pw = this.getFieldValue('Password');
var ssid = this.getFieldValue('SSID');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['define_network'] = 'Bee* b = new Bee();';
if (pw === "") {
Blockly.Arduino.setupCode_['sensebox_network'] = 'b->connectToWifi("' + ssid + '");\ndelay(1000);';
} else
Blockly.Arduino.setupCode_['sensebox_network'] = 'b->connectToWifi("' + ssid + '","' + pw + '");\ndelay(1000);';
var code = '';
return code;
var pw = this.getFieldValue("Password");
var ssid = this.getFieldValue("SSID");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_WiFi"] = "#include <WiFi101.h>";
Blockly.Arduino.variables_["ssid"] = `char ssid[] = "${ssid}";`;
Blockly.Arduino.variables_["pass"] = `char pass[] = "${pw}";`;
Blockly.Arduino.variables_["wifi_Status"] = "int status = WL_IDLE_STATUS;";
if (pw === "") {
Blockly.Arduino.setupCode_["wifi_begin"] = `
if (WiFi.status() == WL_NO_SHIELD) {
while (true);
}
while (status != WL_CONNECTED) {
status = WiFi.begin(ssid);
delay(5000);
}
`;
} else
Blockly.Arduino.setupCode_["wifi_begin"] = `
if (WiFi.status() == WL_NO_SHIELD) {
while (true);
}
while (status != WL_CONNECTED) {
status = WiFi.begin(ssid, pass);
delay(5000);
}
`;
var code = "";
return code;
};
Blockly.Arduino.sensebox_wifi_status = function () {
var code = "WiFi.status()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_wifi_rssi = function () {
var code = "WiFi.RSSI()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_get_ip = function () {
Blockly.Arduino.definitions_["define_ipadress"] = "IPAddress ip;";
Blockly.Arduino.setupCode_["sensebox_get_ip"] = " ip = WiFi.localIP();";
var code = "ip";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_startap = function (block) {
var ssid = this.getFieldValue('SSID');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['define_network'] = 'Bee* b = new Bee();';
Blockly.Arduino.setupCode_['sensebox_network'] = 'b->startAP("' + ssid + '");'
var code = '';
return code;
};
var ssid = this.getFieldValue("SSID");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_WiFi"] = "#include <WiFi101.h>";
Blockly.Arduino.setupCode_["wifi_startAP"] = `WiFi.beginAP(${ssid});`;
var code = "";
return code;
};
Blockly.Arduino.sensebox_ethernet = function () {
var ip = this.getFieldValue("ip");
var gateway = this.getFieldValue("gateway");
var subnetmask = this.getFieldValue("subnetmask");
var dns = this.getFieldValue("dns");
var mac = this.getFieldValue("mac");
var dhcp = this.getFieldValue("dhcp");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_ethernet"] =
"#include <Ethernet.h> // http://librarymanager/All#Ethernet";
Blockly.Arduino.definitions_["ethernet_config"] = `
byte mac[] = { ${mac}};`;
if (dhcp === "Manual") {
Blockly.Arduino.definitions_["ethernet_manual_config"] = `
//Configure static IP setup (only needed if DHCP is disabled)
IPAddress myIp(${ip.replaceAll(".", ", ")});
IPAddress myDns(${dns.replaceAll(".", ",")});
IPAddress myGateway(${gateway.replaceAll(".", ",")});
IPAddress mySubnet(${subnetmask.replaceAll(".", ",")});
`;
Blockly.Arduino.setupCode_["ethernet_setup"] = `
Ethernet.init(23);
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
// no point in carrying on, so do nothing forevermore:
// try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, myIp);
}
// give the Ethernet shield a second to initialize:
delay(1000);
`;
} else {
Blockly.Arduino.setupCode_["ethernet_setup"] = `
Ethernet.init(23);
// start the Ethernet connection:
Ethernet.begin(mac);
// give the Ethernet shield a second to initialize:
delay(1000);
`;
}
var code = "";
return code;
};
Blockly.Arduino.sensebox_ethernetIp = function () {
var code = "Ethernet.localIP()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
@@ -0,0 +1,35 @@
import * as Blockly from "blockly/core";
Blockly.Arduino["print_serial_monitor"] = function (block) {
var serialId = block.getFieldValue("SERIAL_ID");
var content =
Blockly.Arduino.valueToCode(
block,
"CONTENT",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var checkbox_name = block.getFieldValue("NEW_LINE") === "TRUE";
var code = "";
if (checkbox_name) {
code = serialId + ".println(" + content + ");\n";
} else {
code = serialId + ".print(" + content + ");\n";
}
return code;
};
/**
* Code generator for block for setting the serial com speed.
* Arduino code: setup{ Serial.begin(X); }
* @param {!Blockly.Block} block Block to generate the code from.
* @return {array} Completed code.
*/
Blockly.Arduino["init_serial_monitor"] = function (block) {
var serialId = block.getFieldValue("SERIAL_ID");
var serialSpeed = block.getFieldValue("SPEED");
Blockly.Arduino.setupCode_[
"init_serial"
] = `${serialId}.begin(${serialSpeed});`;
var code = "";
return code;
};
+60 -47
View File
@@ -1,5 +1,4 @@
import * as Blockly from 'blockly/core';
import * as Blockly from "blockly/core";
/**
* Code generator for a literal String (X).
@@ -7,12 +6,11 @@ import * as Blockly from 'blockly/core';
* @param {!Blockly.Block} block Block to generate the code from.
* @return {array} Completed code with order of operation.
*/
Blockly.Arduino['text'] = function (block) {
var code = Blockly.Arduino.quote_(block.getFieldValue('TEXT'));
return [code, Blockly.Arduino.ORDER_ATOMIC];
Blockly.Arduino["text"] = function (block) {
var code = Blockly.Arduino.quote_(block.getFieldValue("TEXT"));
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* Code generator for a String concatenation (X...Y). This string can be made
* up of any number of elements of any type.
@@ -22,30 +20,37 @@ Blockly.Arduino['text'] = function (block) {
* @param {!Blockly.Block} block Block to generate the code from.
* @return {array} Completed code with order of operation.
*/
Blockly.Arduino['text_join'] = function (block) {
var code;
if (block.itemCount_ === 0) {
return ['""', Blockly.Arduino.ORDER_ATOMIC];
} else if (block.itemCount_ === 1) {
var argument0 = Blockly.Arduino.valueToCode(block, 'ADD0',
Blockly.Arduino.ORDER_UNARY_POSTFIX) || '""';
code = 'String(' + argument0 + ')';
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
} else {
var argument;
code = [];
for (var n = 0; n < block.itemCount_; n++) {
argument = Blockly.Arduino.valueToCode(
block, 'ADD' + n, Blockly.Arduino.ORDER_NONE);
if (argument === '') {
code[n] = '""';
} else {
code[n] = 'String(' + argument + ')';
}
}
code = code.join(' + ');
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
Blockly.Arduino["text_join"] = function (block) {
var code;
if (block.itemCount_ === 0) {
return ['""', Blockly.Arduino.ORDER_ATOMIC];
} else if (block.itemCount_ === 1) {
var argument0 =
Blockly.Arduino.valueToCode(
block,
"ADD0",
Blockly.Arduino.ORDER_UNARY_POSTFIX
) || '""';
code = "String(" + argument0 + ")";
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
} else {
var argument;
code = [];
for (var n = 0; n < block.itemCount_; n++) {
argument = Blockly.Arduino.valueToCode(
block,
"ADD" + n,
Blockly.Arduino.ORDER_NONE
);
if (argument === "") {
code[n] = '""';
} else {
code[n] = "String(" + argument + ")";
}
}
code = code.join(" + ");
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
}
};
/**
@@ -55,18 +60,23 @@ Blockly.Arduino['text_join'] = function (block) {
* @param {!Blockly.Block} block Block to generate the code from.
* @return {string} Completed code.
*/
Blockly.Arduino['text_append'] = function (block) {
// Append to a variable in place.
var varName = Blockly.Arduino.variableDB_.getName(
block.getFieldValue('VAR'), Blockly.Variables.NAME_TYPE);
var argument0 = Blockly.Arduino.valueToCode(block, 'TEXT',
Blockly.Arduino.ORDER_UNARY_POSTFIX);
if (argument0 === '') {
argument0 = '""';
} else {
argument0 = 'String(' + argument0 + ')';
}
return varName + ' += ' + argument0 + ';\n';
Blockly.Arduino["text_append"] = function (block) {
// Append to a variable in place.
var varName = Blockly.Arduino.nameDB_.getName(
block.getFieldValue("VAR"),
Blockly.Variables.NAME_TYPE
);
var argument0 = Blockly.Arduino.valueToCode(
block,
"TEXT",
Blockly.Arduino.ORDER_UNARY_POSTFIX
);
if (argument0 === "") {
argument0 = '""';
} else {
argument0 = "String(" + argument0 + ")";
}
return varName + " += " + argument0 + ";\n";
};
/**
@@ -76,10 +86,13 @@ Blockly.Arduino['text_append'] = function (block) {
* @param {!Blockly.Block} block Block to generate the code from.
* @return {array} Completed code with order of operation.
*/
Blockly.Arduino['text_length'] = function (block) {
var argument0 = Blockly.Arduino.valueToCode(block, 'VALUE',
Blockly.Arduino.ORDER_UNARY_POSTFIX) || '""';
var code = 'String(' + argument0 + ').length()';
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
Blockly.Arduino["text_length"] = function (block) {
var argument0 =
Blockly.Arduino.valueToCode(
block,
"VALUE",
Blockly.Arduino.ORDER_UNARY_POSTFIX
) || '""';
var code = "String(" + argument0 + ").length()";
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
};
+58 -28
View File
@@ -1,4 +1,4 @@
import Blockly from 'blockly';
import Blockly from "blockly";
/**
* @license Licensed under the Apache License, Version 2.0 (the "License"):
@@ -16,11 +16,15 @@ import Blockly from 'blockly';
* @param {!Blockly.Block} block Block to generate the code from.
* @return {string} Completed code.
*/
Blockly.Arduino['time_delay'] = function (block) {
var delayTime = Blockly.Arduino.valueToCode(
block, 'DELAY_TIME_MILI', Blockly.Arduino.ORDER_ATOMIC) || '0';
var code = 'delay(' + delayTime + ');\n';
return code;
Blockly.Arduino["time_delay"] = function (block) {
var delayTime =
Blockly.Arduino.valueToCode(
block,
"DELAY_TIME_MILI",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var code = "delay(" + delayTime + ");\n";
return code;
};
/**
@@ -29,11 +33,15 @@ Blockly.Arduino['time_delay'] = function (block) {
* @param {!Blockly.Block} block Block to generate the code from.
* @return {string} Completed code.
*/
Blockly.Arduino['time_delaymicros'] = function (block) {
var delayTimeMs = Blockly.Arduino.valueToCode(
block, 'DELAY_TIME_MICRO', Blockly.Arduino.ORDER_ATOMIC) || '0';
var code = 'delayMicroseconds(' + delayTimeMs + ');\n';
return code;
Blockly.Arduino["time_delaymicros"] = function (block) {
var delayTimeMs =
Blockly.Arduino.valueToCode(
block,
"DELAY_TIME_MICRO",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var code = "delayMicroseconds(" + delayTimeMs + ");\n";
return code;
};
/**
@@ -42,9 +50,9 @@ Blockly.Arduino['time_delaymicros'] = function (block) {
* @param {!Blockly.Block} block Block to generate the code from.
* @return {array} Completed code with order of operation.
*/
Blockly.Arduino['time_millis'] = function (block) {
var code = 'millis()';
return [code, Blockly.Arduino.ORDER_ATOMIC];
Blockly.Arduino["time_millis"] = function (block) {
var code = "millis()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
@@ -53,9 +61,9 @@ Blockly.Arduino['time_millis'] = function (block) {
* @param {!Blockly.Block} block Block to generate the code from.
* @return {array} Completed code with order of operation.
*/
Blockly.Arduino['time_micros'] = function (block) {
var code = 'micros()';
return [code, Blockly.Arduino.ORDER_ATOMIC];
Blockly.Arduino["time_micros"] = function (block) {
var code = "micros()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
@@ -64,17 +72,39 @@ Blockly.Arduino['time_micros'] = function (block) {
* @param {!Blockly.Block} block Block to generate the code from.
* @return {string} Completed code.
*/
Blockly.Arduino['infinite_loop'] = function (block) {
return 'while(true);\n';
Blockly.Arduino["infinite_loop"] = function (block) {
return "while(true);\n";
};
// Blockly.Arduino.sensebox_interval_timer = function (block) {
// var interval = this.getFieldValue("interval");
// Blockly.Arduino.variables_["define_interval_variables"] =
// "const long interval = " +
// interval +
// ";\nlong time_start = 0;\nlong time_actual = 0;";
// var branch = Blockly.Arduino.statementToCode(block, "DO");
// var code = "time_start = millis();\n";
// code +=
// "if (time_start > time_actual + interval) {\n time_actual = millis();\n";
// code += branch;
// code += "}\n";
// return code;
// };
Blockly.Arduino.sensebox_interval_timer = function (block) {
var interval = this.getFieldValue('interval');
Blockly.Arduino.variables_['define_interval_variables'] = 'const long interval = ' + interval + ';\nlong time_start = 0;\nlong time_actual = 0;';
var branch = Blockly.Arduino.statementToCode(block, 'DO');
var code = 'time_start = millis();\n';
code += 'if (time_start > time_actual + interval) {\n time_actual = millis();\n'
code += branch;
code += '}\n'
return code;
};
var intervalTime = this.getFieldValue("interval");
var intervalName = this.getFieldValue("name");
Blockly.Arduino.variables_[`define_interval_variables${intervalName}`] = `
const long interval${intervalName} = ${intervalTime};
long time_start${intervalName} = 0;
long time_actual${intervalName} = 0;`;
Blockly.Arduino.loopCodeOnce_[
`interval_loop${intervalName}`
] = `time_start${intervalName} = millis();\n`;
var branch = Blockly.Arduino.statementToCode(block, "DO");
var code = `
if (time_start${intervalName} > time_actual${intervalName} + interval${intervalName}) {\n time_actual${intervalName} = millis();\n`;
code += branch;
code += "}\n";
return code;
};
@@ -2,7 +2,7 @@ import Blockly from "blockly";
const setVariableFunction = function (defaultValue) {
return function (block) {
const variableName = Blockly["Arduino"].variableDB_.getName(
const variableName = Blockly["Arduino"].nameDB_.getName(
block.getFieldValue("VAR"),
Blockly.Variables.NAME_TYPE
);
@@ -48,7 +48,7 @@ const setVariableFunction = function (defaultValue) {
};
const getVariableFunction = function (block) {
const variableName = Blockly["Arduino"].variableDB_.getName(
const variableName = Blockly["Arduino"].nameDB_.getName(
block.getFieldValue("VAR"),
Blockly.Variables.NAME_TYPE
);
@@ -0,0 +1,16 @@
import * as Blockly from "blockly/core";
Blockly.Arduino.watchdog_enable = function () {
var time = this.getFieldValue("TIME");
Blockly.Arduino.libraries_["Adafruit_sleepydog"] =
"#include <Adafruit_SleepyDog.h> // http://librarymanager/All#Adafruit_SleepyDog_Library";
Blockly.Arduino.setupCode_["watchdog_enable"] = `Watchdog.enable(${time});`;
var code = "";
return code;
};
Blockly.Arduino.watchdog_reset = function () {
var code = "Watchdog.reset();";
return code;
};
+95 -76
View File
@@ -1,114 +1,133 @@
import Blockly from 'blockly';
import Blockly from "blockly";
/**
* Webserver Blocks by Lucas Steinmann
*
*
*/
Blockly.Arduino.sensebox_initialize_http_server = function (block) {
var box_id = this.getFieldValue('Port');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.codeFunctions_['define_wifi_server'] = 'WiFiServer server(' + box_id + ');';
Blockly.Arduino.setupCode_['sensebox_wifi_server_beging'] = 'server.begin();';
return '';
var box_id = this.getFieldValue("Port");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_http"] = "#include <WebUtil.h>";
Blockly.Arduino.codeFunctions_["define_wifi_server"] =
"WiFiServer server(" + box_id + ");";
Blockly.Arduino.setupCode_["sensebox_wifi_server_beging"] = "server.begin();";
return "";
};
Blockly.Arduino.sensebox_http_on_client_connect = function (block) {
var onConnect = Blockly.Arduino.statementToCode(block, 'ON_CONNECT');
var code = '';
code += 'WiFiClient client = server.available();\n';
code += 'if (client && client.available()) {\n';
code += ' String request_string = listenClient(client);\n';
code += ' Request request;\n';
code += ' if (parseRequestSafe(request_string, request)) {\n';
code += onConnect;
code += ' }\n';
code += ' delay(1);\n';
code += ' client.stop();\n';
code += ' delay(1);\n';
code += '}\n';
return code;
var onConnect = Blockly.Arduino.statementToCode(block, "ON_CONNECT");
var code = "";
code += "WiFiClient client = server.available();\n";
code += "if (client && client.available()) {\n";
code += " String request_string = listenClient(client);\n";
code += " Request request;\n";
code += " if (parseRequestSafe(request_string, request)) {\n";
code += onConnect;
code += " }\n";
code += " delay(1);\n";
code += " client.stop();\n";
code += " delay(1);\n";
code += "}\n";
return code;
};
Blockly.Arduino.sensebox_http_method = function (block) {
var code = "request.method";
return [code, Blockly.Arduino.ORDER_ATOMIC];
var code = "request.method";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_http_uri = function (block) {
var code = "request.uri";
return [code, Blockly.Arduino.ORDER_ATOMIC];
var code = "request.uri";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_http_protocol_version = function (block) {
var code = "request.protocol_version";
return [code, Blockly.Arduino.ORDER_ATOMIC];
var code = "request.protocol_version";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_http_user_agent = function (block) {
var code = "request.user_agent";
return [code, Blockly.Arduino.ORDER_ATOMIC];
var code = "request.user_agent";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_generate_html_doc = function (block) {
var header = Blockly.Arduino.valueToCode(block, 'HEADER', Blockly.Arduino.ORDER_NONE) || '""';
var body = Blockly.Arduino.valueToCode(block, 'BODY', Blockly.Arduino.ORDER_NONE) || '""';
var code = 'buildHTML(' + header + ', ' + body + ')';
return [code, Blockly.Arduino.ORDER_ATOMIC];
var header =
Blockly.Arduino.valueToCode(block, "HEADER", Blockly.Arduino.ORDER_NONE) ||
'""';
var body =
Blockly.Arduino.valueToCode(block, "BODY", Blockly.Arduino.ORDER_NONE) ||
'""';
var code = "buildHTML(" + header + ", " + body + ")";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_generate_http_succesful_response = function (block) {
var content = Blockly.Arduino.valueToCode(block, 'CONTENT', Blockly.Arduino.ORDER_NONE) || '""';
var code = 'client.println(buildSuccessfulResponse(request, ' + content + '));\n';
return code;
var content =
Blockly.Arduino.valueToCode(block, "CONTENT", Blockly.Arduino.ORDER_NONE) ||
'""';
var code =
"client.println(buildSuccessfulResponse(request, " + content + "));\n";
return code;
};
Blockly.Arduino.sensebox_generate_http_not_found_response = function (block) {
var code = 'client.println(buildNotFoundResponse(request));\n';
return code;
var code = "client.println(buildNotFoundResponse(request));\n";
return code;
};
Blockly.Arduino.sensebox_ip_address = function (block) {
var code = "b->getIpAddress()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
var code = "b->getIpAddress()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_general_html_tag = function (block) {
var tag = this.getFieldValue('TAG');
var code = 'buildTag("' + tag + '",';
var n = 0;
var branch = Blockly.Arduino.valueToCode(block, 'DO' + n, Blockly.Arduino.ORDER_NONE);
if (branch.length > 0) {
code += '\n ' + branch;
} else {
code += '""';
}
for (n = 1; n <= block.additionalChildCount_; n++) {
branch = Blockly.Arduino.valueToCode(block, 'DO' + n, Blockly.Arduino.ORDER_NONE);
code += ' +' + branch;
}
return [code + ')', Blockly.Arduino.ORDER_ATOMIC];
var tag = this.getFieldValue("TAG");
var code = 'buildTag("' + tag + '",';
var n = 0;
var branch = Blockly.Arduino.valueToCode(
block,
"DO" + n,
Blockly.Arduino.ORDER_NONE
);
if (branch.length > 0) {
code += "\n " + branch;
} else {
code += '""';
}
for (n = 1; n <= block.additionalChildCount_; n++) {
branch = Blockly.Arduino.valueToCode(
block,
"DO" + n,
Blockly.Arduino.ORDER_NONE
);
code += " +" + branch;
}
return [code + ")", Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_web_readHTML = function (block) {
var filename = this.getFieldValue('FILENAME');
Blockly.Arduino.libraries_['library_spi'] = '#include <SPI.h>';
Blockly.Arduino.libraries_['library_sd'] = '#include <SD.h>';
Blockly.Arduino.codeFunctions_['define_sd' + filename] = 'File webFile;';
Blockly.Arduino.setupCode_['sensebox_sd'] = 'SD.begin(28);';
var func = [
'String generateHTML(){',
' webFile = SD.open("' + filename + '", FILE_READ);',
' String finalString ="";',
' while (webFile.available())',
' {',
' finalString+=(char)webFile.read();',
' }',
' return finalString;',
'}'];
var functionName = Blockly.Arduino.addFunction(
'generateHTML', func.join('\n'));
var code = functionName + '()';
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
var filename = this.getFieldValue("FILENAME");
Blockly.Arduino.libraries_["library_spi"] = "#include <SPI.h>";
Blockly.Arduino.libraries_["library_sd"] = "#include <SD.h>";
Blockly.Arduino.codeFunctions_["define_sd" + filename] = "File webFile;";
Blockly.Arduino.setupCode_["sensebox_sd"] = "SD.begin(28);";
var func = [
"String generateHTML(){",
' webFile = SD.open("' + filename + '", FILE_READ);',
' String finalString ="";',
" while (webFile.available())",
" {",
" finalString+=(char)webFile.read();",
" }",
" return finalString;",
"}",
];
var functionName = Blockly.Arduino.addFunction(
"generateHTML",
func.join("\n")
);
var code = functionName + "()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
+122 -35
View File
@@ -3,42 +3,129 @@
*
*/
const sensebox_mcu = {
description: 'senseBox Microcontroller Unit based on Microchip SAMD21G18A',
compilerFlag: 'arduino:samd',
digitalPins: [['D1', '1'], ['D2', '2'], ['D3', '3'], ['D4', '4'], ['D5', '5'], ['D6', '6']],
digitalPinsLED: [['BUILTIN_1', '7'], ['BUILTIN_2', '8'], ['D1', '1'], ['D2', '2'], ['D3', '3'], ['D4', '4'], ['D5', '5'], ['D6', '6']],
digitalPinsButton: [['on Board', '0'], ['D1', '1'], ['D2', '2'], ['D3', '3'], ['D4', '4'], ['D5', '5'], ['D6', '6']],
pwmPins: [['D1', '1'], ['D2', '2'], ['D3', '3'], ['D4', '4'], ['D5', '5'], ['D6', '6']],
serial: [['serial', 'SerialUSB'], ['serial_1', 'Serial1'], ['serial_2', 'Serial2']],
serialPins: {
SerialUSB: [['RX', ''], ['TX', '']],
Serial1: [['RX', '11'], ['TX', '10']],
Serial2: [['RX', '13'], ['TX', '12']]
},
serialSpeed: [['300', '300'], ['600', '600'], ['1200', '1200'],
['2400', '2400'], ['4800', '4800'], ['9600', '9600'],
['14400', '14400'], ['19200', '19200'], ['28800', '28800'],
['31250', '31250'], ['38400', '38400'], ['57600', '57600'],
['115200', '115200']],
spi: [['SPI', 'SPI']],
spiPins: { SPI: [['MOSI', '19'], ['MISO', '21'], ['SCK', '20']] },
spiClockDivide: [['2 (8MHz)', 'SPI_CLOCK_DIV2'],
['4 (4MHz)', 'SPI_CLOCK_DIV4'],
['8 (2MHz)', 'SPI_CLOCK_DIV8'],
['16 (1MHz)', 'SPI_CLOCK_DIV16'],
['32 (500KHz)', 'SPI_CLOCK_DIV32'],
['64 (250KHz)', 'SPI_CLOCK_DIV64'],
['128 (125KHz)', 'SPI_CLOCK_DIV128']],
i2c: [['I2C', 'Wire']],
i2cPins: { Wire: [['SDA', '17'], ['SCL', '16']] },
i2cSpeed: [['100kHz', '100000L'], ['400kHz', '400000L']],
builtinLed: [['BUILTIN_1', '7'], ['BUILTIN_2', '8']],
interrupt: [['interrupt1', '1'], ['interrupt2', '2'], ['interrupt3', '3'], ['interrupt4', '4'], ['interrupt5', '5'], ['interrupt6', '6']],
analogPins: [['A1', 'A1'], ['A2', 'A2'], ['A3', 'A3'], ['A4', 'A4'], ['A5', 'A5'], ['A6', 'A6']],
serial_baud_rate: 9600,
parseKey: '_*_'
description: "senseBox Microcontroller Unit based on Microchip SAMD21G18A",
compilerFlag: "arduino:samd",
digitalPins: [
["A1", "1"],
["A2", "2"],
["B3", "3"],
["B4", "4"],
["C5", "5"],
["C6", "6"],
],
digitalPinsLED: [
["BUILTIN_1", "7"],
["BUILTIN_2", "8"],
["A1", "1"],
["A2", "2"],
["B3", "3"],
["B4", "4"],
["C5", "5"],
["C6", "6"],
],
digitalPinsButton: [
["on Board", "0"],
["A1", "1"],
["A2", "2"],
["B3", "3"],
["B4", "4"],
["C5", "5"],
["C6", "6"],
],
pwmPins: [
["A1", "1"],
["A2", "2"],
["B3", "3"],
["B4", "4"],
["C5", "5"],
["C6", "6"],
],
serial: [
["serial", "SerialUSB"],
["serial_1", "Serial1"],
["serial_2", "Serial2"],
],
serialPins: {
SerialUSB: [
["RX", ""],
["TX", ""],
],
Serial1: [
["RX", "11"],
["TX", "10"],
],
Serial2: [
["RX", "13"],
["TX", "12"],
],
},
serialSpeed: [
["300", "300"],
["600", "600"],
["1200", "1200"],
["2400", "2400"],
["4800", "4800"],
["9600", "9600"],
["14400", "14400"],
["19200", "19200"],
["28800", "28800"],
["31250", "31250"],
["38400", "38400"],
["57600", "57600"],
["115200", "115200"],
],
spi: [["SPI", "SPI"]],
spiPins: {
SPI: [
["MOSI", "19"],
["MISO", "21"],
["SCK", "20"],
],
},
spiClockDivide: [
["2 (8MHz)", "SPI_CLOCK_DIV2"],
["4 (4MHz)", "SPI_CLOCK_DIV4"],
["8 (2MHz)", "SPI_CLOCK_DIV8"],
["16 (1MHz)", "SPI_CLOCK_DIV16"],
["32 (500KHz)", "SPI_CLOCK_DIV32"],
["64 (250KHz)", "SPI_CLOCK_DIV64"],
["128 (125KHz)", "SPI_CLOCK_DIV128"],
],
i2c: [["I2C", "Wire"]],
i2cPins: {
Wire: [
["SDA", "17"],
["SCL", "16"],
],
},
i2cSpeed: [
["100kHz", "100000L"],
["400kHz", "400000L"],
],
builtinLed: [
["BUILTIN_1", "7"],
["BUILTIN_2", "8"],
],
interrupt: [
["interrupt1", "1"],
["interrupt2", "2"],
["interrupt3", "3"],
["interrupt4", "4"],
["interrupt5", "5"],
["interrupt6", "6"],
],
analogPins: [
["A1", "A1"],
["A2", "A2"],
["B3", "A3"],
["B4", "A4"],
["C5", "A5"],
["C6", "A6"],
],
serial_baud_rate: 9600,
parseKey: "_*_",
};
export const selectedBoard = () => {
return sensebox_mcu;
return sensebox_mcu;
};
+1
View File
@@ -11,6 +11,7 @@ const colours = {
audio: 250,
arrays: 33,
mqtt: 90,
serial: 230,
webserver: 40,
phyphox: 25,
};
@@ -0,0 +1,21 @@
/**
* To limit number of specific blocks in the workspace add block name and number of maxInstances here.
*
*/
const maxInstances = {
sensebox_wifi: 1,
sensebox_startap: 1,
sensebox_display_beginDisplay: 1,
sensebox_telegram: 1,
sensebox_telegram_do: 1,
sensebox_osem_connection: 1,
sensebox_lora_initialize_otaa: 1,
sensebox_lora_initialize_abp: 1,
sensebox_phyphox_init: 1,
sensebox_ethernet: 1,
};
export const getMaxInstances = () => {
return maxInstances;
};
+13 -11
View File
@@ -1,10 +1,10 @@
export const FAQ = {
/**
* FAQ
*/
/**
* FAQ
*/
faq_q1_question: `Wie kann ich mein Programm auf die senseBox kopieren?`,
faq_q1_answer: `Um Programme auf die senseBox zu kopieren wird diese mit dem Micro USB Kabel an den Computer angeschlossen. Mache anschließend auf der senseBox MCU einen Doppelklick auf den roten Reset Button. Die senseBox wird nun als Wechseldatenträger an deinem Computer erkannt und die zuvor erstellen Programm können per Drag & Drop kopiert werden. Nach jeder Änderung des Programmcodes muss das Programm neu kompiliert und übertragen werden
faq_q1_question: `Wie kann ich mein Programm auf die senseBox kopieren?`,
faq_q1_answer: `Um Programme auf die senseBox zu kopieren wird diese mit dem Micro USB Kabel an den Computer angeschlossen. Mache anschließend auf der senseBox MCU einen Doppelklick auf den roten Reset Button. Die senseBox wird nun als Wechseldatenträger an deinem Computer erkannt und die zuvor erstellen Programm können per Drag & Drop kopiert werden. Nach jeder Änderung des Programmcodes muss das Programm neu kompiliert und übertragen werden
#### Lernmodus der MCU aktivieren
<iframe width="560" height="315" src="https://www.youtube.com/embed/jzlOJ7Zuqqw" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
@@ -14,14 +14,16 @@ Das Kopieren der Programme unter MacOS funktioniert nicht über den Finder, es g
- [muCommander](https://www.mucommander.com/)
`,
faq_q2_question: `Mit welcher senseBox ist die Programmierumgebung kompatibel?`,
faq_q2_answer: `
faq_q2_question: `Mit welcher senseBox ist die Programmierumgebung kompatibel?`,
faq_q2_answer: `
Grundsätzlich kann die Programmierumgebung mit jeder senseBox mit senseBox MCU verwendet werden.
`,
faq_q3_question: `Ich habe einen Fehler gefunden oder etwas funktioniert nicht. Wo kann ich diesen melden?`,
faq_q3_answer: `
faq_q3_question: `Ich habe einen Fehler gefunden oder etwas funktioniert nicht. Wo kann ich diesen melden?`,
faq_q3_answer: `
Am besten legst du dazu ein Issue auf [Github](https://github.com/sensebox/React-Ardublockly/issues) an. Alternativ kannst du uns auch eine Email an info(at)sensebox.de senden
`,
}
faq_tablet_question: `Kann ich die senseBox auch über ein Tablet programmieren?`,
faq_tablet_answer: `Ja! Installiere dazu die senseBox Connect App aus dem App Store und rufe die Learn- und Programmierumgebung in deinem Browser am Tablet auf. Genaue Informationen zur Verwendung der App findest du unter [https://sensebox.de/app](https://sensebox.de/app)`,
};
+117 -107
View File
@@ -1,108 +1,118 @@
export const IO = {
ARD_ANALOGREAD: "lese analogen Pin#",
ARD_ANALOGREAD_TIP: "Gibt einen Wert zwischen 0 und 1024 zurüch",
ARD_ANALOGWRITE: "setzte analogen Pin#",
ARD_ANALOGWRITE_TIP: "Schreibe analogen Wert zwischen 0 und 255 an einen spezifischen PWM Port",
ARD_BUILTIN_LED: "eingebaute LED",
ARD_BUILTIN_LED_TIP: "Schaltet die interne LED An oder Aus",
ARD_COMPONENT_WARN1: "A %1 configuration block with the same %2 name must be added to use this block!",
ARD_DEFINE: "Definiere",
ARD_DIGITALREAD: "lesen digitalen Pin#",
ARD_DIGITALREAD_TIP: "Lese Wert an digitalen Pin: HIGH(1) oder LOW(0)",
ARD_DIGITALWRITE: "setzte digitalen Pin#",
ARD_DIGITALWRITE_TIP: "Schreibe digitalen Wert HIGH (1) oder LOW(0) an spezifischen Port",
ARD_FUN_RUN_LOOP: "Endlosschleife()",
ARD_FUN_RUN_SETUP: "Setup()",
ARD_FUN_RUN_TIP: "Definiert die setup() und loop() Funktionen. Die setup()-Funktion wird beim starten **einmal** ausgeführt. Anschließend wir die loop()-Funktion in einer **Endlosschleife** ausgeführt. Füge in die Setup()-Funktion Blöcke ein, um z.B. das Display zu initalisieren, eine Verbindung zum WiFi-Netzwerk herzustellen oder um die LoRa Verbindung zu initialsieren.",
ARD_HIGH: "HIGH",
ARD_HIGHLOW_TIP: "Setzt einen Status auf HIGH oder LOWSet a pin state logic High or Low.",
ARD_LOW: "LOW",
ARD_MAP: "Verteile Wert",
ARD_MAP_FROMMIN: "von Minimum",
ARD_MAP_FROMMAX: "bis maximum",
ARD_MAP_TOMIN: "auf Minimum",
ARD_MAP_TOMAX: "bis Maximum",
ARD_MAP_TIP: "Verteilt Werte zwischen [0-1024] zu andere.",
ARD_MAP_VAL: "Wert zu [0-",
ARD_NOTONE: "Schalte Ton aus an Pin",
ARD_NOTONE_PIN: "keinen Ton an Pin",
ARD_NOTONE_PIN_TIP: "Stoppe die Tonerzeugung an Pin",
ARD_NOTONE_TIP: "Schaltet den Ton am ausgewählten Pin aus",
ARD_PIN_WARN1: "Pin %1 wird benötigt für %2 als Pin %3. Bereitsgenutzt als %4.",
ARD_PULSETIMEOUT_TIP: "Misst die Laufzeit eines Impulses am ausgewählten Pin, wenn die Zeit ist in Microsekunden.",
ARD_PULSE_READ: "Misst %1 Impuls an Pin #%2",
ARD_PULSE_READ_TIMEOUT: "Misst %1 Impuls an Pin #%2 (Unterbrechung nach %3 μs)",
ARD_PULSE_TIP: "Misst die Zeit eines Impulses an dem ausgewählten Pin.",
ARD_SERIAL_BPS: "bps",
ARD_SERIAL_PRINT: "schreibe",
ARD_SERIAL_PRINT_NEWLINE: "neue Zeile hinzufügen",
ARD_SERIAL_PRINT_TIP: "Prints data to the console/serial port as human-readable ASCII text.", // untranslated
ARD_SERIAL_PRINT_WARN: "A setup block for %1 must be added to the workspace to use this block!", // untranslated
ARD_SERIAL_SETUP: "Setup",
ARD_SERIAL_SETUP_TIP: "Selects the speed for a specific Serial peripheral", // untranslated
ARD_SERIAL_SPEED: ": Übertragungsgeschwindigkeit zu",
ARD_SERVO_READ: "liest SERVO an PIN#",
ARD_SERVO_READ_TIP: "Liest den Winkel des Servomotors aus",
ARD_SERVO_WRITE: "setzt SERVO an Pin",
ARD_SERVO_WRITE_DEG_180: "Winkel (0~180)",
ARD_SERVO_WRITE_TIP: "Set a Servo to an specified angle", // untranslated
ARD_SERVO_WRITE_TO: "", // untranslated
ARD_SETTONE: "Spiele Ton an Pin", // untranslated
ARD_SPI_SETUP: "Setup",
ARD_SPI_SETUP_CONF: "Konfiguration:",
ARD_SPI_SETUP_DIVIDE: "clock divide", // untranslated
ARD_SPI_SETUP_LSBFIRST: "LSBFIRST", // untranslated
ARD_SPI_SETUP_MODE: "SPI mode (idle - edge)", // untranslated
ARD_SPI_SETUP_MODE0: "0 (LOW - Fallend)",
ARD_SPI_SETUP_MODE1: "1 (LOW - Steigend)",
ARD_SPI_SETUP_MODE2: "2 (HIGH - Fallend)",
ARD_SPI_SETUP_MODE3: "3 (HIGH - Steigend)",
ARD_SPI_SETUP_MSBFIRST: "MSBFIRST", // untranslated
ARD_SPI_SETUP_SHIFT: "data shift", // untranslated
ARD_SPI_SETUP_TIP: "Configures the SPI peripheral.", // untranslated
ARD_SPI_TRANSRETURN_TIP: "Send a SPI message to an specified slave device and get data back.", // untranslated
ARD_SPI_TRANS_NONE: "none", // untranslated
ARD_SPI_TRANS_SLAVE: "to slave pin", // untranslated
ARD_SPI_TRANS_TIP: "Send a SPI message to an specified slave device.", // untranslated
ARD_SPI_TRANS_VAL: "transfer", // untranslated
ARD_SPI_TRANS_WARN1: "A setup block for %1 must be added to the workspace to use this block!", // untranslated
ARD_SPI_TRANS_WARN2: "Old pin value %1 is no longer available.", // untranslated
ARD_STEPPER_COMPONENT: "stepper", // untranslated
ARD_STEPPER_DEFAULT_NAME: "MyStepper", // untranslated
ARD_STEPPER_FOUR_PINS: "4", // untranslated
ARD_STEPPER_MOTOR: "stepper motor:", // untranslated
ARD_STEPPER_NUMBER_OF_PINS: "Number of pins", // untranslated
ARD_STEPPER_PIN1: "pin1#", // untranslated
ARD_STEPPER_PIN2: "pin2#", // untranslated
ARD_STEPPER_PIN3: "pin3#", // untranslated
ARD_STEPPER_PIN4: "pin4#", // untranslated
ARD_STEPPER_REVOLVS: "how many steps per revolution", // untranslated
ARD_STEPPER_SETUP: "Setup stepper motor", // untranslated
ARD_STEPPER_SETUP_TIP: "Configures a stepper motor pinout and other settings.", // untranslated
ARD_STEPPER_SPEED: "set speed (rpm) to", // untranslated
ARD_STEPPER_STEP: "move stepper", // untranslated
ARD_STEPPER_STEPS: "steps", // untranslated
ARD_STEPPER_STEP_TIP: "Turns the stepper motor a specific number of steps.", // untranslated
ARD_STEPPER_TWO_PINS: "2", // untranslated
ARD_TYPE_ARRAY: "Array",
ARD_TYPE_BOOL: "Boolean",
ARD_TYPE_CHAR: "Zeichen",
ARD_TYPE_CHILDBLOCKMISSING: "ChildBlockMissing", // untranslated
ARD_TYPE_DECIMAL: "Dezimalzahl",
ARD_TYPE_LONG: "große Zahl",
ARD_TYPE_NULL: "Null",
ARD_TYPE_NUMBER: "Zahl",
ARD_TYPE_SHORT: "kurze Zahl",
ARD_TYPE_TEXT: "Text",
ARD_TYPE_UNDEF: "Undefiniert",
ARD_VAR_AS: "als",
ARD_VAR_AS_TIP: "Wert einem spezififischen Datentyp zuordnen",
ARD_WRITE_TO: "zu",
NEW_INSTANCE: "Neue Instanz...",
NEW_INSTANCE_TITLE: "Neue Instanz mit Name:",
RENAME_INSTANCE: "Instanz umbenennen...",
RENAME_INSTANCE_TITLE: "Benenne alle '%1' Instanzen zu:",
}
ARD_ANALOGREAD: "lese analogen Pin#",
ARD_ANALOGREAD_TIP: "Gibt einen Wert zwischen 0 und 1023 zurück",
ARD_ANALOGWRITE: "setzte analogen Pin#",
ARD_ANALOGWRITE_TIP:
"Schreibe analogen Wert zwischen 0 und 255 an einen spezifischen PWM Port",
ARD_BUILTIN_LED: "eingebaute LED",
ARD_BUILTIN_LED_TIP: "Schaltet die interne LED An oder Aus",
ARD_COMPONENT_WARN1:
"A %1 configuration block with the same %2 name must be added to use this block!",
ARD_DEFINE: "Definiere",
ARD_DIGITALREAD: "lesen digitalen Pin#",
ARD_DIGITALREAD_TIP: "Lese Wert an digitalen Pin: HIGH(1) oder LOW(0)",
ARD_DIGITALWRITE: "setzte digitalen Pin#",
ARD_DIGITALWRITE_TIP:
"Schreibe digitalen Wert HIGH (1) oder LOW(0) an spezifischen Port",
ARD_FUN_RUN_LOOP: "Endlosschleife()",
ARD_FUN_RUN_SETUP: "Setup()",
ARD_FUN_RUN_TIP:
"Definiert die setup() und loop() Funktionen. Die setup()-Funktion wird beim starten **einmal** ausgeführt. Anschließend wir die loop()-Funktion in einer **Endlosschleife** ausgeführt. Füge in die Setup()-Funktion Blöcke ein, um z.B. das Display zu initalisieren, eine Verbindung zum WiFi-Netzwerk herzustellen oder um die LoRa Verbindung zu initialsieren.",
ARD_HIGH: "HIGH",
ARD_HIGHLOW_TIP:
"Setzt einen Status auf HIGH oder LOWSet a pin state logic High or Low.",
ARD_LOW: "LOW",
ARD_MAP: "Verteile Wert",
ARD_MAP_FROMMIN: "von Minimum",
ARD_MAP_FROMMAX: "bis maximum",
ARD_MAP_TOMIN: "auf Minimum",
ARD_MAP_TOMAX: "bis Maximum",
ARD_MAP_TIP: "Verteilt Werte zwischen [0-1024] zu andere.",
ARD_MAP_VAL: "Wert zu [0-",
ARD_NOTONE: "Schalte Ton aus an Pin",
ARD_NOTONE_PIN: "keinen Ton an Pin",
ARD_NOTONE_PIN_TIP: "Stoppe die Tonerzeugung an Pin",
ARD_NOTONE_TIP: "Schaltet den Ton am ausgewählten Pin aus",
ARD_PIN_WARN1:
"Pin %1 wird benötigt für %2 als Pin %3. Bereitsgenutzt als %4.",
ARD_PULSETIMEOUT_TIP:
"Misst die Laufzeit eines Impulses am ausgewählten Pin, wenn die Zeit ist in Microsekunden.",
ARD_PULSE_READ: "Misst %1 Impuls an Pin #%2",
ARD_PULSE_READ_TIMEOUT:
"Misst %1 Impuls an Pin #%2 (Unterbrechung nach %3 μs)",
ARD_PULSE_TIP: "Misst die Zeit eines Impulses an dem ausgewählten Pin.",
ARD_SERIAL_BPS: "bps",
ARD_SERIAL_PRINT: "schreibe",
ARD_SERIAL_PRINT_NEWLINE: "neue Zeile hinzufügen",
ARD_SERIAL_PRINT_TIP:
"Prints data to the console/serial port as human-readable ASCII text.", // untranslated
ARD_SERIAL_PRINT_WARN:
"A setup block for %1 must be added to the workspace to use this block!", // untranslated
ARD_SERIAL_SETUP: "Setup",
ARD_SERIAL_SETUP_TIP: "Selects the speed for a specific Serial peripheral", // untranslated
ARD_SERIAL_SPEED: ": Übertragungsgeschwindigkeit zu",
ARD_SERVO_READ: "liest SERVO an PIN#",
ARD_SERVO_READ_TIP: "Liest den Winkel des Servomotors aus",
ARD_SERVO_WRITE: "setzt SERVO an Pin",
ARD_SERVO_WRITE_DEG_180: "Winkel (0~180)",
ARD_SERVO_WRITE_TIP: "Set a Servo to an specified angle", // untranslated
ARD_SERVO_WRITE_TO: "", // untranslated
ARD_SETTONE: "Spiele Ton an Pin", // untranslated
ARD_SPI_SETUP: "Setup",
ARD_SPI_SETUP_CONF: "Konfiguration:",
ARD_SPI_SETUP_DIVIDE: "clock divide", // untranslated
ARD_SPI_SETUP_LSBFIRST: "LSBFIRST", // untranslated
ARD_SPI_SETUP_MODE: "SPI mode (idle - edge)", // untranslated
ARD_SPI_SETUP_MODE0: "0 (LOW - Fallend)",
ARD_SPI_SETUP_MODE1: "1 (LOW - Steigend)",
ARD_SPI_SETUP_MODE2: "2 (HIGH - Fallend)",
ARD_SPI_SETUP_MODE3: "3 (HIGH - Steigend)",
ARD_SPI_SETUP_MSBFIRST: "MSBFIRST", // untranslated
ARD_SPI_SETUP_SHIFT: "data shift", // untranslated
ARD_SPI_SETUP_TIP: "Configures the SPI peripheral.", // untranslated
ARD_SPI_TRANSRETURN_TIP:
"Send a SPI message to an specified slave device and get data back.", // untranslated
ARD_SPI_TRANS_NONE: "none", // untranslated
ARD_SPI_TRANS_SLAVE: "to slave pin", // untranslated
ARD_SPI_TRANS_TIP: "Send a SPI message to an specified slave device.", // untranslated
ARD_SPI_TRANS_VAL: "transfer", // untranslated
ARD_SPI_TRANS_WARN1:
"A setup block for %1 must be added to the workspace to use this block!", // untranslated
ARD_SPI_TRANS_WARN2: "Old pin value %1 is no longer available.", // untranslated
ARD_STEPPER_COMPONENT: "stepper", // untranslated
ARD_STEPPER_DEFAULT_NAME: "MyStepper", // untranslated
ARD_STEPPER_FOUR_PINS: "4", // untranslated
ARD_STEPPER_MOTOR: "stepper motor:", // untranslated
ARD_STEPPER_NUMBER_OF_PINS: "Number of pins", // untranslated
ARD_STEPPER_PIN1: "pin1#", // untranslated
ARD_STEPPER_PIN2: "pin2#", // untranslated
ARD_STEPPER_PIN3: "pin3#", // untranslated
ARD_STEPPER_PIN4: "pin4#", // untranslated
ARD_STEPPER_REVOLVS: "how many steps per revolution", // untranslated
ARD_STEPPER_SETUP: "Setup stepper motor", // untranslated
ARD_STEPPER_SETUP_TIP:
"Configures a stepper motor pinout and other settings.", // untranslated
ARD_STEPPER_SPEED: "set speed (rpm) to", // untranslated
ARD_STEPPER_STEP: "move stepper", // untranslated
ARD_STEPPER_STEPS: "steps", // untranslated
ARD_STEPPER_STEP_TIP: "Turns the stepper motor a specific number of steps.", // untranslated
ARD_STEPPER_TWO_PINS: "2", // untranslated
ARD_TYPE_ARRAY: "Array",
ARD_TYPE_BOOL: "Boolean",
ARD_TYPE_CHAR: "Zeichen",
ARD_TYPE_CHILDBLOCKMISSING: "ChildBlockMissing", // untranslated
ARD_TYPE_DECIMAL: "Dezimalzahl",
ARD_TYPE_LONG: "große Zahl",
ARD_TYPE_NULL: "Null",
ARD_TYPE_NUMBER: "Zahl",
ARD_TYPE_SHORT: "kurze Zahl",
ARD_TYPE_TEXT: "Text",
ARD_TYPE_UNDEF: "Undefiniert",
ARD_VAR_AS: "als",
ARD_VAR_AS_TIP: "Wert einem spezififischen Datentyp zuordnen",
ARD_WRITE_TO: "zu",
NEW_INSTANCE: "Neue Instanz...",
NEW_INSTANCE_TITLE: "Neue Instanz mit Name:",
RENAME_INSTANCE: "Instanz umbenennen...",
RENAME_INSTANCE_TITLE: "Benenne alle '%1' Instanzen zu:",
};
+62 -48
View File
@@ -1,50 +1,64 @@
export const LOGIC = {
CONTROLS_IF_ELSEIF_TOOLTIP: "Eine weitere Bedingung hinzufügen.",
CONTROLS_IF_ELSE_TOOLTIP:
"Eine sonst-Bedingung hinzufügen, führt eine Anweisung aus, falls keine Bedingung zutrifft.",
CONTROLS_IF_HELPURL: "https://github.com/google/blockly/wiki/IfElse", // untranslated
CONTROLS_IF_IF_TOOLTIP: "Hinzufügen, entfernen oder sortieren von Sektionen",
CONTROLS_IF_MSG_ELSE: "sonst",
CONTROLS_IF_MSG_ELSEIF: "sonst wenn",
CONTROLS_IF_MSG_IF: "wenn",
CONTROLS_IF_TOOLTIP_1:
"Wenn eine Bedingung wahr (true) ist, dann führe eine Anweisung aus.",
CONTROLS_IF_TOOLTIP_2:
"Wenn eine Bedingung wahr (true) ist, dann führe die erste Anweisung aus. Ansonsten führe die zweite Anweisung aus.",
CONTROLS_IF_TOOLTIP_3:
"Wenn die erste Bedingung wahr (true) ist, dann führe die erste Anweisung aus. Oder wenn die zweite Bedingung wahr (true) ist, dann führe die zweite Anweisung aus.",
CONTROLS_IF_TOOLTIP_4:
"Wenn die erste Bedingung wahr (true) ist, dann führe die erste Anweisung aus. Oder wenn die zweite Bedingung wahr (true) ist, dann führe die zweite Anweisung aus. Falls keine der beiden Bedingungen wahr (true) ist, dann führe die dritte Anweisung aus.",
LOGIC_BOOLEAN_HELPURL: "https://github.com/google/blockly/wiki/Logic#values", // untranslated
LOGIC_BOOLEAN_TOOLTIP: "Ist entweder wahr (true) oder falsch (false)",
LOGIC_BOOLEAN_TRUE: "wahr",
LOGIC_COMPARE_HELPURL: "https://de.wikipedia.org/wiki/Vergleich_%28Zahlen%29",
LOGIC_COMPARE_TOOLTIP_EQ: "Ist wahr (true), wenn beide Werte gleich sind.",
LOGIC_COMPARE_TOOLTIP_GT:
"Ist wahr (true), wenn der erste Wert größer als der zweite Wert ist.",
LOGIC_COMPARE_TOOLTIP_GTE:
"Ist wahr (true), wenn der erste Wert größer als oder gleich groß wie der zweite Wert ist.",
LOGIC_COMPARE_TOOLTIP_LT:
"Ist wahr (true), wenn der erste Wert kleiner als der zweite Wert ist.",
LOGIC_COMPARE_TOOLTIP_LTE:
"Ist wahr (true), wenn der erste Wert kleiner als oder gleich groß wie der zweite Wert ist.",
LOGIC_COMPARE_TOOLTIP_NEQ:
"Ist wahr (true), wenn beide Werte unterschiedlich sind.",
LOGIC_NEGATE_HELPURL: "https://github.com/google/blockly/wiki/Logic#not", // untranslated
LOGIC_NEGATE_TITLE: "nicht %1",
LOGIC_NEGATE_TOOLTIP:
"Ist wahr (true), wenn der Eingabewert falsch (false) ist. Ist falsch (false), wenn der Eingabewert wahr (true) ist.",
LOGIC_NULL: "null",
LOGIC_NULL_HELPURL: "https://de.wikipedia.org/wiki/Nullwert",
LOGIC_NULL_TOOLTIP: "Ist NULL.",
LOGIC_OPERATION_AND: "und",
LOGIC_OPERATION_HELPURL:
"https://github.com/google/blockly/wiki/Logic#logical-operations", // untranslated
LOGIC_OPERATION_OR: "oder",
LOGIC_OPERATION_TOOLTIP_AND:
"Ist wahr (true), wenn beide Werte wahr (true) sind.",
LOGIC_OPERATION_TOOLTIP_OR:
"Ist wahr (true), wenn einer der beiden Werte wahr (true) ist.",
LOGIC_TERNARY_CONDITION: "teste",
LOGIC_TERNARY_HELPURL: "https://de.wikipedia.org/wiki/%3F:#Auswahloperator",
LOGIC_TERNARY_IF_FALSE: "wenn falsch",
LOGIC_TERNARY_IF_TRUE: "wenn wahr",
LOGIC_TERNARY_TOOLTIP:
'Überprüft eine Bedingung "teste". Wenn die Bedingung wahr ist, wird der "wenn wahr" Wert zurückgegeben, andernfalls der "wenn falsch" Wert',
CONTROLS_IF_ELSEIF_TOOLTIP: "Eine weitere Bedingung hinzufügen.",
CONTROLS_IF_ELSE_TOOLTIP: "Eine sonst-Bedingung hinzufügen, führt eine Anweisung aus, falls keine Bedingung zutrifft.",
CONTROLS_IF_HELPURL: "https://github.com/google/blockly/wiki/IfElse", // untranslated
CONTROLS_IF_IF_TOOLTIP: "Hinzufügen, entfernen oder sortieren von Sektionen",
CONTROLS_IF_MSG_ELSE: "sonst",
CONTROLS_IF_MSG_ELSEIF: "sonst wenn",
CONTROLS_IF_MSG_IF: "wenn",
CONTROLS_IF_TOOLTIP_1: "Wenn eine Bedingung wahr (true) ist, dann führe eine Anweisung aus.",
CONTROLS_IF_TOOLTIP_2: "Wenn eine Bedingung wahr (true) ist, dann führe die erste Anweisung aus. Ansonsten führe die zweite Anweisung aus.",
CONTROLS_IF_TOOLTIP_3: "Wenn die erste Bedingung wahr (true) ist, dann führe die erste Anweisung aus. Oder wenn die zweite Bedingung wahr (true) ist, dann führe die zweite Anweisung aus.",
CONTROLS_IF_TOOLTIP_4: "Wenn die erste Bedingung wahr (true) ist, dann führe die erste Anweisung aus. Oder wenn die zweite Bedingung wahr (true) ist, dann führe die zweite Anweisung aus. Falls keine der beiden Bedingungen wahr (true) ist, dann führe die dritte Anweisung aus.",
LOGIC_BOOLEAN_HELPURL: "https://github.com/google/blockly/wiki/Logic#values", // untranslated
LOGIC_BOOLEAN_TOOLTIP: "Ist entweder wahr (true) oder falsch (false)",
LOGIC_BOOLEAN_TRUE: "wahr",
LOGIC_COMPARE_HELPURL: "https://de.wikipedia.org/wiki/Vergleich_%28Zahlen%29",
LOGIC_COMPARE_TOOLTIP_EQ: "Ist wahr (true), wenn beide Werte gleich sind.",
LOGIC_COMPARE_TOOLTIP_GT: "Ist wahr (true), wenn der erste Wert größer als der zweite Wert ist.",
LOGIC_COMPARE_TOOLTIP_GTE: "Ist wahr (true), wenn der erste Wert größer als oder gleich groß wie der zweite Wert ist.",
LOGIC_COMPARE_TOOLTIP_LT: "Ist wahr (true), wenn der erste Wert kleiner als der zweite Wert ist.",
LOGIC_COMPARE_TOOLTIP_LTE: "Ist wahr (true), wenn der erste Wert kleiner als oder gleich groß wie der zweite Wert ist.",
LOGIC_COMPARE_TOOLTIP_NEQ: "Ist wahr (true), wenn beide Werte unterschiedlich sind.",
LOGIC_NEGATE_HELPURL: "https://github.com/google/blockly/wiki/Logic#not", // untranslated
LOGIC_NEGATE_TITLE: "nicht %1",
LOGIC_NEGATE_TOOLTIP: "Ist wahr (true), wenn der Eingabewert falsch (false) ist. Ist falsch (false), wenn der Eingabewert wahr (true) ist.",
LOGIC_NULL: "null",
LOGIC_NULL_HELPURL: "https://de.wikipedia.org/wiki/Nullwert",
LOGIC_NULL_TOOLTIP: "Ist NULL.",
LOGIC_OPERATION_AND: "und",
LOGIC_OPERATION_HELPURL: "https://github.com/google/blockly/wiki/Logic#logical-operations", // untranslated
LOGIC_OPERATION_OR: "oder",
LOGIC_OPERATION_TOOLTIP_AND: "Ist wahr (true), wenn beide Werte wahr (true) sind.",
LOGIC_OPERATION_TOOLTIP_OR: "Ist wahr (true), wenn einer der beiden Werte wahr (true) ist.",
LOGIC_TERNARY_CONDITION: "teste",
LOGIC_TERNARY_HELPURL: "https://de.wikipedia.org/wiki/%3F:#Auswahloperator",
LOGIC_TERNARY_IF_FALSE: "wenn falsch",
LOGIC_TERNARY_IF_TRUE: "wenn wahr",
LOGIC_TERNARY_TOOLTIP: "Überprüft eine Bedingung \"teste\". Wenn die Bedingung wahr ist, wird der \"wenn wahr\" Wert zurückgegeben, andernfalls der \"wenn falsch\" Wert",
/**
* Cases
*/
cases_do: "Führe aus",
cases_condition: "Fall (Variable): ",
cases_switch: "Variable",
cases_add: "Fall",
cases_tooltip: "Führt den entsprechenden Fall aus, wenn die Überprüfung der Variable TRUE ergibt. Über das Zahnrad kannst du weitere Fälle hinzufügen. Über den 'Default' fall kannst du bestimmen, was passieren soll wenn keiner der vorher definierten Fälle eingetreten ist.",
}
/**
* Cases
*/
cases_do: "Führe aus",
cases_condition: "Fall (Variable): ",
cases_switch: "Variable",
cases_add: "Fall",
cases_tooltip:
"Führt den entsprechenden Fall aus, wenn die Überprüfung der Variable TRUE ergibt. Über das Zahnrad kannst du weitere Fälle hinzufügen. Über den 'Default' fall kannst du bestimmen, was passieren soll wenn keiner der vorher definierten Fälle eingetreten ist.",
};
@@ -27,7 +27,7 @@ export const BLE = {
sensebox_phyphox_graphStyle: "Stil",
sensebox_phyphox_init_tooltip:
"Initialisere das Bluetooth Bee. Stecke diese auf dem Steckplatz **XBEE1**. Gib dem Phphox Messgerät einen eindeutigen Namen, damit du dieses in der App wiederfindest",
"Initialisere das Bluetooth Bee. Stecke diese auf dem Steckplatz **XBEE1**. Gib dem Phyphox Messgerät einen eindeutigen Namen, damit du dieses in der App wiederfindest",
sensebox_phyphox_experiment_tooltip:
"Erstelle ein Experiment und vergib einen eindeutigen Namen und eine kurze Beschreibung. Füge bis zu 5 verschiedene Graphen in der Ansicht hinzu. ",
sensebox_phyphox_graph_tooltip:
+54 -39
View File
@@ -1,44 +1,59 @@
export const LORA = {
/*
* LoRa Blöcke
*/
/*
* LoRa Blöcke
*/
senseBox_LoRa_connect: "Zu TTN senden",
senseBox_LoRa_device_id: "Device EUI (lsb)",
senseBox_LoRa_app_id: "Application EUI (lsb)",
senseBox_LoRa_app_key: "App Key (msb)",
senseBox_LoRa_nwskey_id: "Network Session Key (msb)",
senseBox_LoRa_appskey_id: "App Session Key (msb)",
senseBox_LoRa_devaddr_id: "Device Adress",
senseBox_LoRa_interval: "Intervall in Minuten",
senseBox_measurement: "Messung",
senseBox_measurements: "Messungen",
senseBox_LoRa_connect: "Zu TTN senden",
senseBox_LoRa_device_id: "Device EUI (lsb)",
senseBox_LoRa_app_id: "Application EUI (lsb)",
senseBox_LoRa_app_key: "App Key (msb)",
senseBox_LoRa_nwskey_id: "Network Session Key (msb)",
senseBox_LoRa_appskey_id: "App Session Key (msb)",
senseBox_LoRa_devaddr_id: "Device Adress",
senseBox_LoRa_interval: "Intervall in Minuten",
senseBox_measurement: "Messung",
senseBox_measurements: "Messungen",
senseBox_LoRa_send_message: "Sende als Lora Nachricht",
senseBox_LoRa_send_cayenne: "Sende als Cayenne Nachricht",
senseBox_LoRa_cayenne_temperature: "Temperatur",
senseBox_LoRa_cayenne_channel: "Kanal",
senseBox_LoRa_cayenne_humidity: "Luftfeuchtigkeit",
senseBox_LoRa_cayenne_pressure: "Luftdruck",
senseBox_LoRa_cayenne_luminosity: "Helligkeit",
senseBox_LoRa_cayenne_analog: "Analoger Wert",
senseBox_LoRa_cayenne_x: "X Wert",
senseBox_LoRa_cayenne_y: "Y Wert",
senseBox_LoRa_cayenne_z: "Z Wert",
senseBox_LoRa_cayenne_lat: "Breitengrad",
senseBox_LoRa_cayenne_lng: "Längengrad",
senseBox_LoRa_cayenne_alt: "Höhe",
senseBox_LoRa_send_message: "Sende als Lora Nachricht",
senseBox_LoRa_send_cayenne: "Sende als Cayenne Nachricht",
senseBox_LoRa_cayenne_temperature: "Temperatur",
senseBox_LoRa_cayenne_channel: "Kanal",
senseBox_LoRa_cayenne_humidity: "Luftfeuchtigkeit",
senseBox_LoRa_cayenne_pressure: "Luftdruck",
senseBox_LoRa_cayenne_luminosity: "Helligkeit",
senseBox_LoRa_cayenne_analog: "Analoger Wert",
senseBox_LoRa_cayenne_x: "X Wert",
senseBox_LoRa_cayenne_y: "Y Wert",
senseBox_LoRa_cayenne_z: "Z Wert",
senseBox_LoRa_cayenne_lat: "Breitengrad",
senseBox_LoRa_cayenne_lng: "Längengrad",
senseBox_LoRa_cayenne_alt: "Höhe",
senseBox_LoRa_cayenne_concentration: "Konzentration",
senseBox_LoRa_cayenne_tip: "Sende Daten als Cayenne Payload Format",
senseBox_LoRa_cayenne_gps_tip: "Sende GPS",
senseBox_LoRa_cayenne_temperature_tip: "Sendet Temperaturwert mit einer Nachkommastelle",
senseBox_LoRa_cayenne_pressure_tip: "Sendet Luftdruck mit einer Nachkommastelle",
senseBox_LoRa_cayenne_luminosity_tip: "Sendet Helligkeitswert",
senseBox_LoRa_cayenne_analog_tip: "Sendet einen Dezimalwert mit einer Nachkommastelle",
senseBox_LoRa_cayenne_tip: "Sende Daten als Cayenne Payload Format",
senseBox_LoRa_cayenne_gps_tip: "Sende GPS",
senseBox_LoRa_cayenne_temperature_tip:
"Sendet Temperaturwert mit einer Nachkommastelle",
senseBox_LoRa_cayenne_pressure_tip:
"Sendet Luftdruck mit einer Nachkommastelle",
senseBox_LoRa_cayenne_luminosity_tip: "Sendet Helligkeitswert",
senseBox_LoRa_cayenne_analog_tip:
"Sendet einen Dezimalwert mit einer Nachkommastelle",
senseBox_LoRa_message_tooltip: "Sende eine Nachricht über LoRa",
senseBox_LoRa_sensor_tip: "Sende einen Sensorwert mit einer bestimmten Anzahl an Bytes",
senseBox_LoRa_init_abp_tooltip: "Initialisiere die LoRa übertragung. Die Aktivierung erfolgt über ABP. Registriere eine Application auf [thethingsnetwork](https://thethingsnetwork.com) und kopiere den **Network Session Key** und den **App Session Key** im **msb Format** und die **Device ID** im **hex Format**.",
senseBox_LoRa_init_helpurl: "https://docs.sensebox.de/blockly/blockly-web-lora/",
senseBox_LoRa_init_otaa_tooltip: "Initialisiere die LoRa übertragung. Die Aktivierung erfolgt über OTAA. Registriere eine Application auf [thethingsnetwork](https://thethingsnetwork.com) und kopiere die **DEVICE EUI** und die **Application EUI** im **lsb Format** den **App Key** im **msb Format**.",
}
senseBox_LoRa_cayenne_concentration_tip: "Sendet eine Konzentration in PPM",
senseBox_LoRa_message_tooltip: "Sende eine Nachricht über LoRa",
senseBox_LoRa_sensor_tip:
"Sende einen Sensorwert mit einer bestimmten Anzahl an Bytes",
senseBox_LoRa_init_abp_tooltip:
"Initialisiere die LoRa übertragung. Die Aktivierung erfolgt über ABP. Registriere eine Application auf [thethingsnetwork](https://thethingsnetwork.com) und kopiere den **Network Session Key** und den **App Session Key** im **msb Format** und die **Device ID** im **hex Format**.",
senseBox_LoRa_init_helpurl:
"https://docs.sensebox.de/blockly/blockly-web-lora/",
senseBox_LoRa_init_otaa_tooltip:
"Initialisiere die LoRa übertragung. Die Aktivierung erfolgt über OTAA. Registriere eine Application auf [thethingsnetwork](https://thethingsnetwork.com) und kopiere die **DEVICE EUI** und die **Application EUI** im **lsb Format** den **App Key** im **msb Format**.",
sensebox_lora_ttn_mapper_tip:
"Mit einem TTN Mapper kannst du die LoRa-Netzabdeckung in deiner Umgebung aufzeichnen. Die Daten werden dann auf [ttnmaper](https://ttnmapper.org) angezeigt. Den notwendigen Decoder findest du [hier](https://gist.github.com/felixerdy/f959ac03df98c6947f1c7f35d537f23e#file-decoder-js).",
sensebox_lora_ttn_mapper_helpurl:
"https://sensebox.de/projects/de/2020-03-06-ttn-mapper",
};
+22 -16
View File
@@ -1,17 +1,23 @@
export const OSEM = {
/**
* openSenseMap
*/
senseBox_osem_connection_tip: "stellt eine WLAN verbindung her",
senseBox_send_to_osem_tip: "sende Messwert an",
senseBox_send_to_osem: "Sende Messwert an die openSenseMap",
senseBox_osem_connection: "Verbinde mit openSenseMap:",
senseBox_osem_host: "opensensemap.org",
senseBox_osem_host_workshop: "workshop.opensensemap.org",
senseBox_osem_exposure: "Typ",
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",
}
/**
* openSenseMap
*/
senseBox_osem_connection_tip:
"Verwende diesen Block, um deine senseBox mit der openSenseMap zu verbinden. Registriere deine senseBox auf der openSenseMap und trage die IDs und den API-Schlüssel ein. Verwende anschließend den Block ***Sende Messwert an die openSenseMap*** und die Sensor-ID, um die Messwerte zu übertragen.",
senseBox_osem_connection_helpurl: "https://www.opensensemap.org/",
senseBox_send_to_osem_tip:
"Sende mit diesem Block Messwerte an die openSenseMap. Verwende pro Messwert einen Block und trage die zugewiesene Sensor ID ein",
senseBox_send_to_osem: "Sende Messwert an die openSenseMap",
senseBox_osem_connection: "Verbinde mit openSenseMap:",
senseBox_osem_host: "opensensemap.org",
senseBox_osem_host_workshop: "workshop.opensensemap.org",
senseBox_osem_exposure: "Typ",
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_osem_restart: "Bei Verbindungsverlust Gerät neustarten?",
};
@@ -5,7 +5,7 @@ export const RTC = {
sensebox_rtc_set: "Setze Uhrzeit/Datum der RTC",
sensebox_rtc_set_tooltip:
"Stellt die Uhrzeit der RTC ein. Beachte, dass du diesen Block im Setup ausführst.",
sensebox_rtc_get_timestamp: "Zeitstempel",
sensebox_rtc_get_timestamp: "Zeitstempel (RFC 3339)",
sensebox_rtc_get_timestamp_tooltip:
"Gibt dir einen in ISO 8601 formatierten Zeitstempel zurück. Bsp: 2021-12-24T18:21Z",
sensebox_rtc_get: "Wert: ",
+24 -12
View File
@@ -1,13 +1,25 @@
export const SD = {
/**
* SD-Block
*/
senseBox_sd_create_file: "Erstelle Datei auf SD-Karte",
senseBox_sd_write_file: "Schreibe Daten auf SD-Karte",
senseBox_sd_open_file: "Öffne eine Datei auf der SD-Karte",
senseBox_sd_create_file_tooltip: "Erstellt eine Datei auf der Karte. Stecke das SD-Bee auf den Steckplatz **XBEE2**. Die **maximale** Länge des Dateinamen sind **8 Zeichen**. Die Datei sollte zuerst im *Setup()* erstellt werden",
senseBox_sd_write_file_tooptip: "Schreibe Daten auf die SD-Karte. Beachte, dass die Datei zuerst geöffnet werden muss.",
senseBox_sd_open_file_tooltip: "Öffne die Datei auf der SD-Karte, um Dateien zu speichern. Am Ende der Schleife wird die Datei automatisch wieder geschlossen.",
sensebox_sd_filename: "Daten",
senseBox_sd_decimals: "Dezimalen",
}
/**
* SD-Block
*/
senseBox_sd_create_file: "Erstelle Datei auf SD-Karte",
sensebox_sd_helpurl: "https://docs.sensebox.de/hardware/bee-sd/",
senseBox_sd_write_file: "Schreibe Daten auf SD-Karte",
senseBox_sd_open_file: "Öffne eine Datei auf der SD-Karte",
senseBox_sd_create_file_tooltip:
"Erstellt eine Datei auf der Karte. Stecke das SD-Bee auf den Steckplatz **XBEE2**. Die **maximale** Länge des Dateinamen sind **8 Zeichen**. Die Datei sollte zuerst im *Setup()* erstellt werden",
senseBox_sd_write_file_tooptip:
"Schreibe Daten auf die SD-Karte. Beachte, dass die Datei zuerst geöffnet werden muss.",
senseBox_sd_open_file_tooltip:
"Öffne die Datei auf der SD-Karte, um Dateien zu speichern. Am Ende der Schleife wird die Datei automatisch wieder geschlossen.",
sensebox_sd_filename: "Daten",
senseBox_sd_decimals: "Dezimalen",
sensebox_sd_osem: "Erstelle CSV-Datei für openSenseMap",
sensebox_sd_osem_tip:
"Erstellt eine CSV-Datei, die später auf die openSenseMap hochgeladen werden kann. ",
sensebox_sd_save_for_osem: "Speichere Messwert",
sensebox_sd_save_for_osem_tip:
"Füge eine Messung mit Sensor ID zur CSV-Datei hinzu",
sensebox_sd_save_for_osem_id: "Sensor ID:",
sensebox_sd_measurement: "Messwerte",
};
+182 -144
View File
@@ -1,129 +1,162 @@
export const SENSORS = {
/**
* Sensors
* ---------------------------------------------------
*
*/
/**
* Sensors
* ---------------------------------------------------
*
*/
/**
* BMP280
*/
senseBox_pressure_sensor: "Luftdruck-/Temperatursensor (BMP280)",
senseBox_pressure: "Luftdruck in Pa",
senseBox_pressure_dimension: "Luftdruck in Pa",
senseBox_pressure_tip: "Schließe den Sensor an einen der 5 **I2C-Anschlüsse** an. Der Sensor gibt dir den Messwert für den Luftdruck in Pa. Um die korrekte Höhe über NN zu berechnen benötigt der Sensor einen aktuellen Referenzwert.",
senseBox_pressure_referencePressure: "Luftdruck auf NN",
senseBox_pressure_referencePressure_dim: "hPa",
senseBox_pressure_helpurl: "",
/**
* BMP280
*/
senseBox_pressure_sensor: "Luftdruck-/Temperatursensor (BMP280)",
senseBox_pressure: "Luftdruck in hPa",
senseBox_pressure_dimension: "Luftdruck in hPa",
senseBox_pressure_tooltip:
"Schließe den Sensor an einen der 5 **I2C-Anschlüsse** an. Der Sensor gibt dir den Messwert für den Luftdruck in hPa. Um die korrekte Höhe über NN zu berechnen benötigt der Sensor einen aktuellen Referenzwert.",
senseBox_pressure_referencePressure: "Luftdruck auf NN",
senseBox_pressure_referencePressure_dim: "hPa",
senseBox_pressure_helpurl:
"https://docs.sensebox.de/hardware/sensoren-luftdruck-temperatur/",
/**
* DPS310
*/
senseBox_sensor_dps310: "Luftdruck-/Temperatursensor (DPS310)",
senseBox_sensor_dps310_tooltip:
"Schließe den Sensor an einen der 5 **I2C-Anschlüsse** an. Der Sensor gibt dir den Messwert für den Luftdruck in hPa. Um die korrekte Höhe über NN zu berechnen benötigt der Sensor einen aktuellen Referenzwert.",
senseBox_sensor_dps310_helpurl: "",
/**
* Mikro
*/
senseBox_sound: "Mikrofon",
senseBox_sound_tip: "Schließe den Sensor über das Breadbord an einen der 3 **analog/digital** Ports an. Gibt den Messwert des Mikrofons in Volt zurück",
senseBox_sound_helpurl: "https://docs.sensebox.de/hardware/sensoren-mikro/",
/**
* Mikro
*/
senseBox_sound: "Mikrofon",
senseBox_sound_tip:
"Schließe den Sensor über das Breadbord an einen der 3 **analog/digital** Ports an. Gibt den Messwert des Mikrofons in Volt zurück",
senseBox_sound_helpurl: "https://docs.sensebox.de/hardware/sensoren-mikro/",
/**
* Temperature and Humidity Sensor (HDC1080)
*/
senseBox_temp: "Temperatur in °C",
senseBox_temp_hum: "Temperatur-/Luftfeuchtigkeitssensor (HDC1080)",
senseBox_temp_hum_tooltip: "Dieser Block gibt dir die Messwerte des Temperatur- und Luftfeuchtigkeitssensor zurück. Schließe den Sensor an einen der 5 I2C Anschlüsse an. Messwert wird mit 2 Nachkommastellen ausgegeben.",
senseBox_temp_hum_helpurl: "https://docs.sensebox.de/hardware/sensoren-temperatur-luftfeuchte/",
/**
* Temperature and Humidity Sensor (HDC1080)
*/
senseBox_temp: "Temperatur in °C",
senseBox_temp_hum: "Temperatur-/Luftfeuchtigkeitssensor (HDC1080)",
senseBox_temp_hum_tooltip:
"Dieser Block gibt dir die Messwerte des Temperatur- und Luftfeuchtigkeitssensor zurück. Schließe den Sensor an einen der 5 I2C Anschlüsse an. Messwert wird mit 2 Nachkommastellen ausgegeben.",
senseBox_temp_hum_helpurl:
"https://docs.sensebox.de/hardware/sensoren-temperatur-luftfeuchte/",
/**
* Ultraschalldistanzsensor
*/
/**
* Ultraschalldistanzsensor
*/
senseBox_ultrasonic: "Ultraschall-Abstandssensor an Port",
senseBox_ultrasonic_trigger: "Trigger",
senseBox_ultrasonic_echo: "Echo",
senseBox_ultrasonic_port_A: "A",
senseBox_ultrasonic_port_B: "B",
senseBox_ultrasonic_port_C: "C",
senseBox_ultrasonic_tooltip: `Misst die Distanz mithilfe von Ultraschall in cm. Schließe den Sensor an einen der drei Digital/Analog Ports an:
senseBox_ultrasonic: "Ultraschall-Abstandssensor an Port",
senseBox_ultrasonic_trigger: "Trigger",
senseBox_ultrasonic_echo: "Echo",
senseBox_ultrasonic_maxDistance: "Maximale Distanz",
senseBox_ultrasonic_port_A: "A",
senseBox_ultrasonic_port_B: "B",
senseBox_ultrasonic_port_C: "C",
senseBox_ultrasonic_tooltip: `Misst die Distanz mithilfe von Ultraschall in cm. Schließe den Sensor an einen der drei Digital/Analog Ports an:
- Trigger: Grünes Kabel
- Echo: gelbes Kabel`,
senseBox_ultrasonic_helpurl: "https://docs.sensebox.de/hardware/sensoren-distanz/",
/**
* UV and Lightsensor
*/
senseBox_value: "Messwert:",
senseBox_uv_light: "Helligkeit-/UV-Sensor",
senseBox_uv_light_tooltip: "Sensor misst UV-Licht oder die Helligkeit. Die Helligkeit wird als **Ganzezahl** in Lux ausgegeben. Die UV-Intensität als **Kommazahl** in µW/cm².",
senseBox_uv: "UV-Intensität in µW/cm²",
senseBox_light: "Beleuchtungsstärke in Lux",
senseBox_uv_light_helpurl: "https://docs.sensebox.de/hardware/sensoren-helligkeit-uv/",
- Echo: gelbes Kabel
Wenn die maximale Distanz überschritten wird, wird ein Wert von **O** ausgegeben`,
senseBox_ultrasonic_helpurl:
"https://docs.sensebox.de/hardware/sensoren-distanz/",
/**
* UV and Lightsensor
*/
senseBox_value: "Messwert:",
senseBox_uv_light: "Helligkeit-/UV-Sensor",
senseBox_uv_light_tooltip:
"Sensor misst UV-Licht oder die Helligkeit. Die Helligkeit wird als **Ganzezahl** in Lux ausgegeben. Die UV-Intensität als **Kommazahl** in µW/cm².",
senseBox_uv: "UV-Intensität in µW/cm²",
senseBox_light: "Beleuchtungsstärke in Lux",
senseBox_uv_light_helpurl:
"https://docs.sensebox.de/hardware/sensoren-helligkeit-uv/",
/**
* BMX055
*/
/**
* BMX055
*/
senseBox_bmx055_compass: "Lage Sensor",
senseBox_bmx055_accelerometer: "Beschleunigungssensor",
senseBox_bmx055_accelerometer_range: "Messbereich",
senseBox_bmx055_accelerometer_range_2g: "2g",
senseBox_bmx055_accelerometer_range_4g: "4g",
senseBox_bmx055_accelerometer_range_8g: "8g",
senseBox_bmx055_accelerometer_range_16g: "16g",
senseBox_bmx055_accelerometer_direction: "Richtung",
senseBox_bmx055_accelerometer_direction_x: "X-Achse",
senseBox_bmx055_accelerometer_direction_y: "Y-Achse",
senseBox_bmx055_accelerometer_direction_z: "Z-Achse",
senseBox_bmx055_accelerometer_direction_total: "Gesamt",
senseBox_bmx055_gyroscope: "Lage Sensor",
senseBox_bmx055_accelerometer_tip: "Lage Sensor",
senseBox_bmx055_compass_tip: "Lage Sensor",
senseBox_bmx055_gyroscope_tip: "Lage Sensor",
senseBox_bmx055_x: "X-Richtung",
senseBox_bmx055_y: "Y-Richtung",
senseBox_bmx055_accelerometer_tooltip: `Dieser Block gibt dir den Messwert des Beschleunigungssensors der direkt auf der senseBox MCU aufgelötet ist. Im Dropdown Menü kannst du die Richtung und den Messbereich auswählen.`,
senseBox_bmx055_helpurl: "",
senseBox_bmx055_compass: "Lage Sensor",
senseBox_bmx055_accelerometer: "Beschleunigungssensor",
senseBox_bmx055_accelerometer_range: "Messbereich",
senseBox_bmx055_accelerometer_range_2g: "2g",
senseBox_bmx055_accelerometer_range_4g: "4g",
senseBox_bmx055_accelerometer_range_8g: "8g",
senseBox_bmx055_accelerometer_range_16g: "16g",
senseBox_bmx055_accelerometer_direction: "Richtung",
senseBox_bmx055_accelerometer_direction_x: "X-Achse",
senseBox_bmx055_accelerometer_direction_y: "Y-Achse",
senseBox_bmx055_accelerometer_direction_z: "Z-Achse",
senseBox_bmx055_accelerometer_direction_total: "Gesamt",
senseBox_bmx055_gyroscope: "Lage Sensor",
senseBox_bmx055_accelerometer_tip: "Lage Sensor",
senseBox_bmx055_compass_tip: "Lage Sensor",
senseBox_bmx055_gyroscope_tip: "Lage Sensor",
senseBox_bmx055_x: "X-Richtung",
senseBox_bmx055_y: "Y-Richtung",
senseBox_bmx055_accelerometer_tooltip: `Dieser Block gibt dir den Messwert des Beschleunigungssensors der direkt auf der senseBox MCU aufgelötet ist. Im Dropdown Menü kannst du die Richtung und den Messbereich auswählen.`,
senseBox_bmx055_helpurl: "",
/**
*
* GPS
*/
senseBox_gps_getValues: "GPS Modul",
senseBox_gps_lat: "Breitengrad",
senseBox_gps_lng: "Längengrad",
senseBox_gps_alt: "Höhe über NN in m",
senseBox_gps_speed: "Geschwindigkeit in km/h",
senseBox_gps_date: "Datum",
senseBox_gps_time: "Uhrzeit",
senseBox_gps_timeStamp: "Zeitstempel (RFC 3339)",
senseBox_gps_tooltip: `Liest das GPS Modul aus und gibt dir die Standortinformationen. Längen- und Breitengrad werden als Kommazahl mit 6 Nachkommastellen ausgegeben.
/**
*
* GPS
*/
senseBox_gps_getValues: "GPS Modul",
senseBox_gps_lat: "Breitengrad",
senseBox_gps_lng: "Längengrad",
senseBox_gps_alt: "Höhe über NN in m",
senseBox_gps_speed: "Geschwindigkeit in km/h",
senseBox_gps_date: "Datum",
senseBox_gps_time: "Uhrzeit",
senseBox_gps_timeStamp: "Zeitstempel (RFC 3339)",
senseBox_gps_tooltip: `Liest das GPS Modul aus und gibt dir die Standortinformationen. Längen- und Breitengrad werden als Kommazahl mit 6 Nachkommastellen ausgegeben.
**Anschluss: I2C**
**Beachte:** Das GPS Modul benöigt beim ersten Verwenden relativ lange (ca. 5-10 Minuten) bis es deinen Standort gefunden hat!
`,
senseBox_gps_helpurl: "https://docs.sensebox.de/hardware/sensoren-gps/",
senseBox_gps_helpurl: "https://docs.sensebox.de/hardware/sensoren-gps/",
/**
* Windspeed
*/
senseBox_windspeed: "Windgeschwindigkeitssensor",
senseBox_windspeed_tooltip: "",
/**
* Windspeed
*/
senseBox_windspeed: "Windgeschwindigkeitssensor",
senseBox_windspeed_tooltip: "",
/*
* Soundsensor
*/
senseBox_soundsensor_dfrobot: "Soundsensor (DF Robot)",
senseBox_soundsensor_dfrobot_tooltip: "Schließe den Sensor an einen der 3 **digital/analog Ports** an. Der Sensor gibt dir den Messwert in dB mit einer Nachkommastelle",
senseBox_soundsensor_dfrobot_helpurl: "https://docs.sensebox.de/hardware/sensoren-lautstaerke/",
/*
* BME680
*/
/*
* Soundsensor
*/
senseBox_soundsensor_dfrobot: "Soundsensor (DF Robot)",
senseBox_soundsensor_dfrobot_tooltip:
"Schließe den Sensor an einen der 3 **digital/analog Ports** an. Der Sensor gibt dir den Messwert in dB mit einer Nachkommastelle",
senseBox_soundsensor_dfrobot_helpurl:
"https://docs.sensebox.de/hardware/sensoren-lautstaerke/",
senseBox_bme680: "Umweltsensor (BME680)",
senseBox_bme_iaq: "Innenraumluftqualität (IAQ)",
senseBox_bme_iaq_accuracy: "Kalibrierungswert",
senseBox_bme_co2: "CO2 Äquivalent",
senseBox_bme_breatheVocEquivalent: "Atemluft VOC Äquivalent",
senseBox_bme_tooltip: `Schließe den Umweltsensor an einen der 5 **I2C-Anschlüsse** an. **Beachte:** Der Sensor benöigt eine gewisse Zeit zum kalibrieren.
/*
* rainsensor hydreon rg-15
*/
sensebox_rainsensor_hydreon_rg15: "Regensensor (RG-15)",
sensebox_rainsensor_hydreon_rg15_port: "Serieller Port:",
sensebox_rainsensor_hydreon_rg15_serial1: "Serial1",
sensebox_rainsensor_hydreon_rg15_serial2: "Serial2",
sensebox_rainsensor_hydreon_rg15_value: "Messwert:",
sensebox_rainsensor_hydreon_rg15_totalAcc: "gesamter Niederschlag in mm",
sensebox_rainsensor_hydreon_rg15_rainInt: "Niederschlagsintensität in mm/h",
sensebox_rainsensor_hydreon_rg15_eventAcc: "Niederschlag pro Event in mm",
sensebox_rainsensor_hydreon_rg15_acc: "Niederschlag seit letzter Messung in mm",
sensebox_rainsensor_hydreon_rg15_tooltip: "Regensensor (RG-15) an einen der Seriellen Ports anschließen.",
sensebox_rainsensor_hydreon_rg15_helpurl: "https://rainsensors.com/products/rg-15/",
/*
* BME680
*/
senseBox_bme680: "Umweltsensor (BME680)",
senseBox_bme_iaq: "Innenraumluftqualität (IAQ)",
senseBox_bme_iaq_accuracy: "Kalibrierungswert",
senseBox_bme_co2: "CO2 Äquivalent",
senseBox_bme_breatheVocEquivalent: "Atemluft VOC Äquivalent",
senseBox_bme_tooltip: `Schließe den Umweltsensor an einen der 5 **I2C-Anschlüsse** an. **Beachte:** Der Sensor benöigt eine gewisse Zeit zum kalibrieren.
Den Status der Kalibrierung kann über den Kalibrierungswert abgelesen werden. Er ist entweder 0, 1, 2 oder 3 und sagt folgendes aus:
- IAQ Accuracy : 0 heißt Sensor wird stabilisiert (dauert ca. 25 Minuten) oder dass es eine Zeitüberschreitung gab,
@@ -132,49 +165,54 @@ Den Status der Kalibrierung kann über den Kalibrierungswert abgelesen werden. E
- IAQ Accuracy : 3 heißt Sensor erfolgreich kalibriert.
Die Messwerte für Temperatur, Luftfeuchtigkeit und Luftdruck können direkt verwendet werden.`,
senseBox_bme680_helpurl: "https://docs.sensebox.de/hardware/sensoren-umweltsensor/",
senseBox_bme680_helpurl:
"https://docs.sensebox.de/hardware/sensoren-umweltsensor/",
/**
* Truebner SMT50
*/
senseBox_smt50: "Bodenfeuchte/-temperatur (SMT50)",
senseBox_smt50_helpurl:
"https://docs.sensebox.de/hardware/sensoren-truebner/",
senseBox_smt50_tooltip:
"Schließe den Bodenfeuchtigkeit- und Temperatursensor an einen der 3 digital/analog Ports an und wähle den Port im Block aus. Der Sensor gibt die Bodentemperatur in °C und die Bodenfeuchtigkeit in % aus.",
/**
* Truebner SMT50
*/
senseBox_smt50: "Bodenfeuchte/-temperatur (SMT50)",
senseBox_smt50_helpurl: "https://docs.sensebox.de/hardware/sensoren-truebner/",
senseBox_smt50_tooltip: "Schließe den Bodenfeuchtigkeit- und Temperatursensor an einen der 3 digital/analog Ports an und wähle den Port im Block aus. Der Sensor gibt die Bodentemperatur in °C und die Bodenfeuchtigkeit in % aus.",
/**
* SCD30 CO2 Sensor
*/
senseBox_scd30: "CO2 Sensor (Sensirion SCD30)",
senseBox_scd_tooltip:
"Schließe den Sensor an einen der 5 **I2C-Anschlüsse** an. Der Sensor gibt dir den Messwert für die CO2-Konzentration in ppm. Der Temperaturmesswert kann aufgrund der Messung direkt am Sensor um einige Grad vom realen Wert abweichen.",
senseBox_scd_co2: "CO2 in ppm",
senseBox_scd_helpurl: "https://docs.sensebox.de/hardware/sensoren-co2/",
/**
* SCD30 CO2 Sensor
*/
senseBox_scd30: "CO2 Sensor (Sensirion SCD30)",
senseBox_scd_tooltip: "Schließe den Sensor an einen der 5 **I2C-Anschlüsse** an. Der Sensor gibt dir den Messwert für die CO2-Konzentration in ppm. Der Temperaturmesswert kann aufgrund der Messung direkt am Sensor um einige Grad vom realen Wert abweichen.",
senseBox_scd_co2: "CO2 in ppm",
senseBox_scd_helpurl: "https://docs.sensebox.de/hardware/sensoren-co2/",
/**
* Feinstaubsensor (SDS011)
*/
/**
* Feinstaubsensor (SDS011)
*/
senseBox_sds011: "Feinstaubsensor",
senseBox_sds011_dimension: "in µg/m³ an",
senseBox_sds011_pm25: "PM2.5",
senseBox_sds011_pm10: "PM10",
senseBox_sds011_tooltip:
"Dieser Block gibt dir den Messwert des Feinstaubsensor. Schließe den Feinstaubsensor an einen der 2 **Serial/UART** Anschlüssen an. Im Dropdown Menü zwischen PM2.5 und PM10 auswählen. Der Messwert wird dir als **Kommazahl** in µg/m3",
senseBox_sds011_serial1: "Serial1",
senseBox_sds011_serial2: "Serial2",
senseBox_sds011_helpurl:
"https://docs.sensebox.de/hardware/sensoren-feinstaub/",
senseBox_sds011: "Feinstaubsensor",
senseBox_sds011_dimension: "in µg/m³ an",
senseBox_sds011_pm25: "PM2.5",
senseBox_sds011_pm10: "PM10",
senseBox_sds011_tooltip: "Dieser Block gibt dir den Messwert des Feinstaubsensor. Schließe den Feinstaubsensor an einen der 2 **Serial/UART** Anschlüssen an. Im Dropdown Menü zwischen PM2.5 und PM10 auswählen. Der Messwert wird dir als **Kommazahl** in µg/m3",
senseBox_sds011_serial1: "Serial1",
senseBox_sds011_serial2: "Serial2",
senseBox_sds011_helpurl: "https://docs.sensebox.de/hardware/sensoren-feinstaub/",
/**
* Button
*/
senseBox_button: "Button",
senseBox_button_isPressed: "ist gedrückt",
senseBox_button_switch: "als Schalter",
senseBox_button_wasPressed: "wurde gedrückt",
senseBox_button_longPress: "Gedrückt für",
/**
* Button
*/
senseBox_button: "Button",
senseBox_button_isPressed: "ist gedrückt",
senseBox_button_switch: "als Schalter",
senseBox_button_wasPressed: "wurde gedrückt",
senseBox_button_tooltip: `Dieser Block gibt dir den Status des angeschlossenen Buttons. Im Dropdown Menü können verschiedene Modi für den Button ausgewählt werden. Angesteuert können entweder der on Board Button oder ein Button, der an einen der 6 digitalen Pins angeschlossen ist. verschiedene Modi:
senseBox_button_tooltip: `Dieser Block gibt dir den Status des angeschlossenen Buttons. Im Dropdown Menü können verschiedene Modi für den Button ausgewählt werden. Angesteuert können entweder der on Board Button oder ein Button, der an einen der 6 digitalen Pins angeschlossen ist. verschiedene Modi:
- "ist gedrückt": Mit diesem Modus kannst du abfragen ob der Block gerade gedrückt wird. Du erhältst entweder den Wert TRUE oder FALSE.
- "wurde gedrückt": Mit diesem Modus kannst du abfragen ob der Block gedrückt wurde. Erst wenn der Knopf gedrückt und wieder losgelassen wurde erhältst du TRUE zurück
- "als Schalter": Wenn du diesen Block verwendest kannst du den Knopf wie ein Lichtschalter verwenden. Der Status wird gespeichert bis der Button erneut gedrückt wird`,
senseBox_button_helpurl: "",
}
senseBox_button_helpurl: "",
};
+28 -10
View File
@@ -1,11 +1,29 @@
export const WEB = {
/**
* WiFi
*/
senseBox_wifi_connect: "Verbinde mit WLAN",
senseBox_wifi_ssid: "Netzwerkname",
senseBox_wifi_tooltip: "Stellt eine Verbindung mit einem WLAN-Netzwerk her. Möchtest du dich mit einem ungesicheren Netzwerk (z.B. Freifunk) verbinden lösche das Feld Passwort. Das WiFi-Bee muss auf den Steckplatz **XBEE1** aufgesteckt werden.",
senseBox_wifi_startap: "Initialisiere WLAN Access Point",
senseBox_wifi_startap_tooltip: "Erstellt einen WiFi-Accesspoint zu dem du dich verbinden kannst. Beachte, dass immer nur 1 Gerät gleichzeitig verbunden werden kann.",
senseBox_wifi_helpurl: "https://docs.sensebox.de/blockly/blockly-web-wifi/",
}
/**
* WiFi
*/
senseBox_wifi_connect: "Verbinde mit WLAN",
senseBox_wifi_ssid: "Netzwerkname",
senseBox_wifi_ip: "IP-Address",
senseBox_wifi_ip_tooltip: "Gibt die IP-Address der senseBox aus",
senseBox_wifi_status: "WiFi-Status",
senseBox_wifi_status_tooltip: "Gibt den Status der WiFi-Verbindung aus",
senseBox_wifi_rssi: "RSSI",
senseBox_wifi_rssi_tooltip: "Gibt die Sigal Stärke der WiFi-Verbindung",
senseBox_wifi_tooltip:
"Stellt eine Verbindung mit einem WLAN-Netzwerk her. Möchtest du dich mit einem ungesicheren Netzwerk (z.B. Freifunk) verbinden lösche das Feld Passwort. Das WiFi-Bee muss auf den Steckplatz **XBEE1** aufgesteckt werden.",
senseBox_wifi_startap: "Initialisiere WLAN Access Point",
senseBox_wifi_startap_tooltip:
"Erstellt einen WiFi-Accesspoint zu dem du dich verbinden kannst. Beachte, dass immer nur 1 Gerät gleichzeitig verbunden werden kann.",
senseBox_wifi_helpurl: "https://docs.sensebox.de/blockly/blockly-web-wifi/",
senseBox_ethernet: "Verbinde mit Ethernet",
senseBox_ethernet_dhcp: "DHCP",
senseBox_ethernet_manuel_config: "Manuelle Konfiguration",
senseBox_ethernet_ip: "IP-Adresse",
senseBox_ethernet_gateway: "Gateway",
senseBox_ethernet_subnetmask: "Subnetzmaske",
senseBox_ethernet_mac: "MAC-Adresse",
senseBox_ethernet_dns: "DNS-Server",
senseBox_ethernet_tooltip:
"Verbinde das LAN-Bee mit dem Steckplatz XBEE1. Die meisten Netzwerke verwenden DHCP und vergeben automatisch eine IP-Adresse. Solltest du eine Manuelle Konfiguration durchführen wollen wählen im Dropdown Menü **Manuelle Konfiguration** aus und gebe die entsprechenden Daten ein.",
};
+21 -19
View File
@@ -1,20 +1,22 @@
export const TIME = {
/**
* Interval Block
*/
senseBox_interval_timer: "Messintervall",
senseBox_interval: "ms",
senseBox_interval_timer_tip: "Intervall",
ARD_TIME_DELAY: "Warte",
ARD_TIME_DELAY_MICROS: "Mikrosekunden",
ARD_TIME_DELAY_MICRO_TIP: "Warte eine spezifischen Zeit in Microsekunden",
ARD_TIME_DELAY_TIP: "Warte spezifische Zeit in Millisekunden",
ARD_TIME_INF: "Warte für immer (Beende Programm)",
ARD_TIME_INF_TIP: "Stoppt das Programm.",
ARD_TIME_MICROS: "Bereits vergangen Zeit (Mikrosekunden)",
ARD_TIME_MICROS_TIP: "Gibt eine Zahl in Microsekunden zurück, die der Zeitdauer des Aktuellen Programms entspricht. Muss als positiven Integer gespeichert werden", // untranslated
ARD_TIME_MILLIS: "Bereits vergangen Zeit (Millisekunden)",
ARD_TIME_MILLIS_TIP: "Gibt eine Zahl in Millisekunden zurück, die der Zeitdauer des Aktuellen Programms entspricht. Muss als positiven Integer gespeichert werden", // untranslated
ARD_TIME_MS: "Millisekunden",
}
/**
* Interval Block
*/
senseBox_interval_timer: "Intervall: ",
senseBox_interval: "ms",
senseBox_interval_timer_tip:
"Definiere ein Intervall, das alle x Millisekunden ausgeführt wird",
ARD_TIME_DELAY: "Warte",
ARD_TIME_DELAY_MICROS: "Mikrosekunden",
ARD_TIME_DELAY_MICRO_TIP: "Warte eine spezifischen Zeit in Microsekunden",
ARD_TIME_DELAY_TIP: "Warte spezifische Zeit in Millisekunden",
ARD_TIME_INF: "Warte für immer (Beende Programm)",
ARD_TIME_INF_TIP: "Stoppt das Programm.",
ARD_TIME_MICROS: "Bereits vergangen Zeit (Mikrosekunden)",
ARD_TIME_MICROS_TIP:
"Gibt eine Zahl in Microsekunden zurück, die der Zeitdauer des Aktuellen Programms entspricht. Muss als positiven Integer gespeichert werden", // untranslated
ARD_TIME_MILLIS: "Bereits vergangen Zeit (Millisekunden)",
ARD_TIME_MILLIS_TIP:
"Gibt eine Zahl in Millisekunden zurück, die der Zeitdauer des Aktuellen Programms entspricht. Muss als positiven Integer gespeichert werden", // untranslated
ARD_TIME_MS: "Millisekunden",
};
+260 -207
View File
@@ -1,212 +1,265 @@
export const TRANSLATIONS = {
AUTH: "Bitte autorisiere diese App zum Aktivieren der Speicherung deiner Arbeit und zum Teilen.",
CHANGE_VALUE_TITLE: "Wert ändern:",
CHAT: "Chatte mit unserem Mitarbeiter durch Eingeben von Text in diesen Kasten!",
CLEAN_UP: "Blöcke aufräumen",
COLLAPSE_ALL: "Alle Blöcke zusammenfalten",
COLLAPSE_BLOCK: "Block zusammenfalten",
DELETE_ALL_BLOCKS: "Alle %1 Bausteine löschen?",
DELETE_BLOCK: "Block löschen",
DELETE_X_BLOCKS: "Block %1 löschen",
DISABLE_BLOCK: "Block deaktivieren",
DUPLICATE_BLOCK: "Kopieren",
ENABLE_BLOCK: "Block aktivieren",
EXPAND_ALL: "Alle Blöcke entfalten",
EXPAND_BLOCK: "Block entfalten",
EXTERNAL_INPUTS: "externe Eingänge",
HELP: "Hilfe",
INLINE_INPUTS: "interne Eingänge",
LISTS_CREATE_EMPTY_HELPURL:
"https://github.com/google/blockly/wiki/Lists#create-empty-list",
LISTS_CREATE_EMPTY_TITLE: "Erzeuge eine leere Liste",
LISTS_CREATE_EMPTY_TOOLTIP: "Erzeugt eine leere Liste ohne Inhalt.",
LISTS_CREATE_WITH_CONTAINER_TITLE_ADD: "Liste",
LISTS_CREATE_WITH_CONTAINER_TOOLTIP:
"Hinzufügen, entfernen und sortieren von Elementen.",
LISTS_CREATE_WITH_HELPURL:
"https://github.com/google/blockly/wiki/Lists#create-list-with",
LISTS_CREATE_WITH_INPUT_WITH: "Erzeuge Liste mit",
LISTS_CREATE_WITH_ITEM_TOOLTIP: "Ein Element zur Liste hinzufügen.",
LISTS_CREATE_WITH_TOOLTIP: "Erzeugt eine List mit konfigurierten Elementen.",
LISTS_GET_INDEX_FIRST: "erstes",
LISTS_GET_INDEX_FROM_END: "#tes von hinten",
LISTS_GET_INDEX_FROM_START: "#tes",
LISTS_GET_INDEX_GET: "nimm",
LISTS_GET_INDEX_GET_REMOVE: "nimm und entferne",
LISTS_GET_INDEX_LAST: "letztes",
LISTS_GET_INDEX_RANDOM: "zufälliges",
LISTS_GET_INDEX_REMOVE: "entferne",
LISTS_GET_INDEX_TAIL: "",
LISTS_GET_INDEX_TOOLTIP_GET_FIRST:
"Extrahiere das erste Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_FROM_END:
"Extrahiere das #1te Element aus Ende der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_FROM_START:
"Extrahiere das #1te Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_LAST:
"Extrahiere das letzte Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_RANDOM:
"Extrahiere ein zufälliges Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST:
"Extrahiere und entfernt das erste Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM_END:
"Extrahiere und entfernt das #1te Element aus Ende der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM_START:
"Extrahiere und entfernt das #1te Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST:
"Extrahiere und entfernt das letzte Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM:
"Extrahiere und entfernt ein zufälliges Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST:
"Entfernt das erste Element von der Liste.",
LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM_END:
"Entfernt das #1te Element von Ende der Liste.",
LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM_START:
"Entfernt das #1te Element von der Liste.",
LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST:
"Entfernt das letzte Element von der Liste.",
LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM:
"Entfernt ein zufälliges Element von der Liste.",
LISTS_GET_SUBLIST_END_FROM_END: "bis zu # von hinten",
LISTS_GET_SUBLIST_END_FROM_START: "bis zu #",
LISTS_GET_SUBLIST_END_LAST: "bis zum Ende",
LISTS_GET_SUBLIST_HELPURL:
"http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic:%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm",
LISTS_GET_SUBLIST_START_FIRST: "erhalte Unterliste vom Anfang",
LISTS_GET_SUBLIST_START_FROM_END: "erhalte Unterliste von # von hinten",
LISTS_GET_SUBLIST_START_FROM_START: "erhalte Unterliste von #",
LISTS_GET_SUBLIST_TAIL: "",
LISTS_GET_SUBLIST_TOOLTIP:
"Erstellt eine Kopie mit dem angegebenen Abschnitt der Liste.",
LISTS_INDEX_OF_FIRST: "suche erstes Auftreten von",
LISTS_INDEX_OF_HELPURL:
"http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic:%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm",
LISTS_INDEX_OF_LAST: "suche letztes Auftreten von",
LISTS_INDEX_OF_TOOLTIP:
"Sucht die Position (index) eines Elementes in der Liste. Gibt 0 zurück, falls kein Element gefunden wurde.",
LISTS_INLIST: "von der Liste",
LISTS_ISEMPTY_HELPURL:
"https://github.com/google/blockly/wiki/Lists#is-empty", // untranslated
LISTS_ISEMPTY_TITLE: "%1 ist leer?",
LISTS_ISEMPTY_TOOLTIP: "Ist wahr (true), wenn die Liste leer ist.",
LISTS_LENGTH_HELPURL:
"https://github.com/google/blockly/wiki/Lists#length-of", // untranslated
LISTS_LENGTH_TITLE: "Länge von %1",
LISTS_LENGTH_TOOLTIP: "Die Anzahl von Elementen in der Liste.",
LISTS_REPEAT_HELPURL:
"http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic:%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm",
LISTS_REPEAT_TITLE: "Erzeuge Liste mit Element %1 wiederhole es %2 mal",
LISTS_REPEAT_TOOLTIP:
"Erzeugt eine Liste mit einer variablen Anzahl von Elementen",
LISTS_SET_INDEX_HELPURL:
"http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic:%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm",
LISTS_SET_INDEX_INPUT_TO: "ein",
LISTS_SET_INDEX_INSERT: "füge",
LISTS_SET_INDEX_SET: "setze",
LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST:
"Fügt das Element an den Anfang der Liste an.",
LISTS_SET_INDEX_TOOLTIP_INSERT_FROM_END:
"Fügt das Element an der angegebenen Position in der Liste ein. #1 ist das letzte Element.",
LISTS_SET_INDEX_TOOLTIP_INSERT_FROM_START:
"Fügt das Element an der angegebenen Position in der Liste ein. #1 ist die erste Element.",
LISTS_SET_INDEX_TOOLTIP_INSERT_LAST:
"Fügt das Element ans Ende der Liste an.",
LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM:
"Fügt das Element zufällig in die Liste ein.",
LISTS_SET_INDEX_TOOLTIP_SET_FIRST: "Setzt das erste Element in der Liste.",
LISTS_SET_INDEX_TOOLTIP_SET_FROM_END:
"Setzt das Element an der angegebenen Position in der Liste. #1 ist das letzte Element.",
LISTS_SET_INDEX_TOOLTIP_SET_FROM_START:
"Setzte das Element an der angegebenen Position in der Liste. #1 ist das erste Element.",
LISTS_SET_INDEX_TOOLTIP_SET_LAST: "Setzt das letzte Element in der Liste.",
LISTS_SET_INDEX_TOOLTIP_SET_RANDOM:
"Setzt ein zufälliges Element in der Liste.",
LISTS_SORT_HELPURL:
"https://github.com/google/blockly/wiki/Lists#sorting-a-list",
LISTS_SORT_ORDER_ASCENDING: "aufsteigend",
LISTS_SORT_ORDER_DESCENDING: "absteigend",
LISTS_SORT_TITLE: "%1 %2 %3 sortieren",
LISTS_SORT_TOOLTIP: "Eine Kopie einer Liste sortieren.",
LISTS_SORT_TYPE_IGNORECASE: "alphabetisch, Schreibung ignorieren",
LISTS_SORT_TYPE_NUMERIC: "numerisch",
LISTS_SORT_TYPE_TEXT: "alphabetisch",
LISTS_SPLIT_HELPURL:
"https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists",
LISTS_SPLIT_LIST_FROM_TEXT: "Liste aus Text erstellen",
LISTS_SPLIT_TEXT_FROM_LIST: "Text aus Liste erstellen",
LISTS_SPLIT_TOOLTIP_JOIN:
"Liste mit Texten in einen Text vereinen, getrennt durch ein Trennzeichen.",
LISTS_SPLIT_TOOLTIP_SPLIT:
"Text in eine Liste mit Texten aufteilen, unterbrochen bei jedem Trennzeichen.",
LISTS_SPLIT_WITH_DELIMITER: "mit Trennzeichen",
LOGIC_BOOLEAN_FALSE: "falsch",
AUTH: "Bitte autorisiere diese App zum Aktivieren der Speicherung deiner Arbeit und zum Teilen.",
CHANGE_VALUE_TITLE: "Wert ändern:",
CHAT: "Chatte mit unserem Mitarbeiter durch Eingeben von Text in diesen Kasten!",
CLEAN_UP: "Blöcke aufräumen",
COLLAPSE_ALL: "Alle Blöcke zusammenfalten",
COLLAPSE_BLOCK: "Block zusammenfalten",
DELETE_ALL_BLOCKS: "Alle %1 Bausteine löschen?",
DELETE_BLOCK: "Block löschen",
DELETE_X_BLOCKS: "Block %1 löschen",
DISABLE_BLOCK: "Block deaktivieren",
DUPLICATE_BLOCK: "Kopieren",
ENABLE_BLOCK: "Block aktivieren",
EXPAND_ALL: "Alle Blöcke entfalten",
EXPAND_BLOCK: "Block entfalten",
EXTERNAL_INPUTS: "externe Eingänge",
HELP: "Hilfe",
INLINE_INPUTS: "interne Eingänge",
LISTS_CREATE_EMPTY_HELPURL: "https://github.com/google/blockly/wiki/Lists#create-empty-list",
LISTS_CREATE_EMPTY_TITLE: "Erzeuge eine leere Liste",
LISTS_CREATE_EMPTY_TOOLTIP: "Erzeugt eine leere Liste ohne Inhalt.",
LISTS_CREATE_WITH_CONTAINER_TITLE_ADD: "Liste",
LISTS_CREATE_WITH_CONTAINER_TOOLTIP: "Hinzufügen, entfernen und sortieren von Elementen.",
LISTS_CREATE_WITH_HELPURL: "https://github.com/google/blockly/wiki/Lists#create-list-with",
LISTS_CREATE_WITH_INPUT_WITH: "Erzeuge Liste mit",
LISTS_CREATE_WITH_ITEM_TOOLTIP: "Ein Element zur Liste hinzufügen.",
LISTS_CREATE_WITH_TOOLTIP: "Erzeugt eine List mit konfigurierten Elementen.",
LISTS_GET_INDEX_FIRST: "erstes",
LISTS_GET_INDEX_FROM_END: "#tes von hinten",
LISTS_GET_INDEX_FROM_START: "#tes",
LISTS_GET_INDEX_GET: "nimm",
LISTS_GET_INDEX_GET_REMOVE: "nimm und entferne",
LISTS_GET_INDEX_LAST: "letztes",
LISTS_GET_INDEX_RANDOM: "zufälliges",
LISTS_GET_INDEX_REMOVE: "entferne",
LISTS_GET_INDEX_TAIL: "",
LISTS_GET_INDEX_TOOLTIP_GET_FIRST: "Extrahiere das erste Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_FROM_END: "Extrahiere das #1te Element aus Ende der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_FROM_START: "Extrahiere das #1te Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_LAST: "Extrahiere das letzte Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_RANDOM: "Extrahiere ein zufälliges Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST: "Extrahiere und entfernt das erste Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM_END: "Extrahiere und entfernt das #1te Element aus Ende der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM_START: "Extrahiere und entfernt das #1te Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST: "Extrahiere und entfernt das letzte Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM: "Extrahiere und entfernt ein zufälliges Element aus der Liste.",
LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST: "Entfernt das erste Element von der Liste.",
LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM_END: "Entfernt das #1te Element von Ende der Liste.",
LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM_START: "Entfernt das #1te Element von der Liste.",
LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST: "Entfernt das letzte Element von der Liste.",
LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM: "Entfernt ein zufälliges Element von der Liste.",
LISTS_GET_SUBLIST_END_FROM_END: "bis zu # von hinten",
LISTS_GET_SUBLIST_END_FROM_START: "bis zu #",
LISTS_GET_SUBLIST_END_LAST: "bis zum Ende",
LISTS_GET_SUBLIST_HELPURL: "http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic:%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm",
LISTS_GET_SUBLIST_START_FIRST: "erhalte Unterliste vom Anfang",
LISTS_GET_SUBLIST_START_FROM_END: "erhalte Unterliste von # von hinten",
LISTS_GET_SUBLIST_START_FROM_START: "erhalte Unterliste von #",
LISTS_GET_SUBLIST_TAIL: "",
LISTS_GET_SUBLIST_TOOLTIP: "Erstellt eine Kopie mit dem angegebenen Abschnitt der Liste.",
LISTS_INDEX_OF_FIRST: "suche erstes Auftreten von",
LISTS_INDEX_OF_HELPURL: "http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic:%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm",
LISTS_INDEX_OF_LAST: "suche letztes Auftreten von",
LISTS_INDEX_OF_TOOLTIP: "Sucht die Position (index) eines Elementes in der Liste. Gibt 0 zurück, falls kein Element gefunden wurde.",
LISTS_INLIST: "von der Liste",
LISTS_ISEMPTY_HELPURL: "https://github.com/google/blockly/wiki/Lists#is-empty", // untranslated
LISTS_ISEMPTY_TITLE: "%1 ist leer?",
LISTS_ISEMPTY_TOOLTIP: "Ist wahr (true), wenn die Liste leer ist.",
LISTS_LENGTH_HELPURL: "https://github.com/google/blockly/wiki/Lists#length-of", // untranslated
LISTS_LENGTH_TITLE: "Länge von %1",
LISTS_LENGTH_TOOLTIP: "Die Anzahl von Elementen in der Liste.",
LISTS_REPEAT_HELPURL: "http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic:%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm",
LISTS_REPEAT_TITLE: "Erzeuge Liste mit Element %1 wiederhole es %2 mal",
LISTS_REPEAT_TOOLTIP: "Erzeugt eine Liste mit einer variablen Anzahl von Elementen",
LISTS_SET_INDEX_HELPURL: "http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic:%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm",
LISTS_SET_INDEX_INPUT_TO: "ein",
LISTS_SET_INDEX_INSERT: "füge",
LISTS_SET_INDEX_SET: "setze",
LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST: "Fügt das Element an den Anfang der Liste an.",
LISTS_SET_INDEX_TOOLTIP_INSERT_FROM_END: "Fügt das Element an der angegebenen Position in der Liste ein. #1 ist das letzte Element.",
LISTS_SET_INDEX_TOOLTIP_INSERT_FROM_START: "Fügt das Element an der angegebenen Position in der Liste ein. #1 ist die erste Element.",
LISTS_SET_INDEX_TOOLTIP_INSERT_LAST: "Fügt das Element ans Ende der Liste an.",
LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM: "Fügt das Element zufällig in die Liste ein.",
LISTS_SET_INDEX_TOOLTIP_SET_FIRST: "Setzt das erste Element in der Liste.",
LISTS_SET_INDEX_TOOLTIP_SET_FROM_END: "Setzt das Element an der angegebenen Position in der Liste. #1 ist das letzte Element.",
LISTS_SET_INDEX_TOOLTIP_SET_FROM_START: "Setzte das Element an der angegebenen Position in der Liste. #1 ist das erste Element.",
LISTS_SET_INDEX_TOOLTIP_SET_LAST: "Setzt das letzte Element in der Liste.",
LISTS_SET_INDEX_TOOLTIP_SET_RANDOM: "Setzt ein zufälliges Element in der Liste.",
LISTS_SORT_HELPURL: "https://github.com/google/blockly/wiki/Lists#sorting-a-list",
LISTS_SORT_ORDER_ASCENDING: "aufsteigend",
LISTS_SORT_ORDER_DESCENDING: "absteigend",
LISTS_SORT_TITLE: "%1 %2 %3 sortieren",
LISTS_SORT_TOOLTIP: "Eine Kopie einer Liste sortieren.",
LISTS_SORT_TYPE_IGNORECASE: "alphabetisch, Schreibung ignorieren",
LISTS_SORT_TYPE_NUMERIC: "numerisch",
LISTS_SORT_TYPE_TEXT: "alphabetisch",
LISTS_SPLIT_HELPURL: "https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists",
LISTS_SPLIT_LIST_FROM_TEXT: "Liste aus Text erstellen",
LISTS_SPLIT_TEXT_FROM_LIST: "Text aus Liste erstellen",
LISTS_SPLIT_TOOLTIP_JOIN: "Liste mit Texten in einen Text vereinen, getrennt durch ein Trennzeichen.",
LISTS_SPLIT_TOOLTIP_SPLIT: "Text in eine Liste mit Texten aufteilen, unterbrochen bei jedem Trennzeichen.",
LISTS_SPLIT_WITH_DELIMITER: "mit Trennzeichen",
LOGIC_BOOLEAN_FALSE: "falsch",
ME: "Ich",
NEW_VARIABLE: "Neue Variable...",
NEW_VARIABLE_TITLE: "Name der neuen Variable:",
ORDINAL_NUMBER_SUFFIX: "",
PROCEDURES_ALLOW_STATEMENTS: "Aussagen erlauben",
PROCEDURES_CALLNORETURN_HELPURL:
"https://de.wikipedia.org/wiki/Prozedur_%28Programmierung%29",
PROCEDURES_CALLNORETURN_TOOLTIP:
"Rufe einen Funktionsblock ohne Rückgabewert auf.",
PROCEDURES_CALLRETURN_HELPURL:
"https://de.wikipedia.org/wiki/Prozedur_%28Programmierung%29",
PROCEDURES_CALLRETURN_TOOLTIP:
"Rufe einen Funktionsblock mit Rückgabewert auf.",
PROCEDURES_CALL: "Rufe",
PROCEDURES_CALL_END: "auf",
PROCEDURES_DEFNORETURN: "Erstelle Funktion",
PROCEDURES_BEFORE_PARAMS: "mit Eingabeparameter:",
PROCEDURES_DEFRETURN_RETURN_TYPE: "Rückgabetype",
PROCEDURES_CALL_BEFORE_PARAMS: "mit:",
PROCEDURES_CREATE_DO: 'Erzeuge "Aufruf %1"',
PROCEDURES_DEFNORETURN_COMMENT: "Beschreibe diese Funktion …",
PROCEDURES_DEFNORETURN_DO: "",
PROCEDURES_DEFNORETURN_HELPURL:
"https://de.wikipedia.org/wiki/Prozedur_%28Programmierung%29",
PROCEDURES_DEFNORETURN_PROCEDURE: "Funktionsblock",
PROCEDURES_DEFNORETURN_TITLE: "zu",
PROCEDURES_DEFNORETURN_TOOLTIP: "Ein Funktionsblock ohne Rückgabewert.",
PROCEDURES_DEFRETURN_HELPURL:
"https://de.wikipedia.org/wiki/Prozedur_%28Programmierung%29",
PROCEDURES_DEFRETURN_RETURN: "gebe zurück",
PROCEDURES_DEFRETURN_TOOLTIP: "Ein Funktionsblock mit Rückgabewert.",
PROCEDURES_DEF_DUPLICATE_WARNING:
"Warnung: dieser Funktionsblock hat zwei gleich benannte Parameter.",
PROCEDURES_HIGHLIGHT_DEF: "Markiere Funktionsblock",
PROCEDURES_IFRETURN_HELPURL: "http://c2.com/cgi/wiki?GuardClause",
PROCEDURES_IFRETURN_TOOLTIP:
"Wenn der erste Wert wahr (true) ist, Gebe den zweiten Wert zurück.",
PROCEDURES_IFRETURN_WARNING:
"Warnung: Dieser Block darf nur innerhalb eines Funktionsblock genutzt werden.",
PROCEDURES_MUTATORARG_TITLE: "Variable:",
PROCEDURES_MUTATORARG_TOOLTIP: "Eine Eingabe zur Funktion hinzufügen.",
PROCEDURES_MUTATORCONTAINER_TITLE: "Parameter",
PROCEDURES_MUTATORCONTAINER_TOOLTIP:
"Die Eingaben zu dieser Funktion hinzufügen, entfernen oder neu anordnen.",
REDO: "Wiederholen",
REMOVE_COMMENT: "Kommentar entfernen",
RENAME_VARIABLE: "Variable umbenennen...",
RENAME_VARIABLE_TITLE: 'Alle "%1" Variablen umbenennen in:',
ME: "Ich",
NEW_VARIABLE: "Neue Variable...",
NEW_VARIABLE_TITLE: "Name der neuen Variable:",
ORDINAL_NUMBER_SUFFIX: "",
PROCEDURES_ALLOW_STATEMENTS: "Aussagen erlauben",
PROCEDURES_CALLNORETURN_HELPURL: "https://de.wikipedia.org/wiki/Prozedur_%28Programmierung%29",
PROCEDURES_CALLNORETURN_TOOLTIP: "Rufe einen Funktionsblock ohne Rückgabewert auf.",
PROCEDURES_CALLRETURN_HELPURL: "https://de.wikipedia.org/wiki/Prozedur_%28Programmierung%29",
PROCEDURES_CALLRETURN_TOOLTIP: "Rufe einen Funktionsblock mit Rückgabewert auf.",
PROCEDURES_CALL: "Rufe",
PROCEDURES_CALL_END: "auf",
PROCEDURES_DEFNORETURN: "Erstelle Funktion",
PROCEDURES_BEFORE_PARAMS: "mit Eingabeparameter:",
PROCEDURES_DEFRETURN_RETURN_TYPE: "Rückgabetype",
PROCEDURES_CALL_BEFORE_PARAMS: "mit:",
PROCEDURES_CREATE_DO: "Erzeuge \"Aufruf %1\"",
PROCEDURES_DEFNORETURN_COMMENT: "Beschreibe diese Funktion …",
PROCEDURES_DEFNORETURN_DO: "",
PROCEDURES_DEFNORETURN_HELPURL: "https://de.wikipedia.org/wiki/Prozedur_%28Programmierung%29",
PROCEDURES_DEFNORETURN_PROCEDURE: "Funktionsblock",
PROCEDURES_DEFNORETURN_TITLE: "zu",
PROCEDURES_DEFNORETURN_TOOLTIP: "Ein Funktionsblock ohne Rückgabewert.",
PROCEDURES_DEFRETURN_HELPURL: "https://de.wikipedia.org/wiki/Prozedur_%28Programmierung%29",
PROCEDURES_DEFRETURN_RETURN: "gebe zurück",
PROCEDURES_DEFRETURN_TOOLTIP: "Ein Funktionsblock mit Rückgabewert.",
PROCEDURES_DEF_DUPLICATE_WARNING: "Warnung: dieser Funktionsblock hat zwei gleich benannte Parameter.",
PROCEDURES_HIGHLIGHT_DEF: "Markiere Funktionsblock",
PROCEDURES_IFRETURN_HELPURL: "http://c2.com/cgi/wiki?GuardClause",
PROCEDURES_IFRETURN_TOOLTIP: "Wenn der erste Wert wahr (true) ist, Gebe den zweiten Wert zurück.",
PROCEDURES_IFRETURN_WARNING: "Warnung: Dieser Block darf nur innerhalb eines Funktionsblock genutzt werden.",
PROCEDURES_MUTATORARG_TITLE: "Variable:",
PROCEDURES_MUTATORARG_TOOLTIP: "Eine Eingabe zur Funktion hinzufügen.",
PROCEDURES_MUTATORCONTAINER_TITLE: "Parameter",
PROCEDURES_MUTATORCONTAINER_TOOLTIP: "Die Eingaben zu dieser Funktion hinzufügen, entfernen oder neu anordnen.",
REDO: "Wiederholen",
REMOVE_COMMENT: "Kommentar entfernen",
RENAME_VARIABLE: "Variable umbenennen...",
RENAME_VARIABLE_TITLE: "Alle \"%1\" Variablen umbenennen in:",
TODAY: "Heute",
UNDO: "Rückgängig",
VARIABLES_DEFAULT_NAME: "Element",
VARIABLES_GET_CREATE_SET: 'Erzeuge "Schreibe %1"',
VARIABLES_GET_HELPURL:
"https://de.wikipedia.org/wiki/Variable_%28Programmierung%29",
VARIABLES_GET_TOOLTIP: "Gibt den Wert der Variable zurück.",
VARIABLES_SET: "Schreibe %1 %2",
VARIABLES_SET_CREATE_GET: 'Erzeuge "Lese %1"',
VARIABLES_SET_HELPURL:
"https://de.wikipedia.org/wiki/Variable_%28Programmierung%29",
VARIABLES_SET_TOOLTIP: "Setzt den Wert einer Variable.",
MATH_CHANGE_TITLE_ITEM: "Element",
PROCEDURES_DEFRETURN_TITLE: "zu",
CONTROLS_IF_IF_TITLE_IF: "if",
CONTROLS_WHILEUNTIL_INPUT_DO: "mache",
CONTROLS_IF_MSG_THEN: "mache",
CONTROLS_IF_ELSE_TITLE_ELSE: "sonst",
PROCEDURES_DEFRETURN_PROCEDURE: "Funktionsblock",
LISTS_GET_SUBLIST_INPUT_IN_LIST: "in der Liste",
LISTS_GET_INDEX_INPUT_IN_LIST: "in der Liste",
PROCEDURES_DEFRETURN_DO: "",
CONTROLS_IF_ELSEIF_TITLE_ELSEIF: "sonst wenn",
LISTS_GET_INDEX_HELPURL:
"https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list",
CONTROLS_FOREACH_INPUT_DO: "mache",
LISTS_SET_INDEX_INPUT_IN_LIST: "in der Liste",
CONTROLS_FOR_INPUT_DO: "mache",
LISTS_CREATE_WITH_ITEM_TITLE: "item",
TEXT_APPEND_VARIABLE: "item",
TEXT_CREATE_JOIN_ITEM_TITLE_ITEM: "item",
LISTS_INDEX_OF_INPUT_IN_LIST: "von der Liste",
PROCEDURES_DEFRETURN_COMMENT: "Beschreibe diese Funktion …",
TODAY: "Heute",
UNDO: "Rückgängig",
VARIABLES_DEFAULT_NAME: "Element",
VARIABLES_GET_CREATE_SET: "Erzeuge \"Schreibe %1\"",
VARIABLES_GET_HELPURL: "https://de.wikipedia.org/wiki/Variable_%28Programmierung%29",
VARIABLES_GET_TOOLTIP: "Gibt den Wert der Variable zurück.",
VARIABLES_SET: "Schreibe %1 %2",
VARIABLES_SET_CREATE_GET: "Erzeuge \"Lese %1\"",
VARIABLES_SET_HELPURL: "https://de.wikipedia.org/wiki/Variable_%28Programmierung%29",
VARIABLES_SET_TOOLTIP: "Setzt den Wert einer Variable.",
MATH_CHANGE_TITLE_ITEM: "Element",
PROCEDURES_DEFRETURN_TITLE: "zu",
CONTROLS_IF_IF_TITLE_IF: "if",
CONTROLS_WHILEUNTIL_INPUT_DO: "mache",
CONTROLS_IF_MSG_THEN: "mache",
CONTROLS_IF_ELSE_TITLE_ELSE: "sonst",
PROCEDURES_DEFRETURN_PROCEDURE: "Funktionsblock",
LISTS_GET_SUBLIST_INPUT_IN_LIST: "in der Liste",
LISTS_GET_INDEX_INPUT_IN_LIST: "in der Liste",
PROCEDURES_DEFRETURN_DO: "",
CONTROLS_IF_ELSEIF_TITLE_ELSEIF: "sonst wenn",
LISTS_GET_INDEX_HELPURL: "https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list",
CONTROLS_FOREACH_INPUT_DO: "mache",
LISTS_SET_INDEX_INPUT_IN_LIST: "in der Liste",
CONTROLS_FOR_INPUT_DO: "mache",
LISTS_CREATE_WITH_ITEM_TITLE: "item",
TEXT_APPEND_VARIABLE: "item",
TEXT_CREATE_JOIN_ITEM_TITLE_ITEM: "item",
LISTS_INDEX_OF_INPUT_IN_LIST: "von der Liste",
PROCEDURES_DEFRETURN_COMMENT: "Beschreibe diese Funktion …",
/*senseBox Blockly Translations*/
/*senseBox Blockly Translations*/
senseBox_basic_blue: "Blau",
senseBox_basic_green: "Grün",
senseBox_basic_red: "Rot",
senseBox_basic_state: "Status",
senseBox_off: "Aus",
senseBox_on: "Ein",
senseBox_sensor: "Sensoren",
senseBox_output_filename: "Daten",
senseBox_output_format: "Format:",
senseBox_output_linebreak: "Zeilenumbruch",
senseBox_output_networkid: "NetzwerkID",
senseBox_output_password: "Passwort",
senseBox_output_safetosd: "Auf SD Karte speichern",
senseBox_output_safetosd_tip: "Speichert Messwerte auf SD Karte",
senseBox_output_serialprint: "Auf Kommandozeile ausgeben",
senseBox_serial_tip: "Gibt Messwerte oder Daten auf dem Seriellen Monitor der Arduino IDE aus. Praktisch um ohne Display zu arbeiten",
senseBox_output_timestamp: "Zeitstempel",
senseBox_led: "LED an digitalen",
senseBox_led_tip: "Einfache LED. Beim Anschluss sollte immer ein Vorwiderstand verwendet werden",
senseBox_piezo: "Piezo an digital",
senseBox_piezo_tip: "Piezo an digital PIN. Beim Anschluss sollte immer ein Vorwiderstand verwendet werden",
senseBox_foto: "Fotowiderstand",
senseBox_foto_tip: "Fotowiderstand",
senseBox_hum: "Luftfeuchtigkeit in %",
senseBox_hum_tip: "Luftfeuchtigkeit",
senseBox_ir: "Infrarot Abstandssensor",
senseBox_ir_tip: "Infrarot Abstandssensor",
senseBox_lux: "Helligkeitssensor",
senseBox_lux_tip: "Helligkeitssensor",
senseBox_poti: "Potenziometer",
senseBox_poti_tip: "Potenziometer",
senseBox_soil: "Bodenfeuchte",
senseBox_watertemperature: "Wassertemperatur",
}
senseBox_basic_blue: "Blau",
senseBox_basic_green: "Grün",
senseBox_basic_red: "Rot",
senseBox_basic_state: "Status",
senseBox_off: "Aus",
senseBox_on: "Ein",
senseBox_sensor: "Sensoren",
senseBox_output_filename: "Daten",
senseBox_output_format: "Format:",
senseBox_output_linebreak: "Zeilenumbruch",
senseBox_output_networkid: "NetzwerkID",
senseBox_output_password: "Passwort",
senseBox_output_safetosd: "Auf SD Karte speichern",
senseBox_output_safetosd_tip: "Speichert Messwerte auf SD Karte",
senseBox_output_serialprint: "Auf Kommandozeile ausgeben",
senseBox_serial_tip:
"Gibt Messwerte oder Daten auf dem Seriellen Monitor der Arduino IDE aus. Praktisch um ohne Display zu arbeiten",
senseBox_output_timestamp: "Zeitstempel (RFC 3339)",
senseBox_led: "LED an",
senseBox_led_tip:
"Einfache LED. Beim Anschluss sollte immer ein Vorwiderstand verwendet werden",
senseBox_piezo: "Piezo an digital",
senseBox_piezo_tip:
"Piezo an digital PIN. Beim Anschluss sollte immer ein Vorwiderstand verwendet werden",
senseBox_foto: "Fotowiderstand",
senseBox_foto_tip: "Fotowiderstand",
senseBox_hum: "Luftfeuchtigkeit in %",
senseBox_hum_tip: "Luftfeuchtigkeit",
senseBox_ir: "Infrarot Abstandssensor",
senseBox_ir_tip: "Infrarot Abstandssensor",
senseBox_lux: "Helligkeitssensor",
senseBox_lux_tip: "Helligkeitssensor",
senseBox_poti: "Potenziometer",
senseBox_poti_tip: "Potenziometer",
senseBox_soil: "Bodenfeuchte",
senseBox_watertemperature: "Wassertemperatur",
};
+35 -6
View File
@@ -10,6 +10,8 @@ export const UI = {
toolbox_time: "Zeit",
toolbox_functions: "Funktionen",
toolbox_variables: "Variablen",
toolbox_serial: "Seriell",
toolbox_advanced: "Erweitert",
variable_NUMBER: "Zahl (int)",
variable_SHORT_NUMBER: "char",
variable_LONG: "große Zahl (long)",
@@ -49,7 +51,14 @@ export const UI = {
tooltip_project_title: "Titel des Projektes",
tooltip_check_solution: "Lösung kontrollieren",
tooltip_copy_code: "Code in die Zwischenablage kopieren",
tooltip_statistics_current: "Anzahl aktueller Blöcke",
tooltip_statistics_new: "Anzahl neuer Blöcke",
tooltip_statistics_changed: "Anzahl veränderter Blöcke",
tooltip_statistics_moved: "Anzahl bewegter Blöcke",
tooltip_statistics_deleted: "Anzahl gelöschter Blöcke",
tooltip_statistics_remaining: "Verbleibende Blöcke",
tooltip_statistics_show: "Statistiken anzeigen",
tooltip_start_tour: "Tour starten",
/**
* Messages
*
@@ -76,13 +85,23 @@ export const UI = {
messages_rename_success_01: "Das Projekt wurde erfolgreich in ",
messages_rename_success_02: "umbenannt.",
messages_newblockly_head:
"Willkommen zur neuen Version Blockly für die senseBox",
"Willkommen zur neuen senseBox Lern- und Programmierumgebung",
messages_newblockly_text:
"Die neue Blockly-Version befindet sich derzeit in der Testphase. Wenn Sie einen Fehler finden, melden Sie diesen bitte in unserem [Forum](https://forum.sensebox.de/t/neue-blockly-version-beta-test-und-feedback/1176). Eine Übersicht über alle neuen Funktionen finden Sie [hier](/news)",
"Nach einer Testphase kann die neue senseBox Lern- und Programmierumgebung verwendet werden. Wenn Sie weiterhin Fehler finden, melden Sie diesen bitte in unserem [Forum](https://forum.sensebox.de/t/neue-blockly-version-beta-test-und-feedback/1176). Eine Übersicht über alle neuen Funktionen finden Sie [hier](/news)",
messages_GET_TUTORIAL_FAIL: "Zurück zur Tutorials-Übersicht",
messages_LOGIN_FAIL: "Der Benutzername oder das Passwort ist nicht korrekt.",
messages_copy_code: "Code wurde in die Zwischenablage kopiert",
/**
* Tablet Dialog
*/
tabletDialog_headline: "Tablet Modus ist aktiviert!",
tabletDialog_text:
"Der Tablet Modus wurde aktiviert. Du kannst nun Programmcodes über die senseBox Connect App auf deine senseBox kopieren. Der Tablet Modus kann in den Einstellungen deaktiviert werden",
tabletDialog_more:
"Weitere Informationen und den Link zum Download der App findest du unter: ",
/**
* Reset Dialog
*/
@@ -154,6 +173,14 @@ export const UI = {
"Die Anzeige von Statistiken zur Nutzung der Blöcke oberhalb der Arbeitsfläche kann ein- oder ausgeblendet werden.",
settings_statistics_on: "An",
settings_statistics_off: "Aus",
settings_ota_head: "Tablet Modus",
settings_ota_text:
"Der Tablet Modus deaktiviert die Code anzeige und aktiviert die Möglichkeit den Programmcode über die senseBox Connect App zu übertragen. Weitere Informationen dazu findest du unter: ",
settings_ota_on: "Aktiviert",
settings_ota_off: "Deaktiviert",
settings_sounds: "Töne",
settings_sounds_text:
"Aktiviere oder Deaktiviere Töne beim hinzufügen und löschen von Blöcken. Standardmäßig deaktiviert",
/**
* 404
@@ -175,7 +202,7 @@ export const UI = {
/**
* Tutorials
*/
tutorials_home_head: "Tutorial-Übersicht",
tutorials_assessment_task: "Aufgabe",
tutorials_hardware_head: "Für die Umsetzung benötigst du folgende Hardware:",
tutorials_hardware_moreInformation:
@@ -187,7 +214,9 @@ export const UI = {
/**
* Tutorial Builder
*/
builder_createNew: "neues Tutorial erstellen",
builder_changeExisting: "bestehendes Tutorial ändern",
builder_deleteExisting: "bestehendes Tutorial löschen",
builder_solution: "Lösung",
builder_solution_submit: "Lösung einreichen",
builder_example_submit: "Beispiel einreichen",
@@ -215,7 +244,7 @@ export const UI = {
navbar_tutorials: "Tutorials",
navbar_tutorialbuilder: "Tutorial erstellen",
navbar_gallery: "Gallerie",
navbar_gallery: "Galerie",
navbar_projects: "Projekte",
navbar_menu: "Menü",
+3 -3
View File
@@ -726,7 +726,7 @@ Blockly.Msg.senseBox_output_safetosd_tip = "Speichert Messwerte auf SD Karte";
Blockly.Msg.senseBox_output_serialprint = "Auf Kommandozeile ausgeben";
Blockly.Msg.senseBox_serial_tip =
"Gibt Messwerte oder Daten auf dem Seriellen Monitor der Arduino IDE aus. Praktisch um ohne Display zu arbeiten";
Blockly.Msg.senseBox_output_timestamp = "Zeitstempel";
Blockly.Msg.senseBox_output_timestamp = "Zeitstempel (RFC 3339)";
Blockly.Msg.senseBox_led = "LED an digitalen";
Blockly.Msg.senseBox_led_tip =
@@ -745,8 +745,8 @@ Blockly.Msg.senseBox_lux_tip = "Helligkeitssensor";
Blockly.Msg.senseBox_poti = "Potenziometer";
Blockly.Msg.senseBox_poti_tip = "Potenziometer";
Blockly.Msg.senseBox_pressure_sensor = "Luftdruck-/Temperatursensor (BMP280)";
Blockly.Msg.senseBox_pressure = "Luftdruck in Pa";
Blockly.Msg.senseBox_pressure_dimension = "Luftdruck in Pa";
Blockly.Msg.senseBox_pressure = "Luftdruck in hPa";
Blockly.Msg.senseBox_pressure_dimension = "Luftdruck in hPa";
Blockly.Msg.senseBox_pressure_tip = "Luftdrucksensor";
Blockly.Msg.senseBox_pressure_referencePressure = "Luftdruck auf NN";
Blockly.Msg.senseBox_pressure_referencePressure_dim = "hPa";
+12 -13
View File
@@ -1,11 +1,10 @@
export const FAQ = {
/**
* FAQ
*/
/**
* FAQ
*/
faq_q1_question: `How can I copy my program to the senseBox?`,
faq_q1_answer: `To copy programs to the senseBox, connect it to the computer with the Micro USB cable. Then double click on the red reset button on the senseBox MCU. The senseBox will now be recognized as a removable disk on your computer and the previously created programs can be copied via drag & drop. After each change of the program code the program must be recompiled and transferred again.
faq_q1_question: `How can I copy my program to the senseBox?`,
faq_q1_answer: `To copy programs to the senseBox, connect it to the computer with the Micro USB cable. Then double click on the red reset button on the senseBox MCU. The senseBox will now be recognized as a removable disk on your computer and the previously created programs can be copied via drag & drop. After each change of the program code the program must be recompiled and transferred again.
#### Activate learning mode of the MCU
<iframe width="560" height="315" src="https://www.youtube.com/embed/jzlOJ7Zuqqw" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
@@ -15,15 +14,15 @@ Copying programs under MacOS does not work via the Finder, but there are still t
- [muCommander](https://www.mucommander.com/)
`,
faq_q2_question: `With which senseBox is the programming environment compatible?`,
faq_q2_answer: `
faq_q2_question: `With which senseBox is the programming environment compatible?`,
faq_q2_answer: `
Basically the programming environment can be used with any senseBox with senseBox MCU.
`,
faq_q3_question: `I found an error or something is not working. Where can I report it?`,
faq_q3_answer: `
faq_q3_question: `I found an error or something is not working. Where can I report it?`,
faq_q3_answer: `
The best way to do this is to create an issue on [Github](https://github.com/sensebox/React-Ardublockly/issues). Alternatively you can send us an email to info(at)sensebox.de
`,
}
faq_tablet_question: `Can I program the senseBox with a tablet?`,
faq_tablet_answer: `Yes! Install the senseBox Connect app from the App Store and call up the learning and programming environment in your browser on the tablet. Detailed information on how to use the app can be found at [https://sensebox.de/app](https://sensebox.de/app)`,
};
+112 -106
View File
@@ -1,107 +1,113 @@
export const IO = {
ARD_ANALOGREAD: "read analog pin#",
ARD_ANALOGREAD_TIP: "Return value between 0 and 1024",
ARD_ANALOGWRITE: "set analog pin#",
ARD_ANALOGWRITE_TIP: "Write analog value between 0 and 255 to a specific PWM Port",
ARD_BUILTIN_LED: "set built-in LED",
ARD_BUILTIN_LED_TIP: "Light on or off for the built-in LED of the Arduino",
ARD_COMPONENT_WARN1: "A %1 configuration block with the same %2 name must be added to use this block!",
ARD_DEFINE: "Define",
ARD_DIGITALREAD: "read digital pin#",
ARD_DIGITALREAD_TIP: "Read digital value on a pin: HIGH or LOW",
ARD_DIGITALWRITE: "set digitial pin#",
ARD_DIGITALWRITE_TIP: "Write digital value HIGH or LOW to a specific Port",
ARD_FUN_RUN_LOOP: "Arduino loop forever:",
ARD_FUN_RUN_SETUP: "Arduino run first:",
ARD_FUN_RUN_TIP: "Defines the Arduino setup() and loop() functions.",
ARD_HIGH: "HIGH",
ARD_HIGHLOW_TIP: "Set a pin state logic High or Low.",
ARD_LOW: "LOW",
ARD_MAP: "Map Value",
ARD_MAP_FROMMAX: "from Max",
ARD_MAP_FROMMIN: "from Min",
ARD_MAP_TIP: "Re-maps a number from [0-1024] to another.",
ARD_MAP_TOMAX: "to Max",
ARD_MAP_TOMIN: "to Min",
ARD_MAP_VAL: "value to [0-",
ARD_NOTONE: "Turn off tone on pin #",
ARD_NOTONE_PIN: "No tone PIN#",
ARD_NOTONE_PIN_TIP: "Stop generating a tone on a pin",
ARD_NOTONE_TIP: "Turns the tone off on the selected pin",
ARD_PIN_WARN1: "Pin %1 is needed for %2 as pin %3. Already used as %4.",
ARD_PULSETIMEOUT_TIP: "Measures the duration of a pulse on the selected pin, if it is within the time-out in microseconds.",
ARD_PULSE_READ: "measure %1 pulse on pin #%2",
ARD_PULSE_READ_TIMEOUT: "measure %1 pulse on pin #%2 (timeout after %3 μs)",
ARD_PULSE_TIP: "Measures the duration of a pulse on the selected pin.",
ARD_SERIAL_BPS: "bps",
ARD_SERIAL_PRINT: "print",
ARD_SERIAL_PRINT_NEWLINE: "add new line",
ARD_SERIAL_PRINT_TIP: "Prints data to the console/serial port as human-readable ASCII text.",
ARD_SERIAL_PRINT_WARN: "A setup block for %1 must be added to the workspace to use this block!",
ARD_SERIAL_SETUP: "Setup",
ARD_SERIAL_SETUP_TIP: "Selects the speed for a specific Serial peripheral",
ARD_SERIAL_SPEED: ": speed to",
ARD_SERVO_READ: "read SERVO from PIN#",
ARD_SERVO_READ_TIP: "Read a Servo angle",
ARD_SERVO_WRITE: "set SERVO from Pin",
ARD_SERVO_WRITE_DEG_180: "Degrees (0~180)",
ARD_SERVO_WRITE_TIP: "Set a Servo to an specified angle",
ARD_SERVO_WRITE_TO: "to",
ARD_SETTONE: "Set tone on pin #",
ARD_SPI_SETUP: "Setup",
ARD_SPI_SETUP_CONF: "configuration:",
ARD_SPI_SETUP_DIVIDE: "clock divide",
ARD_SPI_SETUP_LSBFIRST: "LSBFIRST",
ARD_SPI_SETUP_MODE: "SPI mode (idle - edge)",
ARD_SPI_SETUP_MODE0: "0 (Low - Falling)",
ARD_SPI_SETUP_MODE1: "1 (Low - Rising)",
ARD_SPI_SETUP_MODE2: "2 (High - Falling)",
ARD_SPI_SETUP_MODE3: "3 (High - Rising)",
ARD_SPI_SETUP_MSBFIRST: "MSBFIRST",
ARD_SPI_SETUP_SHIFT: "data shift",
ARD_SPI_SETUP_TIP: "Configures the SPI peripheral.",
ARD_SPI_TRANSRETURN_TIP: "Send a SPI message to an specified slave device and get data back.",
ARD_SPI_TRANS_NONE: "none",
ARD_SPI_TRANS_SLAVE: "to slave pin",
ARD_SPI_TRANS_TIP: "Send a SPI message to an specified slave device.",
ARD_SPI_TRANS_VAL: "transfer",
ARD_SPI_TRANS_WARN1: "A setup block for %1 must be added to the workspace to use this block!",
ARD_SPI_TRANS_WARN2: "Old pin value %1 is no longer available.",
ARD_STEPPER_COMPONENT: "stepper",
ARD_STEPPER_DEFAULT_NAME: "MyStepper",
ARD_STEPPER_FOUR_PINS: "4",
ARD_STEPPER_MOTOR: "stepper motor:",
ARD_STEPPER_NUMBER_OF_PINS: "Number of pins",
ARD_STEPPER_PIN1: "pin1#",
ARD_STEPPER_PIN2: "pin2#",
ARD_STEPPER_PIN3: "pin3#",
ARD_STEPPER_PIN4: "pin4#",
ARD_STEPPER_REVOLVS: "how many steps per revolution",
ARD_STEPPER_SETUP: "Setup stepper motor",
ARD_STEPPER_SETUP_TIP: "Configures a stepper motor pinout and other settings.",
ARD_STEPPER_SPEED: "set speed (rpm) to",
ARD_STEPPER_STEP: "move stepper",
ARD_STEPPER_STEPS: "steps",
ARD_STEPPER_STEP_TIP: "Turns the stepper motor a specific number of steps.",
ARD_STEPPER_TWO_PINS: "2",
ARD_TYPE_ARRAY: "Array",
ARD_TYPE_BOOL: "Boolean",
ARD_TYPE_CHAR: "Character",
ARD_TYPE_CHILDBLOCKMISSING: "ChildBlockMissing",
ARD_TYPE_DECIMAL: "Decimal",
ARD_TYPE_LONG: "Large Number",
ARD_TYPE_NULL: "Null",
ARD_TYPE_NUMBER: "Number",
ARD_TYPE_SHORT: "Short Number",
ARD_TYPE_TEXT: "Text",
ARD_TYPE_UNDEF: "Undefined",
ARD_VAR_AS: "as",
ARD_VAR_AS_TIP: "Sets a value to a specific type",
ARD_WRITE_TO: "to",
NEW_INSTANCE: "New instance...",
NEW_INSTANCE_TITLE: "New instance name:",
RENAME_INSTANCE: "Rename instance...",
RENAME_INSTANCE_TITLE: "Rename all '%1' instances to:",
}
ARD_ANALOGREAD: "read analog pin#",
ARD_ANALOGREAD_TIP: "Return value between 0 and 1023",
ARD_ANALOGWRITE: "set analog pin#",
ARD_ANALOGWRITE_TIP:
"Write analog value between 0 and 255 to a specific PWM Port",
ARD_BUILTIN_LED: "set built-in LED",
ARD_BUILTIN_LED_TIP: "Light on or off for the built-in LED of the Arduino",
ARD_COMPONENT_WARN1:
"A %1 configuration block with the same %2 name must be added to use this block!",
ARD_DEFINE: "Define",
ARD_DIGITALREAD: "read digital pin#",
ARD_DIGITALREAD_TIP: "Read digital value on a pin: HIGH or LOW",
ARD_DIGITALWRITE: "set digitial pin#",
ARD_DIGITALWRITE_TIP: "Write digital value HIGH or LOW to a specific Port",
ARD_FUN_RUN_LOOP: "Arduino loop forever:",
ARD_FUN_RUN_SETUP: "Arduino run first:",
ARD_FUN_RUN_TIP: "Defines the Arduino setup() and loop() functions.",
ARD_HIGH: "HIGH",
ARD_HIGHLOW_TIP: "Set a pin state logic High or Low.",
ARD_LOW: "LOW",
ARD_MAP: "Map Value",
ARD_MAP_FROMMAX: "from Max",
ARD_MAP_FROMMIN: "from Min",
ARD_MAP_TIP: "Re-maps a number from [0-1024] to another.",
ARD_MAP_TOMAX: "to Max",
ARD_MAP_TOMIN: "to Min",
ARD_MAP_VAL: "value to [0-",
ARD_NOTONE: "Turn off tone on pin #",
ARD_NOTONE_PIN: "No tone PIN#",
ARD_NOTONE_PIN_TIP: "Stop generating a tone on a pin",
ARD_NOTONE_TIP: "Turns the tone off on the selected pin",
ARD_PIN_WARN1: "Pin %1 is needed for %2 as pin %3. Already used as %4.",
ARD_PULSETIMEOUT_TIP:
"Measures the duration of a pulse on the selected pin, if it is within the time-out in microseconds.",
ARD_PULSE_READ: "measure %1 pulse on pin #%2",
ARD_PULSE_READ_TIMEOUT: "measure %1 pulse on pin #%2 (timeout after %3 μs)",
ARD_PULSE_TIP: "Measures the duration of a pulse on the selected pin.",
ARD_SERIAL_BPS: "bps",
ARD_SERIAL_PRINT: "print",
ARD_SERIAL_PRINT_NEWLINE: "add new line",
ARD_SERIAL_PRINT_TIP:
"Prints data to the console/serial port as human-readable ASCII text.",
ARD_SERIAL_PRINT_WARN:
"A setup block for %1 must be added to the workspace to use this block!",
ARD_SERIAL_SETUP: "Setup",
ARD_SERIAL_SETUP_TIP: "Selects the speed for a specific Serial peripheral",
ARD_SERIAL_SPEED: ": speed to",
ARD_SERVO_READ: "read SERVO from PIN#",
ARD_SERVO_READ_TIP: "Read a Servo angle",
ARD_SERVO_WRITE: "set SERVO from Pin",
ARD_SERVO_WRITE_DEG_180: "Degrees (0~180)",
ARD_SERVO_WRITE_TIP: "Set a Servo to an specified angle",
ARD_SERVO_WRITE_TO: "to",
ARD_SETTONE: "Set tone on pin #",
ARD_SPI_SETUP: "Setup",
ARD_SPI_SETUP_CONF: "configuration:",
ARD_SPI_SETUP_DIVIDE: "clock divide",
ARD_SPI_SETUP_LSBFIRST: "LSBFIRST",
ARD_SPI_SETUP_MODE: "SPI mode (idle - edge)",
ARD_SPI_SETUP_MODE0: "0 (Low - Falling)",
ARD_SPI_SETUP_MODE1: "1 (Low - Rising)",
ARD_SPI_SETUP_MODE2: "2 (High - Falling)",
ARD_SPI_SETUP_MODE3: "3 (High - Rising)",
ARD_SPI_SETUP_MSBFIRST: "MSBFIRST",
ARD_SPI_SETUP_SHIFT: "data shift",
ARD_SPI_SETUP_TIP: "Configures the SPI peripheral.",
ARD_SPI_TRANSRETURN_TIP:
"Send a SPI message to an specified slave device and get data back.",
ARD_SPI_TRANS_NONE: "none",
ARD_SPI_TRANS_SLAVE: "to slave pin",
ARD_SPI_TRANS_TIP: "Send a SPI message to an specified slave device.",
ARD_SPI_TRANS_VAL: "transfer",
ARD_SPI_TRANS_WARN1:
"A setup block for %1 must be added to the workspace to use this block!",
ARD_SPI_TRANS_WARN2: "Old pin value %1 is no longer available.",
ARD_STEPPER_COMPONENT: "stepper",
ARD_STEPPER_DEFAULT_NAME: "MyStepper",
ARD_STEPPER_FOUR_PINS: "4",
ARD_STEPPER_MOTOR: "stepper motor:",
ARD_STEPPER_NUMBER_OF_PINS: "Number of pins",
ARD_STEPPER_PIN1: "pin1#",
ARD_STEPPER_PIN2: "pin2#",
ARD_STEPPER_PIN3: "pin3#",
ARD_STEPPER_PIN4: "pin4#",
ARD_STEPPER_REVOLVS: "how many steps per revolution",
ARD_STEPPER_SETUP: "Setup stepper motor",
ARD_STEPPER_SETUP_TIP:
"Configures a stepper motor pinout and other settings.",
ARD_STEPPER_SPEED: "set speed (rpm) to",
ARD_STEPPER_STEP: "move stepper",
ARD_STEPPER_STEPS: "steps",
ARD_STEPPER_STEP_TIP: "Turns the stepper motor a specific number of steps.",
ARD_STEPPER_TWO_PINS: "2",
ARD_TYPE_ARRAY: "Array",
ARD_TYPE_BOOL: "Boolean",
ARD_TYPE_CHAR: "Character",
ARD_TYPE_CHILDBLOCKMISSING: "ChildBlockMissing",
ARD_TYPE_DECIMAL: "Decimal",
ARD_TYPE_LONG: "Large Number",
ARD_TYPE_NULL: "Null",
ARD_TYPE_NUMBER: "Number",
ARD_TYPE_SHORT: "Short Number",
ARD_TYPE_TEXT: "Text",
ARD_TYPE_UNDEF: "Undefined",
ARD_VAR_AS: "as",
ARD_VAR_AS_TIP: "Sets a value to a specific type",
ARD_WRITE_TO: "to",
NEW_INSTANCE: "New instance...",
NEW_INSTANCE_TITLE: "New instance name:",
RENAME_INSTANCE: "Rename instance...",
RENAME_INSTANCE_TITLE: "Rename all '%1' instances to:",
};
@@ -28,7 +28,9 @@ export const BLE = {
sensebox_phyphox_graphStyle: "style",
sensebox_phyphox_init_tooltip:
"Initialise the Bluetooth Bee. Plug it into the **XBEE1** slot. Give the Phphox meter a unique name so you can find it in the app",
"Initialise the Bluetooth Bee. Plug it into the **XBEE1** slot. Give the Phyphox meter a unique name so you can find it in the app",
sensebox_phyphox_helpurl:
"https://sensebox.de/projects/de/2021-12-21-verbindung%20mit%20der%20phyphox%20app",
sensebox_phyphox_experiment_tooltip:
"Create an experiment and give it a unique name and a short description. Add up to 5 different graphs in the view. ",
sensebox_phyphox_graph_tooltip:
+40 -40
View File
@@ -1,45 +1,45 @@
export const LED = {
senseBox_led: "LED connected to",
senseBox_led_tip: "simple LED. Don't forget the resistor",
senseBox_rgb_led: "RGB-LED",
senseBox_rgb_led_tip: "RGB-LED",
/**
* WS2818 RGB LED
*/
senseBox_ws2818_rgb_led: "Set RGB-LED at",
senseBox_ws2818_rgb_led_init: "Initialise RGB LED (WS2818)",
senseBox_ws2818_rgb_led_position: "Position",
senseBox_ws2818_rgb_led_brightness: "Brightness",
senseBox_ws2818_rgb_led_tooltip:
"Change the color of your RGB LED with this block. Link a block for the color. If multiple RGB LEDs are chained together you can use the position to determine which LED is controlled.",
senseBox_ws2818_rgb_led_init_tooltip:
"Connect the RGB LED to one of the three **digital/analog ports**. If multiple RGB LEDs are daisy-chained together you can determine which LED is controlled by position.",
senseBox_ws2818_rgb_led_color: "Color",
senseBox_ws2818_rgb_led_number: "Number",
senseBox_led: "LED connected to digital",
senseBox_led_tip: "simple LED. Don't forget the resistor",
/**
* Color
*/
senseBox_rgb_led: "RGB-LED",
senseBox_rgb_led_tip: "RGB-LED",
/**
* WS2818 RGB LED
*/
senseBox_ws2818_rgb_led: "Set RGB-LED at",
senseBox_ws2818_rgb_led_init: "Initialise RGB LED (WS2818)",
senseBox_ws2818_rgb_led_position: "Position",
senseBox_ws2818_rgb_led_brightness: "Brightness",
senseBox_ws2818_rgb_led_tooltip: "Change the color of your RGB LED with this block. Link a block for the color. If multiple RGB LEDs are chained together you can use the position to determine which LED is controlled.",
senseBox_ws2818_rgb_led_init_tooltip: "Connect the RGB LED to one of the three **digital/analog ports**. If multiple RGB LEDs are daisy-chained together you can determine which LED is controlled by position.",
senseBox_ws2818_rgb_led_color: "Color",
senseBox_ws2818_rgb_led_number: "Number",
/**
* Color
*/
COLOUR_BLEND_COLOUR1: "colour 1",
COLOUR_BLEND_COLOUR2: "colour 2",
COLOUR_BLEND_HELPURL: "http://meyerweb.com/eric/tools/color-blend/",
COLOUR_BLEND_RATIO: "ratio",
COLOUR_BLEND_TITLE: "blend",
COLOUR_BLEND_TOOLTIP: "Blends two colours together with a given ratio (0.0 - 1.0).",
COLOUR_PICKER_HELPURL: "https://en.wikipedia.org/wiki/Color",
COLOUR_PICKER_TOOLTIP: "Choose a colour from the palette.",
COLOUR_RANDOM_HELPURL: "http://randomcolour.com",
COLOUR_RANDOM_TITLE: "random colour",
COLOUR_RANDOM_TOOLTIP: "Choose a colour at random.",
COLOUR_RGB_BLUE: "blue",
COLOUR_RGB_GREEN: "green",
COLOUR_RGB_HELPURL: "http://www.december.com/html/spec/colorper.html",
COLOUR_RGB_RED: "red",
COLOUR_RGB_TITLE: "colour with",
COLOUR_RGB_TOOLTIP: "Create a colour with the specified amount of red, green, and blue. All values must be between 0 and 255.",
}
COLOUR_BLEND_COLOUR1: "colour 1",
COLOUR_BLEND_COLOUR2: "colour 2",
COLOUR_BLEND_HELPURL: "http://meyerweb.com/eric/tools/color-blend/",
COLOUR_BLEND_RATIO: "ratio",
COLOUR_BLEND_TITLE: "blend",
COLOUR_BLEND_TOOLTIP:
"Blends two colours together with a given ratio (0.0 - 1.0).",
COLOUR_PICKER_HELPURL: "https://en.wikipedia.org/wiki/Color",
COLOUR_PICKER_TOOLTIP: "Choose a colour from the palette.",
COLOUR_RANDOM_HELPURL: "http://randomcolour.com",
COLOUR_RANDOM_TITLE: "random colour",
COLOUR_RANDOM_TOOLTIP: "Choose a colour at random.",
COLOUR_RGB_BLUE: "blue",
COLOUR_RGB_GREEN: "green",
COLOUR_RGB_HELPURL: "http://www.december.com/html/spec/colorper.html",
COLOUR_RGB_RED: "red",
COLOUR_RGB_TITLE: "colour with",
COLOUR_RGB_TOOLTIP:
"Create a colour with the specified amount of red, green, and blue. All values must be between 0 and 255.",
};
+46 -45
View File
@@ -1,51 +1,52 @@
export const LORA = {
/*
* LoRa Blöcke
*/
/*
* LoRa Blöcke
*/
senseBox_LoRa_connect: "Send to TTN",
senseBox_LoRa_device_id: "Device EUI (lsb)",
senseBox_LoRa_app_id: "Application EUI (lsb)",
senseBox_LoRa_app_key: "App Key (msb)",
senseBox_LoRa_nwskey_id: "Network Session Key (msb)",
senseBox_LoRa_appskey_id: "App Session Key (msb)",
senseBox_LoRa_devaddr_id: "Device Adress",
senseBox_LoRa_interval: "Transmission interval in minutes",
senseBox_measurement: "Messung",
senseBox_measurements: "Messungen",
senseBox_LoRa_connect: "Send to TTN",
senseBox_LoRa_device_id: "Device EUI (lsb)",
senseBox_LoRa_app_id: "Application EUI (lsb)",
senseBox_LoRa_app_key: "App Key (msb)",
senseBox_LoRa_nwskey_id: "Network Session Key (msb)",
senseBox_LoRa_appskey_id: "App Session Key (msb)",
senseBox_LoRa_devaddr_id: "Device Adress",
senseBox_LoRa_interval: "Transmission interval in minutes",
senseBox_measurement: "Messung",
senseBox_measurements: "Messungen",
senseBox_LoRa_send_message: "Send as Lora Message",
senseBox_LoRa_send_cayenne: "Send as Cayenne Payload",
senseBox_LoRa_cayenne_temperature: "Temperature",
senseBox_LoRa_cayenne_channel: "Channel",
senseBox_LoRa_cayenne_humidity: "Humidity",
senseBox_LoRa_cayenne_pressure: "Pressure",
senseBox_LoRa_cayenne_luminosity: "Luminosity",
senseBox_LoRa_cayenne_analog: "Analog Value",
senseBox_LoRa_cayenne_x: "X Value",
senseBox_LoRa_cayenne_y: "Y Value",
senseBox_LoRa_cayenne_z: "Z Value",
senseBox_LoRa_cayenne_lat: "Latitude",
senseBox_LoRa_cayenne_lng: "Longitude",
senseBox_LoRa_cayenne_alt: "Altitude",
senseBox_LoRa_cayenne_humidity_tip: "Send temperature with one decimal",
senseBox_LoRa_cayenne_tip: "Send Data as Cayenne Payload Format",
senseBox_LoRa_cayenne_gps_tip: "Send GPS Data",
senseBox_LoRa_cayenne_temperature_tip: "Send temperature with one decimal",
senseBox_LoRa_cayenne_pressure_tip: "Send pressure with one decimal",
senseBox_LoRa_cayenne_luminosity_tip: "Send luminosity without any decimals",
senseBox_LoRa_cayenne_analog_tip: "Send a value with one decimal",
senseBox_LoRa_message_tooltip: "Send a message with LoRa",
senseBox_LoRa_sensor_tip: "Send a value with a specific number of bytes",
senseBox_LoRa_init_abp_tooltip: "Initialize the LoRa transmission. The activation is done via ABP. Register an application on [thethingsnetwork](https://thethingsnetwork.com) and copy the **Network Session Key** and the **App Session Key** in **msb format** and the **Device ID** in **hex format**.",
senseBox_LoRa_init_helpurl: "https://en.docs.sensebox.de/blockly/blockly-web-lora/",
senseBox_LoRa_init_otaa_tooltip: "Initialize the LoRa transmission. The activation is done via OTAA. Register an application on [thethingsnetwork](https://thethingsnetwork.com) and copy the **DEVICE EUI** and the **Application EUI** in **lsb format** the **App Key** in **msb format**.",
}
senseBox_LoRa_send_message: "Send as Lora Message",
senseBox_LoRa_send_cayenne: "Send as Cayenne Payload",
senseBox_LoRa_cayenne_temperature: "Temperature",
senseBox_LoRa_cayenne_channel: "Channel",
senseBox_LoRa_cayenne_humidity: "Humidity",
senseBox_LoRa_cayenne_pressure: "Pressure",
senseBox_LoRa_cayenne_luminosity: "Luminosity",
senseBox_LoRa_cayenne_analog: "Analog Value",
senseBox_LoRa_cayenne_x: "X Value",
senseBox_LoRa_cayenne_y: "Y Value",
senseBox_LoRa_cayenne_z: "Z Value",
senseBox_LoRa_cayenne_lat: "Latitude",
senseBox_LoRa_cayenne_lng: "Longitude",
senseBox_LoRa_cayenne_alt: "Altitude",
senseBox_LoRa_cayenne_concentration: "Concentration",
senseBox_LoRa_cayenne_humidity_tip: "Send temperature with one decimal",
senseBox_LoRa_cayenne_tip: "Send Data as Cayenne Payload Format",
senseBox_LoRa_cayenne_gps_tip: "Send GPS Data",
senseBox_LoRa_cayenne_temperature_tip: "Send temperature with one decimal",
senseBox_LoRa_cayenne_pressure_tip: "Send pressure with one decimal",
senseBox_LoRa_cayenne_luminosity_tip: "Send luminosity without any decimals",
senseBox_LoRa_cayenne_analog_tip: "Send a value with one decimal",
senseBox_LoRa_message_tooltip: "Send a message with LoRa",
senseBox_LoRa_sensor_tip: "Send a value with a specific number of bytes",
senseBox_LoRa_init_abp_tooltip:
"Initialize the LoRa transmission. The activation is done via ABP. Register an application on [thethingsnetwork](https://thethingsnetwork.com) and copy the **Network Session Key** and the **App Session Key** in **msb format** and the **Device ID** in **hex format**.",
senseBox_LoRa_init_helpurl:
"https://en.docs.sensebox.de/blockly/blockly-web-lora/",
senseBox_LoRa_init_otaa_tooltip:
"Initialize the LoRa transmission. The activation is done via OTAA. Register an application on [thethingsnetwork](https://thethingsnetwork.com) and copy the **DEVICE EUI** and the **Application EUI** in **lsb format** the **App Key** in **msb format**.",
sensebox_lora_ttn_mapper_tip:
"You can use a TTN Mapper to map LoRa network coverage in your area. The data is then displayed on [ttnmaper](https://ttnmapper.org). You can find the necessary decoder [here](https://gist.github.com/felixerdy/f959ac03df98c6947f1c7f35d537f23e#file-decoder-js).",
};
+20 -18
View File
@@ -1,20 +1,22 @@
export const OSEM = {
/**
* openSenseMap
*/
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: "Send measurement to openSenseMap",
senseBox_osem_connection: "Connect to openSenseMap",
senseBox_osem_host: "opensensemap.org",
senseBox_osem_host_workshop: "workshop.opensensemap.org",
senseBox_osem_exposure: "Type",
senseBox_osem_stationary: "Stationary",
senseBox_osem_mobile: "Mobile",
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",
}
/**
* openSenseMap
*/
senseBox_osem_connection_tip:
"Use this block to connect your senseBox to the openSenseMap. Register your senseBox on the openSenseMap and enter the IDs and the API key. Then use the block ***Send reading to the openSenseMap*** and the sensor ID to transfer the readings.",
senseBox_osem_connection_helpurl: "https://www.opensensemap.org/",
senseBox_send_to_osem_tip:
"Send measured values to the openSenseMap with this block. Use one block per measurement value and enter the assigned sensor ID",
senseBox_send_to_osem: "Send measurement to openSenseMap",
senseBox_osem_connection: "Connect to openSenseMap",
senseBox_osem_host: "opensensemap.org",
senseBox_osem_host_workshop: "workshop.opensensemap.org",
senseBox_osem_exposure: "Type",
senseBox_osem_stationary: "Stationary",
senseBox_osem_mobile: "Mobile",
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?",
};
+22 -14
View File
@@ -1,15 +1,23 @@
export const SD = {
/**
* SD-Block
*/
senseBox_sd_create_file: "Create file on SD-Card",
senseBox_sd_write_file: " Write Data to SD-Card",
senseBox_sd_open_file: "Open a file from SD-Card",
senseBox_sd_create_file_tooltip: "Creates a file on the card. Plug the SD-Bee into the **XBEE2** slot. The **maximum** length of the file name is **8 characters**. The file should be created first in *Setup()*",
senseBox_sd_write_file_tooptip: "Write data to the SD card. Note that the file must be opened first.",
senseBox_sd_open_file_tooltip: "Open the file on the SD card to save files. At the end of the loop, the file will be closed again automatically.",
sensebox_sd_filename: "Data.txt",
senseBox_sd_decimals: "decimals",
}
/**
* SD-Block
*/
senseBox_sd_create_file: "Create file on SD-Card",
senseBox_sd_write_file: " Write Data to SD-Card",
senseBox_sd_open_file: "Open a file from SD-Card",
senseBox_sd_create_file_tooltip:
"Creates a file on the card. Plug the SD-Bee into the **XBEE2** slot. The **maximum** length of the file name is **8 characters**. The file should be created first in *Setup()*",
senseBox_sd_write_file_tooptip:
"Write data to the SD card. Note that the file must be opened first.",
senseBox_sd_open_file_tooltip:
"Open the file on the SD card to save files. At the end of the loop, the file will be closed again automatically.",
sensebox_sd_filename: "Data.csv",
senseBox_sd_decimals: "decimals",
sensebox_sd_osem: "Create CSV-file for openSenseMap",
sensebox_sd_osem_tip: "Creates a CSV-file for openSenseMap upload",
sensebox_sd_save_for_osem: "Save measurement",
sensebox_sd_save_for_osem_tip:
"Adds a measurement witht the corresponding Sensor ID to the CSV-file",
sensebox_sd_save_for_osem_id: "Sensor ID:",
sensebox_sd_measurement: "measurements",
};
+186 -152
View File
@@ -1,134 +1,164 @@
export const SENSORS = {
/**
* Sensors
* ---------------------------------------------------
*
*/
/**
* Sensors
* ---------------------------------------------------
*
*/
/**
* BMP280
*/
senseBox_pressure_sensor: "Airpressure/Temperature Sensor (BMP280)",
senseBox_pressure: "Airpressure in hPa",
senseBox_pressure_dimension: "Airpressure in hPa",
senseBox_pressure_tooltip:
"Connect the sensor to one of the 5 **I2C ports**. The sensor gives you the measured value for the air pressure in hPa. To calculate the correct altitude above sea level the sensor needs a current reference value.",
senseBox_pressure_referencePressure: "Pressure at Sea Level",
senseBox_pressure_referencePressure_dim: "hPa",
senseBox_pressure_helpurl: "",
/**
* BMP280
*/
senseBox_pressure_sensor: "Airpressure/Temperature Sensor (BMP280)",
senseBox_pressure: "Airpressure in Pa",
senseBox_pressure_dimension: "Airpressure in Pa",
senseBox_pressure_tip: "Connect the sensor to one of the 5 **I2C ports**. The sensor gives you the measured value for the air pressure in Pa. To calculate the correct altitude above sea level the sensor needs a current reference value.",
senseBox_pressure_referencePressure: "Pressure at Sea Level",
senseBox_pressure_referencePressure_dim: "hPa",
senseBox_pressure_helpurl: "",
/**
* DPS310
*/
senseBox_sensor_dps310: "Airpressure/Temperature Sensor (DPS310)",
senseBox_sensor_dps310_tooltip:
"Connect the sensor to one of the 5 **I2C ports**. The sensor gives you the measured value for the air pressure in hPa. To calculate the correct altitude above sea level the sensor needs a current reference value.",
/**
* Mikro
*/
senseBox_sound: "Microphone",
senseBox_sound_tip:
"Connect the sensor to one of the 3 **analog/digital** ports via the breadbord. Returns the reading of the microphone in volt",
senseBox_sound_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-mikro/",
/**
* Mikro
*/
senseBox_sound: "Microphone",
senseBox_sound_tip: "Connect the sensor to one of the 3 **analog/digital** ports via the breadbord. Returns the reading of the microphone in volt",
senseBox_sound_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-mikro/",
/**
* Temperature and Humidity Sensor (HDC1080)
*/
senseBox_temp: "Temperature in °C",
senseBox_temp_hum: "Temperature/Humidity Sensor (HDC1080)",
senseBox_temp_hum_tooltip:
"This block returns the temperature and humidity sensor readings. Connect the sensor to one of the 5 I2C ports. Measured value is output with 2 decimal places.",
senseBox_temp_hum_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-temperatur-luftfeuchte/",
senseBox_hum: "humidity in %",
senseBox_hum_tip: "Measures humidity in %",
/**
* Temperature and Humidity Sensor (HDC1080)
*/
senseBox_temp: "Temperature in °C",
senseBox_temp_hum: "Temperature/Humidity Sensor (HDC1080)",
senseBox_temp_hum_tooltip: "This block returns the temperature and humidity sensor readings. Connect the sensor to one of the 5 I2C ports. Measured value is output with 2 decimal places.",
senseBox_temp_hum_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-temperatur-luftfeuchte/",
senseBox_hum: "humidity in %",
senseBox_hum_tip: "Measures humidity in %",
/**
* Ultraschalldistanzsensor
*/
/**
* Ultraschalldistanzsensor
*/
senseBox_ultrasonic: "Ultrasonic distance sensor at Port",
senseBox_ultrasonic_trigger: "Trigger",
senseBox_ultrasonic_echo: "Echo",
senseBox_ultrasonic_port_A: "A",
senseBox_ultrasonic_port_B: "B",
senseBox_ultrasonic_port_C: "C",
senseBox_ultrasonic_tooltip: `Measures the distance using ultrasound in cm. Connect the sensor to one of the three digital/analog ports:
senseBox_ultrasonic: "Ultrasonic distance sensor at Port",
senseBox_ultrasonic_trigger: "Trigger",
senseBox_ultrasonic_echo: "Echo",
senseBox_ultrasonic_maxDistance: "Max distance",
senseBox_ultrasonic_port_A: "A",
senseBox_ultrasonic_port_B: "B",
senseBox_ultrasonic_port_C: "C",
senseBox_ultrasonic_tooltip: `Measures the distance using ultrasound in cm. Connect the sensor to one of the three digital/analog ports:
- Trigger: Green Cable
- Echo: Yellow Cable`,
senseBox_ultrasonic_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-distanz/",
- Echo: Yellow Cable
If the max distance is reached the a value of **O** will be returned`,
senseBox_ultrasonic_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-distanz/",
/**
* UV and Lightsensor
*/
senseBox_uv: "UV-Light in µW/cm²",
senseBox_uv_light: "Light Visible + UV",
senseBox_value: "Value:",
senseBox_uv_light_tooltip: "Sensor measures UV light or brightness. Brightness is output as **integer** in lux. UV intensity as **decimal** in µW/cm².",
senseBox_light: "Illuminance in Lux",
senseBox_uv_light_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-helligkeit-uv/",
/**
* UV and Lightsensor
*/
senseBox_uv: "UV-Light in µW/cm²",
senseBox_uv_light: "Light Visible + UV",
senseBox_value: "Value:",
senseBox_uv_light_tooltip:
"Sensor measures UV light or brightness. Brightness is output as **integer** in lux. UV intensity as **decimal** in µW/cm².",
senseBox_light: "Illuminance in Lux",
senseBox_uv_light_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-helligkeit-uv/",
/**
* BMX055
*/
/**
* BMX055
*/
senseBox_bmx055_compass: "Lage Sensor",
senseBox_bmx055_accelerometer: "Accelerometer",
senseBox_bmx055_accelerometer_range: "Range",
senseBox_bmx055_accelerometer_range_2g: "2g",
senseBox_bmx055_accelerometer_range_4g: "4g",
senseBox_bmx055_accelerometer_range_8g: "8g",
senseBox_bmx055_accelerometer_range_16g: "16g",
senseBox_bmx055_accelerometer_direction: "Direction",
senseBox_bmx055_accelerometer_direction_x: "X-Axis",
senseBox_bmx055_accelerometer_direction_y: "Y-Axis",
senseBox_bmx055_accelerometer_direction_z: "Z-Axis",
senseBox_bmx055_accelerometer_direction_total: "Total",
senseBox_bmx055_gyroscope: "Gyroscope",
senseBox_bmx055_compass: "Lage Sensor",
senseBox_bmx055_accelerometer: "Accelerometer",
senseBox_bmx055_accelerometer_range: "Range",
senseBox_bmx055_accelerometer_range_2g: "2g",
senseBox_bmx055_accelerometer_range_4g: "4g",
senseBox_bmx055_accelerometer_range_8g: "8g",
senseBox_bmx055_accelerometer_range_16g: "16g",
senseBox_bmx055_accelerometer_direction: "Direction",
senseBox_bmx055_accelerometer_direction_x: "X-Axis",
senseBox_bmx055_accelerometer_direction_y: "Y-Axis",
senseBox_bmx055_accelerometer_direction_z: "Z-Axis",
senseBox_bmx055_accelerometer_direction_total: "Total",
senseBox_bmx055_gyroscope: "Gyroscope",
senseBox_bmx055_compass_tip: "Lage Sensor",
senseBox_bmx055_gyroscope_tip: "Lage Sensor",
senseBox_bmx055_x: "X-Direction",
senseBox_bmx055_y: "Y-Direction",
senseBox_bmx055_accelerometer_tooltip: `This block gives you the measurement value of the accelerometer which is soldered directly on the senseBox MCU. In the dropdown menu you can select the direction and the measuring range.`,
senseBox_bmx055_helpurl: "",
senseBox_bmx055_compass_tip: "Lage Sensor",
senseBox_bmx055_gyroscope_tip: "Lage Sensor",
senseBox_bmx055_x: "X-Direction",
senseBox_bmx055_y: "Y-Direction",
senseBox_bmx055_accelerometer_tooltip: `This block gives you the measurement value of the accelerometer which is soldered directly on the senseBox MCU. In the dropdown menu you can select the direction and the measuring range.`,
senseBox_bmx055_helpurl: "",
/**
*
* GPS
*/
senseBox_gps_getValues: "GPS Modul",
senseBox_gps_lat: "latitude",
senseBox_gps_lng: "longitude",
senseBox_gps_alt: "altitude in m",
senseBox_gps_speed: "speed in km/h",
senseBox_gps_date: "date",
senseBox_gps_time: "time",
senseBox_gps_timeStamp: "Timestamp (RFC 3339)",
senseBox_gps_tooltip: `Reads the GPS module and gives you the location information. Longitude and latitude are output as a decimal number with 6 decimal places.
/**
*
* GPS
*/
senseBox_gps_getValues: "GPS Modul",
senseBox_gps_lat: "latitude",
senseBox_gps_lng: "longitude",
senseBox_gps_alt: "altitude in m",
senseBox_gps_speed: "speed in km/h",
senseBox_gps_date: "date",
senseBox_gps_time: "time",
senseBox_gps_timeStamp: "Timestamp (RFC 3339)",
senseBox_gps_tooltip: `Reads the GPS module and gives you the location information. Longitude and latitude are output as a decimal number with 6 decimal places.
**Connection: I2C**
**Note:** The GPS module needs a relatively long time (about 5-10 minutes) until it has found your location!
`,
senseBox_gps_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-gps/",
senseBox_gps_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-gps/",
/**
* Windspeed
*/
senseBox_windspeed: "Windspeedsensor",
senseBox_windspeed_tooltip: "",
/**
* Windspeed
*/
senseBox_windspeed: "Windspeedsensor",
senseBox_windspeed_tooltip: "",
/*
* Soundsensor
*/
senseBox_soundsensor_dfrobot: "Soundsensor (DF Robot)",
senseBox_soundsensor_dfrobot_tooltip: "Connect the sensor to one of the 3 **digital/analog ports**. The sensor will give you the reading in dB with one decimal.",
senseBox_soundsensor_dfrobot_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-lautstaerke/",
/*
* Soundsensor
*/
senseBox_soundsensor_dfrobot: "Soundsensor (DF Robot)",
senseBox_soundsensor_dfrobot_tooltip:
"Connect the sensor to one of the 3 **digital/analog ports**. The sensor will give you the reading in dB with one decimal.",
senseBox_soundsensor_dfrobot_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-lautstaerke/",
/*
* BME680
*/
/*
* rainsensor hydreon rg-15
*/
sensebox_rainsensor_hydreon_rg15: "Rainsensor (RG-15)",
sensebox_rainsensor_hydreon_rg15_port: "Serial Port:",
sensebox_rainsensor_hydreon_rg15_serial1: "Serial1",
sensebox_rainsensor_hydreon_rg15_serial2: "Serial2",
sensebox_rainsensor_hydreon_rg15_value: "value:",
sensebox_rainsensor_hydreon_rg15_totalAcc: "total Accumulation in mm",
sensebox_rainsensor_hydreon_rg15_rainInt: "Rainfall Intensity in mm/h",
sensebox_rainsensor_hydreon_rg15_eventAcc: "Accumulation per Event in mm",
sensebox_rainsensor_hydreon_rg15_acc: "Accumulation since last loop in mm",
sensebox_rainsensor_hydreon_rg15_tooltip: "Connect Rainsensor (RG-15) to one of the Serial ports.",
sensebox_rainsensor_hydreon_rg15_helpurl: "https://rainsensors.com/products/rg-15/",
senseBox_bme680: "Environmental sensor (BME680)",
senseBox_bme_iaq: "Indoor Air Quality (IAQ)",
senseBox_bme_iaq_accuracy: "Calibration Value",
senseBox_bme_co2: "CO2 Equivalent",
senseBox_bme_breatheVocEquivalent: "Breathe VOC Equivalent",
senseBox_bme_tooltip: `Connect the environmental sensor to one of the 5 **I2C ports**. **Note:** The sensor needs some time to calibrate.
/*
* BME680
*/
senseBox_bme680: "Environmental sensor (BME680)",
senseBox_bme_iaq: "Indoor Air Quality (IAQ)",
senseBox_bme_iaq_accuracy: "Calibration Value",
senseBox_bme_co2: "CO2 Equivalent",
senseBox_bme_breatheVocEquivalent: "Breathe VOC Equivalent",
senseBox_bme_tooltip: `Connect the environmental sensor to one of the 5 **I2C ports**. **Note:** The sensor needs some time to calibrate.
The status of the calibration can be read from the calibration value. It is either 0, 1, 2 or 3 and says the following:
- IAQ Accuracy : 0 means sensor is stabilized (takes about 25 minutes) or that there was a timeout,
@@ -137,53 +167,57 @@ The status of the calibration can be read from the calibration value. It is eith
- IAQ Accuracy : 3 means sensor calibrated successfully.
The measured values for temperature, humidity and air pressure can be used directly,`,
senseBox_bme680_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-umweltsensor/",
senseBox_bme680_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-umweltsensor/",
/**
* Truebner SMT50
*/
senseBox_smt50: "Soil Moisture and Temperature (SMT50)",
senseBox_smt50_helpurl:
"https://docs.sensebox.de/hardware/sensoren-truebner/",
senseBox_smt50_tooltip:
"Schließe den Bodenfeuchtigkeit- und Temperatursensor an einen der 3 digital/analog Ports an und wähle den Port im Block aus. Der Sensor gibt die Bodentemperatur in °C und die Bodenfeuchtigkeit in % aus.",
/**
* Truebner SMT50
*/
senseBox_smt50: "Soil Moisture and Temperature (SMT50)",
senseBox_smt50_helpurl: "https://docs.sensebox.de/hardware/sensoren-truebner/",
senseBox_smt50_tooltip: "Schließe den Bodenfeuchtigkeit- und Temperatursensor an einen der 3 digital/analog Ports an und wähle den Port im Block aus. Der Sensor gibt die Bodentemperatur in °C und die Bodenfeuchtigkeit in % aus.",
/**
* SCD30 CO2 Sensor
*/
senseBox_scd30: "CO2 Sensor (Sensirion SCD30)",
senseBox_scd_tooltip:
"Connect the sensor to one of the 5 **I2C ports**. The sensor will give you the reading for the CO2 concentration in ppm. The temperature reading may differ from the real value by a few degrees due to the measurement directly at the sensor.",
senseBox_scd_co2: "CO2 in ppm",
senseBox_scd_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-co2/",
/**
* Feinstaubsensor (SDS011)
*/
senseBox_sds011: "Fine Particular Sensor",
senseBox_sds011_dimension: "in µg/m³ at",
senseBox_sds011_pm25: "PM2.5",
senseBox_sds011_pm10: "PM10",
senseBox_sds011_tooltip:
"This block gives you the reading of the fine dust sensor. Connect the fine dust sensor to one of the 2 **Serial/UART** ports. Select between PM2.5 and PM10 in the dropdown menu. The measured value will be displayed as **comma number** in µg/m3",
senseBox_sds011_serial1: "Serial1",
senseBox_sds011_serial2: "Serial2",
senseBox_sds011_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-feinstaub/",
/**
* SCD30 CO2 Sensor
*/
senseBox_scd30: "CO2 Sensor (Sensirion SCD30)",
senseBox_scd_tooltip: "Connect the sensor to one of the 5 **I2C ports**. The sensor will give you the reading for the CO2 concentration in ppm. The temperature reading may differ from the real value by a few degrees due to the measurement directly at the sensor.",
senseBox_scd_co2: "CO2 in ppm",
senseBox_scd_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-co2/",
/**
* Feinstaubsensor (SDS011)
*/
senseBox_sds011: "Fine Particular Sensor",
senseBox_sds011_dimension: "in µg/m³ at",
senseBox_sds011_pm25: "PM2.5",
senseBox_sds011_pm10: "PM10",
senseBox_sds011_tooltip: "This block gives you the reading of the fine dust sensor. Connect the fine dust sensor to one of the 2 **Serial/UART** ports. Select between PM2.5 and PM10 in the dropdown menu. The measured value will be displayed as **comma number** in µg/m3",
senseBox_sds011_serial1: "Serial1",
senseBox_sds011_serial2: "Serial2",
senseBox_sds011_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-feinstaub/",
/**
* Button
*/
senseBox_button: "Button",
senseBox_button_isPressed: "is Pressed",
senseBox_button_switch: "as Switch",
senseBox_button_wasPressed: "was Pressed",
senseBox_button_tooltip: `This block gives you the status of the connected button. In the dropdown menu you can select different modes for the button. Either the on board button or a button connected to one of the 6 digital pins can be controlled. different modes:
/**
* Button
*/
senseBox_button: "Button",
senseBox_button_isPressed: "is Pressed",
senseBox_button_switch: "as Switch",
senseBox_button_wasPressed: "was Pressed",
senseBox_button_longPress: "Pressed for",
senseBox_button_tooltip: `This block gives you the status of the connected button. In the dropdown menu you can select different modes for the button. Either the on board button or a button connected to one of the 6 digital pins can be controlled. different modes:
- "is pressed": With this mode you can check if the block is currently pressed. You get either the value TRUE or FALSE.
- "was pressed": With this mode you can query if the block was pressed. Only if the button was pressed and released you will get TRUE.
- "as switch": If you use this block you can use the button like a light switch. The status is saved until the button is pressed again.
`,
senseBox_button_helpurl: "",
senseBox_button_helpurl: "",
/**
*
*/
senseBox_watertemperature: "Water Temperature",
}
/**
*
*/
senseBox_watertemperature: "Water Temperature",
};
+29 -10
View File
@@ -1,11 +1,30 @@
export const WEB = {
/**
* WiFi
*/
senseBox_wifi_connect: "Connect to Wifi",
senseBox_wifi_ssid: "Networkname",
senseBox_wifi_tooltip: "Connects to a wireless network. If you want to connect to an unsecured network (e.g. Freifunk) clear the password field. The WiFi-Bee must be plugged into the **XBEE1** slot.",
senseBox_wifi_startap: "Initialize Wifi Access Point",
senseBox_wifi_startap_tooltip: "Creates a WiFi access point to which you can connect. Note that only 1 device can be connected at a time.",
senseBox_wifi_helpurl: "https://en.docs.sensebox.de/blockly/blockly-web-wifi/",
}
/**
* WiFi
*/
senseBox_wifi_connect: "Connect to Wifi",
senseBox_wifi_ssid: "Networkname",
senseBox_wifi_ip: "IP-Address",
senseBox_wifi_ip_tooltip: "The IP-Address of the SenseBox",
senseBox_wifi_status: "Status",
senseBox_wifi_status_tooltip: "The status of the Wifi connection",
senseBox_wifi_rssi: "RSSI",
senseBox_wifi_rssi_tooltip: "The signal strength of the Wifi connection",
senseBox_wifi_tooltip:
"Connects to a wireless network. If you want to connect to an unsecured network (e.g. Freifunk) clear the password field. The WiFi-Bee must be plugged into the **XBEE1** slot.",
senseBox_wifi_startap: "Initialize Wifi Access Point",
senseBox_wifi_startap_tooltip:
"Creates a WiFi access point to which you can connect. Note that only 1 device can be connected at a time.",
senseBox_wifi_helpurl:
"https://en.docs.sensebox.de/blockly/blockly-web-wifi/",
senseBox_ethernet: "Connect to Ethernet",
senseBox_ethernet_dhcp: "DHCP",
senseBox_ethernet_manuel_config: "Manual configuration",
senseBox_ethernet_ip: "IP address",
senseBox_ethernet_gateway: "Gateway",
senseBox_ethernet_subnetmask: "Subnet mask",
senseBox_ethernet_mac: "MAC address",
senseBox_ethernet_dns: "DNS-Server",
senseBox_ethernet_tooltip:
"Connect the LAN-Bee to the XBEE1 slot. Most networks use DHCP and assign an IP address automatically. If you want to do a manual configuration select **Manual Configuration** in the dropdown menu and enter the appropriate data.",
};
+18 -16
View File
@@ -1,17 +1,19 @@
export const TIME = {
senseBox_interval: "ms",
senseBox_interval_timer: "Measuring interval",
senseBox_interval_timer_tip: "Setup an Intervall",
ARD_TIME_DELAY: "wait",
ARD_TIME_DELAY_MICROS: "microseconds",
ARD_TIME_DELAY_MICRO_TIP: "Wait specific time in microseconds",
ARD_TIME_DELAY_TIP: "Wait specific time in milliseconds",
ARD_TIME_INF: "wait forever (end program)",
ARD_TIME_INF_TIP: "Wait indefinitely, stopping the program.",
ARD_TIME_MICROS: "current elapsed Time (microseconds)",
ARD_TIME_MICROS_TIP: "Returns the number of microseconds since the Arduino board began running the current program. Has to be stored in a positive long integer",
ARD_TIME_MILLIS: "current elapsed Time (milliseconds)",
ARD_TIME_MILLIS_TIP: "Returns the number of milliseconds since the Arduino board began running the current program. Has to be stored in a positive long integer",
ARD_TIME_MS: "milliseconds",
}
senseBox_interval: "ms",
senseBox_interval_timer: "Interval: ",
senseBox_interval_timer_tip:
"Define an interval to be executed every x milliseconds",
ARD_TIME_DELAY: "wait",
ARD_TIME_DELAY_MICROS: "microseconds",
ARD_TIME_DELAY_MICRO_TIP: "Wait specific time in microseconds",
ARD_TIME_DELAY_TIP: "Wait specific time in milliseconds",
ARD_TIME_INF: "wait forever (end program)",
ARD_TIME_INF_TIP: "Wait indefinitely, stopping the program.",
ARD_TIME_MICROS: "current elapsed Time (microseconds)",
ARD_TIME_MICROS_TIP:
"Returns the number of microseconds since the Arduino board began running the current program. Has to be stored in a positive long integer",
ARD_TIME_MILLIS: "current elapsed Time (milliseconds)",
ARD_TIME_MILLIS_TIP:
"Returns the number of milliseconds since the Arduino board began running the current program. Has to be stored in a positive long integer",
ARD_TIME_MS: "milliseconds",
};
+31 -2
View File
@@ -10,6 +10,8 @@ export const UI = {
toolbox_time: "Time",
toolbox_functions: "Functions",
toolbox_variables: "Variables",
toolbox_serial: "Serial",
toolbox_advanced: "Erweitert",
variable_NUMBER: "Number (int)",
variable_SHORT_NUMBER: "char",
variable_LONG: " Zahl (long)",
@@ -49,6 +51,14 @@ export const UI = {
tooltip_project_title: "Project title",
tooltip_check_solution: "Check solution",
tooltip_copy_code: "Copy Code to clipboard",
tooltip_statistics_current: "Number of current blocks",
tooltip_statistics_new: "Number of new blocks",
tooltip_statistics_changed: "Number of changed blocks",
tooltip_statistics_moved: "Number of moved blocks",
tooltip_statistics_deleted: "Number of deleted blocks",
tooltip_statistics_remaining: "Remaining blocks",
tooltip_statistics_show: "Show statistics",
tooltip_start_tour: "start Tour",
/**
* Messages
@@ -80,6 +90,15 @@ export const UI = {
messages_login_error: "Enter both a username and a password.",
messages_copy_code: "Copy code to clipboard succesfull",
/**
* Tablet Dialog
*/
tabletDialog_headline: "Tablet mode is enabled!",
tabletDialog_text:
"Tablet mode has been activated. You can now copy program codes to your senseBox via the senseBox Connect app. Tablet mode can be deactivated in the settings",
tabletDialog_more:
"For more information and the link to download the app, please visit: ",
/**
* Reset Dialog
*/
@@ -149,6 +168,14 @@ export const UI = {
"The display of statistics on the usage of the blocks above the workspace can be shown or hidden.",
settings_statistics_on: "On",
settings_statistics_off: "Off",
settings_ota_head: "Tablet mode",
settings_ota_text:
"Tablet mode disables the code display and enables the possibility to transfer the program code via the senseBox Connect app. You can find more information on: ",
settings_ota_on: "Activated",
settings_ota_off: "Deactivated",
settings_sounds: "Sound",
settings_sounds_text:
"Enable or disable sounds when adding and deleting blocks. Disabled by default",
/**
* 404
@@ -169,7 +196,7 @@ export const UI = {
/**
* Tutorials
*/
tutorials_home_head: "Tutorials",
tutorials_assessment_task: "Task",
tutorials_hardware_head:
"For the implementation you need the following hardware:",
@@ -182,7 +209,9 @@ export const UI = {
/**
* Tutorial Builder
*/
uilder_createNew: "create new Tutorial",
builder_changeExisting: "change existing Tutorial",
builder_deleteExisting: "remove existing Tutorial",
builder_solution: "Solution",
builder_solution_submit: "Submit Solution",
builder_example_submit: "Submit example",
+3 -3
View File
@@ -544,7 +544,7 @@ Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT =
// Ardublockly strings
Blockly.Msg.ARD_ANALOGREAD = "read analog pin#";
Blockly.Msg.ARD_ANALOGREAD_TIP = "Return value between 0 and 1024";
Blockly.Msg.ARD_ANALOGREAD_TIP = "Return value between 0 and 1023";
Blockly.Msg.ARD_ANALOGWRITE = "set analog pin#";
Blockly.Msg.ARD_ANALOGWRITE_TIP =
"Write analog value between 0 and 255 to a specific PWM Port";
@@ -887,13 +887,13 @@ Blockly.Msg.senseBox_output_timestamp = "timestamp";
Blockly.Msg.senseBox_piezo_tip = "simple piezo to make sound";
Blockly.Msg.senseBox_poti = "Potentiometer";
Blockly.Msg.senseBox_poti_tip = "Potentiometer";
Blockly.Msg.senseBox_pressure = "Airpressure in Pa";
Blockly.Msg.senseBox_pressure = "Airpressure in hPa";
Blockly.Msg.senseBox_pressure_referencePressure = "Pressure at Sea Level";
Blockly.Msg.senseBox_pressure_referencePressure_dim = "hPa";
Blockly.Msg.senseBox_pressure_sensor =
"Airpressure/Temperature Sensor (BMP280)";
Blockly.Msg.senseBox_pressure_tip =
"airpressure sensor can measure the airpressure in Pa";
"airpressure sensor can measure the airpressure in hPa";
Blockly.Msg.senseBox_rgb_led = "RGB-LED";
Blockly.Msg.senseBox_rgb_led_tip = "RGB-LED";
Blockly.Msg.senseBox_sd_create_file = "Create file on SD-Card";
+60 -26
View File
@@ -65,6 +65,7 @@ class Toolbox extends React.Component {
<Block type="sensebox_sensor_bmx055_accelerometer" />
<Block type="sensebox_sensor_sds011" />
<Block type="sensebox_sensor_pressure" />
<Block type="sensebox_sensor_dps310" />
<Block type="sensebox_sensor_bme680_bsec" />
<Block type="sensebox_scd30" />
<Block type="sensebox_gps" />
@@ -75,6 +76,7 @@ class Toolbox extends React.Component {
<Block type="sensebox_sensor_watertemperature" />
{/* <Block type="sensebox_windspeed" /> */}
<Block type="sensebox_soundsensor_dfrobot" />
<Block type="sensebox_rainsensor_hydreon_rg15" />
<Block type="sensebox_multiplexer_init">
<Value name="nrChannels">
<Block type="math_number">
@@ -92,8 +94,15 @@ class Toolbox extends React.Component {
</Category>
<Category name="WIFI" colour={getColour().sensebox}>
<Block type="sensebox_wifi" />
<Block type="sensebox_wifi_status" />
<Block type="sensebox_wifi_rssi" />
<Block type="sensebox_get_ip" />
<Block type="sensebox_startap" />
</Category>
<Category name="Ethernet" colour={getColour().sensebox}>
<Block type="sensebox_ethernet" />
<Block type="sensebox_ethernetIp" />
</Category>
<Category name="SD" colour={getColour().sensebox}>
<Block type="sensebox_sd_create_file" />
<Block type="sensebox_sd_open_file">
@@ -102,6 +111,17 @@ class Toolbox extends React.Component {
</Value>
</Block>
<Block type="sensebox_sd_write_file" />
<Block type="sensebox_sd_open_file">
<Value name="SD">
<Block type="sensebox_sd_osem">
<Value name="DO">
<Block type="sensebox_sd_save_for_osem"></Block>
</Value>
</Block>
</Value>
</Block>
<Block type="sensebox_sd_osem" />
<Block type="sensebox_sd_save_for_osem" />
</Category>
<Category name="LED" colour={getColour().sensebox}>
<Block type="sensebox_rgb_led"></Block>
@@ -279,12 +299,12 @@ class Toolbox extends React.Component {
</Value>
</Block>
</Category>
<Category name="Telegram" colour={getColour().sensebox}>
{/* <Category name="Telegram" colour={getColour().sensebox}>
<Block type="sensebox_telegram" />
<Block type="sensebox_telegram_do" />
<Block type="sensebox_telegram_do_on_message" />
<Block type="sensebox_telegram_send" />
</Category>
</Category> */}
<Category name="openSenseMap" colour={getColour().sensebox}>
<Block type="sensebox_interval_timer">
<Value name="DO">
@@ -357,6 +377,7 @@ class Toolbox extends React.Component {
<Block type="sensebox_lora_cayenne_humidity" />
<Block type="sensebox_lora_cayenne_pressure" />
<Block type="sensebox_lora_cayenne_luminosity" />
<Block type="sensebox_lora_cayenne_concentration" />
<Block type="sensebox_lora_cayenne_sensor" />
<Block type="sensebox_lora_cayenne_accelerometer" />
<Block type="sensebox_lora_cayenne_gps" />
@@ -583,39 +604,52 @@ class Toolbox extends React.Component {
colour={getColour().variables}
custom="CREATE_TYPED_VARIABLE"
></Category>
<Category name="Arrays" colour={getColour().arrays}>
{/* <Category name="Arrays" colour={getColour().arrays}>
<Block type="lists_create_empty" />
<Block type="array_getIndex" />
<Block type="lists_length" />
</Category>
</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>
<Block type="io_digitalread"></Block>
<Block type="io_builtin_led"></Block>
<Block type="io_analogwrite"></Block>
<Block type="io_analogread"></Block>
<Block type="io_highlow"></Block>
<Block type="io_pulsein">
<Value name="PULSETYPE">
<Shadow type="io_highlow"></Shadow>
</Value>
</Block>
<Block type="io_pulsetimeout">
<Value name="PULSETYPE">
<Shadow type="io_highlow"></Shadow>
</Value>
<Value name="TIMEOUT">
<Shadow type="math_number">
<Field name="NUM">100</Field>
</Shadow>
</Value>
</Block>
<Category name={Blockly.Msg.toolbox_advanced} colour={getColour().io}>
<Category
name={Blockly.Msg.toolbox_serial}
colour={getColour().serial}
>
<Block type="init_serial_monitor"></Block>
<Block type="print_serial_monitor"></Block>
</Category>
<Category name={Blockly.Msg.toolbox_io} colour={getColour().io}>
<Block type="io_digitalwrite"></Block>
<Block type="io_digitalread"></Block>
<Block type="io_builtin_led"></Block>
<Block type="io_analogwrite"></Block>
<Block type="io_analogread"></Block>
<Block type="io_highlow"></Block>
<Block type="io_pulsein">
<Value name="PULSETYPE">
<Shadow type="io_highlow"></Shadow>
</Value>
</Block>
<Block type="io_pulsetimeout">
<Value name="PULSETYPE">
<Shadow type="io_highlow"></Shadow>
</Value>
<Value name="TIMEOUT">
<Shadow type="math_number">
<Field name="NUM">100</Field>
</Shadow>
</Value>
</Block>
</Category>
<Category name="Watchdog" colour={getColour().io}>
<Block type="watchdog_enable"></Block>
<Block type="watchdog_reset"></Block>
</Category>
</Category>
{/* this block is the initial block of the workspace; not necessary
to display, because it can only be used once anyway
+143 -66
View File
@@ -1,68 +1,78 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { clearStats, workspaceName } from '../actions/workspaceActions';
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import { clearStats, workspaceName } from "../actions/workspaceActions";
import * as Blockly from 'blockly/core';
import { createNameId } from 'mnemonic-id';
import * as Blockly from "blockly/core";
import { createNameId } from "mnemonic-id";
import WorkspaceStats from './Workspace/WorkspaceStats';
import WorkspaceFunc from './Workspace/WorkspaceFunc';
import BlocklyWindow from './Blockly/BlocklyWindow';
import CodeViewer from './CodeViewer';
import TrashcanButtons from './Workspace/TrashcanButtons';
import HintTutorialExists from './Tutorial/HintTutorialExists';
import Snackbar from './Snackbar';
import WorkspaceStats from "./Workspace/WorkspaceStats";
import WorkspaceFunc from "./Workspace/WorkspaceFunc";
import BlocklyWindow from "./Blockly/BlocklyWindow";
import CodeViewer from "./CodeViewer";
import TrashcanButtons from "./Workspace/TrashcanButtons";
import HintTutorialExists from "./Tutorial/HintTutorialExists";
import Grid from '@material-ui/core/Grid';
import IconButton from '@material-ui/core/IconButton';
import Tooltip from '@material-ui/core/Tooltip';
import { withStyles } from '@material-ui/core/styles';
import Grid from "@material-ui/core/Grid";
import IconButton from "@material-ui/core/IconButton";
import Tooltip from "@material-ui/core/Tooltip";
import { withStyles } from "@material-ui/core/styles";
import { faCode } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import TooltipViewer from './TooltipViewer';
import TooltipViewer from "./TooltipViewer";
import Dialog from "./Dialog";
const styles = (theme) => ({
codeOn: {
backgroundColor: theme.palette.primary.main,
color: theme.palette.primary.contrastText,
'&:hover': {
"&:hover": {
backgroundColor: theme.palette.primary.contrastText,
color: theme.palette.primary.main,
border: `1px solid ${theme.palette.secondary.main}`
}
border: `1px solid ${theme.palette.secondary.main}`,
},
},
codeOff: {
backgroundColor: theme.palette.primary.contrastText,
color: theme.palette.primary.main,
border: `1px solid ${theme.palette.secondary.main}`,
'&:hover': {
"&:hover": {
backgroundColor: theme.palette.primary.main,
color: theme.palette.primary.contrastText,
}
}
},
},
});
class Home extends Component {
state = {
codeOn: true,
snackbar: false,
type: '',
key: '',
message: ''
constructor(props) {
super(props);
this.state = {
codeOn: true,
snackbar: false,
type: "",
key: "",
message: "",
open: true,
};
}
componentDidMount() {
this.setState({ stats: window.localStorage.getItem('stats') });
console.log(this.props.platform);
if (this.props.platform === true) {
this.setState({ codeOn: false });
}
this.setState({ stats: window.localStorage.getItem("stats") });
if (!this.props.project) {
this.props.workspaceName(createNameId());
}
if (this.props.message && this.props.message.id === 'GET_SHARE_FAIL') {
this.setState({ snackbar: true, key: Date.now(), message: `Das angefragte geteilte Projekt konnte nicht gefunden werden.`, type: 'error' });
if (this.props.message && this.props.message.id === "GET_SHARE_FAIL") {
this.setState({
snackbar: true,
key: Date.now(),
message: `Das angefragte geteilte Projekt konnte nicht gefunden werden.`,
type: "error",
});
}
}
@@ -80,6 +90,18 @@ class Home extends Component {
this.props.workspaceName(null);
}
toggleDialog = () => {
this.setState({ open: !this.state });
};
onChangeCheckbox = (e) => {
if (e.target.checked) {
window.localStorage.setItem("ota", e.target.checked);
} else {
window.localStorage.removeItem("ota");
}
};
onChange = () => {
this.setState({ codeOn: !this.state.codeOn });
const workspace = Blockly.getMainWorkspace();
@@ -87,67 +109,122 @@ class Home extends Component {
if (workspace.trashcan && workspace.trashcan.flyout) {
workspace.trashcan.flyout.hide(); // in case of resize, the trash flyout does not reposition
}
}
};
render() {
return (
<div>
{this.props.statistics ?
<div style={{ float: 'left', height: '40px', position: 'relative' }}><WorkspaceStats /></div>
: null
}
<div className='workspaceFunc' style={{ float: 'right', height: '40px', marginBottom: '20px' }}>
<WorkspaceFunc project={this.props.project} projectType={this.props.projectType} />
{this.props.statistics ? (
<div style={{ float: "left", height: "40px", position: "relative" }}>
<WorkspaceStats />
</div>
) : null}
<div
className="workspaceFunc"
style={{ float: "right", height: "40px", marginBottom: "20px" }}
>
<WorkspaceFunc
project={this.props.project}
projectType={this.props.projectType}
/>
</div>
<Grid container spacing={2}>
<Grid item xs={12} md={this.state.codeOn ? 8 : 12} style={{ position: 'relative' }}>
<Tooltip title={this.state.codeOn ? 'Code ausblenden' : 'Code anzeigen'} >
<Grid
item
xs={12}
md={this.state.codeOn ? 8 : 12}
style={{ position: "relative" }}
>
<Tooltip
title={
this.state.codeOn
? Blockly.Msg.tooltip_hide_code
: Blockly.Msg.tooltip_show_code
}
>
<IconButton
className={`showCode ${this.state.codeOn ? this.props.classes.codeOn : this.props.classes.codeOff}`}
style={{ width: '40px', height: '40px', position: 'absolute', top: -12, right: 8, zIndex: 21 }}
className={`showCode ${
this.state.codeOn
? this.props.classes.codeOn
: this.props.classes.codeOff
}`}
style={{
width: "40px",
height: "40px",
position: "absolute",
top: -12,
right: 8,
zIndex: 21,
}}
onClick={() => this.onChange()}
>
<FontAwesomeIcon icon={faCode} size="xs" />
</IconButton>
</Tooltip>
<TrashcanButtons />
<div className='blocklyWindow'>
{this.props.project ?
< BlocklyWindow blocklyCSS={{ height: '80vH' }} initialXml={this.props.project.xml} />
: < BlocklyWindow blocklyCSS={{ height: '80vH' }} />
}
<div className="blocklyWindow">
{this.props.project ? (
<BlocklyWindow
blocklyCSS={{ height: "80vH" }}
initialXml={this.props.project.xml}
/>
) : (
<BlocklyWindow blocklyCSS={{ height: "80vH" }} />
)}
</div>
</Grid>
{this.state.codeOn ?
{this.state.codeOn ? (
<Grid item xs={12} md={4}>
<CodeViewer />
<TooltipViewer />
</Grid>
: null}
) : null}
</Grid>
<HintTutorialExists />
<Snackbar
open={this.state.snackbar}
message={this.state.message}
type={this.state.type}
key={this.state.key}
/>
{this.props.platform ? (
<Dialog
style={{ zIndex: 9999999 }}
fullWidth
maxWidth={"sm"}
open={this.state.open}
title={Blockly.Msg.tabletDialog_headline}
content={""}
onClose={this.toggleDialog}
onClick={this.toggleDialog}
button={Blockly.Msg.button_close}
>
<div>{Blockly.Msg.tabletDialog_text}</div>
<div>
{Blockly.Msg.tabletDialog_more}{" "}
<a
href="https://sensebox.de/app"
target="_blank"
rel="noreferrer"
>
https://sensebox.de/app
</a>
</div>
</Dialog>
) : null}
</div>
);
};
}
}
Home.propTypes = {
clearStats: PropTypes.func.isRequired,
workspaceName: PropTypes.func.isRequired,
message: PropTypes.object.isRequired,
statistics: PropTypes.bool.isRequired
statistics: PropTypes.bool.isRequired,
platform: PropTypes.object.isRequired,
};
const mapStateToProps = state => ({
const mapStateToProps = (state) => ({
message: state.message,
statistics: state.general.statistics
statistics: state.general.statistics,
platform: state.general.platform,
});
export default connect(mapStateToProps, { clearStats, workspaceName })(withStyles(styles, { withTheme: true })(Home));
export default connect(mapStateToProps, { clearStats, workspaceName })(
withStyles(styles, { withTheme: true })(Home)
);
+2 -2
View File
@@ -139,7 +139,7 @@ class Navbar extends Component {
</Link>
) : null}
{isHome ? (
<Tooltip title="Hilfe starten" arrow>
<Tooltip title={Blockly.Msg.tooltip_start_tour} arrow>
<IconButton
color="inherit"
className={`openTour ${this.props.classes.button}`}
@@ -153,7 +153,7 @@ class Navbar extends Component {
</Tooltip>
) : null}
{isAssessment ? (
<Tooltip title="Hilfe starten" arrow>
<Tooltip title={Blockly.Msg.tooltip_start_tour} arrow>
<IconButton
color="inherit"
className={`openTour ${this.props.classes.button}`}
+66
View File
@@ -0,0 +1,66 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import { setPlatform } from "../../actions/generalActions";
import * as Blockly from "blockly/core";
import InputLabel from "@material-ui/core/InputLabel";
import MenuItem from "@material-ui/core/MenuItem";
import FormControl from "@material-ui/core/FormControl";
import Select from "@material-ui/core/Select";
import Typography from "@material-ui/core/Typography";
import FormHelperText from "@material-ui/core/FormHelperText";
class OtaSelector extends Component {
componentDidMount() {
// Ensure that Blockly.setLocale is adopted in the component.
// Otherwise, the text will not be displayed until the next update of the component.
this.forceUpdate();
}
render() {
return (
<div>
<Typography style={{ fontWeight: "bold" }}>
{Blockly.Msg.settings_ota_head}
</Typography>
<FormHelperText
style={{ color: "black", lineHeight: 1.3, marginBottom: "8px" }}
>
{Blockly.Msg.settings_ota_text}
<a href="https://sensebox.de/app" target="_blank" rel="noreferrer">
https://sensebox.de/app
</a>
</FormHelperText>
<FormControl>
<InputLabel id="demo-simple-select-label">
{Blockly.Msg.settings_statistics}
</InputLabel>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
value={this.props.platform}
onChange={(e) => this.props.setPlatform(e.target.value)}
>
<MenuItem value={true}>{Blockly.Msg.settings_ota_on}</MenuItem>
<MenuItem value={false}>{Blockly.Msg.settings_ota_off}</MenuItem>
</Select>
</FormControl>
</div>
);
}
}
OtaSelector.propTypes = {
setPlatform: PropTypes.func.isRequired,
language: PropTypes.string.isRequired,
platform: PropTypes.bool.isRequired,
};
const mapStateToProps = (state) => ({
language: state.general.language,
platform: state.general.platform,
});
export default connect(mapStateToProps, { setPlatform })(OtaSelector);
+41 -23
View File
@@ -1,22 +1,23 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import { withRouter } from 'react-router-dom';
import { withRouter } from "react-router-dom";
import * as Blockly from 'blockly/core';
import * as Blockly from "blockly/core";
import Breadcrumbs from '../Breadcrumbs';
import LanguageSelector from './LanguageSelector';
import RenderSelector from './RenderSelector';
import StatsSelector from './StatsSelector';
import Breadcrumbs from "../Breadcrumbs";
import LanguageSelector from "./LanguageSelector";
import RenderSelector from "./RenderSelector";
import StatsSelector from "./StatsSelector";
import OtaSelector from "./OtaSelector";
import SoundsSelector from "./SoundsSelector";
import Button from '@material-ui/core/Button';
import Paper from '@material-ui/core/Paper';
import Button from "@material-ui/core/Button";
import Paper from "@material-ui/core/Paper";
class Settings extends Component {
componentDidMount(){
componentDidMount() {
// Ensure that Blockly.setLocale is adopted in the component.
// Otherwise, the text will not be displayed until the next update of the component.
this.forceUpdate();
@@ -25,41 +26,58 @@ class Settings extends Component {
render() {
return (
<div>
<Breadcrumbs content={[{ link: this.props.location.pathname, title: Blockly.Msg.settings_head }]} />
<Breadcrumbs
content={[
{
link: this.props.location.pathname,
title: Blockly.Msg.settings_head,
},
]}
/>
<h1>{Blockly.Msg.settings_head}</h1>
<Paper style={{margin: '10px 0px', padding: '10px'}}>
<Paper style={{ margin: "10px 0px", padding: "10px" }}>
<LanguageSelector />
</Paper>
<Paper style={{margin: '10px 0px', padding: '10px'}}>
<Paper style={{ margin: "10px 0px", padding: "10px" }}>
<RenderSelector />
</Paper>
<Paper style={{margin: '10px 0px', padding: '10px'}}>
<Paper style={{ margin: "10px 0px", padding: "10px" }}>
<StatsSelector />
</Paper>
<Paper style={{ margin: "10px 0px", padding: "10px" }}>
<OtaSelector />
</Paper>
<Paper style={{ margin: "10px 0px", padding: "10px" }}>
<SoundsSelector />
</Paper>
<Button
style={{ marginTop: '10px' }}
style={{ marginTop: "10px" }}
variant="contained"
color="primary"
onClick={this.props.pageVisits > 0 ? () => this.props.history.goBack() : () => this.props.history.push('/')}
onClick={
this.props.pageVisits > 0
? () => this.props.history.goBack()
: () => this.props.history.push("/")
}
>
{Blockly.Msg.button_back}
</Button>
</div>
);
};
}
}
Settings.propTypes = {
language: PropTypes.string.isRequired,
pageVisits: PropTypes.number.isRequired
pageVisits: PropTypes.number.isRequired,
};
const mapStateToProps = state => ({
const mapStateToProps = (state) => ({
language: state.general.language,
pageVisits: state.general.pageVisits
pageVisits: state.general.pageVisits,
});
export default connect(mapStateToProps, null)(withRouter(Settings));
+63
View File
@@ -0,0 +1,63 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import { setSounds } from "../../actions/generalActions";
import * as Blockly from "blockly/core";
import InputLabel from "@material-ui/core/InputLabel";
import MenuItem from "@material-ui/core/MenuItem";
import FormControl from "@material-ui/core/FormControl";
import Select from "@material-ui/core/Select";
import Typography from "@material-ui/core/Typography";
import FormHelperText from "@material-ui/core/FormHelperText";
class SoundsSelector extends Component {
componentDidMount() {
// Ensure that Blockly.setLocale is adopted in the component.
// Otherwise, the text will not be displayed until the next update of the component.
this.forceUpdate();
}
render() {
return (
<div>
<Typography style={{ fontWeight: "bold" }}>
{Blockly.Msg.settings_sounds}
</Typography>
<FormHelperText
style={{ color: "black", lineHeight: 1.3, marginBottom: "8px" }}
>
{Blockly.Msg.settings_sounds_text}
</FormHelperText>
<FormControl>
<InputLabel id="demo-simple-select-label">
{Blockly.Msg.settings_sounds}
</InputLabel>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
value={this.props.sounds}
onChange={(e) => this.props.setSounds(e.target.value)}
>
<MenuItem value={false}>{Blockly.Msg.settings_ota_off}</MenuItem>
<MenuItem value={true}>{Blockly.Msg.settings_ota_on}</MenuItem>
</Select>
</FormControl>
</div>
);
}
}
SoundsSelector.propTypes = {
setSounds: PropTypes.func.isRequired,
language: PropTypes.string.isRequired,
sounds: PropTypes.string.isRequired,
};
const mapStateToProps = (state) => ({
sounds: state.general.sounds,
language: state.general.language,
});
export default connect(mapStateToProps, { setSounds })(SoundsSelector);
+4 -3
View File
@@ -39,6 +39,7 @@ import InputLabel from "@material-ui/core/InputLabel";
import MenuItem from "@material-ui/core/MenuItem";
import FormControl from "@material-ui/core/FormControl";
import Select from "@material-ui/core/Select";
import * as Blockly from "blockly";
const styles = (theme) => ({
backdrop: {
@@ -392,7 +393,7 @@ class Builder extends Component {
style={{ color: "black" }}
value="new"
control={<Radio color="primary" />}
label="neues Tutorial erstellen"
label={Blockly.Msg.builder_createNew}
labelPlacement="end"
/>
{filteredTutorials.length > 0 ? (
@@ -402,7 +403,7 @@ class Builder extends Component {
disabled={this.props.index === 0}
value="change"
control={<Radio color="primary" />}
label="bestehendes Tutorial ändern"
label={Blockly.Msg.builder_changeExisting}
labelPlacement="end"
/>
<FormControlLabel
@@ -410,7 +411,7 @@ class Builder extends Component {
disabled={this.props.index === 0}
value="delete"
control={<Radio color="primary" />}
label="bestehendes Tutorial löschen"
label={Blockly.Msg.builder_deleteExisting}
labelPlacement="end"
/>
</div>
+164 -64
View File
@@ -1,129 +1,224 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { getTutorials, resetTutorial, tutorialProgress } from '../../actions/tutorialActions';
import { clearMessages } from '../../actions/messageActions';
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import {
getTutorials,
resetTutorial,
tutorialProgress,
} from "../../actions/tutorialActions";
import { clearMessages } from "../../actions/messageActions";
import clsx from 'clsx';
import clsx from "clsx";
import Breadcrumbs from '../Breadcrumbs';
import Breadcrumbs from "../Breadcrumbs";
import { Link } from 'react-router-dom';
import { Link } from "react-router-dom";
import { fade } from '@material-ui/core/styles/colorManipulator';
import { withStyles } from '@material-ui/core/styles';
import Grid from '@material-ui/core/Grid';
import Paper from '@material-ui/core/Paper';
import Typography from '@material-ui/core/Typography';
import { fade } from "@material-ui/core/styles/colorManipulator";
import { withStyles } from "@material-ui/core/styles";
import Grid from "@material-ui/core/Grid";
import Paper from "@material-ui/core/Paper";
import Typography from "@material-ui/core/Typography";
import { faCheck, faTimes } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import * as Blockly from "blockly";
const styles = (theme) => ({
outerDiv: {
position: 'absolute',
right: '-30px',
bottom: '-30px',
width: '160px',
height: '160px',
color: fade(theme.palette.secondary.main, 0.6)
position: "absolute",
right: "-30px",
bottom: "-30px",
width: "160px",
height: "160px",
color: fade(theme.palette.secondary.main, 0.6),
},
outerDivError: {
stroke: fade(theme.palette.error.dark, 0.6),
color: fade(theme.palette.error.dark, 0.6)
color: fade(theme.palette.error.dark, 0.6),
},
outerDivSuccess: {
stroke: fade(theme.palette.primary.main, 0.6),
color: fade(theme.palette.primary.main, 0.6)
color: fade(theme.palette.primary.main, 0.6),
},
outerDivOther: {
stroke: fade(theme.palette.secondary.main, 0.6)
stroke: fade(theme.palette.secondary.main, 0.6),
},
innerDiv: {
width: 'inherit',
height: 'inherit',
display: 'table-cell',
verticalAlign: 'middle',
textAlign: 'center'
}
width: "inherit",
height: "inherit",
display: "table-cell",
verticalAlign: "middle",
textAlign: "center",
},
});
class TutorialHome extends Component {
componentDidMount() {
this.props.tutorialProgress();
// retrieve tutorials only if a potential user is loaded - authentication
// is finished (success or failed)
if(!this.props.progress){
if (!this.props.progress) {
this.props.getTutorials();
}
}
componentDidUpdate(props, state) {
if(props.progress !== this.props.progress && !this.props.progress){
if (props.progress !== this.props.progress && !this.props.progress) {
// authentication is completed
this.props.getTutorials();
}
if(this.props.message.id === 'GET_TUTORIALS_FAIL'){
if (this.props.message.id === "GET_TUTORIALS_FAIL") {
alert(this.props.message.msg);
}
}
componentWillUnmount() {
this.props.resetTutorial();
if(this.props.message.msg){
if (this.props.message.msg) {
this.props.clearMessages();
}
}
render() {
return (
this.props.isLoading ? null :
return this.props.isLoading ? null : (
<div>
<Breadcrumbs content={[{ link: '/tutorial', title: 'Tutorial' }]} />
<Breadcrumbs content={[{ link: "/tutorial", title: "Tutorial" }]} />
<h1>Tutorial-Übersicht</h1>
<h1>{Blockly.Msg.tutorials_home_head}</h1>
<Grid container spacing={2}>
{this.props.tutorials.map((tutorial, i) => {
var status = this.props.status.filter(status => status._id === tutorial._id)[0];
var status = this.props.status.filter(
(status) => status._id === tutorial._id
)[0];
var tasks = status.tasks;
var error = status.tasks.filter(task => task.type === 'error').length > 0;
var success = status.tasks.filter(task => task.type === 'success').length / tasks.length
var tutorialStatus = success === 1 ? 'Success' : error ? 'Error' : 'Other';
var error =
status.tasks.filter((task) => task.type === "error").length > 0;
var success =
status.tasks.filter((task) => task.type === "success").length /
tasks.length;
var tutorialStatus =
success === 1 ? "Success" : error ? "Error" : "Other";
return (
<Grid item xs={12} sm={6} md={4} xl={3} key={i} style={{}}>
<Link to={`/tutorial/${tutorial._id}`} style={{ textDecoration: 'none', color: 'inherit' }}>
<Paper style={{ height: '150px', padding: '10px', position: 'relative', overflow: 'hidden' }}>
<Link
to={`/tutorial/${tutorial._id}`}
style={{ textDecoration: "none", color: "inherit" }}
>
<Paper
style={{
height: "150px",
padding: "10px",
position: "relative",
overflow: "hidden",
}}
>
{tutorial.title}
<div className={clsx(this.props.classes.outerDiv)} style={{ width: '160px', height: '160px', border: 0 }}>
<svg style={{ width: '100%', height: '100%' }}>
{error || success === 1 ?
<circle className={error ? this.props.classes.outerDivError : this.props.classes.outerDivSuccess} style={{ transform: 'rotate(-44deg)', transformOrigin: "50% 50%" }} r="75" cx="50%" cy="50%" fill="none" stroke-width="10"></circle>
: <circle className={this.props.classes.outerDivOther} style={{ transform: 'rotate(-44deg)', transformOrigin: "50% 50%" }} r="75" cx="50%" cy="50%" fill="none" stroke-width="10" stroke-dashoffset={`${(75 * 2 * Math.PI) * (1 - (50 / 100 + success / 2))}`} stroke-dasharray={`${(75 * 2 * Math.PI) * (1 - (50 / 100 - success / 2))} ${(75 * 2 * Math.PI) * (1 - (50 / 100 + success / 2))}`}></circle>}
{success < 1 && !error ?
<circle className={this.props.classes.outerDivSuccess} style={{ transform: 'rotate(-44deg)', transformOrigin: "50% 50%" }} r="75" cx="50%" cy="50%" fill="none" stroke-width="10" stroke-dashoffset={`${(75 * 2 * Math.PI) * (1 - (50 / 100 + success / 2))}`} stroke-dasharray={`${(75 * 2 * Math.PI)}`}>
</circle>
: null}
<div
className={clsx(this.props.classes.outerDiv)}
style={{ width: "160px", height: "160px", border: 0 }}
>
<svg style={{ width: "100%", height: "100%" }}>
{error || success === 1 ? (
<circle
className={
error
? this.props.classes.outerDivError
: this.props.classes.outerDivSuccess
}
style={{
transform: "rotate(-44deg)",
transformOrigin: "50% 50%",
}}
r="75"
cx="50%"
cy="50%"
fill="none"
stroke-width="10"
></circle>
) : (
<circle
className={this.props.classes.outerDivOther}
style={{
transform: "rotate(-44deg)",
transformOrigin: "50% 50%",
}}
r="75"
cx="50%"
cy="50%"
fill="none"
stroke-width="10"
stroke-dashoffset={`${
75 * 2 * Math.PI * (1 - (50 / 100 + success / 2))
}`}
stroke-dasharray={`${
75 * 2 * Math.PI * (1 - (50 / 100 - success / 2))
} ${
75 * 2 * Math.PI * (1 - (50 / 100 + success / 2))
}`}
></circle>
)}
{success < 1 && !error ? (
<circle
className={this.props.classes.outerDivSuccess}
style={{
transform: "rotate(-44deg)",
transformOrigin: "50% 50%",
}}
r="75"
cx="50%"
cy="50%"
fill="none"
stroke-width="10"
stroke-dashoffset={`${
75 * 2 * Math.PI * (1 - (50 / 100 + success / 2))
}`}
stroke-dasharray={`${75 * 2 * Math.PI}`}
></circle>
) : null}
</svg>
</div>
<div className={clsx(this.props.classes.outerDiv, tutorialStatus === 'Error' ? this.props.classes.outerDivError : tutorialStatus === 'Success' ? this.props.classes.outerDivSuccess : null)}>
<div
className={clsx(
this.props.classes.outerDiv,
tutorialStatus === "Error"
? this.props.classes.outerDivError
: tutorialStatus === "Success"
? this.props.classes.outerDivSuccess
: null
)}
>
<div className={this.props.classes.innerDiv}>
{error || success === 1 ?
<FontAwesomeIcon size='4x' icon={tutorialStatus === 'Success' ? faCheck : faTimes} />
: <Typography variant='h3' className={success > 0 ? this.props.classes.outerDivSuccess : {}}>{Math.round(success * 100)}%</Typography>
}
{error || success === 1 ? (
<FontAwesomeIcon
size="4x"
icon={
tutorialStatus === "Success" ? faCheck : faTimes
}
/>
) : (
<Typography
variant="h3"
className={
success > 0
? this.props.classes.outerDivSuccess
: {}
}
>
{Math.round(success * 100)}%
</Typography>
)}
</div>
</div>
</Paper>
</Link>
</Grid>
)
);
})}
</Grid>
</div>
);
};
}
}
TutorialHome.propTypes = {
@@ -136,16 +231,21 @@ TutorialHome.propTypes = {
tutorials: PropTypes.array.isRequired,
isLoading: PropTypes.bool.isRequired,
message: PropTypes.object.isRequired,
progress: PropTypes.bool.isRequired
progress: PropTypes.bool.isRequired,
};
const mapStateToProps = state => ({
const mapStateToProps = (state) => ({
change: state.tutorial.change,
status: state.tutorial.status,
tutorials: state.tutorial.tutorials,
isLoading: state.tutorial.progress,
message: state.message,
progress: state.auth.progress
progress: state.auth.progress,
});
export default connect(mapStateToProps, { getTutorials, resetTutorial, clearMessages, tutorialProgress })(withStyles(styles, { withTheme: true })(TutorialHome));
export default connect(mapStateToProps, {
getTutorials,
resetTutorial,
clearMessages,
tutorialProgress,
})(withStyles(styles, { withTheme: true })(TutorialHome));
+53 -51
View File
@@ -124,57 +124,59 @@ export class Login extends Component {
type={this.state.type}
key={this.state.key}
/>
<TextField
style={{ marginBottom: "10px" }}
// variant='outlined'
type="text"
label={Blockly.Msg.labels_username}
name="email"
value={this.state.email}
onChange={this.onChange}
fullWidth={true}
/>
<TextField
// variant='outlined'
type={this.state.showPassword ? "text" : "password"}
label={Blockly.Msg.labels_password}
name="password"
value={this.state.password}
InputProps={{
endAdornment: (
<InputAdornment position="end">
<IconButton
onClick={this.handleClickShowPassword}
onMouseDown={this.handleMouseDownPassword}
edge="end"
>
<FontAwesomeIcon
size="xs"
icon={this.state.showPassword ? faEyeSlash : faEye}
/>
</IconButton>
</InputAdornment>
),
}}
onChange={this.onChange}
fullWidth={true}
/>
<p>
<Button
color="primary"
variant="contained"
onClick={this.onSubmit}
style={{ width: "100%" }}
>
{this.props.progress ? (
<div style={{ height: "24.5px" }}>
<CircularProgress color="inherit" size={20} />
</div>
) : (
Blockly.Msg.button_login
)}
</Button>
</p>
<form onSubmit={this.onSubmit}>
<TextField
style={{ marginBottom: "10px" }}
// variant='outlined'
type="text"
label={Blockly.Msg.labels_username}
name="email"
value={this.state.email}
onChange={this.onChange}
fullWidth={true}
/>
<TextField
// variant='outlined'
type={this.state.showPassword ? "text" : "password"}
label={Blockly.Msg.labels_password}
name="password"
value={this.state.password}
InputProps={{
endAdornment: (
<InputAdornment position="end">
<IconButton
onClick={this.handleClickShowPassword}
onMouseDown={this.handleMouseDownPassword}
edge="end"
>
<FontAwesomeIcon
size="xs"
icon={this.state.showPassword ? faEyeSlash : faEye}
/>
</IconButton>
</InputAdornment>
),
}}
onChange={this.onChange}
fullWidth={true}
/>
<p>
<Button
color="primary"
variant="contained"
type="submit"
style={{ width: "100%" }}
>
{this.props.progress ? (
<div style={{ height: "24.5px" }}>
<CircularProgress color="inherit" size={20} />
</div>
) : (
Blockly.Msg.button_login
)}
</Button>
</p>
</form>
<p style={{ textAlign: "center", fontSize: "0.8rem" }}>
<Link
rel="noreferrer"
+101 -47
View File
@@ -21,6 +21,7 @@ import "prismjs/themes/prism.css";
import "prismjs/plugins/line-numbers/prism-line-numbers";
import "prismjs/plugins/line-numbers/prism-line-numbers.css";
import MuiDrawer from "@material-ui/core/Drawer";
import Dialog from "../Dialog";
const styles = (theme) => ({
backdrop: {
@@ -65,6 +66,8 @@ class Compile extends Component {
content: "",
name: props.name,
error: "",
appLink: "",
appDialog: false,
};
}
@@ -126,21 +129,43 @@ class Compile extends Component {
};
toggleDialog = () => {
this.setState({ open: !this.state, progress: false });
this.setState({ open: !this.state, progress: false, appDialog: false });
};
createFileName = () => {
if (this.state.name) {
this.download();
} else {
if (this.props.platform === true) {
const filename = detectWhitespacesAndReturnReadableResult(
this.state.name
);
this.setState({
file: true,
open: true,
title: "Projekt kompilieren",
content:
"Bitte gib einen Namen für die Bennenung des zu kompilierenden Programms ein und bestätige diesen mit einem Klick auf 'Eingabe'.",
link: `blocklyconnect-app://sketch/${filename}/${this.state.id}`,
});
this.setState({ appDialog: true });
} else {
if (this.state.name) {
this.download();
} else {
this.setState({
file: true,
open: true,
title: "Projekt kompilieren",
content:
"Bitte gib einen Namen für die Bennenung des zu kompilierenden Programms ein und bestätige diesen mit einem Klick auf 'Eingabe'.",
});
}
}
// if (this.state.name) {
// this.download();
// } else {
// this.setState({
// file: true,
// open: true,
// title: "Projekt kompilieren",
// content:
// "Bitte gib einen Namen für die Bennenung des zu kompilierenden Programms ein und bestätige diesen mit einem Klick auf 'Eingabe'.",
// });
// }
};
setFileName = (e) => {
@@ -188,23 +213,44 @@ class Compile extends Component {
Kompilieren
</Button>
)}
<Backdrop
className={this.props.classes.backdrop}
open={this.state.progress}
>
<div className="overlay">
<img src={Copy} width="400" alt="copyimage"></img>
<h2>{Blockly.Msg.compile_overlay_head}</h2>
<p>{Blockly.Msg.compile_overlay_text}</p>
<p>
{Blockly.Msg.compile_overlay_help}
<a href="/faq" target="_blank">
FAQ
</a>
</p>
<CircularProgress color="inherit" />
</div>
</Backdrop>
{this.props.platform === false ? (
<Backdrop
className={this.props.classes.backdrop}
open={this.state.progress}
>
<div className="overlay">
<img src={Copy} width="400" alt="copyimage"></img>
<h2>{Blockly.Msg.compile_overlay_head}</h2>
<p>{Blockly.Msg.compile_overlay_text}</p>
<p>
{Blockly.Msg.compile_overlay_help}
<a href="/faq" target="_blank">
FAQ
</a>
</p>
<CircularProgress color="inherit" />
</div>
</Backdrop>
) : (
<Backdrop
className={this.props.classes.backdrop}
open={this.state.progress}
>
<div className="overlay">
{/* <img src={Copy} width="400" alt="copyimage"></img> */}
<h2>Dein Code wird kompiliert!</h2>
<p>übertrage ihn anschließend mithlfe der senseBoxConnect-App</p>
<p>
{Blockly.Msg.compile_overlay_help}
<a href="/faq" target="_blank">
FAQ
</a>
</p>
<CircularProgress color="inherit" />
</div>
</Backdrop>
)}
<Drawer
anchor={"bottom"}
open={this.state.open}
@@ -240,29 +286,35 @@ class Compile extends Component {
{`${this.state.error}`}{" "}
</p>
</Drawer>
{/* <Dialog
open={this.state.open}
title={this.state.title}
content={this.state.content}
<Dialog
style={{ zIndex: 9999999 }}
fullWidth
maxWidth={"sm"}
open={this.state.appDialog}
title=""
content={""}
onClose={this.toggleDialog}
onClick={this.state.file ? () => { this.toggleDialog(); this.setState({ name: this.props.name }) } : this.toggleDialog}
button={this.state.file ? Blockly.Msg.button_cancel : Blockly.Msg.button_close}
onClick={this.toggleDialog}
button={Blockly.Msg.button_close}
>
{this.state.file ?
<div style={{ marginTop: '10px' }}>
<TextField autoFocus placeholder='Dateiname' value={this.state.name} onChange={this.setFileName} style={{ marginRight: '10px' }} />
<Button disabled={!this.state.name} variant='contained' color='primary' onClick={() => this.download()}>Eingabe</Button>
</div>
:
<pre className="line-numbers" style={{ paddingBottom: 0, width: '100%', overflow: 'auto', scrollbarWidth: 'thin', height: '100%', margin: '15px 0', paddingTop: 0, whiteSpace: 'pre-wrap', backgroundColor: 'white' }}><code className="language-json">
{`${this.state.error}`}
</code></pre>
</AccordionDetails>
</Accordion>
}
</Dialog> */}
<div>
<p>Dein Code wurde erfolgreich kompiliert</p>
<a href={this.state.link}>
<Button
style={{ color: "white" }}
variant="contained"
className={this.props.classes.button}
onClick={() => this.toggleDialog()}
>
<FontAwesomeIcon
icon={faClipboardCheck}
style={{ marginRight: "5px" }}
/>{" "}
Starte Übertragung
</Button>
</a>
</div>
</Dialog>
</div>
);
}
@@ -272,11 +324,13 @@ Compile.propTypes = {
arduino: PropTypes.string.isRequired,
name: PropTypes.string,
workspaceName: PropTypes.func.isRequired,
platform: PropTypes.bool.isRequired,
};
const mapStateToProps = (state) => ({
arduino: state.workspace.code.arduino,
name: state.workspace.name,
platform: state.general.platform,
});
export default connect(mapStateToProps, { workspaceName })(
+175 -115
View File
@@ -1,147 +1,204 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import * as Blockly from 'blockly/core';
import * as Blockly from "blockly/core";
import withWidth, { isWidthDown } from '@material-ui/core/withWidth';
import { withStyles } from '@material-ui/core/styles';
import Tooltip from '@material-ui/core/Tooltip';
import IconButton from '@material-ui/core/IconButton';
import Chip from '@material-ui/core/Chip';
import Avatar from '@material-ui/core/Avatar';
import Popover from '@material-ui/core/Popover';
import withWidth, { isWidthDown } from "@material-ui/core/withWidth";
import { withStyles } from "@material-ui/core/styles";
import Tooltip from "@material-ui/core/Tooltip";
import IconButton from "@material-ui/core/IconButton";
import Chip from "@material-ui/core/Chip";
import Avatar from "@material-ui/core/Avatar";
import Popover from "@material-ui/core/Popover";
import { faPuzzlePiece, faTrash, faPlus, faPen, faArrowsAlt, faEllipsisH } from "@fortawesome/free-solid-svg-icons";
import {
faPuzzlePiece,
faTrash,
faPlus,
faPen,
faArrowsAlt,
faEllipsisH,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
const styles = (theme) => ({
stats: {
backgroundColor: theme.palette.primary.main,
display: 'inline',
marginLeft: '50px',
padding: '3px 10px',
display: "inline",
marginLeft: "50px",
padding: "3px 10px",
// borderRadius: '25%'
},
menu: {
backgroundColor: theme.palette.secondary.main,
color: theme.palette.secondary.contrastText,
width: '40px',
height: '40px',
'&:hover': {
width: "40px",
height: "40px",
"&:hover": {
backgroundColor: theme.palette.secondary.main,
color: theme.palette.primary.main,
}
}
},
},
});
class WorkspaceStats extends Component {
state = {
anchor: null
}
anchor: null,
};
handleClose = () => {
this.setState({ anchor: null });
}
};
handleClick = (event) => {
this.setState({ anchor: event.currentTarget });
};
render() {
const bigDisplay = !isWidthDown('sm', this.props.width);
const bigDisplay = !isWidthDown("sm", this.props.width);
const workspace = Blockly.getMainWorkspace();
const remainingBlocksInfinity = workspace ? workspace.remainingCapacity() !== Infinity : null;
const stats = <div style={bigDisplay ? { display: 'flex' } : { display: 'inline' }}>
<Tooltip title="Anzahl aktueller Blöcke" arrow>
<Chip
style={bigDisplay ? { marginRight: '1rem' } : { marginRight: '1rem', marginBottom: '5px' }}
color="primary"
avatar={<Avatar><FontAwesomeIcon icon={faPuzzlePiece} /></Avatar>}
label={workspace ? workspace.getAllBlocks().length : 0}>
</Chip>
</Tooltip>
<Tooltip title="Anzahl neuer Blöcke" arrow>
<Chip
style={bigDisplay ? { marginRight: '1rem' } : { marginRight: '1rem', marginBottom: '5px' }}
color="primary"
avatar={<Avatar><FontAwesomeIcon icon={faPlus} /></Avatar>}
label={this.props.create > 0 ? this.props.create : 0}> {/* initialXML is created automatically, Block is not part of the statistics */}
</Chip>
</Tooltip>
<Tooltip title="Anzahl veränderter Blöcke" arrow>
<Chip
style={bigDisplay ? { marginRight: '1rem' } : { marginRight: '1rem', marginBottom: '5px' }}
color="primary"
avatar={<Avatar><FontAwesomeIcon icon={faPen} /></Avatar>}
label={this.props.change}>
</Chip>
</Tooltip>
<Tooltip title="Anzahl bewegter Blöcke" arrow>
<Chip
style={bigDisplay ? { marginRight: '1rem' } : { marginRight: '1rem', marginBottom: '5px' }}
color="primary"
avatar={<Avatar><FontAwesomeIcon icon={faArrowsAlt} /></Avatar>}
label={this.props.move > 0 ? this.props.move : 0}> {/* initialXML is moved automatically, Block is not part of the statistics */}
</Chip>
</Tooltip>
<Tooltip title="Anzahl gelöschter Blöcke" arrow>
<Chip
style={remainingBlocksInfinity ? bigDisplay ? { marginRight: '1rem' } : { marginRight: '1rem', marginBottom: '5px' } : {}}
color="primary"
avatar={<Avatar><FontAwesomeIcon icon={faTrash} /></Avatar>}
label={this.props.delete}>
</Chip>
</Tooltip>
{remainingBlocksInfinity ?
<Tooltip title="Verbleibende Blöcke" arrow>
const remainingBlocksInfinity = workspace
? workspace.remainingCapacity() !== Infinity
: null;
const stats = (
<div style={bigDisplay ? { display: "flex" } : { display: "inline" }}>
<Tooltip title={Blockly.Msg.tooltip_statistics_current} arrow>
<Chip
style={bigDisplay ? { marginRight: '1rem' } : { marginRight: '1rem', marginBottom: '5px' }}
style={
bigDisplay
? { marginRight: "1rem" }
: { marginRight: "1rem", marginBottom: "5px" }
}
color="primary"
label={workspace.remainingCapacity()}>
</Chip>
</Tooltip> : null}
</div>
return (
bigDisplay ?
<div style={{ bottom: 0, position: 'absolute' }}>
{stats}
</div>
:
<div>
<Tooltip title='Statistiken anzeigen' arrow>
<IconButton
className={this.props.classes.menu}
onClick={(event) => this.handleClick(event)}
>
<FontAwesomeIcon icon={faEllipsisH} size="xs" />
</IconButton>
</Tooltip>
<Popover
open={Boolean(this.state.anchor)}
anchorEl={this.state.anchor}
onClose={this.handleClose}
anchorOrigin={{
vertical: 'bottom',
horizontal: 'center',
}}
transformOrigin={{
vertical: 'top',
horizontal: 'center',
}}
PaperProps={{
style: { margin: '5px' }
}}
avatar={
<Avatar>
<FontAwesomeIcon icon={faPuzzlePiece} />
</Avatar>
}
label={workspace ? workspace.getAllBlocks().length : 0}
></Chip>
</Tooltip>
<Tooltip title={Blockly.Msg.tooltip_statistics_new} arrow>
<Chip
style={
bigDisplay
? { marginRight: "1rem" }
: { marginRight: "1rem", marginBottom: "5px" }
}
color="primary"
avatar={
<Avatar>
<FontAwesomeIcon icon={faPlus} />
</Avatar>
}
label={this.props.create > 0 ? this.props.create : 0}
>
<div style={{ margin: '10px' }}>
{stats}
</div>
</Popover>
</div>
{" "}
{/* initialXML is created automatically, Block is not part of the statistics */}
</Chip>
</Tooltip>
<Tooltip title={Blockly.Msg.tooltip_statistics_changed} arrow>
<Chip
style={
bigDisplay
? { marginRight: "1rem" }
: { marginRight: "1rem", marginBottom: "5px" }
}
color="primary"
avatar={
<Avatar>
<FontAwesomeIcon icon={faPen} />
</Avatar>
}
label={this.props.change}
></Chip>
</Tooltip>
<Tooltip title={Blockly.Msg.tooltip_statistics_moved} arrow>
<Chip
style={
bigDisplay
? { marginRight: "1rem" }
: { marginRight: "1rem", marginBottom: "5px" }
}
color="primary"
avatar={
<Avatar>
<FontAwesomeIcon icon={faArrowsAlt} />
</Avatar>
}
label={this.props.move > 0 ? this.props.move : 0}
>
{" "}
{/* initialXML is moved automatically, Block is not part of the statistics */}
</Chip>
</Tooltip>
<Tooltip title={Blockly.Msg.tooltip_statistics_deleted} arrow>
<Chip
style={
remainingBlocksInfinity
? bigDisplay
? { marginRight: "1rem" }
: { marginRight: "1rem", marginBottom: "5px" }
: {}
}
color="primary"
avatar={
<Avatar>
<FontAwesomeIcon icon={faTrash} />
</Avatar>
}
label={this.props.delete}
></Chip>
</Tooltip>
{remainingBlocksInfinity ? (
<Tooltip title={Blockly.Msg.tooltip_statistics_remaining} arrow>
<Chip
style={
bigDisplay
? { marginRight: "1rem" }
: { marginRight: "1rem", marginBottom: "5px" }
}
color="primary"
label={workspace.remainingCapacity()}
></Chip>
</Tooltip>
) : null}
</div>
);
};
return bigDisplay ? (
<div style={{ bottom: 0, position: "absolute" }}>{stats}</div>
) : (
<div>
<Tooltip title={Blockly.Msg.tooltip_statistics_show} arrow>
<IconButton
className={this.props.classes.menu}
onClick={(event) => this.handleClick(event)}
>
<FontAwesomeIcon icon={faEllipsisH} size="xs" />
</IconButton>
</Tooltip>
<Popover
open={Boolean(this.state.anchor)}
anchorEl={this.state.anchor}
onClose={this.handleClose}
anchorOrigin={{
vertical: "bottom",
horizontal: "center",
}}
transformOrigin={{
vertical: "top",
horizontal: "center",
}}
PaperProps={{
style: { margin: "5px" },
}}
>
<div style={{ margin: "10px" }}>{stats}</div>
</Popover>
</div>
);
}
}
WorkspaceStats.propTypes = {
@@ -149,15 +206,18 @@ WorkspaceStats.propTypes = {
change: PropTypes.number.isRequired,
delete: PropTypes.number.isRequired,
move: PropTypes.number.isRequired,
workspaceChange: PropTypes.number.isRequired
workspaceChange: PropTypes.number.isRequired,
};
const mapStateToProps = state => ({
const mapStateToProps = (state) => ({
create: state.workspace.stats.create,
change: state.workspace.stats.change,
delete: state.workspace.stats.delete,
move: state.workspace.stats.move,
workspaceChange: state.workspace.change
workspaceChange: state.workspace.change,
});
export default connect(mapStateToProps, null)(withStyles(styles, { withTheme: true })(withWidth()(WorkspaceStats)));
export default connect(
mapStateToProps,
null
)(withStyles(styles, { withTheme: true })(withWidth()(WorkspaceStats)));
+20 -19
View File
@@ -1,21 +1,22 @@
import * as Blockly from 'blockly/core';
import * as Blockly from "blockly/core";
export const FaqQuestions = () => {
return (
[
{
question: `${Blockly.Msg.faq_q1_question}`,
answer: `${Blockly.Msg.faq_q1_answer}`,
},
{
question: `${Blockly.Msg.faq_q2_question}`,
answer: `${Blockly.Msg.faq_q2_answer}`,
},
{
question: `${Blockly.Msg.faq_q3_question}`,
answer: `${Blockly.Msg.faq_q3_answer}`,
},
])
}
return [
{
question: `${Blockly.Msg.faq_q1_question}`,
answer: `${Blockly.Msg.faq_q1_answer}`,
},
{
question: `${Blockly.Msg.faq_q2_question}`,
answer: `${Blockly.Msg.faq_q2_answer}`,
},
{
question: `${Blockly.Msg.faq_tablet_question}`,
answer: `${Blockly.Msg.faq_tablet_answer}`,
},
{
question: `${Blockly.Msg.faq_q3_question}`,
answer: `${Blockly.Msg.faq_q3_answer}`,
},
];
};
+25 -1
View File
@@ -83,6 +83,12 @@
"src": "lora-bee.png",
"url": "https://docs.sensebox.de/hardware/bee-lora/"
},
{
"id": "bluetooth-bee",
"name": "Bluetooth-Bee",
"src": "ble-bee.png",
"url": "https://docs.sensebox.de/hardware/bee-ble/"
},
{
"id": "button",
"name": "Knopf",
@@ -125,6 +131,18 @@
"src": "rgb-led.png",
"url": ""
},
{
"id": "ws2818-rgb-led",
"name": "RGB-LED",
"src": "ws2818.png",
"url": ""
},
{
"id": "ds1820b",
"name": "Wassertemperatur",
"src": "ws2818.png",
"url": ""
},
{
"id": "jst-adapter",
"name": "JST-Adapterkabel",
@@ -137,6 +155,12 @@
"src": "jst-jst.png",
"url": ""
},
{
"id": "jst-female",
"name": "JST-JST Kabel",
"src": "jst-jst.png",
"url": ""
},
{
"id": "jumperwire",
"name": "Steckkabel",
@@ -155,4 +179,4 @@
"src": "resistor-470ohm.png",
"url": ""
}
]
]
+77 -21
View File
@@ -1,60 +1,116 @@
import { VISIT, LANGUAGE, RENDERER, STATISTICS } from '../actions/types';
import {
VISIT,
LANGUAGE,
RENDERER,
SOUNDS,
STATISTICS,
PLATFORM,
} from "../actions/types";
const initialLanguage = () => {
if (window.localStorage.getItem('locale')) {
return window.localStorage.getItem('locale');
if (window.localStorage.getItem("locale")) {
return window.localStorage.getItem("locale");
}
if (navigator.language === 'de-DE'){
return 'de_DE';
if (navigator.language === "de-DE") {
return "de_DE";
}
return 'en_US';
return "en_US";
};
const initialPlatform = () => {
return getPlatform();
};
const initialSounds = () => {
if (window.localStorage.getItem("sounds")) {
return window.localStorage.getItem("sounds");
} else {
return "off";
}
};
const getPlatform = () => {
if (window.localStorage.getItem("platform")) {
return JSON.parse(window.localStorage.getItem("platform"));
}
var userAgent = window.navigator.userAgent,
platform = window.navigator.platform,
macosPlatforms = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"],
windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"],
iosPlatforms = ["iPhone", "iPad", "iPod"],
os = null;
if (macosPlatforms.indexOf(platform) !== -1) {
os = false;
} else if (iosPlatforms.indexOf(platform) !== -1) {
os = true;
} else if (windowsPlatforms.indexOf(userAgent) !== -1) {
os = false;
} else if (/Android/.test(userAgent)) {
os = true;
} else if (!os && /Linux/.test(platform)) {
os = false;
}
return os;
};
const initialRenderer = () => {
if (window.localStorage.getItem('renderer')) {
return window.localStorage.getItem('renderer');
if (window.localStorage.getItem("renderer")) {
return window.localStorage.getItem("renderer");
}
return 'geras';
return "geras";
};
const initialStatistics = () => {
if (window.localStorage.getItem('statistics')) {
return JSON.parse(window.localStorage.getItem('statistics'));
if (window.localStorage.getItem("statistics")) {
return JSON.parse(window.localStorage.getItem("statistics"));
}
return false;
};
const initialState = {
pageVisits: 0, // detect if previous URL was
language: initialLanguage(),
renderer: initialRenderer(),
statistics: initialStatistics()
sounds: initialSounds(),
statistics: initialStatistics(),
platform: initialPlatform(),
};
export default function foo(state = initialState, action){
switch(action.type){
export default function foo(state = initialState, action) {
switch (action.type) {
case VISIT:
return {
...state,
pageVisits: state.pageVisits += 1
pageVisits: (state.pageVisits += 1),
};
case LANGUAGE:
return {
...state,
language: action.payload
language: action.payload,
};
case PLATFORM:
window.localStorage.setItem("platform", action.payload);
return {
...state,
platform: action.payload,
};
case RENDERER:
window.localStorage.setItem('renderer', action.payload);
window.localStorage.setItem("renderer", action.payload);
return {
...state,
renderer: action.payload
renderer: action.payload,
};
case SOUNDS:
window.localStorage.setItem("sounds", action.payload);
return {
...state,
sounds: action.payload,
};
case STATISTICS:
window.localStorage.setItem('statistics', action.payload);
window.localStorage.setItem("statistics", action.payload);
return {
...state,
statistics: action.payload
statistics: action.payload,
};
default:
return state;
-13028
View File
File diff suppressed because it is too large Load Diff