Compare commits
89
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
431719f242 | ||
|
|
9ed49f2972 | ||
|
|
2a9eecd76b | ||
|
|
c23b74ce8d | ||
|
|
f2d50a33c1 | ||
|
|
5b2add4098 | ||
|
|
ed36a27ac2 | ||
|
|
4e2b57d46a | ||
|
|
9c02fa1ec6 | ||
|
|
e7cfc5c5d3 | ||
|
|
4f24ba607f | ||
|
|
c3bd3a5bef | ||
|
|
1e979f948c | ||
|
|
f6947f8c6b | ||
|
|
bb19a77896 | ||
|
|
f4344f842c | ||
|
|
ee19598728 | ||
|
|
d65948fca7 | ||
|
|
c1eff07b7e | ||
|
|
aef8a164ce | ||
|
|
8c3a86b667 | ||
|
|
5ecc776db2 | ||
|
|
b6c90772ed | ||
|
|
283da13455 | ||
|
|
59142b4c25 | ||
|
|
da65e23d3f | ||
|
|
531db63b85 | ||
|
|
44d48997d4 | ||
|
|
47984fa66c | ||
|
|
4522760e9c | ||
|
|
21d282ee1b | ||
|
|
6b12c501a0 | ||
|
|
255b1619b8 | ||
|
|
687ac32166 | ||
|
|
6a6b2e2f58 | ||
|
|
d835ffc449 | ||
|
|
190d676e5b | ||
|
|
65fa627aeb | ||
|
|
bc5cbb6b33 | ||
|
|
31e0880e7a | ||
|
|
09a9318b24 | ||
|
|
8dea4d97c5 | ||
|
|
d442b2f100 | ||
|
|
a163c76463 | ||
|
|
7a34575314 | ||
|
|
5c843db50b | ||
|
|
2e00fdaa1c | ||
|
|
a8f57b200c | ||
|
|
4626addcfb | ||
|
|
421f7d00b1 | ||
|
|
6d7e2782d6 | ||
|
|
5e4021d6d9 | ||
|
|
269afa4b76 | ||
|
|
1963ca3051 | ||
|
|
0d8c30c1ee | ||
|
|
957ccd566e | ||
|
|
126dc3ecf4 | ||
|
|
851400e1c1 | ||
|
|
b25a4d602a | ||
|
|
97e28b62f8 | ||
|
|
de9141c25c | ||
|
|
7a31d94a21 | ||
|
|
8f47ae4fc8 | ||
|
|
4256d340c4 | ||
|
|
48e63fe898 | ||
|
|
f6f6d6f1da | ||
|
|
5eb6a94a0b | ||
|
|
40f8c62696 | ||
|
|
842b4522f0 | ||
|
|
c52e9db4c8 | ||
|
|
5658aa603c | ||
|
|
59fa90d43f | ||
|
|
7940885388 | ||
|
|
bf82a396fc | ||
|
|
889fba21cc | ||
|
|
d91d22cdee | ||
|
|
a70e333d4d | ||
|
|
ad1e5f1b82 | ||
|
|
3e01ede7f1 | ||
|
|
41739e7fb3 | ||
|
|
fdcd5c9c5d | ||
|
|
b4a9f76d99 | ||
|
|
1e9361b730 | ||
|
|
e4bab3d9ca | ||
|
|
dce73e6a54 | ||
|
|
307607191e | ||
|
|
127c9551a0 | ||
|
|
8504dacc38 | ||
|
|
a6e800c91b |
@@ -2,8 +2,5 @@ REACT_APP_COMPILER_URL=https://compiler.sensebox.de
|
|||||||
REACT_APP_BOARD=sensebox-mcu
|
REACT_APP_BOARD=sensebox-mcu
|
||||||
REACT_APP_BLOCKLY_API=https://api.blockly.sensebox.de
|
REACT_APP_BLOCKLY_API=https://api.blockly.sensebox.de
|
||||||
|
|
||||||
REACT_APP_MYBADGES=https://mybadges.org
|
|
||||||
REACT_APP_MYBADGES_API=https://mybadges.org/api/v1
|
|
||||||
|
|
||||||
# in days
|
# in days
|
||||||
REACT_APP_SHARE_LINK_EXPIRES=30
|
REACT_APP_SHARE_LINK_EXPIRES=30
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
# Blockly 2020
|
||||||
|
|
||||||
|
(aktuelles Preview unter: https://deploy-preview-37--blockly-react.netlify.app/)
|
||||||
|
|
||||||
|
In den letzten Wochen haben wir eine komplett neue Lern- und Programmierumgebung für die senseBox geschaffen. Die Basis bildet hierbei weiterhin Google Blockly und das Frontend wird über React realisiert. Fast alle Blöcke wurden bereits aus der alten Version in die neue Version migriert.
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Blockly Core
|
||||||
|
Nachdem die bisherige Version, die unter [blockly.sensebox.de](https://blockly.sensebox.de) verfügbar ist, auf einen Google Blockly Core von 2016 aufbaut, wurde es Zeit ein großes Update durchzuführen. Durch den neuen Blockly Core lassen sich auch andere Renderer der Blöcke verwenden. In den Einstellungen kannst du zwischen den zwei Renderern Geras und Zelos auswählen. Geras ist der klassische Blockly Renderer während Zelos vor allem für Touchoberfläche optimiert worden ist.
|
||||||
|
|
||||||
|
### Typed Variablen
|
||||||
|
|
||||||
|
Neue Variablen werden nun direkt mit einem bestimmten Datentyp angelegt. Ein einfacher Check überprüft ob der zurückgegeben Typ eines Blockes mit dem der Variablen kompatibel ist.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
### Funktionen (funktioniert aktuell nicht!)
|
||||||
|
|
||||||
|
Funktionen mit Rückgabe Wert und Eingabeparametern können angelegt werden. Durch die Verwendung von Funktionen lassen sich auch komplexere Programme übersichtlicher darstellen und bearbeiten. Beim Anlegen einer Funktion kann über das Zahnrad weitere Eingabeparameter hinzuefügt werden.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
### GPS
|
||||||
|
|
||||||
|
Der Code für das GPS Modul wurde neu aufgebaut und ermöglicht es deutlich schneller einen GPS Fix zu bekommen. Zusätzlich lassen sich bald! die Koordinaten in zwei verschiedenen Formaten zurückgebenlassen. Zum einen als Kommazahl zum anderen als Zahl ohne nachkommastellen
|
||||||
|
|
||||||
|
### MQTT
|
||||||
|
Zwei einfache Blöcke ermöglichen es nun die Daten über MQTT an einen Broker zu versenden. Zwei Broker sind bereits "vorprogrammiert" (Adafruit IO und DIOTY). Natürlich können auch eigene Broker verwendet werden. Falls ihr gute freie Broker kennt, die wir hinzufügen sollten meldet euch einfach bei uns.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
### TTN Mapper
|
||||||
|
Bisher war es möglich einen "kleinen" TTN Mapper zu bauen, der die Daten als Cayenne Payload versendet hat. Es gibt nun einen Block der es direkt ermöglicht einen vollständigen TTN Mapper zu Programmieren, der die Daten auch auf [TTNMapper](https://ttnmapper.org/) veröffentlichen kann.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Fronted
|
||||||
|
|
||||||
|
In der Oberfläche gibt es einige Neuigkeiten. Ziel ist es Blockly für die senseBox zu einer vollständigen Lern- und Programmierumgebung weiterzuentwickeln.
|
||||||
|
|
||||||
|
Die Codeanzeige ist standardmäßig ausgeblendet kann aber einfach durch eine Klick auf das `</>` Icon hinzugefügt werden.
|
||||||
|
|
||||||
|
### Login mit openSenseMap/senseBox Account
|
||||||
|
|
||||||
|
Im Menü unter Login könnt ihr euch mit eurem openSenseMap Account anmelden. Sobald ihr angemeldet seid habt ihr die Möglichkeit Projekte online zu speichern.
|
||||||
|
Sobald der Login mit dem openSenseMap Account erfolgreich war lassen sich die bereits registrierten senseBox unter Account einsehen.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
Im Block zum senden an die openSenseMap müssen dann auch keine IDs mehr ausgewählt werden sondern die registrierten senseBox können einfach aus dem Dropdown Menü ausgewählt werden.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Speichern von Projekten
|
||||||
|
|
||||||
|
Nach dem Login über den openSenseMap Account lassen sich Projekte online speichern und wieder abrufen
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
### Tutorials
|
||||||
|
|
||||||
|
Es gibt jetzt Tutorials! Eine reihe von verschiedenen Tutorials zeigt dir die ersten Schritte in der Programmierung mit Blockly. (Inhalte werden noch ausgebaut)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Gallery
|
||||||
|
|
||||||
|
In der Gallery finden sich Beispiele mit verschiedenen Programmen. Die Beispiele können direkt in Blockly geöffnet werden, um Änderungen vorzunehmen oder das Programm direkt auf deine senseBox zu übertragen.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
### Teilen von Programmen
|
||||||
|
|
||||||
|
Über den Share Button kann ein Link zum Teilen der aktuellen Blöcke erstellt werden. Wann immer du dein Projekt mit anderen Teilen willst musst du nicht mehr eine XML Datei erstellen und verschicken sondern kannst einen Link erstellen, der direkt zu deinem Programm führt. Beachte, dass vor dem Teilen von Blöcken sämtliche sensiblen Daten, wie zum Beispiel Passwörter, Netzwerknamen, Lora oder openSenseMap Keys entfernt werden sollten. Die Links zum teilen von Programmen laufen nach 30 Tagen ab.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Fehler
|
||||||
|
|
||||||
|
Falls ihr Fehler findet legt bitte ein Issue in folgendem Repository an: https://github.com/sensebox/React-Ardublockly/issues
|
||||||
|
|
||||||
Generated
+35286
-4277
File diff suppressed because it is too large
Load Diff
+16
-8
@@ -5,34 +5,42 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@blockly/block-plus-minus": "^2.0.10",
|
"@blockly/block-plus-minus": "^2.0.10",
|
||||||
"@blockly/field-slider": "^2.1.1",
|
"@blockly/field-slider": "^2.1.1",
|
||||||
"@blockly/plugin-typed-variable-modal": "^3.1.1",
|
"@blockly/plugin-scroll-options": "^1.0.2",
|
||||||
|
"@blockly/plugin-typed-variable-modal": "^3.1.26",
|
||||||
|
"@blockly/zoom-to-fit": "^2.0.7",
|
||||||
"@fortawesome/fontawesome-svg-core": "^1.2.30",
|
"@fortawesome/fontawesome-svg-core": "^1.2.30",
|
||||||
"@fortawesome/free-solid-svg-icons": "^5.14.0",
|
"@fortawesome/free-solid-svg-icons": "^5.14.0",
|
||||||
"@fortawesome/react-fontawesome": "^0.1.11",
|
"@fortawesome/react-fontawesome": "^0.1.11",
|
||||||
"@material-ui/core": "^4.11.0",
|
"@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/jest-dom": "^4.2.4",
|
||||||
"@testing-library/react": "^9.5.0",
|
"@testing-library/react": "^9.5.0",
|
||||||
"@testing-library/user-event": "^7.2.1",
|
"@testing-library/user-event": "^7.2.1",
|
||||||
"axios": "^0.21.0",
|
"axios": "^0.21.0",
|
||||||
"blockly": "^3.20200924.0",
|
"blockly": "^6.20210701.0",
|
||||||
"file-saver": "^2.0.2",
|
"file-saver": "^2.0.2",
|
||||||
"mnemonic-id": "^3.2.7",
|
"mnemonic-id": "^3.2.7",
|
||||||
"moment": "^2.28.0",
|
"moment": "^2.28.0",
|
||||||
"prismjs": "^1.20.0",
|
"prismjs": "^1.24.0",
|
||||||
"react": "^16.13.1",
|
"react": "^17.0.2",
|
||||||
"react-cookie-consent": "^5.2.0",
|
"react-cookie-consent": "^5.2.0",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^17.0.2",
|
||||||
"react-markdown": "^5.0.2",
|
"react-markdown": "^5.0.2",
|
||||||
"react-redux": "^7.2.0",
|
"react-mde": "^11.5.0",
|
||||||
|
"react-redux": "^7.2.4",
|
||||||
"react-router-dom": "^5.2.0",
|
"react-router-dom": "^5.2.0",
|
||||||
"react-scripts": "3.4.1",
|
"react-scripts": "^4.0.3",
|
||||||
|
"reactour": "^1.18.0",
|
||||||
"redux": "^4.0.5",
|
"redux": "^4.0.5",
|
||||||
"redux-thunk": "^2.3.0",
|
"redux-thunk": "^2.3.0",
|
||||||
|
"rich-markdown-editor": "^11.17.7",
|
||||||
|
"styled-components": "^5.0.0",
|
||||||
"uuid": "^8.3.1"
|
"uuid": "^8.3.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
"dev": "set \"REACT_APP_BLOCKLY_API=http://localhost:8080\" && set \"REACT_APP_MYBADGES_API=http://localhost:3001/api/v1\"&& npm start",
|
"dev": "set \"REACT_APP_BLOCKLY_API=http://localhost:8080\" && npm start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject"
|
||||||
|
|||||||
@@ -24,6 +24,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
<!-- Matomo Image Tracker-->
|
||||||
|
<img
|
||||||
|
src="https://piwik.sensebox.kaufen/matomo.php?idsite=9&rec=1"
|
||||||
|
style="border: 0; display: none"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
<!-- End Matomo -->
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<!--
|
<!--
|
||||||
This HTML file is a template.
|
This HTML file is a template.
|
||||||
|
|||||||
+16
@@ -15,6 +15,14 @@
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.news img{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
max-height: 40vH;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.tutorial blockquote{
|
.tutorial blockquote{
|
||||||
background: #f9f9f9;
|
background: #f9f9f9;
|
||||||
border-left: 10px solid#4EAF47;
|
border-left: 10px solid#4EAF47;
|
||||||
@@ -33,3 +41,11 @@
|
|||||||
blockquote p {
|
blockquote p {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.overlay {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+114
-144
@@ -1,245 +1,211 @@
|
|||||||
import { MYBADGES_CONNECT, MYBADGES_DISCONNECT, GET_STATUS, USER_LOADED, USER_LOADING, AUTH_ERROR, LOGIN_SUCCESS, LOGIN_FAIL, LOGOUT_SUCCESS, LOGOUT_FAIL, REFRESH_TOKEN_SUCCESS } from '../actions/types';
|
import {
|
||||||
|
GET_STATUS,
|
||||||
|
USER_LOADED,
|
||||||
|
USER_LOADING,
|
||||||
|
AUTH_ERROR,
|
||||||
|
LOGIN_SUCCESS,
|
||||||
|
LOGIN_FAIL,
|
||||||
|
LOGOUT_SUCCESS,
|
||||||
|
LOGOUT_FAIL,
|
||||||
|
REFRESH_TOKEN_SUCCESS,
|
||||||
|
} from "../actions/types";
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from "axios";
|
||||||
import { returnErrors, returnSuccess } from './messageActions';
|
import { returnErrors, returnSuccess } from "./messageActions";
|
||||||
import { setLanguage } from './generalActions';
|
import { setLanguage } from "./generalActions";
|
||||||
|
|
||||||
// Check token & load user
|
// Check token & load user
|
||||||
export const loadUser = () => (dispatch) => {
|
export const loadUser = () => (dispatch) => {
|
||||||
// user loading
|
// user loading
|
||||||
dispatch({
|
dispatch({
|
||||||
type: USER_LOADING
|
type: USER_LOADING,
|
||||||
});
|
});
|
||||||
const config = {
|
const config = {
|
||||||
success: res => {
|
success: (res) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: GET_STATUS,
|
type: GET_STATUS,
|
||||||
payload: res.data.user.status
|
payload: res.data.user.status,
|
||||||
});
|
});
|
||||||
dispatch(setLanguage(res.data.user.language));
|
dispatch(setLanguage(res.data.user.language));
|
||||||
dispatch({
|
dispatch({
|
||||||
type: USER_LOADED,
|
type: USER_LOADED,
|
||||||
payload: res.data.user
|
payload: res.data.user,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: err => {
|
error: (err) => {
|
||||||
if(err.response){
|
if (err.response) {
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status));
|
dispatch(returnErrors(err.response.data.message, err.response.status));
|
||||||
}
|
}
|
||||||
var status = [];
|
var status = [];
|
||||||
if (window.localStorage.getItem('status')) {
|
if (window.localStorage.getItem("status")) {
|
||||||
status = JSON.parse(window.localStorage.getItem('status'));
|
status = JSON.parse(window.localStorage.getItem("status"));
|
||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: GET_STATUS,
|
type: GET_STATUS,
|
||||||
payload: status
|
payload: status,
|
||||||
});
|
});
|
||||||
dispatch({
|
dispatch({
|
||||||
type: AUTH_ERROR
|
type: AUTH_ERROR,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
axios.get(`${process.env.REACT_APP_BLOCKLY_API}/user`, config, dispatch(authInterceptor()))
|
axios
|
||||||
.then(res => {
|
.get(
|
||||||
|
`${process.env.REACT_APP_BLOCKLY_API}/user`,
|
||||||
|
config,
|
||||||
|
dispatch(authInterceptor())
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
res.config.success(res);
|
res.config.success(res);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
err.config.error(err);
|
err.config.error(err);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var logoutTimerId;
|
var logoutTimerId;
|
||||||
const timeToLogout = 14.9*60*1000; // nearly 15 minutes corresponding to the API
|
const timeToLogout = 14.9 * 60 * 1000; // nearly 15 minutes corresponding to the API
|
||||||
|
|
||||||
// Login user
|
// Login user
|
||||||
export const login = ({ email, password }) => (dispatch) => {
|
export const login =
|
||||||
|
({ email, password }) =>
|
||||||
|
(dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: USER_LOADING
|
type: USER_LOADING,
|
||||||
});
|
});
|
||||||
// Headers
|
// Headers
|
||||||
const config = {
|
const config = {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
"Content-Type": "application/json",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
// Request Body
|
// Request Body
|
||||||
const body = JSON.stringify({ email, password });
|
const body = JSON.stringify({ email, password });
|
||||||
axios.post(`${process.env.REACT_APP_BLOCKLY_API}/user`, body, config)
|
axios
|
||||||
.then(res => {
|
.post(`${process.env.REACT_APP_BLOCKLY_API}/user`, body, config)
|
||||||
|
.then((res) => {
|
||||||
// Logout automatically if refreshToken "expired"
|
// Logout automatically if refreshToken "expired"
|
||||||
const logoutTimer = () => setTimeout(
|
const logoutTimer = () =>
|
||||||
() => dispatch(logout()),
|
setTimeout(() => dispatch(logout()), timeToLogout);
|
||||||
timeToLogout
|
|
||||||
);
|
|
||||||
logoutTimerId = logoutTimer();
|
logoutTimerId = logoutTimer();
|
||||||
dispatch(setLanguage(res.data.user.language));
|
dispatch(setLanguage(res.data.user.language));
|
||||||
dispatch({
|
dispatch({
|
||||||
type: LOGIN_SUCCESS,
|
type: LOGIN_SUCCESS,
|
||||||
payload: res.data
|
payload: res.data,
|
||||||
});
|
});
|
||||||
dispatch({
|
dispatch({
|
||||||
type: GET_STATUS,
|
type: GET_STATUS,
|
||||||
payload: res.data.user.status
|
payload: res.data.user.status,
|
||||||
});
|
});
|
||||||
dispatch(returnSuccess(res.data.message, res.status, 'LOGIN_SUCCESS'));
|
dispatch(returnSuccess(res.data.message, res.status, "LOGIN_SUCCESS"));
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status, 'LOGIN_FAIL'));
|
dispatch(
|
||||||
|
returnErrors(
|
||||||
|
err.response.data.message,
|
||||||
|
err.response.status,
|
||||||
|
"LOGIN_FAIL"
|
||||||
|
)
|
||||||
|
);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: LOGIN_FAIL
|
type: LOGIN_FAIL,
|
||||||
});
|
});
|
||||||
var status = [];
|
var status = [];
|
||||||
if (window.localStorage.getItem('status')) {
|
if (window.localStorage.getItem("status")) {
|
||||||
status = JSON.parse(window.localStorage.getItem('status'));
|
status = JSON.parse(window.localStorage.getItem("status"));
|
||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: GET_STATUS,
|
type: GET_STATUS,
|
||||||
payload: status
|
payload: status,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Connect to MyBadges-Account
|
|
||||||
export const connectMyBadges = ({ username, password }) => (dispatch, getState) => {
|
|
||||||
const config = {
|
|
||||||
success: res => {
|
|
||||||
var user = getState().auth.user;
|
|
||||||
user.badge = res.data.account;
|
|
||||||
user.badges = res.data.badges;
|
|
||||||
dispatch({
|
|
||||||
type: MYBADGES_CONNECT,
|
|
||||||
payload: user
|
|
||||||
});
|
|
||||||
dispatch(returnSuccess(res.data.message, res.status, 'MYBADGES_CONNECT_SUCCESS'));
|
|
||||||
},
|
|
||||||
error: err => {
|
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status, 'MYBADGES_CONNECT_FAIL'));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
// Request Body
|
|
||||||
const body = JSON.stringify({ username, password });
|
|
||||||
axios.post(`${process.env.REACT_APP_BLOCKLY_API}/user/badge`, body, config)
|
|
||||||
.then(res => {
|
|
||||||
res.config.success(res);
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
if(err.response && err.response.status !== 401){
|
|
||||||
err.config.error(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Disconnect MyBadges-Account
|
|
||||||
export const disconnectMyBadges = () => (dispatch, getState) => {
|
|
||||||
const config = {
|
|
||||||
success: res => {
|
|
||||||
var user = getState().auth.user;
|
|
||||||
user.badge = null;
|
|
||||||
user.badges = null;
|
|
||||||
dispatch({
|
|
||||||
type: MYBADGES_DISCONNECT,
|
|
||||||
payload: user
|
|
||||||
});
|
|
||||||
dispatch(returnSuccess(res.data.message, res.status, 'MYBADGES_DISCONNECT_SUCCESS'));
|
|
||||||
},
|
|
||||||
error: err => {
|
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status, 'MYBADGES_DISCONNECT_FAIL'));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
axios.put(`${process.env.REACT_APP_BLOCKLY_API}/user/badge`, {}, config)
|
|
||||||
.then(res => {
|
|
||||||
res.config.success(res);
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
if(err.response && err.response.status !== 401){
|
|
||||||
err.config.error(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Logout User
|
// Logout User
|
||||||
export const logout = () => (dispatch) => {
|
export const logout = () => (dispatch) => {
|
||||||
const config = {
|
const config = {
|
||||||
success: res => {
|
success: (res) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: LOGOUT_SUCCESS
|
type: LOGOUT_SUCCESS,
|
||||||
});
|
});
|
||||||
var status = [];
|
var status = [];
|
||||||
if (window.localStorage.getItem('status')) {
|
if (window.localStorage.getItem("status")) {
|
||||||
status = JSON.parse(window.localStorage.getItem('status'));
|
status = JSON.parse(window.localStorage.getItem("status"));
|
||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: GET_STATUS,
|
type: GET_STATUS,
|
||||||
payload: status
|
payload: status,
|
||||||
});
|
});
|
||||||
var locale = 'en_US';
|
var locale = "en_US";
|
||||||
if (window.localStorage.getItem('locale')) {
|
if (window.localStorage.getItem("locale")) {
|
||||||
locale = window.localStorage.getItem('locale');
|
locale = window.localStorage.getItem("locale");
|
||||||
}
|
} else if (navigator.language === "de-DE") {
|
||||||
else if (navigator.language === 'de-DE'){
|
locale = "de_DE";
|
||||||
locale = 'de_DE';
|
|
||||||
}
|
}
|
||||||
dispatch(setLanguage(locale));
|
dispatch(setLanguage(locale));
|
||||||
dispatch(returnSuccess(res.data.message, res.status, 'LOGOUT_SUCCESS'));
|
dispatch(returnSuccess(res.data.message, res.status, "LOGOUT_SUCCESS"));
|
||||||
clearTimeout(logoutTimerId);
|
clearTimeout(logoutTimerId);
|
||||||
},
|
},
|
||||||
error: err => {
|
error: (err) => {
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status, 'LOGOUT_FAIL'));
|
dispatch(
|
||||||
|
returnErrors(
|
||||||
|
err.response.data.message,
|
||||||
|
err.response.status,
|
||||||
|
"LOGOUT_FAIL"
|
||||||
|
)
|
||||||
|
);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: LOGOUT_FAIL
|
type: LOGOUT_FAIL,
|
||||||
});
|
});
|
||||||
var status = [];
|
var status = [];
|
||||||
if (window.localStorage.getItem('status')) {
|
if (window.localStorage.getItem("status")) {
|
||||||
status = JSON.parse(window.localStorage.getItem('status'));
|
status = JSON.parse(window.localStorage.getItem("status"));
|
||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: GET_STATUS,
|
type: GET_STATUS,
|
||||||
payload: status
|
payload: status,
|
||||||
});
|
});
|
||||||
clearTimeout(logoutTimerId);
|
clearTimeout(logoutTimerId);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
axios.post('https://api.opensensemap.org/users/sign-out', {}, config)
|
axios
|
||||||
.then(res => {
|
.post("https://api.opensensemap.org/users/sign-out", {}, config)
|
||||||
|
.then((res) => {
|
||||||
res.config.success(res);
|
res.config.success(res);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
if(err.response && err.response.status !== 401){
|
if (err.response && err.response.status !== 401) {
|
||||||
err.config.error(err);
|
err.config.error(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const authInterceptor = () => (dispatch, getState) => {
|
export const authInterceptor = () => (dispatch, getState) => {
|
||||||
// Add a request interceptor
|
// Add a request interceptor
|
||||||
axios.interceptors.request.use(
|
axios.interceptors.request.use(
|
||||||
config => {
|
(config) => {
|
||||||
config.headers['Content-Type'] = 'application/json';
|
config.headers["Content-Type"] = "application/json";
|
||||||
const token = getState().auth.token;
|
const token = getState().auth.token;
|
||||||
if (token) {
|
if (token) {
|
||||||
config.headers['Authorization'] = `Bearer ${token}`;
|
config.headers["Authorization"] = `Bearer ${token}`;
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
error => {
|
(error) => {
|
||||||
Promise.reject(error);
|
Promise.reject(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add a response interceptor
|
// Add a response interceptor
|
||||||
axios.interceptors.response.use(
|
axios.interceptors.response.use(
|
||||||
response => {
|
(response) => {
|
||||||
// request was successfull
|
// request was successfull
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
error => {
|
(error) => {
|
||||||
const originalRequest = error.config;
|
const originalRequest = error.config;
|
||||||
const refreshToken = getState().auth.refreshToken;
|
const refreshToken = getState().auth.refreshToken;
|
||||||
if(refreshToken){
|
if (refreshToken) {
|
||||||
// try to refresh the token failed
|
// try to refresh the token failed
|
||||||
if (error.response.status === 401 && originalRequest._retry) {
|
if (error.response.status === 401 && originalRequest._retry) {
|
||||||
// router.push('/login');
|
// router.push('/login');
|
||||||
@@ -250,38 +216,42 @@ export const authInterceptor = () => (dispatch, getState) => {
|
|||||||
originalRequest._retry = true;
|
originalRequest._retry = true;
|
||||||
const refreshToken = getState().auth.refreshToken;
|
const refreshToken = getState().auth.refreshToken;
|
||||||
// request to refresh the token, in request-body is the refreshToken
|
// request to refresh the token, in request-body is the refreshToken
|
||||||
axios.post('https://api.opensensemap.org/users/refresh-auth', {"token": refreshToken})
|
axios
|
||||||
.then(res => {
|
.post("https://api.opensensemap.org/users/refresh-auth", {
|
||||||
|
token: refreshToken,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
clearTimeout(logoutTimerId);
|
clearTimeout(logoutTimerId);
|
||||||
const logoutTimer = () => setTimeout(
|
const logoutTimer = () =>
|
||||||
() => dispatch(logout()),
|
setTimeout(() => dispatch(logout()), timeToLogout);
|
||||||
timeToLogout
|
|
||||||
);
|
|
||||||
logoutTimerId = logoutTimer();
|
logoutTimerId = logoutTimer();
|
||||||
dispatch({
|
dispatch({
|
||||||
type: REFRESH_TOKEN_SUCCESS,
|
type: REFRESH_TOKEN_SUCCESS,
|
||||||
payload: res.data
|
payload: res.data,
|
||||||
});
|
});
|
||||||
axios.defaults.headers.common['Authorization'] = 'Bearer ' + getState().auth.token;
|
axios.defaults.headers.common["Authorization"] =
|
||||||
|
"Bearer " + getState().auth.token;
|
||||||
// request was successfull, new request with the old parameters and the refreshed token
|
// request was successfull, new request with the old parameters and the refreshed token
|
||||||
return axios(originalRequest)
|
return axios(originalRequest)
|
||||||
.then(res => {
|
.then((res) => {
|
||||||
originalRequest.success(res);
|
originalRequest.success(res);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
originalRequest.error(err);
|
originalRequest.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
// request failed, token could not be refreshed
|
// request failed, token could not be refreshed
|
||||||
if(err.response){
|
if (err.response) {
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status));
|
dispatch(
|
||||||
|
returnErrors(err.response.data.message, err.response.status)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: AUTH_ERROR
|
type: AUTH_ERROR,
|
||||||
});
|
});
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ export const getProject = (type, id) => (dispatch) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: err => {
|
error: err => {
|
||||||
if(err.response){
|
if (err.response) {
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_PROJECT_FAIL'));
|
dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_PROJECT_FAIL'));
|
||||||
}
|
}
|
||||||
dispatch({type: PROJECT_PROGRESS});
|
dispatch({ type: PROJECT_PROGRESS });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
axios.get(`${process.env.REACT_APP_BLOCKLY_API}/${type}/${id}`, config)
|
axios.get(`${process.env.REACT_APP_BLOCKLY_API}/${type}/${id}`, config)
|
||||||
@@ -58,7 +58,7 @@ export const getProject = (type, id) => (dispatch) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getProjects = (type) => (dispatch) => {
|
export const getProjects = (type) => (dispatch) => {
|
||||||
dispatch({type: PROJECT_PROGRESS});
|
dispatch({ type: PROJECT_PROGRESS });
|
||||||
const config = {
|
const config = {
|
||||||
success: res => {
|
success: res => {
|
||||||
var data = type === 'project' ? 'projects' : 'galleries';
|
var data = type === 'project' ? 'projects' : 'galleries';
|
||||||
@@ -71,10 +71,10 @@ export const getProjects = (type) => (dispatch) => {
|
|||||||
dispatch(returnSuccess(res.data.message, res.status));
|
dispatch(returnSuccess(res.data.message, res.status));
|
||||||
},
|
},
|
||||||
error: err => {
|
error: err => {
|
||||||
if(err.response){
|
if (err.response) {
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_PROJECTS_FAIL'));
|
dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_PROJECTS_FAIL'));
|
||||||
}
|
}
|
||||||
dispatch({type: PROJECT_PROGRESS});
|
dispatch({ type: PROJECT_PROGRESS });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
axios.get(`${process.env.REACT_APP_BLOCKLY_API}/${type}`, config)
|
axios.get(`${process.env.REACT_APP_BLOCKLY_API}/${type}`, config)
|
||||||
@@ -113,8 +113,8 @@ export const updateProject = (type, id) => (dispatch, getState) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: err => {
|
error: err => {
|
||||||
if(err.response){
|
if (err.response) {
|
||||||
if(type === 'project'){
|
if (type === 'project') {
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status, 'PROJECT_UPDATE_FAIL'));
|
dispatch(returnErrors(err.response.data.message, err.response.status, 'PROJECT_UPDATE_FAIL'));
|
||||||
} else {
|
} else {
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status, 'GALLERY_UPDATE_FAIL'));
|
dispatch(returnErrors(err.response.data.message, err.response.status, 'GALLERY_UPDATE_FAIL'));
|
||||||
@@ -132,7 +132,6 @@ export const updateProject = (type, id) => (dispatch, getState) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const deleteProject = (type, id) => (dispatch, getState) => {
|
export const deleteProject = (type, id) => (dispatch, getState) => {
|
||||||
var project = getState().project;
|
|
||||||
const config = {
|
const config = {
|
||||||
success: res => {
|
success: res => {
|
||||||
var projects = getState().project.projects;
|
var projects = getState().project.projects;
|
||||||
@@ -157,7 +156,7 @@ export const deleteProject = (type, id) => (dispatch, getState) => {
|
|||||||
res.config.success(res);
|
res.config.success(res);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if(err.response && err.response.status !== 401){
|
if (err.response && err.response.status !== 401) {
|
||||||
err.config.error(err);
|
err.config.error(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+128
-102
@@ -1,109 +1,105 @@
|
|||||||
import { MYBADGES_DISCONNECT, TUTORIAL_PROGRESS, GET_TUTORIAL, GET_TUTORIALS, TUTORIAL_SUCCESS, TUTORIAL_ERROR, TUTORIAL_CHANGE, TUTORIAL_XML, TUTORIAL_STEP } from './types';
|
import {
|
||||||
|
TUTORIAL_PROGRESS,
|
||||||
|
GET_TUTORIAL,
|
||||||
|
GET_TUTORIALS,
|
||||||
|
TUTORIAL_SUCCESS,
|
||||||
|
TUTORIAL_ERROR,
|
||||||
|
TUTORIAL_CHANGE,
|
||||||
|
TUTORIAL_XML,
|
||||||
|
TUTORIAL_STEP,
|
||||||
|
} from "./types";
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from "axios";
|
||||||
import { returnErrors, returnSuccess } from './messageActions';
|
import { returnErrors, returnSuccess } from "./messageActions";
|
||||||
|
|
||||||
export const tutorialProgress = () => (dispatch) => {
|
export const tutorialProgress = () => (dispatch) => {
|
||||||
dispatch({type: TUTORIAL_PROGRESS});
|
dispatch({ type: TUTORIAL_PROGRESS });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const getTutorial = (id) => (dispatch, getState) => {
|
export const getTutorial = (id) => (dispatch, getState) => {
|
||||||
axios.get(`${process.env.REACT_APP_BLOCKLY_API}/tutorial/${id}`)
|
axios
|
||||||
.then(res => {
|
.get(`${process.env.REACT_APP_BLOCKLY_API}/tutorial/${id}`)
|
||||||
|
.then((res) => {
|
||||||
var tutorial = res.data.tutorial;
|
var tutorial = res.data.tutorial;
|
||||||
existingTutorial(tutorial, getState().tutorial.status).then(status => {
|
existingTutorial(tutorial, getState().tutorial.status).then((status) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: TUTORIAL_SUCCESS,
|
type: TUTORIAL_SUCCESS,
|
||||||
payload: status
|
payload: status,
|
||||||
});
|
});
|
||||||
dispatch(updateStatus(status));
|
dispatch(updateStatus(status));
|
||||||
dispatch({
|
dispatch({
|
||||||
type: GET_TUTORIAL,
|
type: GET_TUTORIAL,
|
||||||
payload: tutorial
|
payload: tutorial,
|
||||||
});
|
});
|
||||||
dispatch({type: TUTORIAL_PROGRESS});
|
dispatch({ type: TUTORIAL_PROGRESS });
|
||||||
dispatch(returnSuccess(res.data.message, res.status));
|
dispatch(returnSuccess(res.data.message, res.status));
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
if (err.response) {
|
if (err.response) {
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_TUTORIAL_FAIL'));
|
dispatch(
|
||||||
|
returnErrors(
|
||||||
|
err.response.data.message,
|
||||||
|
err.response.status,
|
||||||
|
"GET_TUTORIAL_FAIL"
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
dispatch({ type: TUTORIAL_PROGRESS });
|
dispatch({ type: TUTORIAL_PROGRESS });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getTutorials = () => (dispatch, getState) => {
|
export const getTutorials = () => (dispatch, getState) => {
|
||||||
axios.get(`${process.env.REACT_APP_BLOCKLY_API}/tutorial`)
|
axios
|
||||||
.then(res => {
|
.get(`${process.env.REACT_APP_BLOCKLY_API}/tutorial`)
|
||||||
|
.then((res) => {
|
||||||
var tutorials = res.data.tutorials;
|
var tutorials = res.data.tutorials;
|
||||||
console.log(tutorials);
|
existingTutorials(tutorials, getState().tutorial.status).then(
|
||||||
existingTutorials(tutorials, getState().tutorial.status).then(status => {
|
(status) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: TUTORIAL_SUCCESS,
|
type: TUTORIAL_SUCCESS,
|
||||||
payload: status
|
payload: status,
|
||||||
});
|
});
|
||||||
console.log('zwei');
|
|
||||||
dispatch(updateStatus(status));
|
dispatch(updateStatus(status));
|
||||||
dispatch({
|
dispatch({
|
||||||
type: GET_TUTORIALS,
|
type: GET_TUTORIALS,
|
||||||
payload: tutorials
|
payload: tutorials,
|
||||||
});
|
});
|
||||||
dispatch({ type: TUTORIAL_PROGRESS });
|
dispatch({ type: TUTORIAL_PROGRESS });
|
||||||
dispatch(returnSuccess(res.data.message, res.status));
|
dispatch(returnSuccess(res.data.message, res.status));
|
||||||
});
|
}
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
if (err.response) {
|
if (err.response) {
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_TUTORIALS_FAIL'));
|
dispatch(
|
||||||
|
returnErrors(
|
||||||
|
err.response.data.message,
|
||||||
|
err.response.status,
|
||||||
|
"GET_TUTORIALS_FAIL"
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
dispatch({ type: TUTORIAL_PROGRESS });
|
dispatch({ type: TUTORIAL_PROGRESS });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const assigneBadge = (id) => (dispatch, getState) => {
|
|
||||||
const config = {
|
|
||||||
success: res => {
|
|
||||||
var badge = res.data.badge;
|
|
||||||
var user = getState().auth.user;
|
|
||||||
user.badges.push(badge._id);
|
|
||||||
dispatch({
|
|
||||||
type: MYBADGES_DISCONNECT,
|
|
||||||
payload: user
|
|
||||||
});
|
|
||||||
dispatch(returnSuccess(badge, res.status, 'ASSIGNE_BADGE_SUCCESS'));
|
|
||||||
},
|
|
||||||
error: err => {
|
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status, 'ASSIGNE_BADGE_FAIL'));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
axios.put(`${process.env.REACT_APP_BLOCKLY_API}/user/badge/${id}`, {}, config)
|
|
||||||
.then(res => {
|
|
||||||
res.config.success(res);
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
if(err.response && err.response.status !== 401){
|
|
||||||
err.config.error(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const updateStatus = (status) => (dispatch, getState) => {
|
export const updateStatus = (status) => (dispatch, getState) => {
|
||||||
if(getState().auth.isAuthenticated){
|
if (getState().auth.isAuthenticated) {
|
||||||
// update user account in database - sync with redux store
|
// update user account in database - sync with redux store
|
||||||
axios.put(`${process.env.REACT_APP_BLOCKLY_API}/user/status`, {status: status})
|
axios
|
||||||
.then(res => {
|
.put(`${process.env.REACT_APP_BLOCKLY_API}/user/status`, {
|
||||||
// dispatch(returnSuccess(badge, res.status, 'UPDATE_STATUS_SUCCESS'));
|
status: status,
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.then((res) => {})
|
||||||
if(err.response){
|
.catch((err) => {
|
||||||
|
if (err.response) {
|
||||||
// dispatch(returnErrors(err.response.data.message, err.response.status, 'UPDATE_STATUS_FAIL'));
|
// dispatch(returnErrors(err.response.data.message, err.response.status, 'UPDATE_STATUS_FAIL'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// update locale storage - sync with redux store
|
// update locale storage - sync with redux store
|
||||||
window.localStorage.setItem('status', JSON.stringify(status));
|
window.localStorage.setItem("status", JSON.stringify(status));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -111,66 +107,77 @@ export const deleteTutorial = (id) => (dispatch, getState) => {
|
|||||||
var tutorial = getState().tutorial;
|
var tutorial = getState().tutorial;
|
||||||
var id = getState().builder.id;
|
var id = getState().builder.id;
|
||||||
const config = {
|
const config = {
|
||||||
success: res => {
|
success: (res) => {
|
||||||
var tutorials = tutorial.tutorials;
|
var tutorials = tutorial.tutorials;
|
||||||
var index = tutorials.findIndex(res => res._id === id);
|
var index = tutorials.findIndex((res) => res._id === id);
|
||||||
tutorials.splice(index, 1)
|
tutorials.splice(index, 1);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: GET_TUTORIALS,
|
type: GET_TUTORIALS,
|
||||||
payload: tutorials
|
payload: tutorials,
|
||||||
});
|
});
|
||||||
dispatch(returnSuccess(res.data.message, res.status, 'TUTORIAL_DELETE_SUCCESS'));
|
dispatch(
|
||||||
|
returnSuccess(res.data.message, res.status, "TUTORIAL_DELETE_SUCCESS")
|
||||||
|
);
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
dispatch(
|
||||||
|
returnErrors(
|
||||||
|
err.response.data.message,
|
||||||
|
err.response.status,
|
||||||
|
"TUTORIAL_DELETE_FAIL"
|
||||||
|
)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
error: err => {
|
|
||||||
dispatch(returnErrors(err.response.data.message, err.response.status, 'TUTORIAL_DELETE_FAIL'));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
axios.delete(`${process.env.REACT_APP_BLOCKLY_API}/tutorial/${id}`, config)
|
axios
|
||||||
.then(res => {
|
.delete(`${process.env.REACT_APP_BLOCKLY_API}/tutorial/${id}`, config)
|
||||||
|
.then((res) => {
|
||||||
res.config.success(res);
|
res.config.success(res);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
if(err.response && err.response.status !== 401){
|
if (err.response && err.response.status !== 401) {
|
||||||
err.config.error(err);
|
err.config.error(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const resetTutorial = () => (dispatch) => {
|
export const resetTutorial = () => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: GET_TUTORIALS,
|
type: GET_TUTORIALS,
|
||||||
payload: []
|
payload: [],
|
||||||
});
|
});
|
||||||
dispatch({
|
dispatch({
|
||||||
type: TUTORIAL_STEP,
|
type: TUTORIAL_STEP,
|
||||||
payload: 0
|
payload: 0,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const tutorialChange = () => (dispatch) => {
|
export const tutorialChange = () => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: TUTORIAL_CHANGE
|
type: TUTORIAL_CHANGE,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const tutorialCheck = (status, step) => (dispatch, getState) => {
|
export const tutorialCheck = (status, step) => (dispatch, getState) => {
|
||||||
var tutorialsStatus = getState().tutorial.status;
|
var tutorialsStatus = getState().tutorial.status;
|
||||||
var id = getState().tutorial.tutorials[0]._id;
|
var id = getState().tutorial.tutorials[0]._id;
|
||||||
var tutorialsStatusIndex = tutorialsStatus.findIndex(tutorialStatus => tutorialStatus._id === id);
|
var tutorialsStatusIndex = tutorialsStatus.findIndex(
|
||||||
var tasksIndex = tutorialsStatus[tutorialsStatusIndex].tasks.findIndex(task => task._id === step._id);
|
(tutorialStatus) => tutorialStatus._id === id
|
||||||
|
);
|
||||||
|
var tasksIndex = tutorialsStatus[tutorialsStatusIndex].tasks.findIndex(
|
||||||
|
(task) => task._id === step._id
|
||||||
|
);
|
||||||
tutorialsStatus[tutorialsStatusIndex].tasks[tasksIndex] = {
|
tutorialsStatus[tutorialsStatusIndex].tasks[tasksIndex] = {
|
||||||
...tutorialsStatus[tutorialsStatusIndex].tasks[tasksIndex],
|
...tutorialsStatus[tutorialsStatusIndex].tasks[tasksIndex],
|
||||||
type: status
|
type: status,
|
||||||
};
|
};
|
||||||
dispatch({
|
dispatch({
|
||||||
type: status === 'success' ? TUTORIAL_SUCCESS : TUTORIAL_ERROR,
|
type: status === "success" ? TUTORIAL_SUCCESS : TUTORIAL_ERROR,
|
||||||
payload: tutorialsStatus
|
payload: tutorialsStatus,
|
||||||
});
|
});
|
||||||
console.log('drei');
|
|
||||||
dispatch(updateStatus(tutorialsStatus));
|
dispatch(updateStatus(tutorialsStatus));
|
||||||
dispatch(tutorialChange());
|
dispatch(tutorialChange());
|
||||||
dispatch(returnSuccess('', '', 'TUTORIAL_CHECK_SUCCESS'));
|
dispatch(returnSuccess("", "", "TUTORIAL_CHECK_SUCCESS"));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const storeTutorialXml = (code) => (dispatch, getState) => {
|
export const storeTutorialXml = (code) => (dispatch, getState) => {
|
||||||
@@ -179,17 +186,21 @@ export const storeTutorialXml = (code) => (dispatch, getState) => {
|
|||||||
var id = tutorial._id;
|
var id = tutorial._id;
|
||||||
var activeStep = getState().tutorial.activeStep;
|
var activeStep = getState().tutorial.activeStep;
|
||||||
var steps = tutorial.steps;
|
var steps = tutorial.steps;
|
||||||
if (steps && steps[activeStep].type === 'task') {
|
if (steps && steps[activeStep].type === "task") {
|
||||||
var tutorialsStatus = getState().tutorial.status;
|
var tutorialsStatus = getState().tutorial.status;
|
||||||
var tutorialsStatusIndex = tutorialsStatus.findIndex(tutorialStatus => tutorialStatus._id === id);
|
var tutorialsStatusIndex = tutorialsStatus.findIndex(
|
||||||
var tasksIndex = tutorialsStatus[tutorialsStatusIndex].tasks.findIndex(task => task._id === steps[activeStep]._id);
|
(tutorialStatus) => tutorialStatus._id === id
|
||||||
|
);
|
||||||
|
var tasksIndex = tutorialsStatus[tutorialsStatusIndex].tasks.findIndex(
|
||||||
|
(task) => task._id === steps[activeStep]._id
|
||||||
|
);
|
||||||
tutorialsStatus[tutorialsStatusIndex].tasks[tasksIndex] = {
|
tutorialsStatus[tutorialsStatusIndex].tasks[tasksIndex] = {
|
||||||
...tutorialsStatus[tutorialsStatusIndex].tasks[tasksIndex],
|
...tutorialsStatus[tutorialsStatusIndex].tasks[tasksIndex],
|
||||||
xml: code
|
xml: code,
|
||||||
};
|
};
|
||||||
dispatch({
|
dispatch({
|
||||||
type: TUTORIAL_XML,
|
type: TUTORIAL_XML,
|
||||||
payload: tutorialsStatus
|
payload: tutorialsStatus,
|
||||||
});
|
});
|
||||||
dispatch(updateStatus(tutorialsStatus));
|
dispatch(updateStatus(tutorialsStatus));
|
||||||
}
|
}
|
||||||
@@ -199,38 +210,45 @@ export const storeTutorialXml = (code) => (dispatch, getState) => {
|
|||||||
export const tutorialStep = (step) => (dispatch) => {
|
export const tutorialStep = (step) => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: TUTORIAL_STEP,
|
type: TUTORIAL_STEP,
|
||||||
payload: step
|
payload: step,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const existingTutorials = (tutorials, status) =>
|
||||||
const existingTutorials = (tutorials, status) => new Promise(function (resolve, reject) {
|
new Promise(function (resolve, reject) {
|
||||||
var newstatus;
|
var newstatus;
|
||||||
new Promise(function (resolve, reject) {
|
new Promise(function (resolve, reject) {
|
||||||
var existingTutorialIds = tutorials.map((tutorial, i) => {
|
var existingTutorialIds = tutorials.map((tutorial, i) => {
|
||||||
existingTutorial(tutorial, status).then(status => {
|
existingTutorial(tutorial, status).then((status) => {
|
||||||
newstatus = status;
|
newstatus = status;
|
||||||
});
|
});
|
||||||
return tutorial._id;
|
return tutorial._id;
|
||||||
});
|
});
|
||||||
resolve(existingTutorialIds)
|
resolve(existingTutorialIds);
|
||||||
}).then(existingTutorialIds => {
|
}).then((existingTutorialIds) => {
|
||||||
// deleting old tutorials which do not longer exist
|
// deleting old tutorials which do not longer exist
|
||||||
if (existingTutorialIds.length > 0) {
|
if (existingTutorialIds.length > 0) {
|
||||||
status = newstatus.filter(status => existingTutorialIds.indexOf(status._id) > -1);
|
status = newstatus.filter(
|
||||||
|
(status) => existingTutorialIds.indexOf(status._id) > -1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
resolve(status);
|
resolve(status);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const existingTutorial = (tutorial, status) => new Promise(function(resolve, reject){
|
const existingTutorial = (tutorial, status) =>
|
||||||
|
new Promise(function (resolve, reject) {
|
||||||
var tutorialsId = tutorial._id;
|
var tutorialsId = tutorial._id;
|
||||||
var statusIndex = status.findIndex(status => status._id === tutorialsId);
|
var statusIndex = status.findIndex((status) => status._id === tutorialsId);
|
||||||
if (statusIndex > -1) {
|
if (statusIndex > -1) {
|
||||||
var tasks = tutorial.steps.filter(step => step.type === 'task');
|
var tasks = tutorial.steps.filter((step) => step.type === "task");
|
||||||
var existingTaskIds = tasks.map((task, j) => {
|
var existingTaskIds = tasks.map((task, j) => {
|
||||||
var tasksId = task._id;
|
var tasksId = task._id;
|
||||||
if (status[statusIndex].tasks.findIndex(task => task._id === tasksId) === -1) {
|
if (
|
||||||
|
status[statusIndex].tasks.findIndex(
|
||||||
|
(task) => task._id === tasksId
|
||||||
|
) === -1
|
||||||
|
) {
|
||||||
// task does not exist
|
// task does not exist
|
||||||
status[statusIndex].tasks.push({ _id: tasksId });
|
status[statusIndex].tasks.push({ _id: tasksId });
|
||||||
}
|
}
|
||||||
@@ -238,11 +256,19 @@ const existingTutorial = (tutorial, status) => new Promise(function(resolve, rej
|
|||||||
});
|
});
|
||||||
// deleting old tasks which do not longer exist
|
// deleting old tasks which do not longer exist
|
||||||
if (existingTaskIds.length > 0) {
|
if (existingTaskIds.length > 0) {
|
||||||
status[statusIndex].tasks = status[statusIndex].tasks.filter(task => existingTaskIds.indexOf(task._id) > -1);
|
status[statusIndex].tasks = status[statusIndex].tasks.filter(
|
||||||
|
(task) => existingTaskIds.indexOf(task._id) > -1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
status.push({
|
||||||
status.push({ _id: tutorialsId, tasks: tutorial.steps.filter(step => step.type === 'task').map(task => { return { _id: task._id }; }) });
|
_id: tutorialsId,
|
||||||
|
tasks: tutorial.steps
|
||||||
|
.filter((step) => step.type === "task")
|
||||||
|
.map((task) => {
|
||||||
|
return { _id: task._id };
|
||||||
|
}),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
resolve(status);
|
resolve(status);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,24 +1,36 @@
|
|||||||
import { PROGRESS, JSON_STRING, BUILDER_CHANGE, BUILDER_ERROR, BUILDER_TITLE, BUILDER_ID, BUILDER_BADGE, BUILDER_ADD_STEP, BUILDER_DELETE_STEP, BUILDER_CHANGE_STEP, BUILDER_CHANGE_ORDER, BUILDER_DELETE_PROPERTY } from './types';
|
import {
|
||||||
|
PROGRESS,
|
||||||
|
JSON_STRING,
|
||||||
|
BUILDER_CHANGE,
|
||||||
|
BUILDER_ERROR,
|
||||||
|
BUILDER_TITLE,
|
||||||
|
BUILDER_ID,
|
||||||
|
BUILDER_ADD_STEP,
|
||||||
|
BUILDER_DELETE_STEP,
|
||||||
|
BUILDER_CHANGE_STEP,
|
||||||
|
BUILDER_CHANGE_ORDER,
|
||||||
|
BUILDER_DELETE_PROPERTY,
|
||||||
|
} from "./types";
|
||||||
|
|
||||||
import data from '../data/hardware.json';
|
import data from "../data/hardware.json";
|
||||||
|
|
||||||
export const changeTutorialBuilder = () => (dispatch) => {
|
export const changeTutorialBuilder = () => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_CHANGE
|
type: BUILDER_CHANGE,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const jsonString = (json) => (dispatch) => {
|
export const jsonString = (json) => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: JSON_STRING,
|
type: JSON_STRING,
|
||||||
payload: json
|
payload: json,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const tutorialTitle = (title) => (dispatch) => {
|
export const tutorialTitle = (title) => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_TITLE,
|
type: BUILDER_TITLE,
|
||||||
payload: title
|
payload: title,
|
||||||
});
|
});
|
||||||
dispatch(changeTutorialBuilder());
|
dispatch(changeTutorialBuilder());
|
||||||
};
|
};
|
||||||
@@ -26,7 +38,7 @@ export const tutorialTitle = (title) => (dispatch) => {
|
|||||||
export const tutorialSteps = (steps) => (dispatch) => {
|
export const tutorialSteps = (steps) => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_ADD_STEP,
|
type: BUILDER_ADD_STEP,
|
||||||
payload: steps
|
payload: steps,
|
||||||
});
|
});
|
||||||
dispatch(changeTutorialBuilder());
|
dispatch(changeTutorialBuilder());
|
||||||
};
|
};
|
||||||
@@ -34,15 +46,7 @@ export const tutorialSteps = (steps) => (dispatch) => {
|
|||||||
export const tutorialId = (id) => (dispatch) => {
|
export const tutorialId = (id) => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_ID,
|
type: BUILDER_ID,
|
||||||
payload: id
|
payload: id,
|
||||||
});
|
|
||||||
dispatch(changeTutorialBuilder());
|
|
||||||
};
|
|
||||||
|
|
||||||
export const tutorialBadge = (badge) => (dispatch) => {
|
|
||||||
dispatch({
|
|
||||||
type: BUILDER_BADGE,
|
|
||||||
payload: badge
|
|
||||||
});
|
});
|
||||||
dispatch(changeTutorialBuilder());
|
dispatch(changeTutorialBuilder());
|
||||||
};
|
};
|
||||||
@@ -51,14 +55,14 @@ export const addStep = (index) => (dispatch, getState) => {
|
|||||||
var steps = getState().builder.steps;
|
var steps = getState().builder.steps;
|
||||||
var step = {
|
var step = {
|
||||||
id: index + 1,
|
id: index + 1,
|
||||||
type: 'instruction',
|
type: "instruction",
|
||||||
headline: '',
|
headline: "",
|
||||||
text: ''
|
text: "",
|
||||||
};
|
};
|
||||||
steps.splice(index, 0, step);
|
steps.splice(index, 0, step);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_ADD_STEP,
|
type: BUILDER_ADD_STEP,
|
||||||
payload: steps
|
payload: steps,
|
||||||
});
|
});
|
||||||
dispatch(addErrorStep(index));
|
dispatch(addErrorStep(index));
|
||||||
dispatch(changeTutorialBuilder());
|
dispatch(changeTutorialBuilder());
|
||||||
@@ -69,7 +73,7 @@ export const addErrorStep = (index) => (dispatch, getState) => {
|
|||||||
error.steps.splice(index, 0, {});
|
error.steps.splice(index, 0, {});
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_ERROR,
|
type: BUILDER_ERROR,
|
||||||
payload: error
|
payload: error,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -78,7 +82,7 @@ export const removeStep = (index) => (dispatch, getState) => {
|
|||||||
steps.splice(index, 1);
|
steps.splice(index, 1);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_DELETE_STEP,
|
type: BUILDER_DELETE_STEP,
|
||||||
payload: steps
|
payload: steps,
|
||||||
});
|
});
|
||||||
dispatch(removeErrorStep(index));
|
dispatch(removeErrorStep(index));
|
||||||
dispatch(changeTutorialBuilder());
|
dispatch(changeTutorialBuilder());
|
||||||
@@ -89,11 +93,12 @@ export const removeErrorStep = (index) => (dispatch, getState) => {
|
|||||||
error.steps.splice(index, 1);
|
error.steps.splice(index, 1);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_ERROR,
|
type: BUILDER_ERROR,
|
||||||
payload: error
|
payload: error,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const changeContent = (content, index, property1, property2) => (dispatch, getState) => {
|
export const changeContent =
|
||||||
|
(content, index, property1, property2) => (dispatch, getState) => {
|
||||||
var steps = getState().builder.steps;
|
var steps = getState().builder.steps;
|
||||||
var step = steps[index];
|
var step = steps[index];
|
||||||
if (property2) {
|
if (property2) {
|
||||||
@@ -107,12 +112,13 @@ export const changeContent = (content, index, property1, property2) => (dispatch
|
|||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_CHANGE_STEP,
|
type: BUILDER_CHANGE_STEP,
|
||||||
payload: steps
|
payload: steps,
|
||||||
});
|
});
|
||||||
dispatch(changeTutorialBuilder());
|
dispatch(changeTutorialBuilder());
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteProperty = (index, property1, property2) => (dispatch, getState) => {
|
export const deleteProperty =
|
||||||
|
(index, property1, property2) => (dispatch, getState) => {
|
||||||
var steps = getState().builder.steps;
|
var steps = getState().builder.steps;
|
||||||
var step = steps[index];
|
var step = steps[index];
|
||||||
if (property2) {
|
if (property2) {
|
||||||
@@ -124,10 +130,10 @@ export const deleteProperty = (index, property1, property2) => (dispatch, getSta
|
|||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_DELETE_PROPERTY,
|
type: BUILDER_DELETE_PROPERTY,
|
||||||
payload: steps
|
payload: steps,
|
||||||
});
|
});
|
||||||
dispatch(changeTutorialBuilder());
|
dispatch(changeTutorialBuilder());
|
||||||
};
|
};
|
||||||
|
|
||||||
export const changeStepIndex = (fromIndex, toIndex) => (dispatch, getState) => {
|
export const changeStepIndex = (fromIndex, toIndex) => (dispatch, getState) => {
|
||||||
var steps = getState().builder.steps;
|
var steps = getState().builder.steps;
|
||||||
@@ -136,34 +142,34 @@ export const changeStepIndex = (fromIndex, toIndex) => (dispatch, getState) => {
|
|||||||
steps.splice(toIndex, 0, step);
|
steps.splice(toIndex, 0, step);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_CHANGE_ORDER,
|
type: BUILDER_CHANGE_ORDER,
|
||||||
payload: steps
|
payload: steps,
|
||||||
});
|
});
|
||||||
dispatch(changeErrorStepIndex(fromIndex, toIndex));
|
dispatch(changeErrorStepIndex(fromIndex, toIndex));
|
||||||
dispatch(changeTutorialBuilder());
|
dispatch(changeTutorialBuilder());
|
||||||
};
|
};
|
||||||
|
|
||||||
export const changeErrorStepIndex = (fromIndex, toIndex) => (dispatch, getState) => {
|
export const changeErrorStepIndex =
|
||||||
|
(fromIndex, toIndex) => (dispatch, getState) => {
|
||||||
var error = getState().builder.error;
|
var error = getState().builder.error;
|
||||||
var errorStep = error.steps[fromIndex];
|
var errorStep = error.steps[fromIndex];
|
||||||
error.steps.splice(fromIndex, 1);
|
error.steps.splice(fromIndex, 1);
|
||||||
error.steps.splice(toIndex, 0, errorStep);
|
error.steps.splice(toIndex, 0, errorStep);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_ERROR,
|
type: BUILDER_ERROR,
|
||||||
payload: error
|
payload: error,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setError = (index, property) => (dispatch, getState) => {
|
export const setError = (index, property) => (dispatch, getState) => {
|
||||||
var error = getState().builder.error;
|
var error = getState().builder.error;
|
||||||
if (index !== undefined) {
|
if (index !== undefined) {
|
||||||
error.steps[index][property] = true;
|
error.steps[index][property] = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
error[property] = true;
|
error[property] = true;
|
||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_ERROR,
|
type: BUILDER_ERROR,
|
||||||
payload: error
|
payload: error,
|
||||||
});
|
});
|
||||||
dispatch(changeTutorialBuilder());
|
dispatch(changeTutorialBuilder());
|
||||||
};
|
};
|
||||||
@@ -172,13 +178,12 @@ export const deleteError = (index, property) => (dispatch, getState) => {
|
|||||||
var error = getState().builder.error;
|
var error = getState().builder.error;
|
||||||
if (index !== undefined) {
|
if (index !== undefined) {
|
||||||
delete error.steps[index][property];
|
delete error.steps[index][property];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
delete error[property];
|
delete error[property];
|
||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_ERROR,
|
type: BUILDER_ERROR,
|
||||||
payload: error
|
payload: error,
|
||||||
});
|
});
|
||||||
dispatch(changeTutorialBuilder());
|
dispatch(changeTutorialBuilder());
|
||||||
};
|
};
|
||||||
@@ -188,11 +193,11 @@ export const setSubmitError = () => (dispatch, getState) => {
|
|||||||
// if(builder.id === undefined || builder.id === ''){
|
// if(builder.id === undefined || builder.id === ''){
|
||||||
// dispatch(setError(undefined, 'id'));
|
// dispatch(setError(undefined, 'id'));
|
||||||
// }
|
// }
|
||||||
if (builder.title === '') {
|
if (builder.title === "") {
|
||||||
dispatch(setError(undefined, 'title'));
|
dispatch(setError(undefined, "title"));
|
||||||
}
|
}
|
||||||
if (builder.title === null) {
|
if (builder.title === null) {
|
||||||
dispatch(setError(undefined, 'badge'));
|
dispatch(setError(undefined, "title"));
|
||||||
}
|
}
|
||||||
var type = builder.steps.map((step, i) => {
|
var type = builder.steps.map((step, i) => {
|
||||||
// media and xml are directly checked for errors in their components and
|
// media and xml are directly checked for errors in their components and
|
||||||
@@ -200,76 +205,82 @@ export const setSubmitError = () => (dispatch, getState) => {
|
|||||||
step.id = i + 1;
|
step.id = i + 1;
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
if (step.requirements && step.requirements.length > 0) {
|
if (step.requirements && step.requirements.length > 0) {
|
||||||
var requirements = step.requirements.filter(requirement => /^[0-9a-fA-F]{24}$/.test(requirement));
|
var requirements = step.requirements.filter((requirement) =>
|
||||||
|
/^[0-9a-fA-F]{24}$/.test(requirement)
|
||||||
|
);
|
||||||
if (requirements.length < step.requirements.length) {
|
if (requirements.length < step.requirements.length) {
|
||||||
dispatch(changeContent(requirements, i, 'requirements'));
|
dispatch(changeContent(requirements, i, "requirements"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (step.hardware === undefined || step.hardware.length < 1) {
|
if (step.hardware === undefined || step.hardware.length < 1) {
|
||||||
dispatch(setError(i, 'hardware'));
|
dispatch(setError(i, "hardware"));
|
||||||
}
|
} else {
|
||||||
else {
|
var hardwareIds = data.map((hardware) => hardware.id);
|
||||||
var hardwareIds = data.map(hardware => hardware.id);
|
var hardware = step.hardware.filter((hardware) =>
|
||||||
var hardware = step.hardware.filter(hardware => hardwareIds.includes(hardware));
|
hardwareIds.includes(hardware)
|
||||||
|
);
|
||||||
if (hardware.length < step.hardware.length) {
|
if (hardware.length < step.hardware.length) {
|
||||||
dispatch(changeContent(hardware, i, 'hardware'));
|
dispatch(changeContent(hardware, i, "hardware"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (step.headline === undefined || step.headline === '') {
|
if (step.headline === undefined || step.headline === "") {
|
||||||
dispatch(setError(i, 'headline'));
|
dispatch(setError(i, "headline"));
|
||||||
}
|
}
|
||||||
if (step.text === undefined || step.text === '') {
|
if (step.text === undefined || step.text === "") {
|
||||||
dispatch(setError(i, 'text'));
|
dispatch(setError(i, "text"));
|
||||||
}
|
}
|
||||||
return step.type;
|
return step.type;
|
||||||
});
|
});
|
||||||
if (!(type.filter(item => item === 'task').length > 0 && type.filter(item => item === 'instruction').length > 0)) {
|
if (
|
||||||
dispatch(setError(undefined, 'type'));
|
!(
|
||||||
|
type.filter((item) => item === "task").length > 0 &&
|
||||||
|
type.filter((item) => item === "instruction").length > 0
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
dispatch(setError(undefined, "type"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const checkError = () => (dispatch, getState) => {
|
export const checkError = () => (dispatch, getState) => {
|
||||||
dispatch(setSubmitError());
|
dispatch(setSubmitError());
|
||||||
var error = getState().builder.error;
|
var error = getState().builder.error;
|
||||||
if (error.id || error.title || error.badge ||error.type) {
|
if (error.id || error.title || error.type) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (var i = 0; i < error.steps.length; i++) {
|
for (var i = 0; i < error.steps.length; i++) {
|
||||||
if (Object.keys(error.steps[i]).length > 0) {
|
if (Object.keys(error.steps[i]).length > 0) {
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const progress = (inProgress) => (dispatch) => {
|
export const progress = (inProgress) => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: PROGRESS,
|
type: PROGRESS,
|
||||||
payload: inProgress
|
payload: inProgress,
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const resetTutorial = () => (dispatch, getState) => {
|
export const resetTutorial = () => (dispatch, getState) => {
|
||||||
dispatch(jsonString(''));
|
dispatch(jsonString(""));
|
||||||
dispatch(tutorialTitle(''));
|
dispatch(tutorialTitle(""));
|
||||||
dispatch(tutorialBadge(undefined));
|
|
||||||
var steps = [
|
var steps = [
|
||||||
{
|
{
|
||||||
type: 'instruction',
|
type: "instruction",
|
||||||
headline: '',
|
headline: "",
|
||||||
text: '',
|
text: "",
|
||||||
hardware: [],
|
hardware: [],
|
||||||
requirements: []
|
requirements: [],
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
dispatch(tutorialSteps(steps));
|
dispatch(tutorialSteps(steps));
|
||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_ERROR,
|
type: BUILDER_ERROR,
|
||||||
payload: {
|
payload: {
|
||||||
steps: [{}]
|
steps: [{}],
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -278,8 +289,10 @@ export const readJSON = (json) => (dispatch, getState) => {
|
|||||||
dispatch({
|
dispatch({
|
||||||
type: BUILDER_ERROR,
|
type: BUILDER_ERROR,
|
||||||
payload: {
|
payload: {
|
||||||
steps: json.steps.map(() => { return {}; })
|
steps: json.steps.map(() => {
|
||||||
}
|
return {};
|
||||||
|
}),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
// accept only valid attributes
|
// accept only valid attributes
|
||||||
var steps = json.steps.map((step, i) => {
|
var steps = json.steps.map((step, i) => {
|
||||||
@@ -287,7 +300,7 @@ export const readJSON = (json) => (dispatch, getState) => {
|
|||||||
_id: step._id,
|
_id: step._id,
|
||||||
type: step.type,
|
type: step.type,
|
||||||
headline: step.headline,
|
headline: step.headline,
|
||||||
text: step.text
|
text: step.text,
|
||||||
};
|
};
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
object.hardware = step.hardware;
|
object.hardware = step.hardware;
|
||||||
@@ -296,19 +309,17 @@ export const readJSON = (json) => (dispatch, getState) => {
|
|||||||
if (step.xml) {
|
if (step.xml) {
|
||||||
object.xml = step.xml;
|
object.xml = step.xml;
|
||||||
}
|
}
|
||||||
if (step.media && step.type === 'instruction') {
|
if (step.media && step.type === "instruction") {
|
||||||
object.media = {};
|
object.media = {};
|
||||||
if (step.media.picture) {
|
if (step.media.picture) {
|
||||||
object.media.picture = step.media.picture;
|
object.media.picture = step.media.picture;
|
||||||
}
|
} else if (step.media.youtube) {
|
||||||
else if (step.media.youtube) {
|
|
||||||
object.media.youtube = step.media.youtube;
|
object.media.youtube = step.media.youtube;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
});
|
});
|
||||||
dispatch(tutorialTitle(json.title));
|
dispatch(tutorialTitle(json.title));
|
||||||
dispatch(tutorialBadge(json.badge));
|
|
||||||
dispatch(tutorialSteps(steps));
|
dispatch(tutorialSteps(steps));
|
||||||
dispatch(setSubmitError());
|
dispatch(setSubmitError());
|
||||||
dispatch(progress(false));
|
dispatch(progress(false));
|
||||||
|
|||||||
+50
-56
@@ -1,65 +1,59 @@
|
|||||||
// authentication
|
// authentication
|
||||||
export const USER_LOADING = 'USER_LOADING';
|
export const USER_LOADING = "USER_LOADING";
|
||||||
export const USER_LOADED = 'USER_LOADED';
|
export const USER_LOADED = "USER_LOADED";
|
||||||
export const AUTH_ERROR = 'AUTH_ERROR';
|
export const AUTH_ERROR = "AUTH_ERROR";
|
||||||
export const LOGIN_SUCCESS = 'LOGIN_SUCCESS';
|
export const LOGIN_SUCCESS = "LOGIN_SUCCESS";
|
||||||
export const LOGIN_FAIL = 'LOGIN_FAIL';
|
export const LOGIN_FAIL = "LOGIN_FAIL";
|
||||||
export const LOGOUT_SUCCESS = 'LOGOUT_SUCCESS';
|
export const LOGOUT_SUCCESS = "LOGOUT_SUCCESS";
|
||||||
export const LOGOUT_FAIL = 'LOGOUT_FAIL';
|
export const LOGOUT_FAIL = "LOGOUT_FAIL";
|
||||||
export const REFRESH_TOKEN_FAIL = 'REFRESH_TOKEN_FAIL';
|
export const REFRESH_TOKEN_FAIL = "REFRESH_TOKEN_FAIL";
|
||||||
export const REFRESH_TOKEN_SUCCESS = 'REFRESH_TOKEN_SUCCESS';
|
export const REFRESH_TOKEN_SUCCESS = "REFRESH_TOKEN_SUCCESS";
|
||||||
export const MYBADGES_CONNECT = 'MYBADGES_CONNECT';
|
|
||||||
export const MYBADGES_DISCONNECT = 'MYBADGES_DISCONNECT';
|
|
||||||
|
|
||||||
export const NEW_CODE = 'NEW_CODE';
|
export const NEW_CODE = "NEW_CODE";
|
||||||
export const CHANGE_WORKSPACE = 'CHANGE_WORKSPACE';
|
export const CHANGE_WORKSPACE = "CHANGE_WORKSPACE";
|
||||||
export const CREATE_BLOCK = 'CREATE_BLOCK';
|
export const CREATE_BLOCK = "CREATE_BLOCK";
|
||||||
export const MOVE_BLOCK = 'MOVE_BLOCK';
|
export const MOVE_BLOCK = "MOVE_BLOCK";
|
||||||
export const CHANGE_BLOCK = 'CHANGE_BLOCK';
|
export const CHANGE_BLOCK = "CHANGE_BLOCK";
|
||||||
export const DELETE_BLOCK = 'DELETE_BLOCK';
|
export const DELETE_BLOCK = "DELETE_BLOCK";
|
||||||
export const CLEAR_STATS = 'CLEAR_STATS';
|
export const CLEAR_STATS = "CLEAR_STATS";
|
||||||
export const NAME = 'NAME';
|
export const NAME = "NAME";
|
||||||
|
|
||||||
export const TUTORIAL_PROGRESS = 'TUTORIAL_PROGRESS';
|
export const TUTORIAL_PROGRESS = "TUTORIAL_PROGRESS";
|
||||||
export const GET_TUTORIAL = 'GET_TUTORIAL';
|
export const GET_TUTORIAL = "GET_TUTORIAL";
|
||||||
export const GET_TUTORIALS = 'GET_TUTORIALS';
|
export const GET_TUTORIALS = "GET_TUTORIALS";
|
||||||
export const GET_STATUS = 'GET_STATUS';
|
export const GET_STATUS = "GET_STATUS";
|
||||||
export const TUTORIAL_SUCCESS = 'TUTORIAL_SUCCESS';
|
export const TUTORIAL_SUCCESS = "TUTORIAL_SUCCESS";
|
||||||
export const TUTORIAL_ERROR = 'TUTORIAL_ERROR';
|
export const TUTORIAL_ERROR = "TUTORIAL_ERROR";
|
||||||
export const TUTORIAL_CHANGE = 'TUTORIAL_CHANGE';
|
export const TUTORIAL_CHANGE = "TUTORIAL_CHANGE";
|
||||||
export const TUTORIAL_XML = 'TUTORIAL_XML';
|
export const TUTORIAL_XML = "TUTORIAL_XML";
|
||||||
export const TUTORIAL_ID = 'TUTORIAL_ID';
|
export const TUTORIAL_ID = "TUTORIAL_ID";
|
||||||
export const TUTORIAL_STEP = 'TUTORIAL_STEP';
|
export const TUTORIAL_STEP = "TUTORIAL_STEP";
|
||||||
export const JSON_STRING = 'JSON_STRING';
|
export const JSON_STRING = "JSON_STRING";
|
||||||
|
|
||||||
|
export const BUILDER_CHANGE = "BUILDER_CHANGE";
|
||||||
|
export const BUILDER_TITLE = "BUILDER_TITLE";
|
||||||
|
export const BUILDER_ID = "BUILDER_ID";
|
||||||
|
export const BUILDER_ADD_STEP = "BUILDER_ADD_STEP";
|
||||||
|
export const BUILDER_DELETE_STEP = "BUILDER_DELETE_STEP";
|
||||||
|
export const BUILDER_CHANGE_STEP = "BUILDER_CHANGE_STEP";
|
||||||
|
export const BUILDER_CHANGE_ORDER = "BUILDER_CHANGE_ORDER";
|
||||||
|
export const BUILDER_DELETE_PROPERTY = "BUILDER_DELETE_PROPERTY";
|
||||||
|
export const BUILDER_ERROR = "BUILDER_ERROR";
|
||||||
|
export const PROGRESS = "PROGRESS";
|
||||||
|
|
||||||
export const BUILDER_CHANGE = 'BUILDER_CHANGE';
|
export const VISIT = "VISIT";
|
||||||
export const BUILDER_TITLE = 'BUILDER_TITLE';
|
export const LANGUAGE = "LANGUAGE";
|
||||||
export const BUILDER_BADGE = 'BUILDER_BADGE';
|
export const RENDERER = "RENDERER";
|
||||||
export const BUILDER_ID = 'BUILDER_ID';
|
export const STATISTICS = "STATISTICS";
|
||||||
export const BUILDER_ADD_STEP = 'BUILDER_ADD_STEP';
|
|
||||||
export const BUILDER_DELETE_STEP = 'BUILDER_DELETE_STEP';
|
|
||||||
export const BUILDER_CHANGE_STEP = 'BUILDER_CHANGE_STEP';
|
|
||||||
export const BUILDER_CHANGE_ORDER = 'BUILDER_CHANGE_ORDER';
|
|
||||||
export const BUILDER_DELETE_PROPERTY = 'BUILDER_DELETE_PROPERTY';
|
|
||||||
export const BUILDER_ERROR = 'BUILDER_ERROR';
|
|
||||||
export const PROGRESS = 'PROGRESS';
|
|
||||||
|
|
||||||
|
|
||||||
export const VISIT = 'VISIT';
|
|
||||||
export const LANGUAGE = 'LANGUAGE';
|
|
||||||
export const RENDERER = 'RENDERER';
|
|
||||||
export const STATISTICS = 'STATISTICS';
|
|
||||||
|
|
||||||
// messages
|
// messages
|
||||||
export const GET_ERRORS = 'GET_ERRORS';
|
export const GET_ERRORS = "GET_ERRORS";
|
||||||
export const GET_SUCCESS = 'GET_SUCCESS';
|
export const GET_SUCCESS = "GET_SUCCESS";
|
||||||
export const CLEAR_MESSAGES = 'CLEAR_MESSAGES';
|
export const CLEAR_MESSAGES = "CLEAR_MESSAGES";
|
||||||
|
|
||||||
|
|
||||||
// projects: share, gallery, project
|
// projects: share, gallery, project
|
||||||
export const PROJECT_PROGRESS = 'PROJECT_PROGRESS';
|
export const PROJECT_PROGRESS = "PROJECT_PROGRESS";
|
||||||
export const GET_PROJECT = 'GET_PROJECT';
|
export const GET_PROJECT = "GET_PROJECT";
|
||||||
export const GET_PROJECTS = 'GET_PROJECTS';
|
export const GET_PROJECTS = "GET_PROJECTS";
|
||||||
export const PROJECT_TYPE = 'PROJECT_TYPE';
|
export const PROJECT_TYPE = "PROJECT_TYPE";
|
||||||
export const PROJECT_DESCRIPTION = 'PROJECT_DESCRIPTION';
|
export const PROJECT_DESCRIPTION = "PROJECT_DESCRIPTION";
|
||||||
|
|||||||
@@ -16,6 +16,16 @@ export const onChangeCode = () => (dispatch, getState) => {
|
|||||||
code.arduino = Blockly.Arduino.workspaceToCode(workspace);
|
code.arduino = Blockly.Arduino.workspaceToCode(workspace);
|
||||||
var xmlDom = Blockly.Xml.workspaceToDom(workspace);
|
var xmlDom = Blockly.Xml.workspaceToDom(workspace);
|
||||||
code.xml = Blockly.Xml.domToPrettyText(xmlDom);
|
code.xml = Blockly.Xml.domToPrettyText(xmlDom);
|
||||||
|
var selectedBlock = Blockly.selected
|
||||||
|
if (selectedBlock !== null) {
|
||||||
|
code.helpurl = selectedBlock.helpUrl
|
||||||
|
code.tooltip = selectedBlock.tooltip
|
||||||
|
} else if (selectedBlock === null) {
|
||||||
|
code.tooltip = Blockly.Msg.tooltip_hint
|
||||||
|
code.helpurl = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: NEW_CODE,
|
type: NEW_CODE,
|
||||||
payload: code
|
payload: code
|
||||||
|
|||||||
@@ -21,18 +21,20 @@
|
|||||||
* @author samelh@google.com (Sam El-Husseini)
|
* @author samelh@google.com (Sam El-Husseini)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from "react";
|
||||||
|
|
||||||
import Blockly from 'blockly/core';
|
|
||||||
import 'blockly/blocks';
|
|
||||||
import Toolbox from './toolbox/Toolbox';
|
|
||||||
|
|
||||||
import { Card } from '@material-ui/core';
|
|
||||||
|
|
||||||
|
import Blockly from "blockly/core";
|
||||||
|
import "blockly/blocks";
|
||||||
|
import Toolbox from "./toolbox/Toolbox";
|
||||||
|
|
||||||
|
import { Card } from "@material-ui/core";
|
||||||
|
import {
|
||||||
|
ScrollOptions,
|
||||||
|
ScrollBlockDragger,
|
||||||
|
ScrollMetricsManager,
|
||||||
|
} from "@blockly/plugin-scroll-options";
|
||||||
|
|
||||||
class BlocklyComponent extends React.Component {
|
class BlocklyComponent extends React.Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.blocklyDiv = React.createRef();
|
this.blocklyDiv = React.createRef();
|
||||||
@@ -42,17 +44,25 @@ class BlocklyComponent extends React.Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { initialXml, children, ...rest } = this.props;
|
const { initialXml, children, ...rest } = this.props;
|
||||||
this.primaryWorkspace = Blockly.inject(
|
this.primaryWorkspace = Blockly.inject(this.blocklyDiv.current, {
|
||||||
this.blocklyDiv.current,
|
|
||||||
{
|
|
||||||
toolbox: this.toolbox.current,
|
toolbox: this.toolbox.current,
|
||||||
...rest
|
plugins: {
|
||||||
|
// These are both required.
|
||||||
|
blockDragger: ScrollBlockDragger,
|
||||||
|
metricsManager: ScrollMetricsManager,
|
||||||
},
|
},
|
||||||
);
|
...rest,
|
||||||
this.setState({ workspace: this.primaryWorkspace })
|
});
|
||||||
|
// Initialize plugin.
|
||||||
|
|
||||||
|
this.setState({ workspace: this.primaryWorkspace });
|
||||||
|
const plugin = new ScrollOptions(this.workspace);
|
||||||
|
plugin.init({ enableWheelScroll: true, enableEdgeScroll: false });
|
||||||
if (initialXml) {
|
if (initialXml) {
|
||||||
Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(initialXml), this.primaryWorkspace);
|
Blockly.Xml.domToWorkspace(
|
||||||
|
Blockly.Xml.textToDom(initialXml),
|
||||||
|
this.primaryWorkspace
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,14 +71,23 @@ class BlocklyComponent extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setXml(xml) {
|
setXml(xml) {
|
||||||
Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), this.primaryWorkspace);
|
Blockly.Xml.domToWorkspace(
|
||||||
|
Blockly.Xml.textToDom(xml),
|
||||||
|
this.primaryWorkspace
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <React.Fragment>
|
return (
|
||||||
<Card ref={this.blocklyDiv} id="blocklyDiv" style={this.props.style ? this.props.style : {}} />
|
<React.Fragment>
|
||||||
|
<Card
|
||||||
|
ref={this.blocklyDiv}
|
||||||
|
id="blocklyDiv"
|
||||||
|
style={this.props.style ? this.props.style : {}}
|
||||||
|
/>
|
||||||
<Toolbox toolbox={this.toolbox} workspace={this.state.workspace} />
|
<Toolbox toolbox={this.toolbox} workspace={this.state.workspace} />
|
||||||
</React.Fragment>;
|
</React.Fragment>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from "react";
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from "prop-types";
|
||||||
import { connect } from 'react-redux';
|
import { connect } from "react-redux";
|
||||||
import { onChangeWorkspace, clearStats } from '../../actions/workspaceActions';
|
import { onChangeWorkspace, clearStats } from "../../actions/workspaceActions";
|
||||||
|
|
||||||
import BlocklyComponent from './BlocklyComponent';
|
import BlocklyComponent from "./BlocklyComponent";
|
||||||
import BlocklySvg from './BlocklySvg';
|
import BlocklySvg from "./BlocklySvg";
|
||||||
|
|
||||||
import * as Blockly from 'blockly/core';
|
|
||||||
import './blocks/index';
|
|
||||||
import './generator/index';
|
|
||||||
|
|
||||||
import { initialXml } from './initialXml.js';
|
|
||||||
|
|
||||||
|
import * as Blockly from "blockly/core";
|
||||||
|
import "./blocks/index";
|
||||||
|
import "./generator/index";
|
||||||
|
import { ZoomToFitControl } from "@blockly/zoom-to-fit";
|
||||||
|
import { initialXml } from "./initialXml.js";
|
||||||
|
|
||||||
class BlocklyWindow extends Component {
|
class BlocklyWindow extends Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.simpleWorkspace = React.createRef();
|
this.simpleWorkspace = React.createRef();
|
||||||
@@ -33,6 +31,8 @@ class BlocklyWindow extends Component {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
Blockly.svgResize(workspace);
|
Blockly.svgResize(workspace);
|
||||||
|
const zoomToFit = new ZoomToFitControl(workspace);
|
||||||
|
zoomToFit.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(props) {
|
componentDidUpdate(props) {
|
||||||
@@ -45,13 +45,12 @@ class BlocklyWindow extends Component {
|
|||||||
if (!xml) xml = initialXml;
|
if (!xml) xml = initialXml;
|
||||||
Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), workspace);
|
Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), workspace);
|
||||||
}
|
}
|
||||||
if(props.language !== this.props.language){
|
if (props.language !== this.props.language) {
|
||||||
// change language
|
// change language
|
||||||
if (!xml) xml = initialXml;
|
if (!xml) xml = initialXml;
|
||||||
var xmlDom = Blockly.Xml.textToDom(xml);
|
var xmlDom = Blockly.Xml.textToDom(xml);
|
||||||
Blockly.Xml.clearWorkspaceAndLoadFromXml(xmlDom, workspace);
|
Blockly.Xml.clearWorkspaceAndLoadFromXml(xmlDom, workspace);
|
||||||
// var toolbox = workspace.getToolbox();
|
// var toolbox = workspace.getToolbox();
|
||||||
// console.log(toolbox);
|
|
||||||
// workspace.updateToolbox(toolbox.toolboxDef_);
|
// workspace.updateToolbox(toolbox.toolboxDef_);
|
||||||
}
|
}
|
||||||
Blockly.svgResize(workspace);
|
Blockly.svgResize(workspace);
|
||||||
@@ -60,52 +59,74 @@ class BlocklyWindow extends Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<BlocklyComponent ref={this.simpleWorkspace}
|
<BlocklyComponent
|
||||||
|
ref={this.simpleWorkspace}
|
||||||
style={this.props.svg ? { height: 0 } : this.props.blocklyCSS}
|
style={this.props.svg ? { height: 0 } : this.props.blocklyCSS}
|
||||||
readOnly={this.props.readOnly !== undefined ? this.props.readOnly : false}
|
readOnly={
|
||||||
trashcan={this.props.trashcan !== undefined ? this.props.trashcan : true}
|
this.props.readOnly !== undefined ? this.props.readOnly : false
|
||||||
|
}
|
||||||
|
trashcan={
|
||||||
|
this.props.trashcan !== undefined ? this.props.trashcan : true
|
||||||
|
}
|
||||||
renderer={this.props.renderer}
|
renderer={this.props.renderer}
|
||||||
zoom={{ // https://developers.google.com/blockly/guides/configure/web/zoom
|
zoom={{
|
||||||
controls: this.props.zoomControls !== undefined ? this.props.zoomControls : true,
|
// https://developers.google.com/blockly/guides/configure/web/zoom
|
||||||
|
controls:
|
||||||
|
this.props.zoomControls !== undefined
|
||||||
|
? this.props.zoomControls
|
||||||
|
: true,
|
||||||
wheel: false,
|
wheel: false,
|
||||||
startScale: 1,
|
startScale: 1,
|
||||||
maxScale: 3,
|
maxScale: 3,
|
||||||
minScale: 0.3,
|
minScale: 0.3,
|
||||||
scaleSpeed: 1.2
|
scaleSpeed: 1.2,
|
||||||
}}
|
}}
|
||||||
grid={this.props.grid !== undefined && !this.props.grid ? {} :
|
grid={
|
||||||
{ // https://developers.google.com/blockly/guides/configure/web/grid
|
this.props.grid !== undefined && !this.props.grid
|
||||||
|
? {}
|
||||||
|
: {
|
||||||
|
// https://developers.google.com/blockly/guides/configure/web/grid
|
||||||
spacing: 20,
|
spacing: 20,
|
||||||
length: 1,
|
length: 1,
|
||||||
colour: '#4EAF47', // senseBox-green
|
colour: "#4EAF47", // senseBox-green
|
||||||
snap: false
|
snap: false,
|
||||||
}}
|
}
|
||||||
media={'/media/blockly/'}
|
}
|
||||||
move={this.props.move !== undefined && !this.props.move ? {} :
|
media={"/media/blockly/"}
|
||||||
{ // https://developers.google.com/blockly/guides/configure/web/move
|
move={
|
||||||
|
this.props.move !== undefined && !this.props.move
|
||||||
|
? {}
|
||||||
|
: {
|
||||||
|
// https://developers.google.com/blockly/guides/configure/web/move
|
||||||
scrollbars: true,
|
scrollbars: true,
|
||||||
drag: true,
|
drag: true,
|
||||||
wheel: false
|
wheel: true,
|
||||||
}}
|
}
|
||||||
initialXml={this.props.initialXml ? this.props.initialXml : initialXml}
|
}
|
||||||
>
|
initialXml={
|
||||||
</BlocklyComponent >
|
this.props.initialXml ? this.props.initialXml : initialXml
|
||||||
{this.props.svg && this.props.initialXml ? <BlocklySvg initialXml={this.props.initialXml} /> : null}
|
}
|
||||||
|
></BlocklyComponent>
|
||||||
|
{this.props.svg && this.props.initialXml ? (
|
||||||
|
<BlocklySvg initialXml={this.props.initialXml} />
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BlocklyWindow.propTypes = {
|
BlocklyWindow.propTypes = {
|
||||||
onChangeWorkspace: PropTypes.func.isRequired,
|
onChangeWorkspace: PropTypes.func.isRequired,
|
||||||
clearStats: PropTypes.func.isRequired,
|
clearStats: PropTypes.func.isRequired,
|
||||||
renderer: PropTypes.string.isRequired,
|
renderer: PropTypes.string.isRequired,
|
||||||
language: PropTypes.string.isRequired
|
language: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = (state) => ({
|
||||||
renderer: state.general.renderer,
|
renderer: state.general.renderer,
|
||||||
language: state.general.language
|
language: state.general.language,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, { onChangeWorkspace, clearStats })(BlocklyWindow);
|
export default connect(mapStateToProps, { onChangeWorkspace, clearStats })(
|
||||||
|
BlocklyWindow
|
||||||
|
);
|
||||||
|
|||||||
@@ -1,24 +1,26 @@
|
|||||||
import './loops';
|
import "./loops";
|
||||||
import './sensebox';
|
import "./sensebox";
|
||||||
import './logic';
|
import "./logic";
|
||||||
import './sensebox-sensors';
|
import "./sensebox-sensors";
|
||||||
import './sensebox-telegram';
|
import "./sensebox-telegram";
|
||||||
import './sensebox-osem';
|
import "./sensebox-osem";
|
||||||
import './sensebox-web';
|
import "./sensebox-web";
|
||||||
import './sensebox-display';
|
import "./sensebox-display";
|
||||||
import './sensebox-lora';
|
import "./sensebox-lora";
|
||||||
import './sensebox-led';
|
import "./sensebox-led";
|
||||||
import './sensebox-sd';
|
import "./sensebox-rtc";
|
||||||
import './mqtt';
|
import "./sensebox-ble";
|
||||||
import './text';
|
import "./sensebox-sd";
|
||||||
import './io';
|
import "./mqtt";
|
||||||
import './audio';
|
import "./text";
|
||||||
import './math';
|
import "./io";
|
||||||
import './map';
|
import "./audio";
|
||||||
import './procedures';
|
import "./math";
|
||||||
import './time';
|
import "./map";
|
||||||
import './variables';
|
import "./procedures";
|
||||||
import './lists';
|
import "./time";
|
||||||
import './webserver';
|
import "./variables";
|
||||||
|
import "./lists";
|
||||||
|
import "./webserver";
|
||||||
|
|
||||||
import '../helpers/types'
|
import "../helpers/types";
|
||||||
|
|||||||
@@ -136,11 +136,12 @@ Blockly.Blocks['controls_if'] = {
|
|||||||
saveConnections: function (containerBlock) {
|
saveConnections: function (containerBlock) {
|
||||||
var clauseBlock = containerBlock.nextConnection.targetBlock();
|
var clauseBlock = containerBlock.nextConnection.targetBlock();
|
||||||
var i = 1;
|
var i = 1;
|
||||||
|
var inputDo;
|
||||||
while (clauseBlock) {
|
while (clauseBlock) {
|
||||||
switch (clauseBlock.type) {
|
switch (clauseBlock.type) {
|
||||||
case 'controls_if_elseif':
|
case 'controls_if_elseif':
|
||||||
var inputIf = this.getInput('IF' + i);
|
var inputIf = this.getInput('IF' + i);
|
||||||
var inputDo = this.getInput('DO' + i);
|
inputDo = this.getInput('DO' + i);
|
||||||
clauseBlock.valueConnection_ =
|
clauseBlock.valueConnection_ =
|
||||||
inputIf && inputIf.connection.targetConnection;
|
inputIf && inputIf.connection.targetConnection;
|
||||||
clauseBlock.statementConnection_ =
|
clauseBlock.statementConnection_ =
|
||||||
@@ -148,7 +149,7 @@ Blockly.Blocks['controls_if'] = {
|
|||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
case 'controls_if_else':
|
case 'controls_if_else':
|
||||||
var inputDo = this.getInput('ELSE');
|
inputDo = this.getInput('ELSE');
|
||||||
clauseBlock.statementConnection_ =
|
clauseBlock.statementConnection_ =
|
||||||
inputDo && inputDo.connection.targetConnection;
|
inputDo && inputDo.connection.targetConnection;
|
||||||
break;
|
break;
|
||||||
@@ -169,11 +170,11 @@ Blockly.Blocks['controls_if'] = {
|
|||||||
if (this.getInput('ELSE')) {
|
if (this.getInput('ELSE')) {
|
||||||
this.removeInput('ELSE');
|
this.removeInput('ELSE');
|
||||||
}
|
}
|
||||||
var i = 1;
|
var j = 1;
|
||||||
while (this.getInput('IF' + i)) {
|
while (this.getInput('IF' + j)) {
|
||||||
this.removeInput('IF' + i);
|
this.removeInput('IF' + j);
|
||||||
this.removeInput('DO' + i);
|
this.removeInput('DO' + j);
|
||||||
i++;
|
j++;
|
||||||
}
|
}
|
||||||
// Rebuild block.
|
// Rebuild block.
|
||||||
for (var i = 1; i <= this.elseifCount_; i++) {
|
for (var i = 1; i <= this.elseifCount_; i++) {
|
||||||
@@ -483,6 +484,7 @@ Blockly.Blocks['switch_case'] = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(getColour().logic);
|
this.setColour(getColour().logic);
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
|
this.setTooltip(Blockly.Msg.cases_tooltip);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.appendValueInput('CONDITION')
|
this.appendValueInput('CONDITION')
|
||||||
.appendField(Blockly.Msg.cases_switch);
|
.appendField(Blockly.Msg.cases_switch);
|
||||||
@@ -491,7 +493,6 @@ Blockly.Blocks['switch_case'] = {
|
|||||||
this.appendStatementInput('CASE0')
|
this.appendStatementInput('CASE0')
|
||||||
.appendField(Blockly.Msg.cases_do);
|
.appendField(Blockly.Msg.cases_do);
|
||||||
this.setMutator(new Blockly.Mutator(['case_incaseof', 'case_default']));
|
this.setMutator(new Blockly.Mutator(['case_incaseof', 'case_default']));
|
||||||
this.setTooltip('Does something if the condition is true. If there isn\'t a matching case the default function will be executed.');
|
|
||||||
this.caseCount_ = 0;
|
this.caseCount_ = 0;
|
||||||
this.defaultCount_ = 0;
|
this.defaultCount_ = 0;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import Blockly from 'blockly';
|
import Blockly from 'blockly';
|
||||||
import { getColour } from '../helpers/colour';
|
import { getColour } from '../helpers/colour';
|
||||||
import { getCompatibleTypes } from '../helpers/types'
|
import { getCompatibleTypes } from '../helpers/types'
|
||||||
|
import * as Types from '../helpers/types';
|
||||||
|
|
||||||
Blockly.Blocks['controls_whileUntil'] = {
|
Blockly.Blocks['controls_whileUntil'] = {
|
||||||
/**
|
/**
|
||||||
@@ -16,7 +16,7 @@ Blockly.Blocks['controls_whileUntil'] = {
|
|||||||
this.setHelpUrl(Blockly.Msg.CONTROLS_WHILEUNTIL_HELPURL);
|
this.setHelpUrl(Blockly.Msg.CONTROLS_WHILEUNTIL_HELPURL);
|
||||||
this.setColour(getColour().loops);
|
this.setColour(getColour().loops);
|
||||||
this.appendValueInput('BOOL')
|
this.appendValueInput('BOOL')
|
||||||
.setCheck(getCompatibleTypes(Boolean))
|
.setCheck(getCompatibleTypes('boolean'))
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'MODE');
|
.appendField(new Blockly.FieldDropdown(OPERATORS), 'MODE');
|
||||||
this.appendStatementInput('DO')
|
this.appendStatementInput('DO')
|
||||||
.appendField(Blockly.Msg.CONTROLS_WHILEUNTIL_INPUT_DO);
|
.appendField(Blockly.Msg.CONTROLS_WHILEUNTIL_INPUT_DO);
|
||||||
@@ -47,24 +47,25 @@ Blockly.Blocks['controls_for'] = {
|
|||||||
{
|
{
|
||||||
"type": "field_variable",
|
"type": "field_variable",
|
||||||
"name": "VAR",
|
"name": "VAR",
|
||||||
|
"defaultType": Types.NUMBER.typeName,
|
||||||
"variable": null
|
"variable": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "FROM",
|
"name": "FROM",
|
||||||
"check": getCompatibleTypes(Number),
|
"check": getCompatibleTypes('int'),
|
||||||
"align": "RIGHT"
|
"align": "RIGHT"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "TO",
|
"name": "TO",
|
||||||
"check": getCompatibleTypes(Number),
|
"check": getCompatibleTypes('int'),
|
||||||
"align": "RIGHT"
|
"align": "RIGHT"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "BY",
|
"name": "BY",
|
||||||
"check": getCompatibleTypes(Number),
|
"check": getCompatibleTypes('int'),
|
||||||
"align": "RIGHT"
|
"align": "RIGHT"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -97,12 +98,13 @@ Blockly.Blocks['controls_forEach'] = {
|
|||||||
{
|
{
|
||||||
"type": "field_variable",
|
"type": "field_variable",
|
||||||
"name": "VAR",
|
"name": "VAR",
|
||||||
|
"defaultType": Types.NUMBER.typeName,
|
||||||
"variable": null
|
"variable": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "LIST",
|
"name": "LIST",
|
||||||
"check": getCompatibleTypes(Array)
|
"check": getCompatibleTypes('Array')
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"previousStatement": null,
|
"previousStatement": null,
|
||||||
@@ -195,7 +197,7 @@ Blockly.Blocks['controls_repeat_ext'] = {
|
|||||||
{
|
{
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "TIMES",
|
"name": "TIMES",
|
||||||
"check": getCompatibleTypes(Number),
|
"check": getCompatibleTypes('int'),
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"previousStatement": null,
|
"previousStatement": null,
|
||||||
|
|||||||
@@ -287,7 +287,8 @@ Blockly.Blocks['math_change'] = {
|
|||||||
{
|
{
|
||||||
"type": "field_variable",
|
"type": "field_variable",
|
||||||
"name": "VAR",
|
"name": "VAR",
|
||||||
"variable": Blockly.Msg.MATH_CHANGE_TITLE_ITEM
|
"defaultType": Types.NUMBER.typeName,
|
||||||
|
"variable": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ Blockly.Blocks["sensebox_mqtt_setup"] = {
|
|||||||
.appendField(new Blockly.FieldTextInput("Password"), "password");
|
.appendField(new Blockly.FieldTextInput("Password"), "password");
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
|
this.setTooltip(Blockly.Msg.senseBox_mqtt_init_tooltip);
|
||||||
},
|
},
|
||||||
onchange: function (e) {
|
onchange: function (e) {
|
||||||
let service = this.getFieldValue('service');
|
let service = this.getFieldValue('service');
|
||||||
@@ -48,9 +49,6 @@ Blockly.Blocks["sensebox_mqtt_setup"] = {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "custom":
|
case "custom":
|
||||||
this.getField('server').setValue("server");
|
|
||||||
this.getField('port').setValue("port");
|
|
||||||
this.getField('passwordmsg').setValue(Blockly.Msg.senseBox_mqtt_password);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
@@ -71,6 +69,7 @@ Blockly.Blocks["sensebox_mqtt_publish"] = {
|
|||||||
.appendField(new Blockly.FieldTextInput('Name'), 'publishfeed');
|
.appendField(new Blockly.FieldTextInput('Name'), 'publishfeed');
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
|
this.setTooltip(Blockly.Msg.senseBox_mqtt_publish_tooltip);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,3 +83,4 @@ Blockly.Blocks["sensebox_mqtt_subscribe"] = {
|
|||||||
this.setOutput(true, null);
|
this.setOutput(true, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1148,9 +1148,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
|||||||
// This should only be possible programatically and may indicate a problem
|
// This should only be possible programatically and may indicate a problem
|
||||||
// with event grouping. If you see this message please investigate. If the
|
// with event grouping. If you see this message please investigate. If the
|
||||||
// use ends up being valid we may need to reorder events in the undo stack.
|
// use ends up being valid we may need to reorder events in the undo stack.
|
||||||
console.log(
|
|
||||||
'Saw an existing group while responding to a definition change'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
Blockly.Events.setGroup(event.group);
|
Blockly.Events.setGroup(event.group);
|
||||||
if (event.newValue) {
|
if (event.newValue) {
|
||||||
|
|||||||
@@ -0,0 +1,145 @@
|
|||||||
|
import * as Blockly from "blockly";
|
||||||
|
import { getColour } from "../helpers/colour";
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_phyphox_init"] = {
|
||||||
|
init: function () {
|
||||||
|
this.setColour(getColour().phyphox);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.sensebox_phyphox_init)
|
||||||
|
.appendField(new Blockly.FieldTextInput("Geräte Name"), "devicename");
|
||||||
|
|
||||||
|
this.setPreviousStatement(true, null);
|
||||||
|
this.setNextStatement(true, null);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_phyphox_init_tooltip);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_phyphox_experiment"] = {
|
||||||
|
init: function () {
|
||||||
|
this.setColour(getColour().phyphox);
|
||||||
|
this.appendDummyInput().appendField(
|
||||||
|
Blockly.Msg.sensebox_phyphox_createExperiment
|
||||||
|
);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.sensebox_phyphox_experimentTitle)
|
||||||
|
.appendField(new Blockly.FieldTextInput("Experiment Title"), "title");
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.sensebox_phyphox_experimentDescription)
|
||||||
|
.appendField(
|
||||||
|
new Blockly.FieldTextInput(
|
||||||
|
Blockly.Msg.sensebox_phyphox_experiment_description
|
||||||
|
),
|
||||||
|
"description"
|
||||||
|
);
|
||||||
|
this.appendStatementInput("view").appendField(
|
||||||
|
Blockly.Msg.sensebox_phyphox_createView
|
||||||
|
);
|
||||||
|
this.setPreviousStatement(true, null);
|
||||||
|
this.setNextStatement(true, null);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_phyphox_experiment_tooltip);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_phyphox_graph"] = {
|
||||||
|
init: function () {
|
||||||
|
this.setColour(getColour().phyphox);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.sensebox_phyphox_createGraph)
|
||||||
|
.appendField(Blockly.Msg.sensebox_phyphox_graphLabel)
|
||||||
|
.appendField(new Blockly.FieldTextInput("Label"), "label");
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.sensebox_phyphox_unitx)
|
||||||
|
.appendField(new Blockly.FieldTextInput("Unit X"), "unitx");
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.sensebox_phyphox_unity)
|
||||||
|
.appendField(new Blockly.FieldTextInput("Unit Y"), "unity");
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.sensebox_phyphox_labelx)
|
||||||
|
.appendField(new Blockly.FieldTextInput("Label X"), "labelx");
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.sensebox_phyphox_labely)
|
||||||
|
.appendField(new Blockly.FieldTextInput("Label Y"), "labely");
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.sensebox_phyphox_graphStyle)
|
||||||
|
.appendField(
|
||||||
|
new Blockly.FieldDropdown([
|
||||||
|
[Blockly.Msg.sensebox_phyphox_style_dots, "dots"],
|
||||||
|
[Blockly.Msg.sensebox_phyphox_style_line, "line"],
|
||||||
|
]),
|
||||||
|
"style"
|
||||||
|
);
|
||||||
|
this.appendValueInput("channel0").appendField(
|
||||||
|
Blockly.Msg.sensebox_phyphox_channel0
|
||||||
|
);
|
||||||
|
this.appendValueInput("channel1").appendField(
|
||||||
|
Blockly.Msg.sensebox_phyphox_channel1
|
||||||
|
);
|
||||||
|
this.setPreviousStatement(true, null);
|
||||||
|
this.setNextStatement(true, null);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_phyphox_graph_tooltip);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_phyphox_timestamp"] = {
|
||||||
|
init: function () {
|
||||||
|
this.setColour(getColour().phyphox);
|
||||||
|
this.appendDummyInput().appendField(Blockly.Msg.sensebox_phyphox_timestamp);
|
||||||
|
this.setOutput(true);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_phyphox_timestamp_tooltip);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_phyphox_channel"] = {
|
||||||
|
init: function () {
|
||||||
|
this.setColour(getColour().phyphox);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.sensebox_phyphox_channel)
|
||||||
|
.appendField(
|
||||||
|
new Blockly.FieldDropdown([
|
||||||
|
["1", "1"],
|
||||||
|
["2", "2"],
|
||||||
|
["3", "3"],
|
||||||
|
["4", "4"],
|
||||||
|
["5", "5"],
|
||||||
|
]),
|
||||||
|
"channel"
|
||||||
|
);
|
||||||
|
|
||||||
|
this.setOutput(true);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_phyphox_channel_tooltip);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_phyphox_sendchannel"] = {
|
||||||
|
init: function () {
|
||||||
|
this.setColour(getColour().phyphox);
|
||||||
|
this.appendValueInput("value")
|
||||||
|
.appendField(Blockly.Msg.sensebox_phyphox_sendchannel)
|
||||||
|
.appendField(
|
||||||
|
new Blockly.FieldDropdown([
|
||||||
|
["1", "1"],
|
||||||
|
["2", "2"],
|
||||||
|
["3", "3"],
|
||||||
|
["4", "4"],
|
||||||
|
["5", "5"],
|
||||||
|
]),
|
||||||
|
"channel"
|
||||||
|
);
|
||||||
|
|
||||||
|
this.setPreviousStatement(true, null);
|
||||||
|
this.setNextStatement(true, null);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_phyphox_sendchannel_tooltip);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_phyphox_experiment_send"] = {
|
||||||
|
init: function () {
|
||||||
|
this.setColour(getColour().phyphox);
|
||||||
|
this.appendStatementInput("sendValues").appendField(
|
||||||
|
Blockly.Msg.sensebox_phyphox_writeValues
|
||||||
|
);
|
||||||
|
this.setPreviousStatement(true, null);
|
||||||
|
this.setNextStatement(true, null);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_phyphox_experiment_send_tooltip);
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -11,8 +11,8 @@ Blockly.Blocks['sensebox_display_beginDisplay'] = {
|
|||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_display_beginDisplay_tip);
|
this.setTooltip(Blockly.Msg.senseBox_display_beginDisplay_tooltip);
|
||||||
this.setHelpUrl('https://sensebox.de/books');
|
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@ Blockly.Blocks['sensebox_display_clearDisplay'] = {
|
|||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_display_clearDisplay_tip);
|
this.setTooltip(Blockly.Msg.senseBox_display_clearDisplay_tooltip);
|
||||||
this.setHelpUrl('https://sensebox.de/books');
|
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -50,8 +50,8 @@ Blockly.Blocks['sensebox_display_printDisplay'] = {
|
|||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tip);
|
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tooltip);
|
||||||
this.setHelpUrl('https://sensebox.de/books');
|
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Called whenever anything on the workspace changes.
|
* Called whenever anything on the workspace changes.
|
||||||
@@ -98,8 +98,8 @@ Blockly.Blocks['sensebox_display_fastPrint'] = {
|
|||||||
.appendField(Blockly.Msg.senseBox_display_fastPrint_dimension);
|
.appendField(Blockly.Msg.senseBox_display_fastPrint_dimension);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip(Blockly.Msg.sensebox_display_fastPrint_tip);
|
this.setTooltip(Blockly.Msg.sensebox_display_fastPrint_tooltip);
|
||||||
this.setHelpUrl('https://sensebox.de/books');
|
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Called whenever anything on the workspace changes.
|
* Called whenever anything on the workspace changes.
|
||||||
@@ -112,7 +112,7 @@ Blockly.Blocks['sensebox_display_fastPrint'] = {
|
|||||||
// Is the block nested in a loop?
|
// Is the block nested in a loop?
|
||||||
var block = this;
|
var block = this;
|
||||||
do {
|
do {
|
||||||
if (this.LOOP_TYPES.indexOf(block.type) != -1) {
|
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
|
||||||
legal = true;
|
legal = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -159,8 +159,8 @@ Blockly.Blocks['sensebox_display_plotDisplay'] = {
|
|||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tip);
|
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tooltip);
|
||||||
this.setHelpUrl('https://sensebox.de/books');
|
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Called whenever anything on the workspace changes.
|
* Called whenever anything on the workspace changes.
|
||||||
@@ -220,6 +220,8 @@ Blockly.Blocks['sensebox_display_fillCircle'] = {
|
|||||||
.appendField(Blockly.Msg.senseBox_display_filled)
|
.appendField(Blockly.Msg.senseBox_display_filled)
|
||||||
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
|
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
|
||||||
this.setInputsInline(false);
|
this.setInputsInline(false);
|
||||||
|
this.setTooltip(Blockly.Msg.senseBox_display_fillCircle_tooltip)
|
||||||
|
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl)
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
@@ -270,6 +272,8 @@ Blockly.Blocks['sensebox_display_drawRectangle'] = {
|
|||||||
.appendField(Blockly.Msg.senseBox_display_filled)
|
.appendField(Blockly.Msg.senseBox_display_filled)
|
||||||
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
|
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
|
||||||
this.setInputsInline(false);
|
this.setInputsInline(false);
|
||||||
|
this.setTooltip(Blockly.Msg.senseBox_display_drawRectangle_tooltip)
|
||||||
|
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl)
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import * as Blockly from 'blockly';
|
import * as Blockly from 'blockly';
|
||||||
import { FieldSlider } from '@blockly/field-slider';
|
|
||||||
import { getColour } from '../helpers/colour'
|
import { getColour } from '../helpers/colour'
|
||||||
import { selectedBoard } from '../helpers/board'
|
import { selectedBoard } from '../helpers/board'
|
||||||
|
import * as Types from '../helpers/types'
|
||||||
|
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_led'] = {
|
Blockly.Blocks['sensebox_led'] = {
|
||||||
@@ -16,7 +15,7 @@ Blockly.Blocks['sensebox_led'] = {
|
|||||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_on, "HIGH"], [Blockly.Msg.senseBox_off, "LOW"]]), "STAT");
|
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_on, "HIGH"], [Blockly.Msg.senseBox_off, "LOW"]]), "STAT");
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_led_tip);
|
this.setTooltip(Blockly.Msg.senseBox_led_tooltip);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -27,23 +26,44 @@ Blockly.Blocks['sensebox_rgb_led'] = {
|
|||||||
.appendField(Blockly.Msg.senseBox_rgb_led)
|
.appendField(Blockly.Msg.senseBox_rgb_led)
|
||||||
.appendField("Pin:")
|
.appendField("Pin:")
|
||||||
.appendField(new Blockly.FieldDropdown(selectedBoard().digitalPins), "PIN");
|
.appendField(new Blockly.FieldDropdown(selectedBoard().digitalPins), "PIN");
|
||||||
this.appendDummyInput()
|
|
||||||
.appendField(Blockly.Msg.COLOUR_RGB_RED)//Blockly.Msg.senseBox_basic_red
|
this.appendValueInput("COLOR", 'Number')
|
||||||
.appendField(new FieldSlider(255, 0, 255), "RED");
|
.appendField(Blockly.Msg.senseBox_ws2818_rgb_led_color)
|
||||||
this.appendDummyInput()
|
.setCheck("Colour");
|
||||||
.appendField(Blockly.Msg.COLOUR_RGB_GREEN)//Blockly.Msg.senseBox_basic_green
|
// this.appendValueInput("RED", 'Number')
|
||||||
.appendField(new FieldSlider(255, 0, 255), "GREEN");
|
// .appendField(Blockly.Msg.COLOUR_RGB_RED);//Blockly.Msg.senseBox_basic_red
|
||||||
this.appendDummyInput()
|
// this.appendValueInput("GREEN", 'Number')
|
||||||
.appendField(Blockly.Msg.COLOUR_RGB_BLUE)//Blockly.Msg.senseBox_basic_green
|
// .appendField(Blockly.Msg.COLOUR_RGB_GREEN);//Blockly.Msg.senseBox_basic_green
|
||||||
.appendField(new FieldSlider(255, 0, 255), "BLUE");
|
// this.appendValueInput("BLUE", 'Number')
|
||||||
|
// .appendField(Blockly.Msg.COLOUR_RGB_BLUE);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_rgb_led_tip);
|
this.setTooltip(Blockly.Msg.senseBox_rgb_led_tip);
|
||||||
this.setHelpUrl('https://sensebox.de/books');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Blockly.Blocks['sensebox_ws2818_led_init'] = {
|
||||||
|
init: function () {
|
||||||
|
|
||||||
|
var dropdownOptions = [[Blockly.Msg.senseBox_ultrasonic_port_A, '1'],
|
||||||
|
[Blockly.Msg.senseBox_ultrasonic_port_B, '3'], [Blockly.Msg.senseBox_ultrasonic_port_C, '5']];
|
||||||
|
|
||||||
|
this.setColour(getColour().sensebox);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.senseBox_ws2818_rgb_led_init)
|
||||||
|
.appendField("Port:")
|
||||||
|
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port")
|
||||||
|
this.appendValueInput("BRIGHTNESS", "brightness")
|
||||||
|
.appendField((Blockly.Msg.senseBox_ws2818_rgb_led_brightness));
|
||||||
|
this.appendValueInput("NUMBER", "number")
|
||||||
|
.appendField((Blockly.Msg.senseBox_ws2818_rgb_led_number));
|
||||||
|
this.setPreviousStatement(true, null);
|
||||||
|
this.setNextStatement(true, null);
|
||||||
|
this.setTooltip(Blockly.Msg.senseBox_ws2818_rgb_led_init_tooltip);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_ws2818_led'] = {
|
Blockly.Blocks['sensebox_ws2818_led'] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
|
|
||||||
@@ -53,21 +73,108 @@ Blockly.Blocks['sensebox_ws2818_led'] = {
|
|||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.senseBox_ws2818_rgb_led)
|
.appendField(Blockly.Msg.senseBox_ws2818_rgb_led)
|
||||||
.appendField("Pin:")
|
.appendField("Port:")
|
||||||
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port")
|
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port")
|
||||||
this.appendValueInput("BRIGHTNESS", "brightness")
|
|
||||||
.appendField((Blockly.Msg.senseBox_ws2818_rgb_led_brightness));
|
|
||||||
this.appendValueInput("POSITION", "position")
|
this.appendValueInput("POSITION", "position")
|
||||||
.appendField((Blockly.Msg.senseBox_ws2818_rgb_led_position));
|
.appendField((Blockly.Msg.senseBox_ws2818_rgb_led_position));
|
||||||
this.appendValueInput("RED", 'Number')
|
this.appendValueInput("COLOR", 'Number')
|
||||||
.appendField(Blockly.Msg.COLOUR_RGB_RED);//Blockly.Msg.senseBox_basic_red
|
.appendField(Blockly.Msg.senseBox_ws2818_rgb_led_color)
|
||||||
this.appendValueInput("GREEN", 'Number')
|
.setCheck("Colour");
|
||||||
.appendField(Blockly.Msg.COLOUR_RGB_GREEN);//Blockly.Msg.senseBox_basic_green
|
|
||||||
this.appendValueInput("BLUE", 'Number')
|
|
||||||
.appendField(Blockly.Msg.COLOUR_RGB_BLUE);
|
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_rgb_led_tip);
|
this.setTooltip(Blockly.Msg.senseBox_ws2818_rgb_led_tooltip);
|
||||||
this.setHelpUrl('https://sensebox.de/books');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
|
||||||
|
// Block for colour picker.
|
||||||
|
{
|
||||||
|
"type": "colour_picker",
|
||||||
|
"message0": "%1",
|
||||||
|
"args0": [
|
||||||
|
{
|
||||||
|
"type": "field_colour",
|
||||||
|
"name": "COLOUR",
|
||||||
|
"colour": "#ff0000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"output": "Colour",
|
||||||
|
"helpUrl": "%{BKY_COLOUR_PICKER_HELPURL}",
|
||||||
|
"colour": getColour().sensebox,
|
||||||
|
"tooltip": "%{BKY_COLOUR_PICKER_TOOLTIP}",
|
||||||
|
"extensions": ["parent_tooltip_when_inline"]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Block for random colour.
|
||||||
|
{
|
||||||
|
"type": "colour_random",
|
||||||
|
"message0": "%{BKY_COLOUR_RANDOM_TITLE}",
|
||||||
|
"output": "Colour",
|
||||||
|
"helpUrl": "%{BKY_COLOUR_RANDOM_HELPURL}",
|
||||||
|
"colour": getColour().sensebox,
|
||||||
|
"tooltip": "%{BKY_COLOUR_RANDOM_TOOLTIP}"
|
||||||
|
},
|
||||||
|
|
||||||
|
// Block for composing a colour from RGB components.
|
||||||
|
{
|
||||||
|
"type": "colour_rgb",
|
||||||
|
"message0": "%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",
|
||||||
|
"args0": [
|
||||||
|
{
|
||||||
|
"type": "input_value",
|
||||||
|
"name": "RED",
|
||||||
|
"check": Types.getCompatibleTypes('int'),
|
||||||
|
"align": "RIGHT"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "input_value",
|
||||||
|
"name": "GREEN",
|
||||||
|
"check": Types.getCompatibleTypes('int'),
|
||||||
|
"align": "RIGHT"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "input_value",
|
||||||
|
"name": "BLUE",
|
||||||
|
"check": Types.getCompatibleTypes('int'),
|
||||||
|
"align": "RIGHT"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"output": "Colour",
|
||||||
|
"helpUrl": "%{BKY_COLOUR_RGB_HELPURL}",
|
||||||
|
"colour": getColour().sensebox,
|
||||||
|
"tooltip": "%{BKY_COLOUR_RGB_TOOLTIP}"
|
||||||
|
},
|
||||||
|
|
||||||
|
// Block for blending two colours together.
|
||||||
|
{
|
||||||
|
"type": "colour_blend",
|
||||||
|
"message0": "%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} " +
|
||||||
|
"%1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",
|
||||||
|
"args0": [
|
||||||
|
{
|
||||||
|
"type": "input_value",
|
||||||
|
"name": "COLOUR1",
|
||||||
|
"check": "Colour",
|
||||||
|
"align": "RIGHT"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "input_value",
|
||||||
|
"name": "COLOUR2",
|
||||||
|
"check": "Colour",
|
||||||
|
"align": "RIGHT"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "input_value",
|
||||||
|
"name": "RATIO",
|
||||||
|
"check": "Number",
|
||||||
|
"align": "RIGHT"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"output": "Colour",
|
||||||
|
"helpUrl": "%{BKY_COLOUR_BLEND_HELPURL}",
|
||||||
|
"style": "colour_blocks",
|
||||||
|
"tooltip": "%{BKY_COLOUR_BLEND_TOOLTIP}"
|
||||||
|
}
|
||||||
|
]); // END JSON EXTRACT (Do not delete this comment.)
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,34 @@
|
|||||||
import * as Blockly from 'blockly/core';
|
import * as Blockly from "blockly/core";
|
||||||
import { getColour } from '../helpers/colour';
|
import { getColour } from "../helpers/colour";
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
----------------------------------LoRa--------------------------------------------------
|
----------------------------------LoRa--------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_lora_initialize_otaa'] = {
|
Blockly.Blocks["sensebox_lora_initialize_otaa"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_LoRa_init_otaa_tip);
|
this.setTooltip(Blockly.Msg.senseBox_LoRa_init_otaa_tooltip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl(Blockly.Msg.senseBox_LoRa_init_helpurl);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField("Initialize LoRa (OTAA)");
|
||||||
.appendField("Initialize LoRa (OTAA)");
|
|
||||||
|
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_device_id)
|
.appendField(Blockly.Msg.senseBox_LoRa_device_id)
|
||||||
.appendField(new Blockly.FieldTextInput("DEVICE ID"), "DEVICEID");
|
.appendField("{")
|
||||||
|
.appendField(new Blockly.FieldTextInput("DEVICE ID"), "DEVICEID")
|
||||||
|
.appendField("}");
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_app_id)
|
.appendField(Blockly.Msg.senseBox_LoRa_app_id)
|
||||||
.appendField(new Blockly.FieldTextInput("APP ID"), "APPID");
|
.appendField("{")
|
||||||
|
.appendField(new Blockly.FieldTextInput("APP ID"), "APPID")
|
||||||
|
.appendField("}");
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_app_key)
|
.appendField(Blockly.Msg.senseBox_LoRa_app_key)
|
||||||
.appendField(new Blockly.FieldTextInput("APP KEY"), "APPKEY");
|
.appendField("{")
|
||||||
|
.appendField(new Blockly.FieldTextInput("APP KEY"), "APPKEY")
|
||||||
|
.appendField("}");
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_interval)
|
.appendField(Blockly.Msg.senseBox_LoRa_interval)
|
||||||
@@ -35,21 +38,24 @@ Blockly.Blocks['sensebox_lora_initialize_otaa'] = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_lora_initialize_abp'] = {
|
Blockly.Blocks["sensebox_lora_initialize_abp"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_LoRa_init_abp_tip);
|
this.setTooltip(Blockly.Msg.senseBox_LoRa_init_abp_tooltip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl(Blockly.Msg.senseBox_LoRa_init_helpurl);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField("Initialize LoRa (ABP)");
|
||||||
.appendField("Initialize LoRa (ABP)");
|
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_nwskey_id)
|
.appendField(Blockly.Msg.senseBox_LoRa_nwskey_id)
|
||||||
.appendField(new Blockly.FieldTextInput("NWSKEY"), "NWSKEY");
|
.appendField("{")
|
||||||
|
.appendField(new Blockly.FieldTextInput("NWSKEY"), "NWSKEY")
|
||||||
|
.appendField("}");
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_appskey_id)
|
.appendField(Blockly.Msg.senseBox_LoRa_appskey_id)
|
||||||
.appendField(new Blockly.FieldTextInput("APPSKEY"), "APPSKEY");
|
.appendField("{")
|
||||||
|
.appendField(new Blockly.FieldTextInput("APPSKEY"), "APPSKEY")
|
||||||
|
.appendField("}");
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_devaddr_id)
|
.appendField(Blockly.Msg.senseBox_LoRa_devaddr_id)
|
||||||
@@ -66,26 +72,27 @@ Blockly.Blocks['sensebox_lora_initialize_abp'] = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_lora_message_send'] = {
|
Blockly.Blocks["sensebox_lora_message_send"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_LoRa_message_tip);
|
this.setTooltip(Blockly.Msg.senseBox_LoRa_message_tooltip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl("");
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendStatementInput('DO')
|
this.appendStatementInput("DO")
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_send_message)
|
.appendField(Blockly.Msg.senseBox_LoRa_send_message)
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_send_lora_sensor_value'] = {
|
Blockly.Blocks["sensebox_send_lora_sensor_value"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_LoRa_sensor_tip);
|
this.setTooltip(Blockly.Msg.senseBox_LoRa_sensor_tip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl("");
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendValueInput('Value')
|
this.appendValueInput("Value").appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_measurement)
|
Blockly.Msg.senseBox_measurement
|
||||||
|
);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField("Bytes")
|
.appendField("Bytes")
|
||||||
@@ -116,60 +123,65 @@ Blockly.Blocks['sensebox_send_lora_sensor_value'] = {
|
|||||||
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_lora_message_send'],
|
LOOP_TYPES: ["sensebox_lora_message_send"],
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_lora_ttn_mapper'] = {
|
Blockly.Blocks["sensebox_lora_ttn_mapper"] = {
|
||||||
init: function (block) {
|
init: function (block) {
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField("TTN Mapper");
|
||||||
.appendField("TTN Mapper");
|
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_RIGHT)
|
.setAlign(Blockly.ALIGN_RIGHT)
|
||||||
.appendField("Fix Type Limit")
|
.appendField("Fix Type Limit")
|
||||||
.appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"]].reverse()), "dropdown");
|
.appendField(
|
||||||
|
new Blockly.FieldDropdown(
|
||||||
|
[
|
||||||
|
["0", "0"],
|
||||||
|
["1", "1"],
|
||||||
|
["2", "2"],
|
||||||
|
["3", "3"],
|
||||||
|
].reverse()
|
||||||
|
),
|
||||||
|
"dropdown"
|
||||||
|
);
|
||||||
// reverse() because i want 3 be be at first and i'm to lazy to write the array again
|
// reverse() because i want 3 be be at first and i'm to lazy to write the array again
|
||||||
this.appendValueInput('Latitude')
|
this.appendValueInput("Latitude")
|
||||||
.appendField(Blockly.Msg.senseBox_gps_lat)
|
.appendField(Blockly.Msg.senseBox_gps_lat)
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
this.appendValueInput('Longitude')
|
this.appendValueInput("Longitude")
|
||||||
.appendField(Blockly.Msg.senseBox_gps_lng)
|
.appendField(Blockly.Msg.senseBox_gps_lng)
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
this.appendValueInput('Altitude')
|
this.appendValueInput("Altitude")
|
||||||
.appendField(Blockly.Msg.senseBox_gps_alt)
|
.appendField(Blockly.Msg.senseBox_gps_alt)
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
this.appendValueInput('pDOP')
|
this.appendValueInput("pDOP").appendField("pDOP").setCheck(null);
|
||||||
.appendField('pDOP')
|
this.appendValueInput("Fix Type").appendField("Fix Type").setCheck(null);
|
||||||
.setCheck(null);
|
|
||||||
this.appendValueInput('Fix Type')
|
|
||||||
.appendField('Fix Type')
|
|
||||||
.setCheck(null);
|
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tip);
|
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tip);
|
||||||
|
},
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_lora_cayenne_send'] = {
|
Blockly.Blocks["sensebox_lora_cayenne_send"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_tip);
|
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_tip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl("");
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendStatementInput('DO')
|
this.appendStatementInput("DO")
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_send_cayenne)
|
.appendField(Blockly.Msg.senseBox_LoRa_send_cayenne)
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
Blockly.Blocks['sensebox_lora_cayenne_temperature'] = {
|
Blockly.Blocks["sensebox_lora_cayenne_temperature"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_temperature_tip);
|
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_temperature_tip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl("");
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendValueInput('Value')
|
this.appendValueInput("Value").appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_temperature)
|
Blockly.Msg.senseBox_LoRa_cayenne_temperature
|
||||||
|
);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
||||||
@@ -177,15 +189,16 @@ Blockly.Blocks['sensebox_lora_cayenne_temperature'] = {
|
|||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_lora_cayenne_send'],
|
LOOP_TYPES: ["sensebox_lora_cayenne_send"],
|
||||||
};
|
};
|
||||||
Blockly.Blocks['sensebox_lora_cayenne_humidity'] = {
|
Blockly.Blocks["sensebox_lora_cayenne_humidity"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_humidity_tip);
|
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_humidity_tip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl("");
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendValueInput('Value')
|
this.appendValueInput("Value").appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_humidity)
|
Blockly.Msg.senseBox_LoRa_cayenne_humidity
|
||||||
|
);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
||||||
@@ -193,15 +206,16 @@ Blockly.Blocks['sensebox_lora_cayenne_humidity'] = {
|
|||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_lora_cayenne_send'],
|
LOOP_TYPES: ["sensebox_lora_cayenne_send"],
|
||||||
};
|
};
|
||||||
Blockly.Blocks['sensebox_lora_cayenne_pressure'] = {
|
Blockly.Blocks["sensebox_lora_cayenne_pressure"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_pressure_tip);
|
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_pressure_tip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl("");
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendValueInput('Value')
|
this.appendValueInput("Value").appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_pressure)
|
Blockly.Msg.senseBox_LoRa_cayenne_pressure
|
||||||
|
);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
||||||
@@ -209,15 +223,16 @@ Blockly.Blocks['sensebox_lora_cayenne_pressure'] = {
|
|||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_lora_cayenne_send'],
|
LOOP_TYPES: ["sensebox_lora_cayenne_send"],
|
||||||
};
|
};
|
||||||
Blockly.Blocks['sensebox_lora_cayenne_luminosity'] = {
|
Blockly.Blocks["sensebox_lora_cayenne_luminosity"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_luminosity_tip);
|
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_luminosity_tip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl("");
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendValueInput('Value')
|
this.appendValueInput("Value").appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_luminosity)
|
Blockly.Msg.senseBox_LoRa_cayenne_luminosity
|
||||||
|
);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
||||||
@@ -225,15 +240,16 @@ Blockly.Blocks['sensebox_lora_cayenne_luminosity'] = {
|
|||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_lora_cayenne_send'],
|
LOOP_TYPES: ["sensebox_lora_cayenne_send"],
|
||||||
};
|
};
|
||||||
Blockly.Blocks['sensebox_lora_cayenne_sensor'] = {
|
Blockly.Blocks["sensebox_lora_cayenne_sensor"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_analog_tip);
|
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_analog_tip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl("");
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendValueInput('Value')
|
this.appendValueInput("Value").appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_analog)
|
Blockly.Msg.senseBox_LoRa_cayenne_analog
|
||||||
|
);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
||||||
@@ -241,19 +257,16 @@ Blockly.Blocks['sensebox_lora_cayenne_sensor'] = {
|
|||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_lora_cayenne_send'],
|
LOOP_TYPES: ["sensebox_lora_cayenne_send"],
|
||||||
};
|
};
|
||||||
Blockly.Blocks['sensebox_lora_cayenne_accelerometer'] = {
|
Blockly.Blocks["sensebox_lora_cayenne_accelerometer"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_gyros_tip);
|
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_gyros_tip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl("");
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendValueInput('X')
|
this.appendValueInput("X").appendField(Blockly.Msg.senseBox_LoRa_cayenne_x);
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_x)
|
this.appendValueInput("Y").appendField(Blockly.Msg.senseBox_LoRa_cayenne_y);
|
||||||
this.appendValueInput('Y')
|
this.appendValueInput("Z").appendField(Blockly.Msg.senseBox_LoRa_cayenne_z);
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_y)
|
|
||||||
this.appendValueInput('Z')
|
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_z)
|
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
||||||
@@ -261,19 +274,22 @@ Blockly.Blocks['sensebox_lora_cayenne_accelerometer'] = {
|
|||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_lora_cayenne_send'],
|
LOOP_TYPES: ["sensebox_lora_cayenne_send"],
|
||||||
};
|
};
|
||||||
Blockly.Blocks['sensebox_lora_cayenne_gps'] = {
|
Blockly.Blocks["sensebox_lora_cayenne_gps"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_gps_tip);
|
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_gps_tip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl("");
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendValueInput('LAT')
|
this.appendValueInput("LAT").appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_lat)
|
Blockly.Msg.senseBox_LoRa_cayenne_lat
|
||||||
this.appendValueInput('LNG')
|
);
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_lng)
|
this.appendValueInput("LNG").appendField(
|
||||||
this.appendValueInput('ALT')
|
Blockly.Msg.senseBox_LoRa_cayenne_lng
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_alt)
|
);
|
||||||
|
this.appendValueInput("ALT").appendField(
|
||||||
|
Blockly.Msg.senseBox_LoRa_cayenne_alt
|
||||||
|
);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
|
||||||
@@ -281,5 +297,5 @@ Blockly.Blocks['sensebox_lora_cayenne_gps'] = {
|
|||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_lora_cayenne_send'],
|
LOOP_TYPES: ["sensebox_lora_cayenne_send"],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -50,8 +50,29 @@ Blockly.Blocks['sensebox_osem_connection'] = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
onchange: function (e) {
|
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');
|
selectedBox = this.getFieldValue('BoxID');
|
||||||
console.log(selectedBox)
|
|
||||||
if (selectedBox !== '' && boxes) {
|
if (selectedBox !== '' && boxes) {
|
||||||
var accessToken = boxes.find(element => element._id === selectedBox).access_token
|
var accessToken = boxes.find(element => element._id === selectedBox).access_token
|
||||||
if (accessToken !== undefined) {
|
if (accessToken !== undefined) {
|
||||||
@@ -62,6 +83,7 @@ Blockly.Blocks['sensebox_osem_connection'] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mutationToDom: function () {
|
mutationToDom: function () {
|
||||||
var container = document.createElement('mutation');
|
var container = document.createElement('mutation');
|
||||||
var input = this.getFieldValue('type');
|
var input = this.getFieldValue('type');
|
||||||
@@ -101,6 +123,7 @@ Blockly.Blocks['sensebox_osem_connection'] = {
|
|||||||
this.removeInput('timeStamp');
|
this.removeInput('timeStamp');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
LOOP_TYPES: ['sensebox_interval_timer']
|
||||||
};
|
};
|
||||||
Blockly.Blocks['sensebox_send_to_osem'] = {
|
Blockly.Blocks['sensebox_send_to_osem'] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -136,7 +159,6 @@ Blockly.Blocks['sensebox_send_to_osem'] = {
|
|||||||
for (var i = 0; i < box.sensors.length; i++) {
|
for (var i = 0; i < box.sensors.length; i++) {
|
||||||
dropdown.push([box.sensors[i].title, box.sensors[i]._id])
|
dropdown.push([box.sensors[i].title, box.sensors[i]._id])
|
||||||
}
|
}
|
||||||
console.log(dropdown)
|
|
||||||
}
|
}
|
||||||
if (dropdown.length > 1) {
|
if (dropdown.length > 1) {
|
||||||
var options = dropdown.slice(1)
|
var options = dropdown.slice(1)
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
import * as Blockly from "blockly";
|
||||||
|
import { getColour } from "../helpers/colour";
|
||||||
|
import * as Types from "../helpers/types";
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_rtc_init"] = {
|
||||||
|
init: function () {
|
||||||
|
this.setHelpUrl(Blockly.Msg.sensebox_rtc_helpurl);
|
||||||
|
this.setColour(getColour().time);
|
||||||
|
this.appendDummyInput().appendField(Blockly.Msg.sensebox_rtc_init);
|
||||||
|
this.setPreviousStatement(true);
|
||||||
|
this.setNextStatement(true);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_rtc_init_tooltip);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_rtc_set"] = {
|
||||||
|
init: function () {
|
||||||
|
this.setHelpUrl(Blockly.Msg.sensebox_rtc_helpurl);
|
||||||
|
this.setColour(getColour().time);
|
||||||
|
this.appendDummyInput().appendField(Blockly.Msg.sensebox_rtc_set);
|
||||||
|
this.appendValueInput("second").appendField(
|
||||||
|
Blockly.Msg.sensebox_rtc_second
|
||||||
|
);
|
||||||
|
this.appendValueInput("minutes").appendField(
|
||||||
|
Blockly.Msg.sensebox_rtc_minutes
|
||||||
|
);
|
||||||
|
this.appendValueInput("hour").appendField(Blockly.Msg.sensebox_rtc_hour);
|
||||||
|
this.appendValueInput("day").appendField(Blockly.Msg.sensebox_rtc_day);
|
||||||
|
this.appendValueInput("month").appendField(Blockly.Msg.sensebox_rtc_month);
|
||||||
|
this.appendValueInput("year").appendField(Blockly.Msg.sensebox_rtc_year);
|
||||||
|
this.setPreviousStatement(true);
|
||||||
|
this.setNextStatement(true);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_rtc_set_tooltip);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_rtc_set_ntp"] = {
|
||||||
|
init: function () {
|
||||||
|
this.setHelpUrl(Blockly.Msg.sensebox_rtc_helpurl);
|
||||||
|
this.setColour(getColour().time);
|
||||||
|
this.appendValueInput("time").appendField(Blockly.Msg.sensebox_rtc_set_ntp);
|
||||||
|
this.setPreviousStatement(true);
|
||||||
|
this.setNextStatement(true);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_rtc_set_ntp_tooltip);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_rtc_get"] = {
|
||||||
|
init: function () {
|
||||||
|
this.setHelpUrl(Blockly.Msg.sensebox_rtc_helpurl);
|
||||||
|
this.setColour(getColour().time);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.sensebox_rtc_get)
|
||||||
|
.appendField(
|
||||||
|
new Blockly.FieldDropdown([
|
||||||
|
[Blockly.Msg.sensebox_rtc_hour, "hour"],
|
||||||
|
[Blockly.Msg.sensebox_rtc_minutes, "minutes"],
|
||||||
|
[Blockly.Msg.sensebox_rtc_second, "seconds"],
|
||||||
|
[Blockly.Msg.sensebox_rtc_day, "day"],
|
||||||
|
[Blockly.Msg.sensebox_rtc_month, "month"],
|
||||||
|
[Blockly.Msg.sensebox_rtc_year, "year"],
|
||||||
|
]),
|
||||||
|
"dropdown"
|
||||||
|
);
|
||||||
|
this.setOutput(true, Types.LARGE_NUMBER.typeId);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_rtc_get_tooltip);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_rtc_get_timestamp"] = {
|
||||||
|
init: function () {
|
||||||
|
this.setHelpUrl(Blockly.Msg.sensebox_rtc_helpurl);
|
||||||
|
this.setColour(getColour().time);
|
||||||
|
this.appendDummyInput().appendField(Blockly.Msg.sensebox_rtc_get_timestamp);
|
||||||
|
this.setOutput(true);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_rtc_get_timestamp_tooltip);
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -15,8 +15,8 @@ Blockly.Blocks['sensebox_sd_open_file'] = {
|
|||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_output_safetosd_tip);
|
this.setTooltip(Blockly.Msg.senseBox_sd_open_file_tooltip);
|
||||||
this.setHelpUrl('https://sensebox.de/books');
|
this.setHelpUrl('https://docs.sensebox.de/hardware/bee-sd/');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -32,8 +32,8 @@ Blockly.Blocks['sensebox_sd_create_file'] = {
|
|||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_output_safetosd_tip);
|
this.setTooltip(Blockly.Msg.senseBox_sd_create_file_tooltip);
|
||||||
this.setHelpUrl('https://sensebox.de/books');
|
this.setHelpUrl('https://docs.sensebox.de/hardware/bee-sd/');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -50,8 +50,8 @@ Blockly.Blocks['sensebox_sd_write_file'] = {
|
|||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_output_safetosd_tip);
|
this.setTooltip(Blockly.Msg.senseBox_sd_write_file_tooltip);
|
||||||
this.setHelpUrl('https://sensebox.de/books');
|
this.setHelpUrl('https://docs.sensebox.de/hardware/bee-sd/');
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Called whenever anything on the workspace changes.
|
* Called whenever anything on the workspace changes.
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ Blockly.Blocks['sensebox_sensor_temp_hum'] = {
|
|||||||
.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.setOutput(true, Types.DECIMAL.typeName);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_temp_hum_tip);
|
this.setTooltip(Blockly.Msg.senseBox_temp_hum_tooltip);
|
||||||
this.setHelpUrl('https://edu.books.sensebox.de/de/projekte/diy_umweltstation/temp_und_luftfeuchte.html');
|
this.setHelpUrl(Blockly.Msg.senseBox_temp_hum_helpurl);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -29,6 +29,7 @@ Blockly.Blocks['sensebox_sensor_temp_hum'] = {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_sensor_uv_light'] = {
|
Blockly.Blocks['sensebox_sensor_uv_light'] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
@@ -39,8 +40,8 @@ Blockly.Blocks['sensebox_sensor_uv_light'] = {
|
|||||||
.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.setOutput(true, Types.DECIMAL.typeName);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_uv_light_tip);
|
this.setTooltip(Blockly.Msg.senseBox_uv_light_tooltip);
|
||||||
this.setHelpUrl('https://edu.books.sensebox.de/de/projekte/diy_umweltstation/temp_und_luftfeuchte.html');
|
this.setHelpUrl(Blockly.Msg.senseBox_uv_light_helpurl);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,8 +63,8 @@ Blockly.Blocks['sensebox_sensor_bmx055_accelerometer'] = {
|
|||||||
.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.setOutput(true, Types.DECIMAL.typeName);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_bmx055_accelerometer_tip);
|
this.setTooltip(Blockly.Msg.senseBox_bmx055_accelerometer_tooltip);
|
||||||
this.setHelpUrl('https://edu.books.sensebox.de/de/projekte/diy_umweltstation/temp_und_luftfeuchte.html');
|
this.setHelpUrl(Blockly.Msg.senseBox_bmx055_helpurl);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,8 +85,8 @@ Blockly.Blocks['sensebox_sensor_sds011'] = {
|
|||||||
.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.setOutput(true, Types.DECIMAL.typeName);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_sds011_tip);
|
this.setTooltip(Blockly.Msg.senseBox_sds011_tooltip);
|
||||||
this.setHelpUrl('https://edu.books.sensebox.de/de/projekte/diy_umweltstation/temp_und_luftfeuchte.html');
|
this.setHelpUrl(Blockly.Msg.senseBox_sds011_helpurl);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -110,8 +111,8 @@ Blockly.Blocks['sensebox_sensor_pressure'] = {
|
|||||||
.appendField(dropdown, "NAME");
|
.appendField(dropdown, "NAME");
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setOutput(true, Types.DECIMAL.typeName);
|
this.setOutput(true, Types.DECIMAL.typeName);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_pressure_tip);
|
this.setTooltip(Blockly.Msg.senseBox_pressure_tooltip);
|
||||||
this.setHelpUrl('https://edu.books.sensebox.de/de/projekte/diy_umweltstation/luftdruck.html');
|
this.setHelpUrl(Blockly.Msg.senseBox_pressure_helpurl);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Parse XML to restore the number of pins available.
|
* Parse XML to restore the number of pins available.
|
||||||
@@ -175,7 +176,8 @@ Blockly.Blocks['sensebox_sensor_bme680_bsec'] = {
|
|||||||
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown")
|
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown")
|
||||||
this.setOutput(true, Types.DECIMAL.typeName);
|
this.setOutput(true, Types.DECIMAL.typeName);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_bme_tip);
|
this.setTooltip(Blockly.Msg.senseBox_bme_tooltip);
|
||||||
|
this.setHelpUrl(Blockly.Msg.senseBox_bme680_helpurl)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -209,8 +211,8 @@ Blockly.Blocks['sensebox_sensor_ultrasonic_ranger'] = {
|
|||||||
.appendField(new Blockly.FieldDropdown(
|
.appendField(new Blockly.FieldDropdown(
|
||||||
selectedBoard().digitalPins), 'ultrasonic_echo');
|
selectedBoard().digitalPins), 'ultrasonic_echo');
|
||||||
this.setOutput(true, Types.NUMBER.typeName);
|
this.setOutput(true, Types.NUMBER.typeName);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_ultrasonic_tip);
|
this.setTooltip(Blockly.Msg.senseBox_ultrasonic_tooltip);
|
||||||
this.setHelpUrl('https://sensebox.de/books');
|
this.setHelpUrl(Blockly.Msg.senseBox_ultrasonic_helpurl);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Parse XML to restore the number of pins available.
|
* Parse XML to restore the number of pins available.
|
||||||
@@ -274,8 +276,8 @@ Blockly.Blocks['sensebox_sensor_sound'] = {
|
|||||||
.appendField("Pin:")
|
.appendField("Pin:")
|
||||||
.appendField(new Blockly.FieldDropdown(selectedBoard().analogPins), "PIN")
|
.appendField(new Blockly.FieldDropdown(selectedBoard().analogPins), "PIN")
|
||||||
this.setOutput(true, Types.NUMBER.typeName);
|
this.setOutput(true, Types.NUMBER.typeName);
|
||||||
this.setHelpUrl(Blockly.Msg.senseBox_sound_tip);
|
this.setHelpUrl(Blockly.Msg.senseBox_sound_helpurl);
|
||||||
this.setTooltip('Dieser Sensor mist den Geräuschpegel.');
|
this.setTooltip(Blockly.Msg.senseBox_sound_tooltip);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -295,8 +297,7 @@ Blockly.Blocks['sensebox_button'] = {
|
|||||||
.appendField(new Blockly.FieldDropdown(selectedBoard().digitalPinsButton), "PIN");
|
.appendField(new Blockly.FieldDropdown(selectedBoard().digitalPinsButton), "PIN");
|
||||||
this.setOutput(true, Types.BOOLEAN.typeName);
|
this.setOutput(true, Types.BOOLEAN.typeName);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_button_tip);
|
this.setTooltip(Blockly.Msg.senseBox_button_tooltip);
|
||||||
this.setHelpUrl('https://sensebox.de/books');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -318,7 +319,8 @@ Blockly.Blocks['sensebox_scd30'] = {
|
|||||||
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown")
|
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown")
|
||||||
this.setOutput(true, Types.NUMBER.typeName);
|
this.setOutput(true, Types.NUMBER.typeName);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_scd_tip);
|
this.setTooltip(Blockly.Msg.senseBox_scd_tooltip);
|
||||||
|
this.setHelpUrl(Blockly.Msg.senseBox_scd_helpurl);
|
||||||
},
|
},
|
||||||
onchange: function (e) {
|
onchange: function (e) {
|
||||||
var dropdown = this.getFieldValue('dropdown');
|
var dropdown = this.getFieldValue('dropdown');
|
||||||
@@ -348,6 +350,86 @@ Blockly.Blocks['sensebox_gps'] = {
|
|||||||
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown")
|
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown")
|
||||||
this.setOutput(true, Types.NUMBER.typeName);
|
this.setOutput(true, Types.NUMBER.typeName);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_bme_tip);
|
this.setTooltip(Blockly.Msg.senseBox_gps_tooltip);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block for Truebner STM50
|
||||||
|
*/
|
||||||
|
|
||||||
|
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']];
|
||||||
|
this.setColour(getColour().sensebox);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.senseBox_smt50);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField("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')
|
||||||
|
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'] = {
|
||||||
|
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']];
|
||||||
|
this.setColour(getColour().sensebox);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.senseBox_watertemperature)
|
||||||
|
.appendField("Port:")
|
||||||
|
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port")
|
||||||
|
this.setOutput(true, Types.NUMBER.typeName);
|
||||||
|
this.setTooltip(Blockly.Msg.senseBox_watertemperature_tip);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Windspeed
|
||||||
|
* removed for now
|
||||||
|
|
||||||
|
|
||||||
|
Blockly.Blocks['sensebox_windspeed'] = {
|
||||||
|
init: function () {
|
||||||
|
this.setColour(getColour().sensebox);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.senseBox_windspeed)
|
||||||
|
.appendField("Pin:")
|
||||||
|
.appendField(new Blockly.FieldDropdown(selectedBoard().analogPins), "PIN")
|
||||||
|
this.setOutput(true, Types.DECIMAL.typeName);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DF Robot Soundsensor
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
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']];
|
||||||
|
this.setColour(getColour().sensebox);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.senseBox_soundsensor_dfrobot)
|
||||||
|
.appendField("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)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -12,6 +12,7 @@ Blockly.Blocks["sensebox_telegram"] = {
|
|||||||
.appendField("telegram")
|
.appendField("telegram")
|
||||||
.appendField(new Blockly.FieldTextInput("token"), "telegram_token");
|
.appendField(new Blockly.FieldTextInput("token"), "telegram_token");
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
|
this.setTooltip(Blockly.Msg.senseBox_telegram_init_tooltip);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -24,6 +25,7 @@ Blockly.Blocks["sensebox_telegram_do"] = {
|
|||||||
this.appendStatementInput("telegram_do");
|
this.appendStatementInput("telegram_do");
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
|
this.setTooltip(Blockly.Msg.senseBox_telegram_do_tooltip)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -36,6 +38,7 @@ Blockly.Blocks["sensebox_telegram_do_on_message"] = {
|
|||||||
.appendField(Blockly.Msg.senseBox_telegram_message)
|
.appendField(Blockly.Msg.senseBox_telegram_message)
|
||||||
.appendField(new Blockly.FieldTextInput("/message"), 'telegram_message');
|
.appendField(new Blockly.FieldTextInput("/message"), 'telegram_message');
|
||||||
this.appendStatementInput("telegram_do_on_message").setCheck(null);
|
this.appendStatementInput("telegram_do_on_message").setCheck(null);
|
||||||
|
this.setTooltip(Blockly.Msg.senseBox_telegram_message_tooltip)
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
}
|
}
|
||||||
@@ -46,8 +49,10 @@ Blockly.Blocks["sensebox_telegram_send"] = {
|
|||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput().appendField(Blockly.Msg.senseBox_telegram_send);
|
this.appendDummyInput().appendField(Blockly.Msg.senseBox_telegram_send);
|
||||||
this.appendValueInput("telegram_text_to_send").setCheck(null);
|
this.appendValueInput("telegram_text_to_send").setCheck(null);
|
||||||
|
this.setTooltip(Blockly.Msg.senseBox_telegram_send_tooltip)
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
|
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ["sensebox_telegram_do_on_message"]
|
LOOP_TYPES: ["sensebox_telegram_do_on_message"]
|
||||||
};
|
};
|
||||||
@@ -3,7 +3,7 @@ import { getColour } from '../helpers/colour'
|
|||||||
|
|
||||||
Blockly.Blocks['sensebox_wifi'] = {
|
Blockly.Blocks['sensebox_wifi'] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_wifi_tip);
|
this.setTooltip(Blockly.Msg.senseBox_wifi_tooltip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl('');
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
@@ -16,6 +16,7 @@ Blockly.Blocks['sensebox_wifi'] = {
|
|||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_output_password)
|
.appendField(Blockly.Msg.senseBox_output_password)
|
||||||
.appendField(new Blockly.FieldTextInput("Password"), "Password");
|
.appendField(new Blockly.FieldTextInput("Password"), "Password");
|
||||||
|
this.setHelpUrl(Blockly.Msg.senseBox_wifi_helpurl)
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
@@ -43,7 +44,7 @@ Blockly.Blocks['sensebox_wifi'] = {
|
|||||||
|
|
||||||
Blockly.Blocks['sensebox_startap'] = {
|
Blockly.Blocks['sensebox_startap'] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setTooltip(Blockly.Msg.senseBox_wifi_tip);
|
this.setTooltip(Blockly.Msg.senseBox_wifi_startap_tooltip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl('');
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
@@ -52,6 +53,7 @@ Blockly.Blocks['sensebox_startap'] = {
|
|||||||
.setAlign(Blockly.ALIGN_LEFT)
|
.setAlign(Blockly.ALIGN_LEFT)
|
||||||
.appendField(Blockly.Msg.senseBox_wifi_ssid)
|
.appendField(Blockly.Msg.senseBox_wifi_ssid)
|
||||||
.appendField(new Blockly.FieldTextInput("SSID"), "SSID");
|
.appendField(new Blockly.FieldTextInput("SSID"), "SSID");
|
||||||
|
this.setHelpUrl(Blockly.Msg.senseBox_wifi_helpurl)
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,36 @@
|
|||||||
|
import * as Blockly from "blockly/core";
|
||||||
|
import { getColour } from "../helpers/colour";
|
||||||
|
import * as Types from "../helpers/types";
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_multiplexer_init"] = {
|
||||||
|
init: function () {
|
||||||
|
this.appendDummyInput().appendField(Blockly.Msg.senseBox_multiplexer_init);
|
||||||
|
this.appendValueInput("nrChannels").setCheck(
|
||||||
|
Types.getCompatibleTypes("int")
|
||||||
|
);
|
||||||
|
this.appendDummyInput().appendField(
|
||||||
|
Blockly.Msg.senseBox_multplexer_nchannels
|
||||||
|
);
|
||||||
|
this.setPreviousStatement(true, null);
|
||||||
|
this.setNextStatement(true, null);
|
||||||
|
this.setInputsInline("true");
|
||||||
|
this.setColour(getColour().sensebox);
|
||||||
|
this.setTooltip(Blockly.Msg.senseBox_multiplexer_init_tooltip);
|
||||||
|
this.setHelpUrl(Blockly.Msg.senseBox_multiplexer_init_helpurl);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_multiplexer_changeChannel"] = {
|
||||||
|
init: function () {
|
||||||
|
this.appendDummyInput().appendField(
|
||||||
|
Blockly.Msg.senseBox_multiplexer_changeChannel
|
||||||
|
);
|
||||||
|
this.appendValueInput("Channel").setCheck(Types.getCompatibleTypes("int"));
|
||||||
|
this.setInputsInline("true");
|
||||||
|
this.setPreviousStatement(true, null);
|
||||||
|
this.setNextStatement(true, null);
|
||||||
|
this.setColour(getColour().sensebox);
|
||||||
|
this.setTooltip(Blockly.Msg.sensebox_multiplexer_changeChannel_tooltip);
|
||||||
|
this.setHelpUrl(Blockly.Msg.sensebox_multiplexer_changeChannel_helpurl);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,43 +1,46 @@
|
|||||||
import Blockly from 'blockly/core';
|
import Blockly from "blockly/core";
|
||||||
import { getColour } from '../helpers/colour';
|
import { getColour } from "../helpers/colour";
|
||||||
import { getCompatibleTypes } from '../helpers/types'
|
import { getCompatibleTypes } from "../helpers/types";
|
||||||
|
|
||||||
|
Blockly.Blocks["variables_set_dynamic"] = {
|
||||||
Blockly.Blocks['variables_set_dynamic'] = {
|
|
||||||
init: function () {
|
init: function () {
|
||||||
|
|
||||||
// const type = myVar.type;
|
// const type = myVar.type;
|
||||||
this.setColour(getColour().variables);
|
this.setColour(getColour().variables);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.appendValueInput('VALUE')
|
this.appendValueInput("VALUE")
|
||||||
.appendField('set', 'set')
|
.appendField("set", "set")
|
||||||
.appendField('', 'type')
|
.appendField("", "type")
|
||||||
.appendField(new Blockly.FieldVariable('VAR'), 'VAR')
|
.appendField(new Blockly.FieldVariable("VAR"), "VAR")
|
||||||
.appendField('to');
|
.appendField("to");
|
||||||
},
|
},
|
||||||
onchange: function (e) {
|
onchange: function (e) {
|
||||||
let variableID = this.getFieldValue('VAR');
|
let variableID = this.getFieldValue("VAR");
|
||||||
let variable = Blockly.getMainWorkspace().getVariableMap().getVariableById(variableID)
|
let variable = Blockly.getMainWorkspace()
|
||||||
this.getField('type').setValue(variable.type);
|
.getVariableMap()
|
||||||
this.getInput('VALUE').setCheck(getCompatibleTypes(variable.type));
|
.getVariableById(variableID);
|
||||||
|
if (variable !== null) {
|
||||||
|
this.getField("type").setValue(variable.type);
|
||||||
|
this.getInput("VALUE").setCheck(getCompatibleTypes(variable.type));
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
};
|
||||||
|
|
||||||
Blockly.Blocks['variables_get_dynamic'] = {
|
Blockly.Blocks["variables_get_dynamic"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(getColour().variables);
|
this.setColour(getColour().variables);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField('', 'type')
|
.appendField("", "type")
|
||||||
.appendField(new Blockly.FieldVariable('VAR'), 'VAR');
|
.appendField(new Blockly.FieldVariable("VAR"), "VAR");
|
||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
},
|
},
|
||||||
onchange: function (e) {
|
onchange: function (e) {
|
||||||
let variableID = this.getFieldValue('VAR');
|
let variableID = this.getFieldValue("VAR");
|
||||||
let variable = Blockly.getMainWorkspace().getVariableMap().getVariableById(variableID)
|
let variable = Blockly.getMainWorkspace()
|
||||||
this.getField('type').setValue(variable.type);
|
.getVariableMap()
|
||||||
|
.getVariableById(variableID);
|
||||||
|
if (variable !== null) {
|
||||||
|
this.getField("type").setValue(variable.type);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
};
|
||||||
|
|||||||
@@ -24,13 +24,13 @@
|
|||||||
// More on generating code:
|
// More on generating code:
|
||||||
// https://developers.google.com/blockly/guides/create-custom-blocks/generating-code
|
// https://developers.google.com/blockly/guides/create-custom-blocks/generating-code
|
||||||
|
|
||||||
import * as Blockly from 'blockly/core';
|
import * as Blockly from "blockly/core";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Arduino code generator.
|
* Arduino code generator.
|
||||||
* @type !Blockly.Generator
|
* @type !Blockly.Generator
|
||||||
*/
|
*/
|
||||||
Blockly['Arduino'] = new Blockly.Generator('Arduino');
|
Blockly["Arduino"] = new Blockly.Generator("Arduino");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of illegal variable names.
|
* List of illegal variable names.
|
||||||
@@ -39,49 +39,46 @@ Blockly['Arduino'] = new Blockly.Generator('Arduino');
|
|||||||
* accidentally clobbering a built-in object or function.
|
* accidentally clobbering a built-in object or function.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Blockly['Arduino'].addReservedWords(
|
Blockly["Arduino"].addReservedWords(
|
||||||
// http://arduino.cc/en/Reference/HomePage
|
// http://arduino.cc/en/Reference/HomePage
|
||||||
'setup,loop,if,else,for,switch,case,while,' +
|
"setup,loop,if,else,for,switch,case,while," +
|
||||||
'do,break,continue,return,goto,define,include,' +
|
"do,break,continue,return,goto,define,include," +
|
||||||
'HIGH,LOW,INPUT,OUTPUT,INPUT_PULLUP,true,false,' +
|
"HIGH,LOW,INPUT,OUTPUT,INPUT_PULLUP,true,false," +
|
||||||
'interger, constants,floating,point,void,boolean,char,' +
|
"interger, constants,floating,point,void,boolean,char," +
|
||||||
'unsigned,byte,int,word,long,float,double,string,String,array,' +
|
"unsigned,byte,int,word,long,float,double,string,String,array," +
|
||||||
'static, volatile,const,sizeof,pinMode,digitalWrite,digitalRead,' +
|
"static, volatile,const,sizeof,pinMode,digitalWrite,digitalRead," +
|
||||||
'analogReference,analogRead,analogWrite,tone,noTone,shiftOut,shitIn,' +
|
"analogReference,analogRead,analogWrite,tone,noTone,shiftOut,shitIn," +
|
||||||
'pulseIn,millis,micros,delay,delayMicroseconds,min,max,abs,constrain,' +
|
"pulseIn,millis,micros,delay,delayMicroseconds,min,max,abs,constrain," +
|
||||||
'map,pow,sqrt,sin,cos,tan,randomSeed,random,lowByte,highByte,bitRead,' +
|
"map,pow,sqrt,sin,cos,tan,randomSeed,random,lowByte,highByte,bitRead," +
|
||||||
'bitWrite,bitSet,bitClear,ultraSonicDistance,parseDouble,setNeoPixelColor,' +
|
"bitWrite,bitSet,bitClear,ultraSonicDistance,parseDouble,setNeoPixelColor," +
|
||||||
'bit,attachInterrupt,detachInterrupt,interrupts,noInterrupts',
|
"bit,attachInterrupt,detachInterrupt,interrupts,noInterrupts",
|
||||||
'short',
|
"short",
|
||||||
'isBtnPressed'
|
"isBtnPressed"
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order of operation ENUMs.
|
* Order of operation ENUMs.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Blockly['Arduino'].ORDER_ATOMIC = 0; // 0 "" ...
|
Blockly["Arduino"].ORDER_ATOMIC = 0; // 0 "" ...
|
||||||
Blockly['Arduino'].ORDER_UNARY_POSTFIX = 1; // expr++ expr-- () [] .
|
Blockly["Arduino"].ORDER_UNARY_POSTFIX = 1; // expr++ expr-- () [] .
|
||||||
Blockly['Arduino'].ORDER_UNARY_PREFIX = 2; // -expr !expr ~expr ++expr --expr
|
Blockly["Arduino"].ORDER_UNARY_PREFIX = 2; // -expr !expr ~expr ++expr --expr
|
||||||
Blockly['Arduino'].ORDER_MULTIPLICATIVE = 3; // * / % ~/
|
Blockly["Arduino"].ORDER_MULTIPLICATIVE = 3; // * / % ~/
|
||||||
Blockly['Arduino'].ORDER_ADDITIVE = 4; // + -
|
Blockly["Arduino"].ORDER_ADDITIVE = 4; // + -
|
||||||
Blockly['Arduino'].ORDER_LOGICAL_NOT = 4.4; // !
|
Blockly["Arduino"].ORDER_LOGICAL_NOT = 4.4; // !
|
||||||
Blockly['Arduino'].ORDER_SHIFT = 5; // << >>
|
Blockly["Arduino"].ORDER_SHIFT = 5; // << >>
|
||||||
Blockly['Arduino'].ORDER_MODULUS = 5.3; // %
|
Blockly["Arduino"].ORDER_MODULUS = 5.3; // %
|
||||||
Blockly['Arduino'].ORDER_RELATIONAL = 6; // is is! >= > <= <
|
Blockly["Arduino"].ORDER_RELATIONAL = 6; // is is! >= > <= <
|
||||||
Blockly['Arduino'].ORDER_EQUALITY = 7; // === !== === !==
|
Blockly["Arduino"].ORDER_EQUALITY = 7; // === !== === !==
|
||||||
Blockly['Arduino'].ORDER_BITWISE_AND = 8; // &
|
Blockly["Arduino"].ORDER_BITWISE_AND = 8; // &
|
||||||
Blockly['Arduino'].ORDER_BITWISE_XOR = 9; // ^
|
Blockly["Arduino"].ORDER_BITWISE_XOR = 9; // ^
|
||||||
Blockly['Arduino'].ORDER_BITWISE_OR = 10; // |
|
Blockly["Arduino"].ORDER_BITWISE_OR = 10; // |
|
||||||
Blockly['Arduino'].ORDER_LOGICAL_AND = 11; // &&
|
Blockly["Arduino"].ORDER_LOGICAL_AND = 11; // &&
|
||||||
Blockly['Arduino'].ORDER_LOGICAL_OR = 12; // ||
|
Blockly["Arduino"].ORDER_LOGICAL_OR = 12; // ||
|
||||||
Blockly['Arduino'].ORDER_CONDITIONAL = 13; // expr ? expr : expr
|
Blockly["Arduino"].ORDER_CONDITIONAL = 13; // expr ? expr : expr
|
||||||
Blockly['Arduino'].ORDER_ASSIGNMENT = 14; // = *= /= ~/= %= += -= <<= >>= &= ^= |=
|
Blockly["Arduino"].ORDER_ASSIGNMENT = 14; // = *= /= ~/= %= += -= <<= >>= &= ^= |=
|
||||||
Blockly['Arduino'].ORDER_COMMA = 18; // ,
|
Blockly["Arduino"].ORDER_COMMA = 18; // ,
|
||||||
Blockly['Arduino'].ORDER_NONE = 99; // (...)
|
Blockly["Arduino"].ORDER_NONE = 99; // (...)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -90,49 +87,49 @@ Blockly['Arduino'].ORDER_NONE = 99; // (...)
|
|||||||
* Blockly Types
|
* Blockly Types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise the database of variable names.
|
* Initialise the database of variable names.
|
||||||
* @param {!Blockly.Workspace} workspace Workspace to generate code from.
|
* @param {!Blockly.Workspace} workspace Workspace to generate code from.
|
||||||
*/
|
*/
|
||||||
Blockly['Arduino'].init = function (workspace) {
|
Blockly["Arduino"].init = function (workspace) {
|
||||||
// Create a dictionary of definitions to be printed before the code.
|
// Create a dictionary of definitions to be printed before the code.
|
||||||
Blockly['Arduino'].libraries_ = Object.create(null);
|
Blockly["Arduino"].libraries_ = Object.create(null);
|
||||||
|
|
||||||
Blockly['Arduino'].definitions_ = Object.create(null);
|
Blockly["Arduino"].definitions_ = Object.create(null);
|
||||||
|
|
||||||
// creates a list of code to be setup before the setup block
|
// creates a list of code to be setup before the setup block
|
||||||
Blockly['Arduino'].setupCode_ = Object.create(null);
|
Blockly["Arduino"].setupCode_ = Object.create(null);
|
||||||
|
|
||||||
// creates a list of code to be setup before the setup block
|
// creates a list of code to be setup before the setup block
|
||||||
Blockly['Arduino'].loraSetupCode_ = Object.create(null);
|
Blockly["Arduino"].phyphoxSetupCode_ = Object.create(null);
|
||||||
|
|
||||||
|
// creates a list of code to be setup before the setup block
|
||||||
|
Blockly["Arduino"].loraSetupCode_ = Object.create(null);
|
||||||
|
|
||||||
// creates a list of code for the loop to be runned once
|
// creates a list of code for the loop to be runned once
|
||||||
Blockly['Arduino'].loopCodeOnce_ = Object.create(null)
|
Blockly["Arduino"].loopCodeOnce_ = Object.create(null);
|
||||||
|
|
||||||
// creates a list of code for the loop to be runned once
|
// creates a list of code for the loop to be runned once
|
||||||
Blockly['Arduino'].codeFunctions_ = Object.create(null)
|
Blockly["Arduino"].codeFunctions_ = Object.create(null);
|
||||||
|
|
||||||
// creates a list of code variables
|
// creates a list of code variables
|
||||||
Blockly['Arduino'].variables_ = Object.create(null)
|
Blockly["Arduino"].variables_ = Object.create(null);
|
||||||
|
|
||||||
// Create a dictionary mapping desired function names in definitions_
|
// Create a dictionary mapping desired function names in definitions_
|
||||||
// to actual function names (to avoid collisions with user functions).
|
// to actual function names (to avoid collisions with user functions).
|
||||||
Blockly['Arduino'].functionNames_ = Object.create(null);
|
Blockly["Arduino"].functionNames_ = Object.create(null);
|
||||||
|
|
||||||
Blockly['Arduino'].variablesInitCode_ = '';
|
Blockly["Arduino"].variablesInitCode_ = "";
|
||||||
|
|
||||||
if (!Blockly['Arduino'].variableDB_) {
|
if (!Blockly["Arduino"].variableDB_) {
|
||||||
Blockly['Arduino'].variableDB_ = new Blockly.Names(
|
Blockly["Arduino"].variableDB_ = new Blockly.Names(
|
||||||
Blockly['Arduino'].RESERVED_WORDS_
|
Blockly["Arduino"].RESERVED_WORDS_
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Blockly['Arduino'].variableDB_.reset();
|
Blockly["Arduino"].variableDB_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
Blockly['Arduino'].variableDB_.setVariableMap(workspace.getVariableMap());
|
Blockly["Arduino"].variableDB_.setVariableMap(workspace.getVariableMap());
|
||||||
|
|
||||||
// We don't have developer variables for now
|
// We don't have developer variables for now
|
||||||
// // Add developer variables (not created or named by the user).
|
// // Add developer variables (not created or named by the user).
|
||||||
@@ -142,53 +139,53 @@ Blockly['Arduino'].init = function (workspace) {
|
|||||||
// Blockly.Names.DEVELOPER_VARIABLE_TYPE));
|
// Blockly.Names.DEVELOPER_VARIABLE_TYPE));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
const doubleVariables = workspace.getVariablesOfType('Number');
|
const doubleVariables = workspace.getVariablesOfType("Number");
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let variableCode = '';
|
let variableCode = "";
|
||||||
for (i = 0; i < doubleVariables.length; i += 1) {
|
for (i = 0; i < doubleVariables.length; i += 1) {
|
||||||
variableCode +=
|
variableCode +=
|
||||||
'double ' +
|
"double " +
|
||||||
Blockly['Arduino'].variableDB_.getName(
|
Blockly["Arduino"].variableDB_.getName(
|
||||||
doubleVariables[i].getId(),
|
doubleVariables[i].getId(),
|
||||||
Blockly.Variables.NAME_TYPE
|
Blockly.Variables.NAME_TYPE
|
||||||
) +
|
) +
|
||||||
' = 0; \n\n';
|
" = 0; \n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
const stringVariables = workspace.getVariablesOfType('String');
|
const stringVariables = workspace.getVariablesOfType("String");
|
||||||
for (i = 0; i < stringVariables.length; i += 1) {
|
for (i = 0; i < stringVariables.length; i += 1) {
|
||||||
variableCode +=
|
variableCode +=
|
||||||
'String ' +
|
"String " +
|
||||||
Blockly['Arduino'].variableDB_.getName(
|
Blockly["Arduino"].variableDB_.getName(
|
||||||
stringVariables[i].getId(),
|
stringVariables[i].getId(),
|
||||||
Blockly.Variables.NAME_TYPE
|
Blockly.Variables.NAME_TYPE
|
||||||
) +
|
) +
|
||||||
' = ""; \n\n';
|
' = ""; \n\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
const booleanVariables = workspace.getVariablesOfType('Boolean');
|
const booleanVariables = workspace.getVariablesOfType("Boolean");
|
||||||
for (i = 0; i < booleanVariables.length; i += 1) {
|
for (i = 0; i < booleanVariables.length; i += 1) {
|
||||||
variableCode +=
|
variableCode +=
|
||||||
'boolean ' +
|
"boolean " +
|
||||||
Blockly['Arduino'].variableDB_.getDistinctName(
|
Blockly["Arduino"].variableDB_.getDistinctName(
|
||||||
booleanVariables[i].getId(),
|
booleanVariables[i].getId(),
|
||||||
Blockly.Variables.NAME_TYPE
|
Blockly.Variables.NAME_TYPE
|
||||||
) +
|
) +
|
||||||
' = false; \n\n';
|
" = false; \n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
const colourVariables = workspace.getVariablesOfType('Colour');
|
const colourVariables = workspace.getVariablesOfType("Colour");
|
||||||
for (i = 0; i < colourVariables.length; i += 1) {
|
for (i = 0; i < colourVariables.length; i += 1) {
|
||||||
variableCode +=
|
variableCode +=
|
||||||
'RGB ' +
|
"RGB " +
|
||||||
Blockly['Arduino'].variableDB_.getName(
|
Blockly["Arduino"].variableDB_.getName(
|
||||||
colourVariables[i].getId(),
|
colourVariables[i].getId(),
|
||||||
Blockly.Variables.NAME_TYPE
|
Blockly.Variables.NAME_TYPE
|
||||||
) +
|
) +
|
||||||
' = {0, 0, 0}; \n\n';
|
" = {0, 0, 0}; \n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
Blockly['Arduino'].variablesInitCode_ = variableCode;
|
Blockly["Arduino"].variablesInitCode_ = variableCode;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -196,86 +193,95 @@ Blockly['Arduino'].init = function (workspace) {
|
|||||||
* @param {string} code Generated code.
|
* @param {string} code Generated code.
|
||||||
* @return {string} Completed code.
|
* @return {string} Completed code.
|
||||||
*/
|
*/
|
||||||
Blockly['Arduino'].finish = function (code) {
|
Blockly["Arduino"].finish = function (code) {
|
||||||
let libraryCode = '';
|
let libraryCode = "";
|
||||||
let variablesCode = '';
|
let variablesCode = "";
|
||||||
let codeFunctions = '';
|
let codeFunctions = "";
|
||||||
let functionsCode = '';
|
let functionsCode = "";
|
||||||
let definitionsCode = '';
|
let definitionsCode = "";
|
||||||
let loopCodeOnce = '';
|
let phyphoxSetupCode = "";
|
||||||
let setupCode = '';
|
let loopCodeOnce = "";
|
||||||
let preSetupCode = '';
|
let setupCode = "";
|
||||||
let loraSetupCode = '';
|
let preSetupCode = "";
|
||||||
let devVariables = '\n';
|
let loraSetupCode = "";
|
||||||
|
let devVariables = "\n";
|
||||||
|
|
||||||
for (const key in Blockly['Arduino'].libraries_) {
|
for (const key in Blockly["Arduino"].libraries_) {
|
||||||
libraryCode += Blockly['Arduino'].libraries_[key] + '\n';
|
libraryCode += Blockly["Arduino"].libraries_[key] + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key in Blockly['Arduino'].variables_) {
|
for (const key in Blockly["Arduino"].variables_) {
|
||||||
variablesCode += Blockly['Arduino'].variables_[key] + '\n';
|
variablesCode += Blockly["Arduino"].variables_[key] + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key in Blockly['Arduino'].definitions_) {
|
for (const key in Blockly["Arduino"].definitions_) {
|
||||||
definitionsCode += Blockly['Arduino'].definitions_[key] + '\n';
|
definitionsCode += Blockly["Arduino"].definitions_[key] + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key in Blockly['Arduino'].loopCodeOnce_) {
|
for (const key in Blockly["Arduino"].loopCodeOnce_) {
|
||||||
loopCodeOnce += Blockly['Arduino'].loopCodeOnce_[key] + '\n';
|
loopCodeOnce += Blockly["Arduino"].loopCodeOnce_[key] + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key in Blockly['Arduino'].codeFunctions_) {
|
for (const key in Blockly["Arduino"].codeFunctions_) {
|
||||||
codeFunctions += Blockly['Arduino'].codeFunctions_[key] + '\n';
|
codeFunctions += Blockly["Arduino"].codeFunctions_[key] + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key in Blockly['Arduino'].functionNames_) {
|
for (const key in Blockly["Arduino"].functionNames_) {
|
||||||
functionsCode += Blockly['Arduino'].functionNames_[key] + '\n';
|
functionsCode += Blockly["Arduino"].functionNames_[key] + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const key in Blockly["Arduino"].setupCode_) {
|
||||||
|
preSetupCode += Blockly["Arduino"].setupCode_[key] + "\n" || "";
|
||||||
for (const key in Blockly['Arduino'].setupCode_) {
|
|
||||||
preSetupCode += Blockly['Arduino'].setupCode_[key] || '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key in Blockly['Arduino'].loraSetupCode_) {
|
for (const key in Blockly["Arduino"].loraSetupCode_) {
|
||||||
loraSetupCode += Blockly['Arduino'].loraSetupCode_[key] || '';
|
loraSetupCode += Blockly["Arduino"].loraSetupCode_[key] + "\n" || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setupCode =
|
||||||
|
"\nvoid setup() { \n" + preSetupCode + "\n" + loraSetupCode + "\n}\n";
|
||||||
|
for (const key in Blockly["Arduino"].phyphoxSetupCode_) {
|
||||||
|
phyphoxSetupCode += Blockly["Arduino"].phyphoxSetupCode_[key] + "\n" || "";
|
||||||
|
}
|
||||||
|
|
||||||
setupCode = '\nvoid setup() { \n' + preSetupCode + '\n' + loraSetupCode + '\n}\n';
|
setupCode =
|
||||||
|
"\nvoid setup() { \n" +
|
||||||
let loopCode = '\nvoid loop() { \n' + loopCodeOnce + code + '\n}\n';
|
preSetupCode +
|
||||||
|
"\n" +
|
||||||
|
phyphoxSetupCode +
|
||||||
|
"\n" +
|
||||||
|
loraSetupCode +
|
||||||
|
"\n}\n";
|
||||||
|
|
||||||
|
let loopCode = "\nvoid loop() { \n" + loopCodeOnce + code + "\n}\n";
|
||||||
|
|
||||||
// Convert the definitions dictionary into a list.
|
// Convert the definitions dictionary into a list.
|
||||||
code =
|
code =
|
||||||
devVariables +
|
devVariables +
|
||||||
'\n' +
|
"\n" +
|
||||||
libraryCode +
|
libraryCode +
|
||||||
'\n' +
|
"\n" +
|
||||||
variablesCode +
|
variablesCode +
|
||||||
'\n' +
|
"\n" +
|
||||||
definitionsCode +
|
definitionsCode +
|
||||||
'\n' +
|
"\n" +
|
||||||
codeFunctions +
|
codeFunctions +
|
||||||
'\n' +
|
"\n" +
|
||||||
Blockly['Arduino'].variablesInitCode_ +
|
Blockly["Arduino"].variablesInitCode_ +
|
||||||
'\n' +
|
"\n" +
|
||||||
functionsCode +
|
functionsCode +
|
||||||
'\n' +
|
"\n" +
|
||||||
setupCode +
|
setupCode +
|
||||||
'\n' +
|
"\n" +
|
||||||
loopCode
|
loopCode;
|
||||||
;
|
|
||||||
|
|
||||||
// Clean up temporary data.
|
// Clean up temporary data.
|
||||||
delete Blockly['Arduino'].definitions_;
|
delete Blockly["Arduino"].definitions_;
|
||||||
delete Blockly['Arduino'].functionNames_;
|
delete Blockly["Arduino"].functionNames_;
|
||||||
delete Blockly['Arduino'].loopCodeOnce_;
|
delete Blockly["Arduino"].loopCodeOnce_;
|
||||||
delete Blockly['Arduino'].variablesInitCode_;
|
delete Blockly["Arduino"].variablesInitCode_;
|
||||||
delete Blockly['Arduino'].libraries_;
|
delete Blockly["Arduino"].libraries_;
|
||||||
Blockly['Arduino'].variableDB_.reset();
|
Blockly["Arduino"].variableDB_.reset();
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
};
|
};
|
||||||
@@ -286,8 +292,8 @@ Blockly['Arduino'].finish = function (code) {
|
|||||||
* @param {string} line Line of generated code.
|
* @param {string} line Line of generated code.
|
||||||
* @return {string} Legal line of code.
|
* @return {string} Legal line of code.
|
||||||
*/
|
*/
|
||||||
Blockly['Arduino'].scrubNakedValue = function (line) {
|
Blockly["Arduino"].scrubNakedValue = function (line) {
|
||||||
return line + ';\n';
|
return line + ";\n";
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -297,12 +303,12 @@ Blockly['Arduino'].scrubNakedValue = function (line) {
|
|||||||
* @return {string} Arduino string.
|
* @return {string} Arduino string.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Blockly['Arduino'].quote_ = function (string) {
|
Blockly["Arduino"].quote_ = function (string) {
|
||||||
// Can't use goog.string.quote since Google's style guide recommends
|
// Can't use goog.string.quote since Google's style guide recommends
|
||||||
// JS string literals use single quotes.
|
// JS string literals use single quotes.
|
||||||
string = string
|
string = string
|
||||||
.replace(/\\/g, '\\\\')
|
.replace(/\\/g, "\\\\")
|
||||||
.replace(/\n/g, '\\\n')
|
.replace(/\n/g, "\\\n")
|
||||||
.replace(/'/g, "\\'");
|
.replace(/'/g, "\\'");
|
||||||
return '"' + string + '"';
|
return '"' + string + '"';
|
||||||
};
|
};
|
||||||
@@ -317,26 +323,25 @@ Blockly['Arduino'].quote_ = function (string) {
|
|||||||
* @return {string} Arduino code with comments and subsequent blocks added.
|
* @return {string} Arduino code with comments and subsequent blocks added.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Blockly['Arduino'].scrub_ = function (block, code) {
|
Blockly["Arduino"].scrub_ = function (block, code) {
|
||||||
let commentCode = '';
|
let commentCode = "";
|
||||||
// Only collect comments for blocks that aren't inline.
|
// Only collect comments for blocks that aren't inline.
|
||||||
if (!block.outputConnection || !block.outputConnection.targetConnection) {
|
if (!block.outputConnection || !block.outputConnection.targetConnection) {
|
||||||
// Collect comment for this block.
|
// Collect comment for this block.
|
||||||
let comment = block.getCommentText();
|
let comment = block.getCommentText();
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
comment = comment ? Blockly.utils.string.wrap(
|
comment = comment
|
||||||
comment,
|
? Blockly.utils.string.wrap(comment, Blockly["Arduino"].COMMENT_WRAP - 3)
|
||||||
Blockly['Arduino'].COMMENT_WRAP - 3
|
: null;
|
||||||
) : null;
|
|
||||||
if (comment) {
|
if (comment) {
|
||||||
if (block.getProcedureDef) {
|
if (block.getProcedureDef) {
|
||||||
// Use a comment block for function comments.
|
// Use a comment block for function comments.
|
||||||
commentCode +=
|
commentCode +=
|
||||||
'/**\n' +
|
"/**\n" +
|
||||||
Blockly['Arduino'].prefixLines(comment + '\n', ' * ') +
|
Blockly["Arduino"].prefixLines(comment + "\n", " * ") +
|
||||||
' */\n';
|
" */\n";
|
||||||
} else {
|
} else {
|
||||||
commentCode += Blockly['Arduino'].prefixLines(comment + '\n', '// ');
|
commentCode += Blockly["Arduino"].prefixLines(comment + "\n", "// ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Collect comments for all value arguments.
|
// Collect comments for all value arguments.
|
||||||
@@ -345,15 +350,15 @@ Blockly['Arduino'].scrub_ = function (block, code) {
|
|||||||
if (block.inputList[i].type === Blockly.INPUT_VALUE) {
|
if (block.inputList[i].type === Blockly.INPUT_VALUE) {
|
||||||
const childBlock = block.inputList[i].connection.targetBlock();
|
const childBlock = block.inputList[i].connection.targetBlock();
|
||||||
if (childBlock) {
|
if (childBlock) {
|
||||||
const comment = Blockly['Arduino'].allNestedComments(childBlock);
|
const comment = Blockly["Arduino"].allNestedComments(childBlock);
|
||||||
if (comment) {
|
if (comment) {
|
||||||
commentCode += Blockly['Arduino'].prefixLines(comment, '// ');
|
commentCode += Blockly["Arduino"].prefixLines(comment, "// ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const nextBlock = block.nextConnection && block.nextConnection.targetBlock();
|
const nextBlock = block.nextConnection && block.nextConnection.targetBlock();
|
||||||
const nextCode = Blockly['Arduino'].blockToCode(nextBlock);
|
const nextCode = Blockly["Arduino"].blockToCode(nextBlock);
|
||||||
return commentCode + code + nextCode;
|
return commentCode + code + nextCode;
|
||||||
};
|
};
|
||||||
@@ -1,24 +1,25 @@
|
|||||||
import './generator';
|
import "./generator";
|
||||||
import './loops';
|
import "./loops";
|
||||||
import './sensebox-sensors';
|
import "./sensebox-sensors";
|
||||||
import './sensebox-telegram';
|
import "./sensebox-telegram";
|
||||||
import './sensebox-osem';
|
import "./sensebox-osem";
|
||||||
import './sensebox-web';
|
import "./sensebox-web";
|
||||||
import './sensebox-display';
|
import "./sensebox-display";
|
||||||
import './sensebox-lora';
|
import "./sensebox-lora";
|
||||||
import './sensebox-led';
|
import "./sensebox-led";
|
||||||
import './sensebox-sd';
|
import "./sensebox";
|
||||||
import './mqtt';
|
import "./sensebox-rtc";
|
||||||
import './logic';
|
import "./sensebox-ble";
|
||||||
import './text';
|
import "./sensebox-sd";
|
||||||
import './math';
|
import "./mqtt";
|
||||||
import './map';
|
import "./logic";
|
||||||
import './io';
|
import "./text";
|
||||||
import './audio';
|
import "./math";
|
||||||
import './procedures';
|
import "./map";
|
||||||
import './time';
|
import "./io";
|
||||||
import './variables';
|
import "./audio";
|
||||||
import './lists';
|
import "./procedures";
|
||||||
import './webserver';
|
import "./time";
|
||||||
|
import "./variables";
|
||||||
|
import "./lists";
|
||||||
|
import "./webserver";
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
|
import * as Blockly from "blockly/core";
|
||||||
import * as Blockly from 'blockly/core';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license Licensed under the Apache License, Version 2.0 (the "License"):
|
* @license Licensed under the Apache License, Version 2.0 (the "License"):
|
||||||
@@ -19,13 +18,13 @@ import * as Blockly from 'blockly/core';
|
|||||||
* @param {!Blockly.Block} block Block to generate the code from.
|
* @param {!Blockly.Block} block Block to generate the code from.
|
||||||
* @return {array} Completed code with order of operation.
|
* @return {array} Completed code with order of operation.
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino['math_number'] = function (block) {
|
Blockly.Arduino["math_number"] = function (block) {
|
||||||
// Numeric value.
|
// Numeric value.
|
||||||
var code = parseFloat(block.getFieldValue('NUM'));
|
var code = parseFloat(block.getFieldValue("NUM"));
|
||||||
if (code === Infinity) {
|
if (code === Infinity) {
|
||||||
code = 'INFINITY';
|
code = "INFINITY";
|
||||||
} else if (code === -Infinity) {
|
} else if (code === -Infinity) {
|
||||||
code = '-INFINITY';
|
code = "-INFINITY";
|
||||||
}
|
}
|
||||||
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
};
|
};
|
||||||
@@ -37,23 +36,23 @@ Blockly.Arduino['math_number'] = function (block) {
|
|||||||
* @param {!Blockly.Block} block Block to generate the code from.
|
* @param {!Blockly.Block} block Block to generate the code from.
|
||||||
* @return {array} Completed code with order of operation.
|
* @return {array} Completed code with order of operation.
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino['math_arithmetic'] = function (block) {
|
Blockly.Arduino["math_arithmetic"] = function (block) {
|
||||||
var OPERATORS = {
|
var OPERATORS = {
|
||||||
ADD: [' + ', Blockly.Arduino.ORDER_ADDITIVE],
|
ADD: [" + ", Blockly.Arduino.ORDER_ADDITIVE],
|
||||||
MINUS: [' - ', Blockly.Arduino.ORDER_ADDITIVE],
|
MINUS: [" - ", Blockly.Arduino.ORDER_ADDITIVE],
|
||||||
MULTIPLY: [' * ', Blockly.Arduino.ORDER_MULTIPLICATIVE],
|
MULTIPLY: [" * ", Blockly.Arduino.ORDER_MULTIPLICATIVE],
|
||||||
DIVIDE: [' / ', Blockly.Arduino.ORDER_MULTIPLICATIVE],
|
DIVIDE: [" / ", Blockly.Arduino.ORDER_MULTIPLICATIVE],
|
||||||
POWER: [null, Blockly.Arduino.ORDER_NONE] // Handle power separately.
|
POWER: [null, Blockly.Arduino.ORDER_NONE], // Handle power separately.
|
||||||
};
|
};
|
||||||
var tuple = OPERATORS[block.getFieldValue('OP')];
|
var tuple = OPERATORS[block.getFieldValue("OP")];
|
||||||
var operator = tuple[0];
|
var operator = tuple[0];
|
||||||
var order = tuple[1];
|
var order = tuple[1];
|
||||||
var argument0 = Blockly.Arduino.valueToCode(block, 'A', order) || '0';
|
var argument0 = Blockly.Arduino.valueToCode(block, "A", order) || "0";
|
||||||
var argument1 = Blockly.Arduino.valueToCode(block, 'B', order) || '0';
|
var argument1 = Blockly.Arduino.valueToCode(block, "B", order) || "0";
|
||||||
var code;
|
var code;
|
||||||
// Power in C++ requires a special case since it has no operator.
|
// Power in C++ requires a special case since it has no operator.
|
||||||
if (!operator) {
|
if (!operator) {
|
||||||
code = 'Math.pow(' + argument0 + ', ' + argument1 + ')';
|
code = "Math.pow(" + argument0 + ", " + argument1 + ")";
|
||||||
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
|
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
|
||||||
}
|
}
|
||||||
code = argument0 + operator + argument1;
|
code = argument0 + operator + argument1;
|
||||||
@@ -66,65 +65,78 @@ Blockly.Arduino['math_arithmetic'] = function (block) {
|
|||||||
* @param {!Blockly.Block} block Block to generate the code from.
|
* @param {!Blockly.Block} block Block to generate the code from.
|
||||||
* @return {array} Completed code with order of operation.
|
* @return {array} Completed code with order of operation.
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino['math_single'] = function (block) {
|
Blockly.Arduino["math_single"] = function (block) {
|
||||||
var operator = block.getFieldValue('OP');
|
var operator = block.getFieldValue("OP");
|
||||||
var code;
|
var code;
|
||||||
var arg;
|
var arg;
|
||||||
if (operator === 'NEG') {
|
if (operator === "NEG") {
|
||||||
// Negation is a special case given its different operator precedents.
|
// Negation is a special case given its different operator precedents.
|
||||||
arg = Blockly.Arduino.valueToCode(block, 'NUM',
|
arg =
|
||||||
Blockly.Arduino.ORDER_UNARY_PREFIX) || '0';
|
Blockly.Arduino.valueToCode(
|
||||||
if (arg[0] === '-') {
|
block,
|
||||||
|
"NUM",
|
||||||
|
Blockly.Arduino.ORDER_UNARY_PREFIX
|
||||||
|
) || "0";
|
||||||
|
if (arg[0] === "-") {
|
||||||
// --3 is not legal in C++ in this context.
|
// --3 is not legal in C++ in this context.
|
||||||
arg = ' ' + arg;
|
arg = " " + arg;
|
||||||
}
|
}
|
||||||
code = '-' + arg;
|
code = "-" + arg;
|
||||||
return [code, Blockly.Arduino.ORDER_UNARY_PREFIX];
|
return [code, Blockly.Arduino.ORDER_UNARY_PREFIX];
|
||||||
}
|
}
|
||||||
if (operator === 'ABS' || operator.substring(0, 5) === 'ROUND') {
|
if (operator === "ABS" || operator.substring(0, 5) === "ROUND") {
|
||||||
arg = Blockly.Arduino.valueToCode(block, 'NUM',
|
arg =
|
||||||
Blockly.Arduino.ORDER_UNARY_POSTFIX) || '0';
|
Blockly.Arduino.valueToCode(
|
||||||
} else if (operator === 'SIN' || operator === 'COS' || operator === 'TAN') {
|
block,
|
||||||
arg = Blockly.Arduino.valueToCode(block, 'NUM',
|
"NUM",
|
||||||
Blockly.Arduino.ORDER_MULTIPLICATIVE) || '0';
|
Blockly.Arduino.ORDER_UNARY_POSTFIX
|
||||||
|
) || "0";
|
||||||
|
} else if (operator === "SIN" || operator === "COS" || operator === "TAN") {
|
||||||
|
arg =
|
||||||
|
Blockly.Arduino.valueToCode(
|
||||||
|
block,
|
||||||
|
"NUM",
|
||||||
|
Blockly.Arduino.ORDER_MULTIPLICATIVE
|
||||||
|
) || "0";
|
||||||
} else {
|
} else {
|
||||||
arg = Blockly.Arduino.valueToCode(block, 'NUM',
|
arg =
|
||||||
Blockly.Arduino.ORDER_NONE) || '0';
|
Blockly.Arduino.valueToCode(block, "NUM", Blockly.Arduino.ORDER_NONE) ||
|
||||||
|
"0";
|
||||||
}
|
}
|
||||||
// First, handle cases which generate values that don't need parentheses.
|
// First, handle cases which generate values that don't need parentheses.
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case 'ABS':
|
case "ABS":
|
||||||
code = 'abs(' + arg + ')';
|
code = "abs(" + arg + ")";
|
||||||
break;
|
break;
|
||||||
case 'ROOT':
|
case "ROOT":
|
||||||
code = 'sqrt(' + arg + ')';
|
code = "sqrt(" + arg + ")";
|
||||||
break;
|
break;
|
||||||
case 'LN':
|
case "LN":
|
||||||
code = 'log(' + arg + ')';
|
code = "log(" + arg + ")";
|
||||||
break;
|
break;
|
||||||
case 'EXP':
|
case "EXP":
|
||||||
code = 'exp(' + arg + ')';
|
code = "exp(" + arg + ")";
|
||||||
break;
|
break;
|
||||||
case 'POW10':
|
case "POW10":
|
||||||
code = 'pow(10,' + arg + ')';
|
code = "pow(10," + arg + ")";
|
||||||
break;
|
break;
|
||||||
case 'ROUND':
|
case "ROUND":
|
||||||
code = 'round(' + arg + ')';
|
code = "round(" + arg + ")";
|
||||||
break;
|
break;
|
||||||
case 'ROUNDUP':
|
case "ROUNDUP":
|
||||||
code = 'ceil(' + arg + ')';
|
code = "ceil(" + arg + ")";
|
||||||
break;
|
break;
|
||||||
case 'ROUNDDOWN':
|
case "ROUNDDOWN":
|
||||||
code = 'floor(' + arg + ')';
|
code = "floor(" + arg + ")";
|
||||||
break;
|
break;
|
||||||
case 'SIN':
|
case "SIN":
|
||||||
code = 'sin(' + arg + ' / 180 * Math.PI)';
|
code = "sin(" + arg + " / 180 * Math.PI)";
|
||||||
break;
|
break;
|
||||||
case 'COS':
|
case "COS":
|
||||||
code = 'cos(' + arg + ' / 180 * Math.PI)';
|
code = "cos(" + arg + " / 180 * Math.PI)";
|
||||||
break;
|
break;
|
||||||
case 'TAN':
|
case "TAN":
|
||||||
code = 'tan(' + arg + ' / 180 * Math.PI)';
|
code = "tan(" + arg + " / 180 * Math.PI)";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -134,20 +146,20 @@ Blockly.Arduino['math_single'] = function (block) {
|
|||||||
}
|
}
|
||||||
// Second, handle cases which generate values that may need parentheses.
|
// Second, handle cases which generate values that may need parentheses.
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case 'LOG10':
|
case "LOG10":
|
||||||
code = 'log(' + arg + ') / log(10)';
|
code = "log(" + arg + ") / log(10)";
|
||||||
break;
|
break;
|
||||||
case 'ASIN':
|
case "ASIN":
|
||||||
code = 'asin(' + arg + ') / M_PI * 180';
|
code = "asin(" + arg + ") / M_PI * 180";
|
||||||
break;
|
break;
|
||||||
case 'ACOS':
|
case "ACOS":
|
||||||
code = 'acos(' + arg + ') / M_PI * 180';
|
code = "acos(" + arg + ") / M_PI * 180";
|
||||||
break;
|
break;
|
||||||
case 'ATAN':
|
case "ATAN":
|
||||||
code = 'atan(' + arg + ') / M_PI * 180';
|
code = "atan(" + arg + ") / M_PI * 180";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error('Unknown math operator: ' + operator);
|
throw new Error("Unknown math operator: " + operator);
|
||||||
}
|
}
|
||||||
return [code, Blockly.Arduino.ORDER_MULTIPLICATIVE];
|
return [code, Blockly.Arduino.ORDER_MULTIPLICATIVE];
|
||||||
};
|
};
|
||||||
@@ -161,16 +173,16 @@ Blockly.Arduino['math_single'] = function (block) {
|
|||||||
* @param {!Blockly.Block} block Block to generate the code from.
|
* @param {!Blockly.Block} block Block to generate the code from.
|
||||||
* @return {string} Completed code.
|
* @return {string} Completed code.
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino['math_constant'] = function (block) {
|
Blockly.Arduino["math_constant"] = function (block) {
|
||||||
var CONSTANTS = {
|
var CONSTANTS = {
|
||||||
'PI': ['M_PI', Blockly.Arduino.ORDER_UNARY_POSTFIX],
|
PI: ["M_PI", Blockly.Arduino.ORDER_UNARY_POSTFIX],
|
||||||
'E': ['M_E', Blockly.Arduino.ORDER_UNARY_POSTFIX],
|
E: ["M_E", Blockly.Arduino.ORDER_UNARY_POSTFIX],
|
||||||
'GOLDEN_RATIO': ['(1 + sqrt(5)) / 2', Blockly.Arduino.ORDER_MULTIPLICATIVE],
|
GOLDEN_RATIO: ["(1 + sqrt(5)) / 2", Blockly.Arduino.ORDER_MULTIPLICATIVE],
|
||||||
'SQRT2': ['M_SQRT2', Blockly.Arduino.ORDER_UNARY_POSTFIX],
|
SQRT2: ["M_SQRT2", Blockly.Arduino.ORDER_UNARY_POSTFIX],
|
||||||
'SQRT1_2': ['M_SQRT1_2', Blockly.Arduino.ORDER_UNARY_POSTFIX],
|
SQRT1_2: ["M_SQRT1_2", Blockly.Arduino.ORDER_UNARY_POSTFIX],
|
||||||
'INFINITY': ['INFINITY', Blockly.Arduino.ORDER_ATOMIC]
|
INFINITY: ["INFINITY", Blockly.Arduino.ORDER_ATOMIC],
|
||||||
};
|
};
|
||||||
return CONSTANTS[block.getFieldValue('CONSTANT')];
|
return CONSTANTS[block.getFieldValue("CONSTANT")];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,58 +192,67 @@ Blockly.Arduino['math_constant'] = function (block) {
|
|||||||
* @param {!Blockly.Block} block Block to generate the code from.
|
* @param {!Blockly.Block} block Block to generate the code from.
|
||||||
* @return {array} Completed code with order of operation.
|
* @return {array} Completed code with order of operation.
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino['math_number_property'] = function (block) {
|
Blockly.Arduino["math_number_property"] = function (block) {
|
||||||
var number_to_check = Blockly.Arduino.valueToCode(block, 'NUMBER_TO_CHECK',
|
var number_to_check =
|
||||||
Blockly.Arduino.ORDER_MULTIPLICATIVE) || '0';
|
Blockly.Arduino.valueToCode(
|
||||||
var dropdown_property = block.getFieldValue('PROPERTY');
|
block,
|
||||||
|
"NUMBER_TO_CHECK",
|
||||||
|
Blockly.Arduino.ORDER_MULTIPLICATIVE
|
||||||
|
) || "0";
|
||||||
|
var dropdown_property = block.getFieldValue("PROPERTY");
|
||||||
var code;
|
var code;
|
||||||
if (dropdown_property === 'PRIME') {
|
if (dropdown_property === "PRIME") {
|
||||||
var func = [
|
var func = [
|
||||||
'boolean ' + Blockly.Arduino.DEF_FUNC_NAME + '(int n) {',
|
"boolean " + Blockly.Arduino.DEF_FUNC_NAME + "(int n) {",
|
||||||
' // https://en.wikipedia.org/wiki/Primality_test#Naive_methods',
|
" // https://en.wikipedia.org/wiki/Primality_test#Naive_methods",
|
||||||
' if (n == 2 || n == 3) {',
|
" if (n == 2 || n == 3) {",
|
||||||
' return true;',
|
" return true;",
|
||||||
' }',
|
" }",
|
||||||
' // False if n is NaN, negative, is 1.',
|
" // False if n is NaN, negative, is 1.",
|
||||||
' // And false if n is divisible by 2 or 3.',
|
" // And false if n is divisible by 2 or 3.",
|
||||||
' if (isnan(n) || (n <= 1) || (n == 1) || (n % 2 == 0) || ' +
|
" if (isnan(n) || (n <= 1) || (n == 1) || (n % 2 == 0) || " +
|
||||||
'(n % 3 == 0)) {',
|
"(n % 3 == 0)) {",
|
||||||
' return false;',
|
" return false;",
|
||||||
' }',
|
" }",
|
||||||
' // Check all the numbers of form 6k +/- 1, up to sqrt(n).',
|
" // Check all the numbers of form 6k +/- 1, up to sqrt(n).",
|
||||||
' for (int x = 6; x <= sqrt(n) + 1; x += 6) {',
|
" for (int x = 6; x <= sqrt(n) + 1; x += 6) {",
|
||||||
' if (n % (x - 1) == 0 || n % (x + 1) == 0) {',
|
" if (n % (x - 1) == 0 || n % (x + 1) == 0) {",
|
||||||
' return false;',
|
" return false;",
|
||||||
' }',
|
" }",
|
||||||
' }',
|
" }",
|
||||||
' return true;',
|
" return true;",
|
||||||
'}'];
|
"}",
|
||||||
var funcName = Blockly.Arduino.addFunction('mathIsPrime', func.join('\n'));
|
];
|
||||||
Blockly.Arduino.addInclude('math', '#include <math.h>');
|
var funcName = Blockly.Arduino.addFunction("mathIsPrime", func.join("\n"));
|
||||||
code = funcName + '(' + number_to_check + ')';
|
Blockly.Arduino.addInclude("math", "#include <math.h>");
|
||||||
|
code = funcName + "(" + number_to_check + ")";
|
||||||
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
|
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
|
||||||
}
|
}
|
||||||
switch (dropdown_property) {
|
switch (dropdown_property) {
|
||||||
case 'EVEN':
|
case "EVEN":
|
||||||
code = number_to_check + ' % 2 == 0';
|
code = number_to_check + " % 2 == 0";
|
||||||
break;
|
break;
|
||||||
case 'ODD':
|
case "ODD":
|
||||||
code = number_to_check + ' % 2 == 1';
|
code = number_to_check + " % 2 == 1";
|
||||||
break;
|
break;
|
||||||
case 'WHOLE':
|
case "WHOLE":
|
||||||
Blockly.Arduino.addInclude('math', '#include <math.h>');
|
Blockly.Arduino.addInclude("math", "#include <math.h>");
|
||||||
code = '(floor(' + number_to_check + ') == ' + number_to_check + ')';
|
code = "(floor(" + number_to_check + ") == " + number_to_check + ")";
|
||||||
break;
|
break;
|
||||||
case 'POSITIVE':
|
case "POSITIVE":
|
||||||
code = number_to_check + ' > 0';
|
code = number_to_check + " > 0";
|
||||||
break;
|
break;
|
||||||
case 'NEGATIVE':
|
case "NEGATIVE":
|
||||||
code = number_to_check + ' < 0';
|
code = number_to_check + " < 0";
|
||||||
break;
|
break;
|
||||||
case 'DIVISIBLE_BY':
|
case "DIVISIBLE_BY":
|
||||||
var divisor = Blockly.Arduino.valueToCode(block, 'DIVISOR',
|
var divisor =
|
||||||
Blockly.Arduino.ORDER_MULTIPLICATIVE) || '0';
|
Blockly.Arduino.valueToCode(
|
||||||
code = number_to_check + ' % ' + divisor + ' == 0';
|
block,
|
||||||
|
"DIVISOR",
|
||||||
|
Blockly.Arduino.ORDER_MULTIPLICATIVE
|
||||||
|
) || "0";
|
||||||
|
code = number_to_check + " % " + divisor + " == 0";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -247,19 +268,25 @@ Blockly.Arduino['math_number_property'] = function (block) {
|
|||||||
* @param {!Blockly.Block} block Block to generate the code from.
|
* @param {!Blockly.Block} block Block to generate the code from.
|
||||||
* @return {array} Completed code with order of operation.
|
* @return {array} Completed code with order of operation.
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino['math_change'] = function (block) {
|
Blockly.Arduino["math_change"] = function (block) {
|
||||||
var argument0 = Blockly.Arduino.valueToCode(block, 'DELTA',
|
var argument0 =
|
||||||
Blockly.Arduino.ORDER_ADDITIVE) || '0';
|
Blockly.Arduino.valueToCode(
|
||||||
|
block,
|
||||||
|
"DELTA",
|
||||||
|
Blockly.Arduino.ORDER_ADDITIVE
|
||||||
|
) || "0";
|
||||||
var varName = Blockly.Arduino.variableDB_.getName(
|
var varName = Blockly.Arduino.variableDB_.getName(
|
||||||
block.getFieldValue('VAR'), Blockly.Variables.NAME_TYPE);
|
block.getFieldValue("VAR"),
|
||||||
return varName + ' += ' + argument0 + ';\n';
|
Blockly.Variables.NAME_TYPE
|
||||||
|
);
|
||||||
|
return varName + " += " + argument0 + ";\n";
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Rounding functions have a single operand. */
|
/** Rounding functions have a single operand. */
|
||||||
Blockly.Arduino['math_round'] = Blockly.Arduino['math_single'];
|
Blockly.Arduino["math_round"] = Blockly.Arduino["math_single"];
|
||||||
|
|
||||||
/** Trigonometry functions have a single operand. */
|
/** Trigonometry functions have a single operand. */
|
||||||
Blockly.Arduino['math_trig'] = Blockly.Arduino['math_single'];
|
Blockly.Arduino["math_trig"] = Blockly.Arduino["math_single"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generator for the math function to a list.
|
* Generator for the math function to a list.
|
||||||
@@ -268,7 +295,7 @@ Blockly.Arduino['math_trig'] = Blockly.Arduino['math_single'];
|
|||||||
* @param {!Blockly.Block} block Block to generate the code from.
|
* @param {!Blockly.Block} block Block to generate the code from.
|
||||||
* @return {array} Completed code with order of operation.
|
* @return {array} Completed code with order of operation.
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino['math_on_list'] = Blockly.Arduino.noGeneratorCodeInline;
|
Blockly.Arduino["math_on_list"] = Blockly.Arduino.noGeneratorCodeInline;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generator for the math modulo function (calculates remainder of X/Y).
|
* Generator for the math modulo function (calculates remainder of X/Y).
|
||||||
@@ -276,12 +303,20 @@ Blockly.Arduino['math_on_list'] = Blockly.Arduino.noGeneratorCodeInline;
|
|||||||
* @param {!Blockly.Block} block Block to generate the code from.
|
* @param {!Blockly.Block} block Block to generate the code from.
|
||||||
* @return {array} Completed code with order of operation.
|
* @return {array} Completed code with order of operation.
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino['math_modulo'] = function (block) {
|
Blockly.Arduino["math_modulo"] = function (block) {
|
||||||
var argument0 = Blockly.Arduino.valueToCode(block, 'DIVIDEND',
|
var argument0 =
|
||||||
Blockly.Arduino.ORDER_MULTIPLICATIVE) || '0';
|
Blockly.Arduino.valueToCode(
|
||||||
var argument1 = Blockly.Arduino.valueToCode(block, 'DIVISOR',
|
block,
|
||||||
Blockly.Arduino.ORDER_MULTIPLICATIVE) || '0';
|
"DIVIDEND",
|
||||||
var code = argument0 + ' % ' + argument1;
|
Blockly.Arduino.ORDER_MULTIPLICATIVE
|
||||||
|
) || "0";
|
||||||
|
var argument1 =
|
||||||
|
Blockly.Arduino.valueToCode(
|
||||||
|
block,
|
||||||
|
"DIVISOR",
|
||||||
|
Blockly.Arduino.ORDER_MULTIPLICATIVE
|
||||||
|
) || "0";
|
||||||
|
var code = argument0 + " % " + argument1;
|
||||||
return [code, Blockly.Arduino.ORDER_MULTIPLICATIVE];
|
return [code, Blockly.Arduino.ORDER_MULTIPLICATIVE];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -291,17 +326,33 @@ Blockly.Arduino['math_modulo'] = function (block) {
|
|||||||
* @param {!Blockly.Block} block Block to generate the code from.
|
* @param {!Blockly.Block} block Block to generate the code from.
|
||||||
* @return {array} Completed code with order of operation.
|
* @return {array} Completed code with order of operation.
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino['math_constrain'] = function (block) {
|
Blockly.Arduino["math_constrain"] = function (block) {
|
||||||
// Constrain a number between two limits.
|
// Constrain a number between two limits.
|
||||||
var argument0 = Blockly.Arduino.valueToCode(block, 'VALUE',
|
var argument0 =
|
||||||
Blockly.Arduino.ORDER_NONE) || '0';
|
Blockly.Arduino.valueToCode(block, "VALUE", Blockly.Arduino.ORDER_NONE) ||
|
||||||
var argument1 = Blockly.Arduino.valueToCode(block, 'LOW',
|
"0";
|
||||||
Blockly.Arduino.ORDER_NONE) || '0';
|
var argument1 =
|
||||||
var argument2 = Blockly.Arduino.valueToCode(block, 'HIGH',
|
Blockly.Arduino.valueToCode(block, "LOW", Blockly.Arduino.ORDER_NONE) ||
|
||||||
Blockly.Arduino.ORDER_NONE) || '0';
|
"0";
|
||||||
var code = '(' + argument0 + ' < ' + argument1 + ' ? ' + argument1 +
|
var argument2 =
|
||||||
' : ( ' + argument0 + ' > ' + argument2 + ' ? ' + argument2 + ' : ' +
|
Blockly.Arduino.valueToCode(block, "HIGH", Blockly.Arduino.ORDER_NONE) ||
|
||||||
argument0 + '))';
|
"0";
|
||||||
|
var code =
|
||||||
|
"(" +
|
||||||
|
argument0 +
|
||||||
|
" < " +
|
||||||
|
argument1 +
|
||||||
|
" ? " +
|
||||||
|
argument1 +
|
||||||
|
" : ( " +
|
||||||
|
argument0 +
|
||||||
|
" > " +
|
||||||
|
argument2 +
|
||||||
|
" ? " +
|
||||||
|
argument2 +
|
||||||
|
" : " +
|
||||||
|
argument0 +
|
||||||
|
"))";
|
||||||
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
|
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -312,28 +363,26 @@ Blockly.Arduino['math_constrain'] = function (block) {
|
|||||||
* @param {!Blockly.Block} block Block to generate the code from.
|
* @param {!Blockly.Block} block Block to generate the code from.
|
||||||
* @return {array} Completed code with order of operation.
|
* @return {array} Completed code with order of operation.
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino['math_random_int'] = function (block) {
|
Blockly.Arduino["math_random_int"] = function (block) {
|
||||||
var argument0 = Blockly.Arduino.valueToCode(block, 'FROM',
|
var argument0 =
|
||||||
Blockly.Arduino.ORDER_NONE) || '0';
|
Blockly.Arduino.valueToCode(block, "FROM", Blockly.Arduino.ORDER_NONE) ||
|
||||||
var argument1 = Blockly.Arduino.valueToCode(block, 'TO',
|
"0";
|
||||||
Blockly.Arduino.ORDER_NONE) || '0';
|
var argument1 =
|
||||||
var functionName = Blockly.Arduino.variableDB_.getDistinctName(
|
Blockly.Arduino.valueToCode(block, "TO", Blockly.Arduino.ORDER_NONE) || "0";
|
||||||
'math_random_int', Blockly.Generator.NAME_TYPE);
|
Blockly.Arduino.setupCode_["init_rand"] = "randomSeed(analogRead(0));";
|
||||||
Blockly.Arduino.setups_['init_rand'] = 'randomSeed(analogRead(0));';
|
Blockly.Arduino.functionNames_[
|
||||||
Blockly.Arduino.math_random_int.random_function = functionName;
|
"math_random_int"
|
||||||
var func = [
|
] = `int mathRandomInt (int min, int max) {\n
|
||||||
'int ' + Blockly.Arduino.DEF_FUNC_NAME + '(int min, int max) {',
|
if (min > max) {
|
||||||
' if (min > max) {',
|
int temp = min;
|
||||||
' // Swap min and max to ensure min is smaller.',
|
min = max;
|
||||||
' int temp = min;',
|
max = temp;
|
||||||
' min = max;',
|
}
|
||||||
' max = temp;',
|
return min + (rand() % (max - min + 1));
|
||||||
' }',
|
}
|
||||||
' return min + (rand() % (max - min + 1));',
|
`;
|
||||||
'}'];
|
var code = `mathRandomInt(${argument0},${argument1});`;
|
||||||
var funcName = Blockly.Arduino.addFunction('mathRandomInt', func.join('\n'));
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
var code = funcName + '(' + argument0 + ', ' + argument1 + ')';
|
|
||||||
return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -342,6 +391,6 @@ Blockly.Arduino['math_random_int'] = function (block) {
|
|||||||
* @param {!Blockly.Block} block Block to generate the code from.
|
* @param {!Blockly.Block} block Block to generate the code from.
|
||||||
* @return {string} Completed code.
|
* @return {string} Completed code.
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino['math_random_float'] = function (block) {
|
Blockly.Arduino["math_random_float"] = function (block) {
|
||||||
return ['(rand() / RAND_MAX)', Blockly.Arduino.ORDER_UNARY_POSTFIX];
|
return ["(rand() / RAND_MAX)", Blockly.Arduino.ORDER_UNARY_POSTFIX];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ Blockly.Arduino.sensebox_mqtt_publish = function (block) {
|
|||||||
Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, "/"USERNAME"/' + feedname + '");'
|
Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, "/"USERNAME"/' + feedname + '");'
|
||||||
break;
|
break;
|
||||||
case 'custom':
|
case 'custom':
|
||||||
Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, ' + feedname + ');'
|
Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, "' + feedname + '");'
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -78,3 +78,4 @@ Blockly.Arduino.sensebox_mqtt_subscribe = function (block) {
|
|||||||
var code = '';
|
var code = '';
|
||||||
return code;
|
return code;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ Blockly.Arduino['procedures_defreturn'] = function (block) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function translateType(type) {
|
function translateType(type) {
|
||||||
console.log(type);
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
||||||
case 'int':
|
case 'int':
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
import * as Blockly from "blockly/core";
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_phyphox_init = function () {
|
||||||
|
var name = this.getFieldValue("devicename");
|
||||||
|
Blockly.Arduino.libraries_["phyphox_library"] = `#include <phyphoxBle.h>`;
|
||||||
|
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
|
||||||
|
'#include "SenseBoxMCU.h"';
|
||||||
|
Blockly.Arduino.phyphoxSetupCode_[
|
||||||
|
"phyphox_start"
|
||||||
|
] = `PhyphoxBLE::start("${name}");`;
|
||||||
|
var code = ``;
|
||||||
|
return code;
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_phyphox_experiment = function () {
|
||||||
|
var experimentname = "experiment";
|
||||||
|
var title = this.getFieldValue("title").replace(/[^a-zA-Z0-9]/g, "");
|
||||||
|
var description = this.getFieldValue("description");
|
||||||
|
var branch = Blockly.Arduino.statementToCode(this, "view");
|
||||||
|
Blockly.Arduino.phyphoxSetupCode_[
|
||||||
|
`PhyphoxBleExperiment_${experimentname}`
|
||||||
|
] = `PhyphoxBleExperiment ${experimentname};`;
|
||||||
|
Blockly.Arduino.phyphoxSetupCode_[
|
||||||
|
`setTitle_${title}`
|
||||||
|
] = `${experimentname}.setTitle("${title}");`;
|
||||||
|
Blockly.Arduino.phyphoxSetupCode_[
|
||||||
|
`setCategory_senseBoxExperiments}`
|
||||||
|
] = `${experimentname}.setCategory("senseBox Experimente");`;
|
||||||
|
Blockly.Arduino.phyphoxSetupCode_[
|
||||||
|
`setDescription_${description}`
|
||||||
|
] = `${experimentname}.setDescription("${description}");`;
|
||||||
|
Blockly.Arduino.phyphoxSetupCode_[
|
||||||
|
`addView_${experimentname}`
|
||||||
|
] = `PhyphoxBleExperiment::View firstView;\nfirstView.setLabel("Messwerte"); //Create a "view"`;
|
||||||
|
Blockly.Arduino.phyphoxSetupCode_[`addGraph`] = `${branch}`;
|
||||||
|
Blockly.Arduino.phyphoxSetupCode_[
|
||||||
|
`addView_firstview`
|
||||||
|
] = `${experimentname}.addView(firstView);`; //Attach view to experiment
|
||||||
|
Blockly.Arduino.phyphoxSetupCode_[
|
||||||
|
`addExperiment_${experimentname}`
|
||||||
|
] = `PhyphoxBLE::addExperiment(${experimentname});`; //Attach experiment to server
|
||||||
|
|
||||||
|
var code = ``;
|
||||||
|
return code;
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino["sensebox_phyphox_timestamp"] = function () {
|
||||||
|
var code = 0;
|
||||||
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino["sensebox_phyphox_channel"] = function () {
|
||||||
|
var channel = parseFloat(this.getFieldValue("channel"));
|
||||||
|
var code = channel;
|
||||||
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_phyphox_sendchannel = function (block) {
|
||||||
|
var channel = this.getFieldValue("channel");
|
||||||
|
var value =
|
||||||
|
Blockly.Arduino.valueToCode(this, "value", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
|
"1";
|
||||||
|
|
||||||
|
var code = `float channel${channel} = ${value};\n`;
|
||||||
|
return code;
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_phyphox_graph = function () {
|
||||||
|
var label = this.getFieldValue("label").replace(/[^a-zA-Z0-9]/g, "");
|
||||||
|
var unitx = this.getFieldValue("unitx");
|
||||||
|
var unity = this.getFieldValue("unity");
|
||||||
|
var labelx = this.getFieldValue("labelx");
|
||||||
|
var labely = this.getFieldValue("labely");
|
||||||
|
var style = this.getFieldValue("style");
|
||||||
|
var channelX =
|
||||||
|
Blockly.Arduino.valueToCode(
|
||||||
|
this,
|
||||||
|
"channel0",
|
||||||
|
Blockly.Arduino.ORDER_ATOMIC
|
||||||
|
) || 0;
|
||||||
|
var channelY =
|
||||||
|
Blockly.Arduino.valueToCode(
|
||||||
|
this,
|
||||||
|
"channel1",
|
||||||
|
Blockly.Arduino.ORDER_ATOMIC
|
||||||
|
) || 1;
|
||||||
|
|
||||||
|
var code = `PhyphoxBleExperiment::Graph ${label};\n`; //Create graph which will plot random numbers over time
|
||||||
|
code += `${label}.setLabel("${label}");\n`;
|
||||||
|
code += `${label}.setUnitX("${unitx}");\n`;
|
||||||
|
code += `${label}.setUnitY("${unity}");\n`;
|
||||||
|
code += `${label}.setLabelX("${labelx}");\n`;
|
||||||
|
code += `${label}.setLabelY("${labely}");\n`;
|
||||||
|
code += `${label}.setStyle("${style}");\n`;
|
||||||
|
code += `${label}.setChannel(${channelX}, ${channelY});\n`;
|
||||||
|
code += `firstView.addElement(${label});\n`;
|
||||||
|
return code;
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_phyphox_experiment_send = function () {
|
||||||
|
var branch = Blockly.Arduino.statementToCode(this, "sendValues");
|
||||||
|
var blocks = this.getDescendants();
|
||||||
|
console.log(blocks);
|
||||||
|
var count = 0;
|
||||||
|
if (blocks !== undefined) {
|
||||||
|
for (var i = 0; i < blocks.length; i++) {
|
||||||
|
if (blocks[i].type === "sensebox_phyphox_sendchannel") {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count === 5) {
|
||||||
|
}
|
||||||
|
var string = "";
|
||||||
|
|
||||||
|
for (var j = 1; j <= count; j++) {
|
||||||
|
console.log("append");
|
||||||
|
if (string === "") {
|
||||||
|
string += `channel${j}`;
|
||||||
|
} else if (string !== "") {
|
||||||
|
string += `, channel${j}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Blockly.Arduino.loopCodeOnce_["phyphox_poll"] = `PhyphoxBLE::poll();`;
|
||||||
|
var code = `${branch}\nPhyphoxBLE::write(${string});`;
|
||||||
|
return code;
|
||||||
|
};
|
||||||
@@ -10,37 +10,57 @@ Blockly.Arduino.sensebox_led = function () {
|
|||||||
|
|
||||||
Blockly.Arduino.sensebox_rgb_led = function () {
|
Blockly.Arduino.sensebox_rgb_led = function () {
|
||||||
var dropdown_pin = this.getFieldValue('PIN');
|
var dropdown_pin = this.getFieldValue('PIN');
|
||||||
var red = this.getFieldValue('RED') || '0'
|
var color = Blockly.Arduino.valueToCode(this, 'COLOR', Blockly.Arduino.ORDER_ATOMIC) || '0'
|
||||||
var green = this.getFieldValue('GREEN') || '0'
|
|
||||||
var blue = this.getFieldValue('BLUE') || '0'
|
|
||||||
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.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();';
|
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';
|
||||||
var code = 'rgb_led_' + dropdown_pin + '.setPixelColor(0,rgb_led_' + dropdown_pin + '.Color(' + red + ',' + green + ',' + blue + '));\n';
|
|
||||||
code += 'rgb_led_' + dropdown_pin + '.show();';
|
code += 'rgb_led_' + dropdown_pin + '.show();';
|
||||||
return code;
|
return code;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_ws2818_led = function () {
|
Blockly.Arduino.sensebox_ws2818_led_init = function () {
|
||||||
var dropdown_pin = this.getFieldValue('Port');
|
var dropdown_pin = this.getFieldValue('Port');
|
||||||
var blocks = Blockly.mainWorkspace.getAllBlocks();
|
var numPixel = Blockly.Arduino.valueToCode(this, 'NUMBER', Blockly.Arduino.ORDER_ATOMIC) || '1';
|
||||||
var count = 0;
|
|
||||||
for (var i = 0; i < blocks.length; i++) {
|
|
||||||
if (blocks[i].type === 'sensebox_ws2818_led' && blocks[i].getFieldValue('Port') === dropdown_pin) {
|
|
||||||
count++;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var numPixel = count;
|
|
||||||
var brightness = Blockly.Arduino.valueToCode(this, 'BRIGHTNESS', Blockly.Arduino.ORDER_ATOMIC) || '50'
|
var brightness = Blockly.Arduino.valueToCode(this, 'BRIGHTNESS', Blockly.Arduino.ORDER_ATOMIC) || '50'
|
||||||
var position = Blockly.Arduino.valueToCode(this, 'POSITION', Blockly.Arduino.ORDER_ATOMIC) || '0';
|
|
||||||
var red = Blockly.Arduino.valueToCode(this, 'RED', Blockly.Arduino.ORDER_ATOMIC) || '0'
|
|
||||||
var green = Blockly.Arduino.valueToCode(this, 'GREEN', Blockly.Arduino.ORDER_ATOMIC) || '0'
|
|
||||||
var blue = Blockly.Arduino.valueToCode(this, 'BLUE', Blockly.Arduino.ORDER_ATOMIC) || '0'
|
|
||||||
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.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' + dropdown_pin] = 'rgb_led_' + dropdown_pin + '.begin();\n';
|
||||||
Blockly.Arduino.setupCode_['setup_rgb_led_brightness' + dropdown_pin] = `rgb_led_${dropdown_pin}.setBrightness(${brightness});\n`;
|
Blockly.Arduino.setupCode_['setup_rgb_led_brightness' + dropdown_pin] = `rgb_led_${dropdown_pin}.setBrightness(${brightness});\n`;
|
||||||
var code = `rgb_led_${dropdown_pin}.setPixelColor(${position},rgb_led_${dropdown_pin}.Color(${red},${green},${blue}));\nrgb_led_${dropdown_pin}.show();\n`;
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_ws2818_led = function () {
|
||||||
|
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'
|
||||||
|
var code = `rgb_led_${dropdown_pin}.setPixelColor(${position},rgb_led_${dropdown_pin}.Color(${color}));\nrgb_led_${dropdown_pin}.show();\n`;
|
||||||
return code;
|
return code;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function hexToRgb(hex) {
|
||||||
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||||
|
return result ? {
|
||||||
|
r: parseInt(result[1], 16),
|
||||||
|
g: parseInt(result[2], 16),
|
||||||
|
b: parseInt(result[3], 16)
|
||||||
|
} : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Blockly.Arduino['colour_picker'] = function (block) {
|
||||||
|
const rgb = hexToRgb(block.getFieldValue('COLOUR'));
|
||||||
|
|
||||||
|
return [rgb.r + ', ' + rgb.g + ', ' + rgb.b, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino['colour_random'] = function (block) {
|
||||||
|
return ['random(0, 255), random(0, 255), random(0, 255)', Blockly.Arduino.ORDER_ATOMIC];
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino['colour_rgb'] = function (block) {
|
||||||
|
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);
|
||||||
|
|
||||||
|
return [red + ', ' + green + ', ' + blue, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
|
};
|
||||||
@@ -1,27 +1,27 @@
|
|||||||
import * as Blockly from 'blockly/core';
|
import * as Blockly from "blockly/core";
|
||||||
|
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_lora_initialize_otaa = function (block) {
|
Blockly.Arduino.sensebox_lora_initialize_otaa = function (block) {
|
||||||
var deivceID = this.getFieldValue('DEVICEID');
|
var deivceID = this.getFieldValue("DEVICEID");
|
||||||
var appID = this.getFieldValue('APPID');
|
var appID = this.getFieldValue("APPID");
|
||||||
var appKey = this.getFieldValue('APPKEY');
|
var appKey = this.getFieldValue("APPKEY");
|
||||||
var interval = this.getFieldValue('INTERVAL');
|
var interval = this.getFieldValue("INTERVAL");
|
||||||
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
|
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
|
||||||
Blockly.Arduino.libraries_['library_spi'] = '#include <SPI.h>';
|
'#include "SenseBoxMCU.h"';
|
||||||
Blockly.Arduino.libraries_['library_lmic'] = '#include <lmic.h>';
|
Blockly.Arduino.libraries_["library_spi"] = "#include <SPI.h>";
|
||||||
Blockly.Arduino.libraries_['library_hal'] = '#include <hal/hal.h>';
|
Blockly.Arduino.libraries_["library_lmic"] = "#include <lmic.h>";
|
||||||
Blockly.Arduino.definitions_['define_LoRaVariablesOTAA'] = `
|
Blockly.Arduino.libraries_["library_hal"] = "#include <hal/hal.h>";
|
||||||
static const u1_t PROGMEM APPEUI[8]= `+ appID + ` ;
|
Blockly.Arduino.definitions_["define_LoRaVariablesOTAA"] = `
|
||||||
|
static const u1_t PROGMEM APPEUI[8]= {${appID}};
|
||||||
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI , 8);}
|
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI , 8);}
|
||||||
|
|
||||||
static const u1_t PROGMEM DEVEUI[8]= `+ deivceID + `;
|
static const u1_t PROGMEM DEVEUI[8]= {${deivceID}};
|
||||||
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI , 8);}
|
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI , 8);}
|
||||||
|
|
||||||
// This key should be in big endian format (or, since it is not really a
|
// This key should be in big endian format (or, since it is not really a
|
||||||
// number but a block of memory, endianness does not really apply). In
|
// number but a block of memory, endianness does not really apply). In
|
||||||
// practice, a key taken from ttnctl can be copied as-is.
|
// practice, a key taken from ttnctl can be copied as-is.
|
||||||
// The key shown here is the semtech default key.
|
// The key shown here is the semtech default key.
|
||||||
static const u1_t PROGMEM APPKEY[16] = `+ appKey + `;
|
static const u1_t PROGMEM APPKEY[16] = {${appKey}};
|
||||||
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY , 16);}
|
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY , 16);}
|
||||||
|
|
||||||
static osjob_t sendjob;
|
static osjob_t sendjob;
|
||||||
@@ -38,7 +38,7 @@ Blockly.Arduino.sensebox_lora_initialize_otaa = function (block) {
|
|||||||
.dio = {PIN_XB1_INT, PIN_XB1_INT, LMIC_UNUSED_PIN},
|
.dio = {PIN_XB1_INT, PIN_XB1_INT, LMIC_UNUSED_PIN},
|
||||||
};`;
|
};`;
|
||||||
|
|
||||||
Blockly.Arduino.codeFunctions_['functions_initLora'] = `
|
Blockly.Arduino.codeFunctions_["functions_initLora"] = `
|
||||||
void initLora() {
|
void initLora() {
|
||||||
delay(2000);
|
delay(2000);
|
||||||
// LMIC init
|
// LMIC init
|
||||||
@@ -48,9 +48,9 @@ Blockly.Arduino.sensebox_lora_initialize_otaa = function (block) {
|
|||||||
|
|
||||||
// Start job (sending automatically starts OTAA too)
|
// Start job (sending automatically starts OTAA too)
|
||||||
do_send(&sendjob);
|
do_send(&sendjob);
|
||||||
}`
|
}`;
|
||||||
|
|
||||||
Blockly.Arduino.codeFunctions_['functions_onEvent'] = `
|
Blockly.Arduino.codeFunctions_["functions_onEvent"] = `
|
||||||
void onEvent (ev_t ev) {
|
void onEvent (ev_t ev) {
|
||||||
Serial.print(os_getTime());
|
Serial.print(os_getTime());
|
||||||
Serial.print(": ");
|
Serial.print(": ");
|
||||||
@@ -120,16 +120,18 @@ Blockly.Arduino.sensebox_lora_initialize_otaa = function (block) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
Blockly.Arduino.loraSetupCode_['initLora'] = 'initLora();\n';
|
Blockly.Arduino.loraSetupCode_["initLora"] = "initLora();\n";
|
||||||
Blockly.Arduino.setupCode_['serial.begin'] = 'Serial.begin(9600);\ndelay(1000);\n';
|
Blockly.Arduino.setupCode_["serial.begin"] =
|
||||||
var code = '';
|
"Serial.begin(9600);\ndelay(1000);\n";
|
||||||
|
var code = "";
|
||||||
return code;
|
return code;
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_lora_message_send = function (block) {
|
Blockly.Arduino.sensebox_lora_message_send = function (block) {
|
||||||
Blockly.Arduino.libraries_['library_lora_message'] = '#include <LoraMessage.h>';
|
Blockly.Arduino.libraries_["library_lora_message"] =
|
||||||
var lora_sensor_values = Blockly.Arduino.statementToCode(block, 'DO');
|
"#include <LoraMessage.h>";
|
||||||
Blockly.Arduino.functionNames_['functions_do_send'] = `
|
var lora_sensor_values = Blockly.Arduino.statementToCode(block, "DO");
|
||||||
|
Blockly.Arduino.functionNames_["functions_do_send"] = `
|
||||||
void do_send(osjob_t* j){
|
void do_send(osjob_t* j){
|
||||||
// Check if there is not a current TX/RX job running
|
// Check if there is not a current TX/RX job running
|
||||||
if (LMIC.opmode & OP_TXRXPEND) {
|
if (LMIC.opmode & OP_TXRXPEND) {
|
||||||
@@ -144,39 +146,41 @@ Blockly.Arduino.sensebox_lora_message_send = function (block) {
|
|||||||
}
|
}
|
||||||
// Next TX is scheduled after TX_COMPLETE event.
|
// Next TX is scheduled after TX_COMPLETE event.
|
||||||
}`;
|
}`;
|
||||||
Blockly.Arduino.loopCodeOnce_['os_runloop'] = 'os_runloop_once();'
|
Blockly.Arduino.loopCodeOnce_["os_runloop"] = "os_runloop_once();";
|
||||||
return ''
|
return "";
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block send Data to TTN
|
* Block send Data to TTN
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino.sensebox_send_lora_sensor_value = function (block) {
|
Blockly.Arduino.sensebox_send_lora_sensor_value = function (block) {
|
||||||
const reading = Blockly.Arduino.valueToCode(this, 'Value', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
|
const reading =
|
||||||
var messageBytes = this.getFieldValue('MESSAGE_BYTES');
|
Blockly.Arduino.valueToCode(this, "Value", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
var code = ''
|
'"Keine Eingabe"';
|
||||||
|
var messageBytes = this.getFieldValue("MESSAGE_BYTES");
|
||||||
|
var code = "";
|
||||||
switch (Number(messageBytes)) {
|
switch (Number(messageBytes)) {
|
||||||
case 1:
|
case 1:
|
||||||
code = `message.addUint8(${reading});\n`
|
code = `message.addUint8(${reading});\n`;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
code = `message.addUint16(${reading});\n`
|
code = `message.addUint16(${reading});\n`;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
code = `message.addUint8(${reading});
|
code = `message.addUint8(${reading});
|
||||||
message.addUint16(${reading} >> 8);\n`
|
message.addUint16(${reading} >> 8);\n`;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
code = `message.addUint16(${reading});\n`
|
code = `message.addUint16(${reading});\n`;
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_lora_cayenne_send = 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>";
|
||||||
Blockly.Arduino.variables_['variable_cayenne'] = 'CayenneLPP lpp(51);'
|
Blockly.Arduino.variables_["variable_cayenne"] = "CayenneLPP lpp(51);";
|
||||||
var lora_sensor_values = Blockly.Arduino.statementToCode(block, 'DO');
|
var lora_sensor_values = Blockly.Arduino.statementToCode(block, "DO");
|
||||||
Blockly.Arduino.functionNames_['functions_do_send'] = `
|
Blockly.Arduino.functionNames_["functions_do_send"] = `
|
||||||
void do_send(osjob_t* j){
|
void do_send(osjob_t* j){
|
||||||
// Check if there is not a current TX/RX job running
|
// Check if there is not a current TX/RX job running
|
||||||
if (LMIC.opmode & OP_TXRXPEND) {
|
if (LMIC.opmode & OP_TXRXPEND) {
|
||||||
@@ -191,18 +195,38 @@ Blockly.Arduino.sensebox_lora_cayenne_send = function (block) {
|
|||||||
}
|
}
|
||||||
// Next TX is scheduled after TX_COMPLETE event.
|
// Next TX is scheduled after TX_COMPLETE event.
|
||||||
}`;
|
}`;
|
||||||
Blockly.Arduino.loopCodeOnce_['os_runloop'] = 'os_runloop_once();'
|
Blockly.Arduino.loopCodeOnce_["os_runloop"] = "os_runloop_once();";
|
||||||
return '';
|
return "";
|
||||||
}
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_lora_ttn_mapper = function (block) {
|
Blockly.Arduino.sensebox_lora_ttn_mapper = function (block) {
|
||||||
var latitude = Blockly.Arduino.valueToCode(this, 'Latitude', Blockly.Arduino.ORDER_ATOMIC)
|
var latitude = Blockly.Arduino.valueToCode(
|
||||||
var longitude = Blockly.Arduino.valueToCode(this, 'Longitude', Blockly.Arduino.ORDER_ATOMIC)
|
this,
|
||||||
var altitude = Blockly.Arduino.valueToCode(this, 'Altitude', Blockly.Arduino.ORDER_ATOMIC)
|
"Latitude",
|
||||||
var pDOP = Blockly.Arduino.valueToCode(this, 'pDOP', Blockly.Arduino.ORDER_ATOMIC)
|
Blockly.Arduino.ORDER_ATOMIC
|
||||||
var fixType = Blockly.Arduino.valueToCode(this, 'Fix Type', Blockly.Arduino.ORDER_ATOMIC)
|
);
|
||||||
var fixTypeLimit = this.getFieldValue('dropdown');
|
var longitude = Blockly.Arduino.valueToCode(
|
||||||
Blockly.Arduino.functionNames_['functions_do_send'] = `
|
this,
|
||||||
|
"Longitude",
|
||||||
|
Blockly.Arduino.ORDER_ATOMIC
|
||||||
|
);
|
||||||
|
var altitude = Blockly.Arduino.valueToCode(
|
||||||
|
this,
|
||||||
|
"Altitude",
|
||||||
|
Blockly.Arduino.ORDER_ATOMIC
|
||||||
|
);
|
||||||
|
var pDOP = Blockly.Arduino.valueToCode(
|
||||||
|
this,
|
||||||
|
"pDOP",
|
||||||
|
Blockly.Arduino.ORDER_ATOMIC
|
||||||
|
);
|
||||||
|
var fixType = Blockly.Arduino.valueToCode(
|
||||||
|
this,
|
||||||
|
"Fix Type",
|
||||||
|
Blockly.Arduino.ORDER_ATOMIC
|
||||||
|
);
|
||||||
|
var fixTypeLimit = this.getFieldValue("dropdown");
|
||||||
|
Blockly.Arduino.functionNames_["functions_do_send"] = `
|
||||||
void do_send(osjob_t* j){
|
void do_send(osjob_t* j){
|
||||||
// Check if there is not a current TX/RX job running
|
// Check if there is not a current TX/RX job running
|
||||||
if (LMIC.opmode & OP_TXRXPEND) {
|
if (LMIC.opmode & OP_TXRXPEND) {
|
||||||
@@ -245,29 +269,30 @@ Blockly.Arduino.sensebox_lora_ttn_mapper = function (block) {
|
|||||||
}
|
}
|
||||||
// Next TX is scheduled after TX_COMPLETE event.
|
// Next TX is scheduled after TX_COMPLETE event.
|
||||||
}`;
|
}`;
|
||||||
Blockly.Arduino.loopCodeOnce_['os_runloop'] = 'os_runloop_once();'
|
Blockly.Arduino.loopCodeOnce_["os_runloop"] = "os_runloop_once();";
|
||||||
return '';
|
return "";
|
||||||
}
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_lora_initialize_abp = function (block) {
|
Blockly.Arduino.sensebox_lora_initialize_abp = function (block) {
|
||||||
var nwskey = this.getFieldValue('NWSKEY');
|
var nwskey = this.getFieldValue("NWSKEY");
|
||||||
var appskey = this.getFieldValue('APPSKEY');
|
var appskey = this.getFieldValue("APPSKEY");
|
||||||
var devaddr = this.getFieldValue('DEVADDR');
|
var devaddr = this.getFieldValue("DEVADDR");
|
||||||
var interval = this.getFieldValue('INTERVAL');
|
var interval = this.getFieldValue("INTERVAL");
|
||||||
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
|
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
|
||||||
Blockly.Arduino.libraries_['library_spi'] = '#include <SPI.h>';
|
'#include "SenseBoxMCU.h"';
|
||||||
Blockly.Arduino.libraries_['library_lmic'] = '#include <lmic.h>';
|
Blockly.Arduino.libraries_["library_spi"] = "#include <SPI.h>";
|
||||||
Blockly.Arduino.libraries_['library_hal'] = '#include <hal/hal.h>';
|
Blockly.Arduino.libraries_["library_lmic"] = "#include <lmic.h>";
|
||||||
Blockly.Arduino.definitions_['define_LoRaVariablesABP'] = `
|
Blockly.Arduino.libraries_["library_hal"] = "#include <hal/hal.h>";
|
||||||
|
Blockly.Arduino.definitions_["define_LoRaVariablesABP"] = `
|
||||||
// LoRaWAN NwkSKey, network session key
|
// LoRaWAN NwkSKey, network session key
|
||||||
// This is the default Semtech key, which is used by the early prototype TTN
|
// This is the default Semtech key, which is used by the early prototype TTN
|
||||||
// network.
|
// network.
|
||||||
static const PROGMEM u1_t NWKSKEY[16] = ${nwskey};
|
static const PROGMEM u1_t NWKSKEY[16] = { ${nwskey} };
|
||||||
|
|
||||||
// LoRaWAN AppSKey, application session key
|
// LoRaWAN AppSKey, application session key
|
||||||
// This is the default Semtech key, which is used by the early prototype TTN
|
// This is the default Semtech key, which is used by the early prototype TTN
|
||||||
// network.
|
// network.
|
||||||
static const u1_t PROGMEM APPSKEY[16] = ${appskey};
|
static const u1_t PROGMEM APPSKEY[16] = { ${appskey} };
|
||||||
|
|
||||||
// LoRaWAN end-device address (DevAddr)
|
// LoRaWAN end-device address (DevAddr)
|
||||||
static const u4_t DEVADDR = 0x${devaddr};
|
static const u4_t DEVADDR = 0x${devaddr};
|
||||||
@@ -293,7 +318,7 @@ Blockly.Arduino.sensebox_lora_initialize_abp = function (block) {
|
|||||||
.dio = {PIN_XB1_INT, PIN_XB1_INT, LMIC_UNUSED_PIN},
|
.dio = {PIN_XB1_INT, PIN_XB1_INT, LMIC_UNUSED_PIN},
|
||||||
};`;
|
};`;
|
||||||
|
|
||||||
Blockly.Arduino.codeFunctions_['functions_initLora'] = `
|
Blockly.Arduino.codeFunctions_["functions_initLora"] = `
|
||||||
void initLora() {
|
void initLora() {
|
||||||
delay(2000);
|
delay(2000);
|
||||||
// LMIC init
|
// LMIC init
|
||||||
@@ -359,9 +384,9 @@ Blockly.Arduino.sensebox_lora_initialize_abp = function (block) {
|
|||||||
|
|
||||||
// Start job
|
// Start job
|
||||||
do_send(&sendjob);
|
do_send(&sendjob);
|
||||||
}`
|
}`;
|
||||||
|
|
||||||
Blockly.Arduino.codeFunctions_['functions_onEvent'] = `
|
Blockly.Arduino.codeFunctions_["functions_onEvent"] = `
|
||||||
void onEvent (ev_t ev) {
|
void onEvent (ev_t ev) {
|
||||||
Serial.print(os_getTime());
|
Serial.print(os_getTime());
|
||||||
Serial.print(": ");
|
Serial.print(": ");
|
||||||
@@ -426,60 +451,77 @@ Blockly.Arduino.sensebox_lora_initialize_abp = function (block) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
Blockly.Arduino.loraSetupCode_['initLora'] = 'initLora();\n';
|
Blockly.Arduino.loraSetupCode_["initLora"] = "initLora();\n";
|
||||||
Blockly.Arduino.setupCode_['serial.begin'] = 'Serial.begin(9600);\ndelay(1000);\n';
|
Blockly.Arduino.setupCode_["serial.begin"] =
|
||||||
return '';
|
"Serial.begin(9600);\ndelay(1000);\n";
|
||||||
}
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_lora_cayenne_temperature = function (block) {
|
Blockly.Arduino.sensebox_lora_cayenne_temperature = function (block) {
|
||||||
var temperature = Blockly.Arduino.valueToCode(this, 'Value', Blockly.Arduino.ORDER_ATOMIC) || 0
|
var temperature =
|
||||||
var channel = this.getFieldValue('CHANNEL');
|
Blockly.Arduino.valueToCode(this, "Value", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
|
0;
|
||||||
|
var channel = this.getFieldValue("CHANNEL");
|
||||||
var code = `lpp.addTemperature(${channel}, ${temperature});\n`;
|
var code = `lpp.addTemperature(${channel}, ${temperature});\n`;
|
||||||
return code;
|
return code;
|
||||||
}
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_lora_cayenne_humidity = function (block) {
|
Blockly.Arduino.sensebox_lora_cayenne_humidity = function (block) {
|
||||||
var humidity = Blockly.Arduino.valueToCode(this, 'Value', Blockly.Arduino.ORDER_ATOMIC) || 0
|
var humidity =
|
||||||
var channel = this.getFieldValue('CHANNEL');
|
Blockly.Arduino.valueToCode(this, "Value", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
|
0;
|
||||||
|
var channel = this.getFieldValue("CHANNEL");
|
||||||
var code = `lpp.addRelativeHumidity(${channel}, ${humidity});\n`;
|
var code = `lpp.addRelativeHumidity(${channel}, ${humidity});\n`;
|
||||||
return code;
|
return code;
|
||||||
}
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_lora_cayenne_pressure = function (block) {
|
Blockly.Arduino.sensebox_lora_cayenne_pressure = function (block) {
|
||||||
var pressure = Blockly.Arduino.valueToCode(this, 'Value', Blockly.Arduino.ORDER_ATOMIC) || 0
|
var pressure =
|
||||||
var channel = this.getFieldValue('CHANNEL');
|
Blockly.Arduino.valueToCode(this, "Value", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
|
0;
|
||||||
|
var channel = this.getFieldValue("CHANNEL");
|
||||||
var code = `lpp.addBarometricPressure(${channel}, ${pressure});\n`;
|
var code = `lpp.addBarometricPressure(${channel}, ${pressure});\n`;
|
||||||
return code;
|
return code;
|
||||||
}
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_lora_cayenne_luminosity = function (block) {
|
Blockly.Arduino.sensebox_lora_cayenne_luminosity = function (block) {
|
||||||
var luminosity = Blockly.Arduino.valueToCode(this, 'Value', Blockly.Arduino.ORDER_ATOMIC) || 0
|
var luminosity =
|
||||||
var channel = this.getFieldValue('CHANNEL');
|
Blockly.Arduino.valueToCode(this, "Value", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
|
0;
|
||||||
|
var channel = this.getFieldValue("CHANNEL");
|
||||||
var code = `lpp.addLuminosity(${channel}, ${luminosity});\n`;
|
var code = `lpp.addLuminosity(${channel}, ${luminosity});\n`;
|
||||||
return code;
|
return code;
|
||||||
}
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_lora_cayenne_sensor = function (block) {
|
Blockly.Arduino.sensebox_lora_cayenne_sensor = function (block) {
|
||||||
var sensorValue = Blockly.Arduino.valueToCode(this, 'Value', Blockly.Arduino.ORDER_ATOMIC) || 0
|
var sensorValue =
|
||||||
var channel = this.getFieldValue('CHANNEL');
|
Blockly.Arduino.valueToCode(this, "Value", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
|
0;
|
||||||
|
var channel = this.getFieldValue("CHANNEL");
|
||||||
var code = `lpp.addAnalogInput(${channel}, ${sensorValue});\n`;
|
var code = `lpp.addAnalogInput(${channel}, ${sensorValue});\n`;
|
||||||
return code;
|
return code;
|
||||||
}
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_lora_cayenne_accelerometer = function (block) {
|
Blockly.Arduino.sensebox_lora_cayenne_accelerometer = function (block) {
|
||||||
var x = Blockly.Arduino.valueToCode(this, 'X', Blockly.Arduino.ORDER_ATOMIC) || 0
|
var x =
|
||||||
var y = Blockly.Arduino.valueToCode(this, 'Y', Blockly.Arduino.ORDER_ATOMIC) || 0
|
Blockly.Arduino.valueToCode(this, "X", Blockly.Arduino.ORDER_ATOMIC) || 0;
|
||||||
var z = Blockly.Arduino.valueToCode(this, 'Z', Blockly.Arduino.ORDER_ATOMIC) || 0
|
var y =
|
||||||
var channel = this.getFieldValue('CHANNEL');
|
Blockly.Arduino.valueToCode(this, "Y", Blockly.Arduino.ORDER_ATOMIC) || 0;
|
||||||
|
var z =
|
||||||
|
Blockly.Arduino.valueToCode(this, "Z", Blockly.Arduino.ORDER_ATOMIC) || 0;
|
||||||
|
var channel = this.getFieldValue("CHANNEL");
|
||||||
var code = `lpp.addAccelerometer(${channel}, ${x}, ${y}, ${z});\n`;
|
var code = `lpp.addAccelerometer(${channel}, ${x}, ${y}, ${z});\n`;
|
||||||
return code;
|
return code;
|
||||||
}
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_lora_cayenne_gps = function (block) {
|
Blockly.Arduino.sensebox_lora_cayenne_gps = function (block) {
|
||||||
var lat = Blockly.Arduino.valueToCode(this, 'LAT', Blockly.Arduino.ORDER_ATOMIC) || 0
|
var lat =
|
||||||
var lng = Blockly.Arduino.valueToCode(this, 'LNG', Blockly.Arduino.ORDER_ATOMIC) || 0
|
Blockly.Arduino.valueToCode(this, "LAT", Blockly.Arduino.ORDER_ATOMIC) || 0;
|
||||||
var alt = Blockly.Arduino.valueToCode(this, 'ALT', Blockly.Arduino.ORDER_ATOMIC) || 0
|
var lng =
|
||||||
var channel = this.getFieldValue('CHANNEL');
|
Blockly.Arduino.valueToCode(this, "LNG", Blockly.Arduino.ORDER_ATOMIC) || 0;
|
||||||
var code = `lpp.addGPS(${channel}, ${lat}, ${lng}, ${alt});\n`
|
var alt =
|
||||||
|
Blockly.Arduino.valueToCode(this, "ALT", Blockly.Arduino.ORDER_ATOMIC) || 0;
|
||||||
|
var channel = this.getFieldValue("CHANNEL");
|
||||||
|
var code = `lpp.addGPS(${channel}, ${lat}, ${lng}, ${alt});\n`;
|
||||||
return code;
|
return code;
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
|
|||||||
var ssl = this.getFieldValue('SSL');
|
var ssl = this.getFieldValue('SSL');
|
||||||
var port = 0;
|
var port = 0;
|
||||||
var count = 0;
|
var count = 0;
|
||||||
if (blocks != undefined) {
|
if (blocks !== undefined) {
|
||||||
for (var i = 0; i < blocks.length; i++) {
|
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++;
|
count++;
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
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.setupCode_["rtc.begin"] = `rtc.begin();`;
|
||||||
|
var code = ``;
|
||||||
|
return code;
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_rtc_set = function () {
|
||||||
|
var second =
|
||||||
|
Blockly.Arduino.valueToCode(this, "second", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
|
"0";
|
||||||
|
var minutes =
|
||||||
|
Blockly.Arduino.valueToCode(this, "second", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
|
"0";
|
||||||
|
var hour =
|
||||||
|
Blockly.Arduino.valueToCode(this, "second", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
|
"0";
|
||||||
|
var day =
|
||||||
|
Blockly.Arduino.valueToCode(this, "second", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
|
"0";
|
||||||
|
var month =
|
||||||
|
Blockly.Arduino.valueToCode(this, "second", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
|
"0";
|
||||||
|
var year =
|
||||||
|
Blockly.Arduino.valueToCode(this, "second", Blockly.Arduino.ORDER_ATOMIC) ||
|
||||||
|
"0";
|
||||||
|
Blockly.Arduino.libraries_["RV8523"] = `#include <RV8523.h>`;
|
||||||
|
Blockly.Arduino.setupCode_["rtc.start"] = `rtc.start();`;
|
||||||
|
Blockly.Arduino.setupCode_[
|
||||||
|
"rtc.batterySwitchOver"
|
||||||
|
] = `rtc.batterySwitchOver(1);`;
|
||||||
|
Blockly.Arduino.setupCode_[
|
||||||
|
"rtc.set"
|
||||||
|
] = `rtc.set(${second}, ${minutes}, ${hour}, ${day}, ${month}, ${year});`;
|
||||||
|
var code = ``;
|
||||||
|
return code;
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_rtc_ntp = function () {
|
||||||
|
Blockly.Arduino.libraries_["RV8523"] = `#include <RV8523.h>`;
|
||||||
|
Blockly.Arduino.setupCode_["rtc.start"] = `rtc.start();`;
|
||||||
|
Blockly.Arduino.setupCode_[
|
||||||
|
"rtc.batterySwitchOver"
|
||||||
|
] = `rtc.batterySwitchOver(1);`;
|
||||||
|
Blockly.Arduino.setupCode_[
|
||||||
|
"rtc.set"
|
||||||
|
] = `rtc.set(SECOND, MINUTE, HOUR, DAY, MONTH, YEAR);`;
|
||||||
|
var code = ``;
|
||||||
|
return code;
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_rtc_get = function () {
|
||||||
|
var dropdown = this.getFieldValue("dropdown");
|
||||||
|
Blockly.Arduino.libraries_["RV8523"] = `#include <RV8523.h>`;
|
||||||
|
Blockly.Arduino.setupCode_["rtc.start"] = `rtc.start();`;
|
||||||
|
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.loopCodeOnce_[
|
||||||
|
"rtc_get"
|
||||||
|
] = `rtc.get(&sec, &min, &hour, &day, &month, &year);`;
|
||||||
|
|
||||||
|
var code = `${dropdown}`;
|
||||||
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
|
};
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_rtc_get_timestamp = function () {
|
||||||
|
Blockly.Arduino.libraries_["RV8523"] = `#include <RV8523.h>`;
|
||||||
|
Blockly.Arduino.setupCode_["rtc.start"] = `rtc.start();`;
|
||||||
|
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`;
|
||||||
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
|
};
|
||||||
@@ -28,15 +28,23 @@ Blockly.Arduino.sensebox_sensor_uv_light = function () {
|
|||||||
Blockly.Arduino.setupCode_['sensebox_sensor_uv_light'] = 'veml.begin();'
|
Blockly.Arduino.setupCode_['sensebox_sensor_uv_light'] = 'veml.begin();'
|
||||||
code = 'veml.get' + dropdown_name + '()';
|
code = 'veml.get' + dropdown_name + '()';
|
||||||
}
|
}
|
||||||
|
// 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') {
|
if (dropdown_name === 'Illuminance') {
|
||||||
Blockly.Arduino.definitions_['define_tsl'] = 'TSL45315 tsl;'
|
Blockly.Arduino.definitions_['define_lightsensor'] = 'Lightsensor lightsensor;'
|
||||||
Blockly.Arduino.setupCode_['sensebox_sensor_illuminance'] = 'tsl.begin();'
|
Blockly.Arduino.setupCode_['sensebox_sensor_illuminance'] = 'lightsensor.begin();'
|
||||||
code = 'tsl.get' + dropdown_name + '()';
|
code = 'lightsensor.get' + dropdown_name + '()';
|
||||||
}
|
}
|
||||||
|
|
||||||
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BMX055 Accelerometer
|
* BMX055 Accelerometer
|
||||||
*
|
*
|
||||||
@@ -295,36 +303,36 @@ Blockly.Arduino.sensebox_scd30 = function () {
|
|||||||
|
|
||||||
Blockly.Arduino.sensebox_gps = function () {
|
Blockly.Arduino.sensebox_gps = function () {
|
||||||
var dropdown = this.getFieldValue('dropdown');
|
var dropdown = this.getFieldValue('dropdown');
|
||||||
Blockly.Arduino.libraries_['gps_library'] = '#include "SparkFun_Ublox_Arduino_Library.h"'
|
Blockly.Arduino.libraries_['gps_library'] = '#include <SparkFun_u-blox_GNSS_Arduino_Library.h>'
|
||||||
Blockly.Arduino.libraries_['wire'] = '#include <Wire.h>'
|
Blockly.Arduino.libraries_['library_wire'] = '#include <Wire.h>';
|
||||||
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
|
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
|
||||||
Blockly.Arduino.definitions_['GPS'] = 'SFE_UBLOX_GPS myGPS;';
|
Blockly.Arduino.definitions_['GPS'] = 'SFE_UBLOX_GNSS myGNSS;';
|
||||||
Blockly.Arduino.setupCode_['init_gps'] = ` Wire.begin();
|
Blockly.Arduino.setupCode_['init_gps'] = ` Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfiguration(); //Save the current settings to flash and BBR`;
|
myGNSS.saveConfiguration(); //Save the current settings to flash and BBR`;
|
||||||
var code = '';
|
var code = '';
|
||||||
switch (dropdown) {
|
switch (dropdown) {
|
||||||
case 'latitude':
|
case 'latitude':
|
||||||
code = 'myGPS.getLatitude()';
|
code = 'myGNSS.getLatitude()';
|
||||||
break;
|
break;
|
||||||
case 'longitude':
|
case 'longitude':
|
||||||
code = 'myGPS.getLongitude()';
|
code = 'myGNSS.getLongitude()';
|
||||||
break;
|
break;
|
||||||
case 'altitude':
|
case 'altitude':
|
||||||
code = 'myGPS.getAltitudeMSL()';
|
code = 'myGNSS.getAltitudeMSL()';
|
||||||
break;
|
break;
|
||||||
case 'pDOP':
|
case 'pDOP':
|
||||||
code = 'myGPS.getPDOP()';
|
code = 'myGNSS.getPDOP()';
|
||||||
break;
|
break;
|
||||||
case 'fixType':
|
case 'fixType':
|
||||||
code = 'myGPS.getFixType()';
|
code = 'myGNSS.getFixType()';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
code = ''
|
code = ''
|
||||||
@@ -332,3 +340,131 @@ Blockly.Arduino.sensebox_gps = function () {
|
|||||||
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
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');
|
||||||
|
var dropdown_pin = 1;
|
||||||
|
var code = '';
|
||||||
|
if (dropdown_value === 'temp') {
|
||||||
|
if (dropdown_port === 'A') {
|
||||||
|
dropdown_pin = 1;
|
||||||
|
}
|
||||||
|
if (dropdown_port === 'B') {
|
||||||
|
dropdown_pin = 3;
|
||||||
|
}
|
||||||
|
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 + ')';
|
||||||
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
|
}
|
||||||
|
else if (dropdown_value === 'soil') {
|
||||||
|
if (dropdown_port === 'A') {
|
||||||
|
dropdown_pin = 2;
|
||||||
|
}
|
||||||
|
if (dropdown_port === 'B') {
|
||||||
|
dropdown_pin = 4;
|
||||||
|
}
|
||||||
|
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 + ')';
|
||||||
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DS18B20 Watertemperature
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_sensor_watertemperature = function () {
|
||||||
|
|
||||||
|
var dropdown_port = this.getFieldValue('Port');
|
||||||
|
var dropdown_pin = 1;
|
||||||
|
if (dropdown_port === 'A') {
|
||||||
|
dropdown_pin = 1;
|
||||||
|
}
|
||||||
|
if (dropdown_port === 'B') {
|
||||||
|
dropdown_pin = 3;
|
||||||
|
}
|
||||||
|
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()';
|
||||||
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Windspeed
|
||||||
|
* remove for now
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_windspeed = function () {
|
||||||
|
var dropdown_pin = this.getFieldValue('PIN');
|
||||||
|
Blockly.Arduino.codeFunctions_['windspeed'] = `
|
||||||
|
float getWindspeed(){
|
||||||
|
float voltageWind = analogRead(`+ dropdown_pin + `) * (3.3 / 1024.0);
|
||||||
|
float windspeed = 0.0;
|
||||||
|
if (voltageWind >= 0.018){
|
||||||
|
float poly1 = pow(voltageWind, 3);
|
||||||
|
poly1 = 17.0359801998299 * poly1;
|
||||||
|
float poly2 = pow(voltageWind, 2);
|
||||||
|
poly2 = 47.9908168343362 * poly2;
|
||||||
|
float poly3 = 122.899677524413 * voltageWind;
|
||||||
|
float poly4 = 0.657504127272728;
|
||||||
|
windspeed = poly1 - poly2 + poly3 - poly4;
|
||||||
|
windspeed = windspeed * 0.2777777777777778; //conversion in m/s
|
||||||
|
}
|
||||||
|
return windspeed;
|
||||||
|
}`
|
||||||
|
var code = 'getWindspeed()';
|
||||||
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DF Robot Soundsensor
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
Blockly.Arduino.sensebox_soundsensor_dfrobot = function () {
|
||||||
|
var dropdown_port = this.getFieldValue('Port');
|
||||||
|
var dropdown_pin = 1;
|
||||||
|
if (dropdown_port === 'A') {
|
||||||
|
dropdown_pin = 1;
|
||||||
|
}
|
||||||
|
if (dropdown_port === 'B') {
|
||||||
|
dropdown_pin = 3;
|
||||||
|
}
|
||||||
|
if (dropdown_port === 'C') {
|
||||||
|
dropdown_pin = 5;
|
||||||
|
}
|
||||||
|
Blockly.Arduino.codeFunctions_['soundsensor'] = `
|
||||||
|
float getSoundValue(){
|
||||||
|
float v = analogRead(`+ dropdown_pin + `) * (3.3 / 1024.0);
|
||||||
|
float decibel = v * 50;
|
||||||
|
return decibel;
|
||||||
|
}`
|
||||||
|
var code = 'getSoundValue()';
|
||||||
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
|
};
|
||||||
@@ -1,3 +1,38 @@
|
|||||||
import * as Blockly from 'blockly/core';
|
import * as Blockly from "blockly/core";
|
||||||
import { Block } from 'blockly';
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Multiplexer
|
||||||
|
*/
|
||||||
|
Blockly.Arduino.sensebox_multiplexer_init = function () {
|
||||||
|
// Blockly.Arduino.libraries_['library_spi'] = '#include <SPI.h>';
|
||||||
|
var nrChannels =
|
||||||
|
Blockly.Arduino.valueToCode(
|
||||||
|
this,
|
||||||
|
"nrChannels",
|
||||||
|
Blockly.Arduino.ORDER_ATOMIC
|
||||||
|
) | 0;
|
||||||
|
var array = [];
|
||||||
|
for (var i = 0; i < nrChannels; i++) {
|
||||||
|
array.push(i);
|
||||||
|
}
|
||||||
|
Blockly.Arduino.libraries_["library_wire"] = "#include <Wire.h>";
|
||||||
|
Blockly.Arduino.definitions_[
|
||||||
|
"define_multiplexer"
|
||||||
|
] = `byte multiplexAddress = 0x77;
|
||||||
|
byte channels[] = {${array}};`;
|
||||||
|
// 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_multiplexer_changeChannel = function () {
|
||||||
|
var channel = Blockly.Arduino.valueToCode(
|
||||||
|
this,
|
||||||
|
"Channel",
|
||||||
|
Blockly.Arduino.ORDER_ATOMIC
|
||||||
|
);
|
||||||
|
var code = `Wire.beginTransmission(0x77);
|
||||||
|
Wire.write(1 << channels[${channel - 1}]);
|
||||||
|
Wire.endTransmission();`;
|
||||||
|
return code;
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,36 +1,44 @@
|
|||||||
import Blockly from 'blockly';
|
import Blockly from "blockly";
|
||||||
|
|
||||||
const setVariableFunction = function (defaultValue) {
|
const setVariableFunction = function (defaultValue) {
|
||||||
return function (block) {
|
return function (block) {
|
||||||
const variableName = Blockly['Arduino'].variableDB_.getName(
|
const variableName = Blockly["Arduino"].variableDB_.getName(
|
||||||
block.getFieldValue('VAR'),
|
block.getFieldValue("VAR"),
|
||||||
Blockly.Variables.NAME_TYPE
|
Blockly.Variables.NAME_TYPE
|
||||||
);
|
);
|
||||||
const variableValue = Blockly['Arduino'].valueToCode(
|
const variableValue = Blockly["Arduino"].valueToCode(
|
||||||
block,
|
block,
|
||||||
'VALUE',
|
"VALUE",
|
||||||
Blockly['Arduino'].ORDER_ATOMIC
|
Blockly["Arduino"].ORDER_ATOMIC
|
||||||
);
|
);
|
||||||
|
|
||||||
const allVars = Blockly.getMainWorkspace().getVariableMap().getAllVariables();
|
const allVars = Blockly.getMainWorkspace()
|
||||||
const myVar = allVars.filter(v => v.name === variableName)[0]
|
.getVariableMap()
|
||||||
var code = ''
|
.getAllVariables();
|
||||||
|
const myVar = allVars.filter((v) => v.name === variableName)[0];
|
||||||
|
var code = "";
|
||||||
|
|
||||||
switch (myVar.type) {
|
switch (myVar.type) {
|
||||||
default:
|
default:
|
||||||
Blockly.Arduino.variables_[myVar + myVar.type] = myVar.type + " " + myVar.name + ';\n';
|
Blockly.Arduino.variables_[variableName + myVar.type] =
|
||||||
code = variableName + ' = ' + (variableValue || defaultValue) + ';\n';
|
myVar.type + " " + myVar.name + ";\n";
|
||||||
|
code = variableName + " = " + (variableValue || defaultValue) + ";\n";
|
||||||
break;
|
break;
|
||||||
case 'Array':
|
case "Array":
|
||||||
var arrayType;
|
var arrayType;
|
||||||
var number;
|
var number;
|
||||||
|
|
||||||
if (this.getChildren().length > 0) {
|
if (this.getChildren().length > 0) {
|
||||||
if (this.getChildren()[0].type === 'lists_create_empty') {
|
if (this.getChildren()[0].type === "lists_create_empty") {
|
||||||
|
arrayType = this.getChildren()[0].getFieldValue("type");
|
||||||
arrayType = this.getChildren()[0].getFieldValue('type');
|
number = Blockly.Arduino.valueToCode(
|
||||||
number = Blockly.Arduino.valueToCode(this.getChildren()[0], 'NUMBER', Blockly['Arduino'].ORDER_ATOMIC);
|
this.getChildren()[0],
|
||||||
Blockly.Arduino.variables_[myVar + myVar.type] = `${arrayType} ${myVar.name} [${number}];\n`;
|
"NUMBER",
|
||||||
|
Blockly["Arduino"].ORDER_ATOMIC
|
||||||
|
);
|
||||||
|
Blockly.Arduino.variables_[
|
||||||
|
myVar + myVar.type
|
||||||
|
] = `${arrayType} ${myVar.name} [${number}];\n`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -40,13 +48,13 @@ const setVariableFunction = function (defaultValue) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getVariableFunction = function (block) {
|
const getVariableFunction = function (block) {
|
||||||
const variableName = Blockly['Arduino'].variableDB_.getName(
|
const variableName = Blockly["Arduino"].variableDB_.getName(
|
||||||
block.getFieldValue('VAR'),
|
block.getFieldValue("VAR"),
|
||||||
Blockly.Variables.NAME_TYPE
|
Blockly.Variables.NAME_TYPE
|
||||||
);
|
);
|
||||||
var code = variableName;
|
var code = variableName;
|
||||||
return [code, Blockly['Arduino'].ORDER_ATOMIC];
|
return [code, Blockly["Arduino"].ORDER_ATOMIC];
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly['Arduino']['variables_set_dynamic'] = setVariableFunction()
|
Blockly["Arduino"]["variables_set_dynamic"] = setVariableFunction();
|
||||||
Blockly['Arduino']['variables_get_dynamic'] = getVariableFunction;
|
Blockly["Arduino"]["variables_get_dynamic"] = getVariableFunction;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
const colours = {
|
const colours = {
|
||||||
sensebox: 120,
|
sensebox: 120,
|
||||||
logic: 210,
|
logic: 210,
|
||||||
@@ -12,11 +11,10 @@ const colours = {
|
|||||||
audio: 250,
|
audio: 250,
|
||||||
arrays: 33,
|
arrays: 33,
|
||||||
mqtt: 90,
|
mqtt: 90,
|
||||||
webserver: 40
|
webserver: 40,
|
||||||
}
|
phyphox: 25,
|
||||||
|
};
|
||||||
|
|
||||||
export const getColour = () => {
|
export const getColour = () => {
|
||||||
return colours;
|
return colours;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -105,135 +105,3 @@ export const getCompatibleTypes = (type) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const VARIABLE_TYPES = [['SHORT_NUMBER', 'char'], ['NUMBER', 'int'], ['DECIMAL', 'long'], ['TEXT', 'String'], ['CHARACTER', 'char'], ['BOOLEAN', 'boolean'], ['NULL', 'void'], ['UNDEF', 'undefined']];
|
export const VARIABLE_TYPES = [['SHORT_NUMBER', 'char'], ['NUMBER', 'int'], ['DECIMAL', 'long'], ['TEXT', 'String'], ['CHARACTER', 'char'], ['BOOLEAN', 'boolean'], ['NULL', 'void'], ['UNDEF', 'undefined']];
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Some Types have circular dependencies on their compatibilities, so add them
|
|
||||||
// * after declaration.
|
|
||||||
// */
|
|
||||||
// Blockly.Types.NUMBER.addCompatibleTypes([
|
|
||||||
// Blockly.Types.BOOLEAN,
|
|
||||||
// Blockly.Types.SHORT_NUMBER,
|
|
||||||
// Blockly.Types.LARGE_NUMBER,
|
|
||||||
// Blockly.Types.DECIMAL]);
|
|
||||||
|
|
||||||
// Blockly.Types.SHORT_NUMBER.addCompatibleTypes([
|
|
||||||
// Blockly.Types.BOOLEAN,
|
|
||||||
// Blockly.Types.NUMBER,
|
|
||||||
// Blockly.Types.LARGE_NUMBER,
|
|
||||||
// Blockly.Types.DECIMAL]);
|
|
||||||
|
|
||||||
// Blockly.Types.LARGE_NUMBER.addCompatibleTypes([
|
|
||||||
// Blockly.Types.BOOLEAN,
|
|
||||||
// Blockly.Types.SHORT_NUMBER,
|
|
||||||
// Blockly.Types.NUMBER,
|
|
||||||
// Blockly.Types.DECIMAL]);
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Adds another type to the Blockly.Types collection.
|
|
||||||
// * @param {string} typeId_ Identifiable name of the type.
|
|
||||||
// * @param {string} typeMsgName_ Name of the member variable from Blockly.Msg
|
|
||||||
// * object to identify the translateble string.for the Type name.
|
|
||||||
// * @param {Array<Blockly.Type>} compatibleTypes_ List of types this Type is
|
|
||||||
// * compatible with.
|
|
||||||
// */
|
|
||||||
// Blockly.Types.addType = function (typeId_, typeMsgName_, compatibleTypes_) {
|
|
||||||
// // The Id is used as the key from the value pair in the BlocklyTypes object
|
|
||||||
// var key = typeId_.toUpperCase().replace(/ /g, '_');
|
|
||||||
// if (Blockly.Types[key] !== undefined) {
|
|
||||||
// throw 'The Blockly type ' + key + ' already exists.';
|
|
||||||
// }
|
|
||||||
// Blockly.Types[key] = new Blockly.Type({
|
|
||||||
// typeId: typeId_,
|
|
||||||
// typeName: typeMsgName_,
|
|
||||||
// compatibleTypes: compatibleTypes_
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Converts the static types dictionary in to a an array with 2-item arrays.
|
|
||||||
// * This array only contains the valid types, excluding any error or temp types.
|
|
||||||
// * @return {!Array<Array<string>>} Blockly types in the format described above.
|
|
||||||
// */
|
|
||||||
// Blockly.Types.getValidTypeArray = function () {
|
|
||||||
// var typesArray = [];
|
|
||||||
// for (var typeKey in Blockly.Types) {
|
|
||||||
// if ((typeKey !== 'UNDEF') && (typeKey !== 'CHILD_BLOCK_MISSING') &&
|
|
||||||
// (typeKey !== 'NULL') && (typeKey !== 'ARRAY') &&
|
|
||||||
// (typeof Blockly.Types[typeKey] !== 'function') &&
|
|
||||||
// !(Blockly.Types[typeKey] instanceof RegExp)) {
|
|
||||||
// typesArray.push([Blockly.Types[typeKey].typeName, typeKey]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return typesArray;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Navigates through child blocks of the argument block to get this block type.
|
|
||||||
// * @param {!Blockly.Block} block Block to navigate through children.
|
|
||||||
// * @return {Blockly.Type} Type of the input block.
|
|
||||||
// */
|
|
||||||
// Blockly.Types.getChildBlockType = function (block) {
|
|
||||||
// var blockType = null;
|
|
||||||
// var nextBlock = block;
|
|
||||||
// // Only checks first input block, so it decides the type. Incoherences amongst
|
|
||||||
// // multiple inputs dealt at a per-block level with their own block warnings
|
|
||||||
// while (nextBlock && (nextBlock.getBlockType === undefined) &&
|
|
||||||
// (nextBlock.inputList.length > 0) &&
|
|
||||||
// (nextBlock.inputList[0].connection)) {
|
|
||||||
// nextBlock = nextBlock.inputList[0].connection.targetBlock();
|
|
||||||
// }
|
|
||||||
// if (nextBlock === block) {
|
|
||||||
// // Set variable block is empty, so no type yet
|
|
||||||
// blockType = Blockly.Types.CHILD_BLOCK_MISSING;
|
|
||||||
// } else if (nextBlock === null) {
|
|
||||||
// // Null return from targetBlock indicates no block connected
|
|
||||||
// blockType = Blockly.Types.CHILD_BLOCK_MISSING;
|
|
||||||
// } else {
|
|
||||||
// var func = nextBlock.getBlockType;
|
|
||||||
// if (func) {
|
|
||||||
// blockType = nextBlock.getBlockType();
|
|
||||||
// } else {
|
|
||||||
// // Most inner block, supposed to define a type, is missing getBlockType()
|
|
||||||
// blockType = Blockly.Types.NULL;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return blockType;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Regular expressions to identify an integer.
|
|
||||||
// * @private
|
|
||||||
// */
|
|
||||||
// Blockly.Types.regExpInt_ = new RegExp(/^-?\d+$/);
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Regular expressions to identify a decimal.
|
|
||||||
// * @private
|
|
||||||
// */
|
|
||||||
// Blockly.Types.regExpFloat_ = new RegExp(/^-?[0-9]*[.][0-9]+$/);
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Uses regular expressions to identify if the input number is an integer or a
|
|
||||||
// * floating point.
|
|
||||||
// * @param {string} numberString String of the number to identify.
|
|
||||||
// * @return {!Blockly.Type} Blockly type.
|
|
||||||
// */
|
|
||||||
// Blockly.Types.identifyNumber = function (numberString) {
|
|
||||||
// if (Blockly.Types.regExpInt_.test(numberString)) {
|
|
||||||
// var intValue = parseInt(numberString);
|
|
||||||
// if (isNaN(intValue)) {
|
|
||||||
// return Blockly.Types.NULL;
|
|
||||||
// }
|
|
||||||
// if (intValue > 32767 || intValue < -32768) {
|
|
||||||
// return Blockly.Types.LARGE_NUMBER;
|
|
||||||
// }
|
|
||||||
// return Blockly.Types.NUMBER;
|
|
||||||
// } else if (Blockly.Types.regExpFloat_.test(numberString)) {
|
|
||||||
// return Blockly.Types.DECIMAL;
|
|
||||||
// }
|
|
||||||
// return Blockly.Types.NULL;
|
|
||||||
// };
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+52
-1026
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
export const AUDIO = {
|
||||||
|
ARD_TONEFREQ: "mit Frequenz",
|
||||||
|
ARD_TONE_FREQ: "Frequenz",
|
||||||
|
ARD_TONE_PIN: "Ton PIN#",
|
||||||
|
ARD_TONE_PIN_TIP: "Erzeugt einen Ton an Pin",
|
||||||
|
ARD_TONE_TIP: "Erzeugt einen Ton an Pin mit einer spezifischen Frequenz zwischen 31 - 65535 Hz",
|
||||||
|
ARD_TONE_WARNING: "Frequenz muss zwischen 31 - 65535 liegen",
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
export const 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
|
||||||
|
#### 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>
|
||||||
|
|
||||||
|
#### Kopieren von Programmen unter MacOS
|
||||||
|
Das Kopieren der Programme unter MacOS funktioniert nicht über den Finder, es gibt es aber dennoch zwei verschiedene Möglichkeiten die Programme zu kopieren:
|
||||||
|
- [senseBox Kopiertool](https://sensebox.de/docs/senseBox_Sketch_Uploader_DE.zip)
|
||||||
|
- [muCommander](https://www.mucommander.com/)
|
||||||
|
`,
|
||||||
|
|
||||||
|
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: `
|
||||||
|
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
|
||||||
|
`,
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
|
||||||
|
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:",
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
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",
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.",
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
export const LOOPS = {
|
||||||
|
CONTROLS_FLOW_STATEMENTS_HELPURL: "https://de.wikipedia.org/wiki/Kontrollstruktur",
|
||||||
|
CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK: "Die Schleife abbrechen",
|
||||||
|
CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE: "mit der nächsten Iteration der Schleife fortfahren",
|
||||||
|
CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK: "Die umgebende Schleife beenden.",
|
||||||
|
CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE: "Diese Anweisung abbrechen und mit dem nächsten Schleifendurchlauf fortfahren.",
|
||||||
|
CONTROLS_FLOW_STATEMENTS_WARNING: "Warnung: Dieser Block sollte nur in einer Schleife verwendet werden.",
|
||||||
|
CONTROLS_FOREACH_HELPURL: "https://de.wikipedia.org/wiki/For-Schleife",
|
||||||
|
CONTROLS_FOREACH_TITLE: "Für Wert %1 aus der Liste %2",
|
||||||
|
CONTROLS_FOREACH_TOOLTIP: "Führe eine Anweisung für jeden Wert in der Liste aus und setzte dabei die Variable \"%1\" auf den aktuellen Listenwert.",
|
||||||
|
CONTROLS_FOR_HELPURL: "https://de.wikipedia.org/wiki/For-Schleife",
|
||||||
|
CONTROLS_FOR_TITLE: "Zähle %1 von %2 bis %3 mit %4",
|
||||||
|
CONTROLS_FOR_TOOLTIP: "Zähle die Variable \"%1\" von einem Startwert bis zu einem Zielwert und führe für jeden Wert eine Anweisung aus.",
|
||||||
|
|
||||||
|
CONTROLS_REPEAT_HELPURL: "https://de.wikipedia.org/wiki/For-Schleife",
|
||||||
|
CONTROLS_REPEAT_INPUT_DO: "mache",
|
||||||
|
CONTROLS_REPEAT_TITLE: "Wiederhole %1 mal",
|
||||||
|
CONTROLS_REPEAT_TOOLTIP: "Eine Anweisung mehrfach ausführen.",
|
||||||
|
CONTROLS_WHILEUNTIL_HELPURL: "https://de.wikipedia.org/wiki/Schleife_%28Programmierung%29",
|
||||||
|
CONTROLS_WHILEUNTIL_OPERATOR_UNTIL: "Wiederhole bis",
|
||||||
|
CONTROLS_WHILEUNTIL_OPERATOR_WHILE: "Wiederhole solange",
|
||||||
|
CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL: "Führe die Anweisung solange aus wie die Bedingung falsch (false) ist.",
|
||||||
|
CONTROLS_WHILEUNTIL_TOOLTIP_WHILE: "Führe die Anweisung solange aus wie die Bedingung wahr (true) ist.",
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
|
||||||
|
export const MATH = {
|
||||||
|
MATH_ADDITION_SYMBOL: "+", // untranslated
|
||||||
|
MATH_ARITHMETIC_HELPURL: "https://de.wikipedia.org/wiki/Grundrechenart",
|
||||||
|
MATH_ARITHMETIC_TOOLTIP_ADD: "Ist die Summe zweier Werte.",
|
||||||
|
MATH_ARITHMETIC_TOOLTIP_DIVIDE: "Ist der Quotient zweier Werte.",
|
||||||
|
MATH_ARITHMETIC_TOOLTIP_MINUS: "Ist die Differenz zweier Werte.",
|
||||||
|
MATH_ARITHMETIC_TOOLTIP_MULTIPLY: "Ist das Produkt zweier Werte.",
|
||||||
|
MATH_ARITHMETIC_TOOLTIP_POWER: "Ist der erste Wert potenziert mit dem zweiten Wert.",
|
||||||
|
MATH_CHANGE_HELPURL: "https://de.wikipedia.org/wiki/Inkrement_und_Dekrement",
|
||||||
|
MATH_CHANGE_TITLE: "erhöhe %1 um %2",
|
||||||
|
MATH_CHANGE_TOOLTIP: "Addiert einen Wert zur Variable \"%1\" hinzu.",
|
||||||
|
MATH_CONSTANT_HELPURL: "https://de.wikipedia.org/wiki/Mathematische_Konstante",
|
||||||
|
MATH_CONSTANT_TOOLTIP: "Mathematische Konstanten wie: π (3.141…), e (2.718…), φ (1.618…), sqrt(2) (1.414…), sqrt(½) (0.707…) oder ∞ (unendlich).",
|
||||||
|
MATH_CONSTRAIN_HELPURL: "https://en.wikipedia.org/wiki/Clamping_%28graphics%29", // untranslated
|
||||||
|
MATH_CONSTRAIN_TITLE: "begrenze %1 von %2 bis %3",
|
||||||
|
MATH_CONSTRAIN_TOOLTIP: "Begrenzt den Wertebereich auf den \"von\"-Wert bis einschließlich zum \"bis\"-Wert. (inklusiv)",
|
||||||
|
MATH_DIVISION_SYMBOL: "÷", // untranslated
|
||||||
|
MATH_IS_DIVISIBLE_BY: "ist teilbar durch",
|
||||||
|
MATH_IS_EVEN: "ist gerade",
|
||||||
|
MATH_IS_NEGATIVE: "ist negativ",
|
||||||
|
MATH_IS_ODD: "ist ungerade",
|
||||||
|
MATH_IS_POSITIVE: "ist positiv",
|
||||||
|
MATH_IS_PRIME: "ist eine Primzahl",
|
||||||
|
MATH_IS_TOOLTIP: "Überprüft ob eine Zahl gerade, ungerade, eine Primzahl, ganzzahlig, positiv, negativ oder durch eine zweite Zahl teilbar ist. Gibt wahr (true) oder falsch (false) zurück.",
|
||||||
|
MATH_IS_WHOLE: "ist eine ganze Zahl",
|
||||||
|
MATH_MODULO_HELPURL: "https://de.wikipedia.org/wiki/Modulo",
|
||||||
|
MATH_MODULO_TITLE: "Rest von %1 ÷ %2",
|
||||||
|
MATH_MODULO_TOOLTIP: "Der Rest nach einer Division.",
|
||||||
|
MATH_MULTIPLICATION_SYMBOL: "×",
|
||||||
|
MATH_NUMBER_HELPURL: "https://de.wikipedia.org/wiki/Zahl",
|
||||||
|
MATH_NUMBER_TOOLTIP: "Eine Zahl.",
|
||||||
|
MATH_ONLIST_HELPURL: "http://www.sysplus.ch/einstieg.php?links:menu&seite:4125&grad:Crash&prog:Excel",
|
||||||
|
MATH_ONLIST_OPERATOR_AVERAGE: "Mittelwert einer Liste",
|
||||||
|
MATH_ONLIST_OPERATOR_MAX: "Maximalwert einer Liste",
|
||||||
|
MATH_ONLIST_OPERATOR_MEDIAN: "Median einer Liste",
|
||||||
|
MATH_ONLIST_OPERATOR_MIN: "Minimalwert einer Liste",
|
||||||
|
MATH_ONLIST_OPERATOR_MODE: "am häufigsten in Liste",
|
||||||
|
MATH_ONLIST_OPERATOR_RANDOM: "Zufallswert einer Liste",
|
||||||
|
MATH_ONLIST_OPERATOR_STD_DEV: "Standardabweichung einer Liste",
|
||||||
|
MATH_ONLIST_OPERATOR_SUM: "Summe einer Liste",
|
||||||
|
MATH_ONLIST_TOOLTIP_AVERAGE: "Ist der Durchschnittswert aller Werte in einer Liste.",
|
||||||
|
MATH_ONLIST_TOOLTIP_MAX: "Ist der größte Wert in einer Liste.",
|
||||||
|
MATH_ONLIST_TOOLTIP_MEDIAN: "Ist der Median aller Werte in einer Liste.",
|
||||||
|
MATH_ONLIST_TOOLTIP_MIN: "Ist der kleinste Wert in einer Liste.",
|
||||||
|
MATH_ONLIST_TOOLTIP_MODE: "Findet den am häufigsten vorkommenden Wert in einer Liste. Falls kein Wert öfter vorkommt als alle anderen, wird die originale Liste zurückgeben",
|
||||||
|
MATH_ONLIST_TOOLTIP_RANDOM: "Gebe einen zufälligen Wert aus der Liste zurück.",
|
||||||
|
MATH_ONLIST_TOOLTIP_STD_DEV: "Ist die standardisierte Standardabweichung aller Werte in der Liste",
|
||||||
|
MATH_ONLIST_TOOLTIP_SUM: "Ist die Summe aller Werte in einer Liste.",
|
||||||
|
MATH_POWER_SYMBOL: "^",
|
||||||
|
MATH_RANDOM_FLOAT_HELPURL: "https://de.wikipedia.org/wiki/Zufallszahlen",
|
||||||
|
MATH_RANDOM_FLOAT_TITLE_RANDOM: "Zufallszahl (0.0 -1.0)",
|
||||||
|
MATH_RANDOM_FLOAT_TOOLTIP: "Erzeuge eine Zufallszahl zwischen 0.0 (inklusiv) und 1.0 (exklusiv).",
|
||||||
|
MATH_RANDOM_INT_HELPURL: "https://de.wikipedia.org/wiki/Zufallszahlen",
|
||||||
|
MATH_RANDOM_INT_TITLE: "ganzzahliger Zufallswert zwischen %1 bis %2",
|
||||||
|
MATH_RANDOM_INT_TOOLTIP: "Erzeuge einen ganzzahligen Zufallswert zwischen zwei Werten (inklusiv).",
|
||||||
|
MATH_ROUND_HELPURL: "https://de.wikipedia.org/wiki/Runden",
|
||||||
|
MATH_ROUND_OPERATOR_ROUND: "runden",
|
||||||
|
MATH_ROUND_OPERATOR_ROUNDDOWN: "abrunden",
|
||||||
|
MATH_ROUND_OPERATOR_ROUNDUP: "aufrunden",
|
||||||
|
MATH_ROUND_TOOLTIP: "Eine Zahl auf- oder abrunden.",
|
||||||
|
MATH_SINGLE_HELPURL: "https://de.wikipedia.org/wiki/Quadratwurzel",
|
||||||
|
MATH_SINGLE_OP_ABSOLUTE: "Absolutwert",
|
||||||
|
MATH_SINGLE_OP_ROOT: "Quadratwurzel",
|
||||||
|
MATH_SINGLE_TOOLTIP_ABS: "Ist der Absolutwert eines Wertes.",
|
||||||
|
MATH_SINGLE_TOOLTIP_EXP: "Ist Wert der Exponentialfunktion eines Wertes.",
|
||||||
|
MATH_SINGLE_TOOLTIP_LN: "Ist der natürliche Logarithmus eines Wertes.",
|
||||||
|
MATH_SINGLE_TOOLTIP_LOG10: "Ist der dekadische Logarithmus eines Wertes.",
|
||||||
|
MATH_SINGLE_TOOLTIP_NEG: "Negiert einen Wert.",
|
||||||
|
MATH_SINGLE_TOOLTIP_POW10: "Rechnet 10 hoch Eingabewert.",
|
||||||
|
MATH_SINGLE_TOOLTIP_ROOT: "Ist die Quadratwurzel eines Wertes.",
|
||||||
|
MATH_SUBTRACTION_SYMBOL: "-",
|
||||||
|
MATH_TRIG_ACOS: "acos",
|
||||||
|
MATH_TRIG_ASIN: "asin",
|
||||||
|
MATH_TRIG_ATAN: "atan",
|
||||||
|
MATH_TRIG_COS: "cos",
|
||||||
|
MATH_TRIG_HELPURL: "https://de.wikipedia.org/wiki/Trigonometrie",
|
||||||
|
MATH_TRIG_SIN: "sin",
|
||||||
|
MATH_TRIG_TAN: "tan",
|
||||||
|
MATH_TRIG_TOOLTIP_ACOS: "Ist der Arkuskosinus des Eingabewertes.",
|
||||||
|
MATH_TRIG_TOOLTIP_ASIN: "Ist der Arkussinus des Eingabewertes.",
|
||||||
|
MATH_TRIG_TOOLTIP_ATAN: "Ist der Arkustangens des Eingabewertes.",
|
||||||
|
MATH_TRIG_TOOLTIP_COS: "Ist der Kosinus des Winkels.",
|
||||||
|
MATH_TRIG_TOOLTIP_SIN: "Ist der Sinus des Winkels.",
|
||||||
|
MATH_TRIG_TOOLTIP_TAN: "Ist der Tangens des Winkels.",
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
export const MQTT = {
|
||||||
|
/**
|
||||||
|
* MQTT
|
||||||
|
*/
|
||||||
|
senseBox_mqtt_init: "Verbinde mit MQTT Broker",
|
||||||
|
senseBox_mqtt_server: "Server",
|
||||||
|
senseBox_mqtt_port: "Port",
|
||||||
|
senseBox_mqtt_username: "Benutzername",
|
||||||
|
senseBox_mqtt_password: "Passwort",
|
||||||
|
sensebox_mqtt_subscribe: "Subscribe to Feed",
|
||||||
|
senseBox_mqtt_publish: "Sende an Feed/Topic",
|
||||||
|
senseBox_mqtt_init_tooltip: "Initialisiere die Verbindung zu dem MQTT Broker. Verwende diesen Block innerhalb der setup()-Funktion und stelle zuerst eine Verbindung mit dem Wlan Netzwerk her.",
|
||||||
|
senseBox_mqtt_publish_tooltip: "Sende etwas an ein 'Topic' deines MQTT Brokers.",
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
export const BLE = {
|
||||||
|
/**
|
||||||
|
* Phyphox Blöcke
|
||||||
|
*/
|
||||||
|
sensebox_phyphox_init: "Initialisiere Phyphox Gerät mit Namen:",
|
||||||
|
sensebox_phyphox_createExperiment: "Erstelle Experiment",
|
||||||
|
sensebox_phyphox_experimentName: "Name des Experiments",
|
||||||
|
sensebox_phyphox_experimentTitle: "Titel",
|
||||||
|
sensebox_phyphox_experimentCategory: "Kategorie",
|
||||||
|
sensebox_phyphox_experimentDescription: "Beschreibung",
|
||||||
|
sensebox_phyphox_experiment_description: "Kurze Beschreibung des Experiments",
|
||||||
|
sensebox_phyphox_writeValues: "Sende Werte",
|
||||||
|
sensebox_phyphox_createView: "Mit Graphen:",
|
||||||
|
sensebox_phyphox_createGraph: "Erstelle Graph",
|
||||||
|
sensebox_phyphox_graphLabel: "",
|
||||||
|
sensebox_phyphox_unitx: "Einheit x-Achse",
|
||||||
|
sensebox_phyphox_unity: "Einheit y-Achse",
|
||||||
|
sensebox_phyphox_labelx: "Beschriftung x-Achse",
|
||||||
|
sensebox_phyphox_labely: "Beschriftung y-Achse",
|
||||||
|
sensebox_phyphox_channel0: "Wert x-Achse",
|
||||||
|
sensebox_phyphox_channel1: "Wert y-Achse",
|
||||||
|
sensebox_phyphox_style_dots: "Punkte",
|
||||||
|
sensebox_phyphox_style_line: "Linie",
|
||||||
|
sensebox_phyphox_timestamp: "Zeitstempel",
|
||||||
|
sensebox_phyphox_channel: "Kanal",
|
||||||
|
sensebox_phyphox_sendchannel: "sende an Kanal:",
|
||||||
|
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",
|
||||||
|
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:
|
||||||
|
"Erstellt einen neuen Graph für das Experiment. Gibt die Einheit und Beschriftung für die Achsen an und wähle den Stil der Visualisuerng der Messwerte. Füge an die Schnittstellen für die Werte der X- und Y-Achse den Kanal an auf dem die Messwerte später gesendet werden. Möchtest du einen Zeitstempel über die Phyphox App erstellen lassen verbinde den Block *Zeitstempel*",
|
||||||
|
sensebox_phyphox_timestamp_tooltip:
|
||||||
|
"Verwende diesen Block, um einen Zeitstempel über die Phyphox App erstellen zu lassen",
|
||||||
|
sensebox_phyphox_sendchannel_tooltip:
|
||||||
|
"Sendet einen Messwert an den ausgewählten Kanal",
|
||||||
|
sensebox_phyphox_experiment_send_tooltip:
|
||||||
|
"Sendet die Messwerte an die Phyphox App",
|
||||||
|
};
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
export const DISPLAY = {
|
||||||
|
/**
|
||||||
|
* Display
|
||||||
|
*/
|
||||||
|
|
||||||
|
senseBox_display_beginDisplay: "Display initialisieren",
|
||||||
|
senseBox_display_beginDisplay_tooltip: `Initialisiert das Display. Dieser Block muss im Setup() verwendet werden.
|
||||||
|
|
||||||
|
**Anschluss:** I2C
|
||||||
|
`,
|
||||||
|
senseBox_display_clearDisplay_tooltip: "Löscht die Anzeige auf dem Display. Sollte immer zu Begin oder am Ende der Endlosschleife aufgerufen werden.",
|
||||||
|
senseBox_display_clearDisplay: "Display löschen",
|
||||||
|
senseBox_display_printDisplay: "Schreibe Text/Zahl",
|
||||||
|
senseBox_display_printDisplay_tooltip: "Zeigt eine Zahl/Text auf dem Display an. Über die X- und Y-Koordinaten kann die Position auf dem Display bestimmt werden. Die Schriftgröße lässt sich in ganzzahligen Werten zwischen 1 und 4 einstellen. Das Display hat eine Auflösung von 128x64 Pixeln (X- und Y-Achse)",
|
||||||
|
senseBox_display_printDisplay_x: "x-Koordinate",
|
||||||
|
senseBox_display_printDisplay_y: "y-Koordinate",
|
||||||
|
senseBox_display_printDisplay_value: "Wert",
|
||||||
|
senseBox_display_setSize: "Schriftgröße",
|
||||||
|
senseBox_display_setSize_tip: "Ändere die Schriftgröße auf einen Wert zwischen 1 und 10.",
|
||||||
|
senseBox_display_color: "Schriftfarbe",
|
||||||
|
senseBox_display_white: "Weiß",
|
||||||
|
senseBox_display_black: "Schwarz",
|
||||||
|
sensebox_display_show: "Zeige auf dem Display",
|
||||||
|
sensebox_display_show_tip: "Zeigt den Nachfolgenden Inhalt auf dem Bildschirm",
|
||||||
|
senseBox_dipslay_plotTitle: "Titel",
|
||||||
|
senseBox_display_plotDisplay: "Zeichne Diagramm",
|
||||||
|
senseBox_display_plotXLabel: "X-Achsen Beschriftung",
|
||||||
|
senseBox_display_plotYLabel: "Y-Achsen Beschriftung",
|
||||||
|
senseBox_display_plotXRange1: "X-Wertebereich Anfang",
|
||||||
|
senseBox_display_plotXRange2: "X-Wertebereich Ende",
|
||||||
|
senseBox_display_plotYRange1: "Y-Wertebereich Anfang",
|
||||||
|
senseBox_display_plotYRange2: "Y-Wertebereich Ende",
|
||||||
|
senseBox_display_plotXTick: "X-Linienabstand",
|
||||||
|
senseBox_display_plotYTick: "Y-Linienabstand",
|
||||||
|
senseBox_display_plotTimeFrame: "Zeitabschnitt",
|
||||||
|
sensebox_display_fillCircle: "Zeichne Punkt",
|
||||||
|
sensebox_display_fillCircle_radius: "Radius",
|
||||||
|
senseBox_display_fillCircle_tooltip: "Mit diesem Block kann ein Punkt auf dem Display angezeigt werden. Über die Koordinaten kannst du den Punkt auf dem Display platzieren und mithilfe des Radius die Größe bestimmen.",
|
||||||
|
sensebox_display_drawRectangle: "Zeichne Rechteck",
|
||||||
|
sensebox_display_drawRectangle_width: "Breite",
|
||||||
|
sensebox_display_drawRectangle_height: "Höhe",
|
||||||
|
senseBox_display_drawRectangle_tooltip: "Dieser Block zeichnet ein Rechteck auf das Display. Mit den X- und Y-Koordinaten wird die Position der oberen linken Ecke des Rechtecks auf dem Display bestimmt. Die Höhe und Breite wird in Pixeln angegeben und mit der Checkbox 'Ausgefüllt' kann ausgewählt werden ob das Rechteck ausgefüllt oder nur als Rahmen angezeigt wird.",
|
||||||
|
senseBox_display_filled: "Ausgefüllt",
|
||||||
|
senseBox_display_fastPrint_show: "Zeige Messwerte",
|
||||||
|
senseBox_display_fastPrint_title: "Titel",
|
||||||
|
senseBox_display_fastPrint_value: "Messwert",
|
||||||
|
senseBox_display_fastPrint_dimension: "Einheit",
|
||||||
|
sensebox_display_fastPrint_tooltip: "Zeigt zwei Messwerte auf dem Display an. Wähle eine Überschrift für jeden Messwert und gib die Einheit an.",
|
||||||
|
senseBox_display_helpurl: "https://docs.sensebox.de/blockly/blockly-display/"
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
export const LED = {
|
||||||
|
/**
|
||||||
|
* WS2818 RGB LED
|
||||||
|
*/
|
||||||
|
senseBox_ws2818_rgb_led: "Setze RGB-LED an",
|
||||||
|
senseBox_ws2818_rgb_led_init: "RGB LED (WS2818) initialisieren",
|
||||||
|
senseBox_ws2818_rgb_led_position: "Position",
|
||||||
|
senseBox_ws2818_rgb_led_brightness: "Helligkeit",
|
||||||
|
senseBox_ws2818_rgb_led_tooltip:
|
||||||
|
"Verändere mit diesem Block die Farbe deiner RGB-LED. Verbinde einen Block für die Farbe. Wenn mehrere RGB-LEDs miteinander verkettet werden kannst du über die Position bestimmen welche LED angesteuert wird. ",
|
||||||
|
senseBox_ws2818_rgb_led_init_tooltip:
|
||||||
|
"Schließe die RGB-LED an einen der drei **digital/analog Ports** an. Wenn mehrere RGB-LEDs miteinander verkettet werden kannst du über die Position bestimmen welche LED angesteuert wird. ",
|
||||||
|
senseBox_ws2818_rgb_led_color: "Farbe",
|
||||||
|
senseBox_ws2818_rgb_led_number: "Anzahl",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Color
|
||||||
|
*/
|
||||||
|
|
||||||
|
COLOUR_BLEND_COLOUR1: "Farbe 1",
|
||||||
|
COLOUR_BLEND_COLOUR2: "mit Farbe 2",
|
||||||
|
COLOUR_BLEND_HELPURL: "http://meyerweb.com/eric/tools/color-blend/",
|
||||||
|
COLOUR_BLEND_RATIO: "im Verhältnis",
|
||||||
|
COLOUR_BLEND_TITLE: "mische",
|
||||||
|
COLOUR_BLEND_TOOLTIP:
|
||||||
|
"Vermische 2 Farben mit konfigurierbaren Farbverhältnis (0.0 - 1.0).",
|
||||||
|
COLOUR_PICKER_HELPURL: "https://de.wikipedia.org/wiki/Farbe",
|
||||||
|
COLOUR_PICKER_TOOLTIP:
|
||||||
|
"Wähle eine Farbe aus der Palette. Die Farbe wird automatisch in RGB-Werte konvertiert.",
|
||||||
|
COLOUR_RANDOM_HELPURL: "http://randomcolour.com", // untranslated
|
||||||
|
COLOUR_RANDOM_TITLE: "zufällige Farbe",
|
||||||
|
COLOUR_RANDOM_TOOLTIP: "Erstelle eine Farbe nach dem Zufallsprinzip.",
|
||||||
|
COLOUR_RGB_BLUE: "blau",
|
||||||
|
COLOUR_RGB_GREEN: "grün",
|
||||||
|
COLOUR_RGB_HELPURL: "https://de.wikipedia.org/wiki/RGB-Farbraum",
|
||||||
|
COLOUR_RGB_RED: "rot",
|
||||||
|
COLOUR_RGB_TITLE: "Farbe mit",
|
||||||
|
COLOUR_RGB_TOOLTIP:
|
||||||
|
"Erstelle eine Farbe mit selbst definierten Rot-, Grün- und Blauwerten. Alle Werte müssen zwischen 0 und 255 liegen. 0 ist hierbei die geringte Intensität der Farbe 255 die höchste.",
|
||||||
|
};
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
export const LORA = {
|
||||||
|
/*
|
||||||
|
* 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_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_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**.",
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
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",
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
export const RTC = {
|
||||||
|
sensebox_rtc_init: "Initialisiere RTC",
|
||||||
|
sensebox_rtc_init_tooltip:
|
||||||
|
"Initialisiere die RTC. Schließe diese an einen der 5 I2C/Wire Anschlüsse an und lege die Batterie ein. Bevor du die Uhrzeit auslesen kannst muss diese zunächst einmal gesetzt werden. Dieser Schritt muss normalerweise nur einmalig durchgeführt werden.",
|
||||||
|
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_tooltip:
|
||||||
|
"Gibt dir einen in ISO 8601 formatierten Zeitstempel zurück. Bsp: 2021-12-24T18:21Z",
|
||||||
|
sensebox_rtc_get: "Wert: ",
|
||||||
|
sensebox_rtc_get_tooltip: "Gibt dir den ausgewählten Wert zurück.",
|
||||||
|
sensebox_rtc_second: "Sekunden",
|
||||||
|
sensebox_rtc_minutes: "Minuten",
|
||||||
|
sensebox_rtc_hour: "Stunden",
|
||||||
|
sensebox_rtc_day: "Tag",
|
||||||
|
sensebox_rtc_month: "Monat",
|
||||||
|
sensebox_rtc_year: "Jahr",
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
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",
|
||||||
|
}
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
export const 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: "",
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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/",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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:
|
||||||
|
|
||||||
|
- 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/",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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: "",
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 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/",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
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,
|
||||||
|
- IAQ Accuracy : 1 heißt Wert ist ungenau,
|
||||||
|
- IAQ Accuracy : 2 heißt Sensor wird kalibriert,
|
||||||
|
- 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/",
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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/",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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/",
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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:
|
||||||
|
- "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: "",
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
export const TELEGRAM = {
|
||||||
|
/*
|
||||||
|
* Telegram
|
||||||
|
*/
|
||||||
|
senseBox_telegram_init: "Telegram Bot initialisieren",
|
||||||
|
senseBox_telegram_token: "Token",
|
||||||
|
senseBox_telegram_do: "Telegram mache",
|
||||||
|
senseBox_telegram_do_tooltip: "Füge in diese Schleife die Blöcke ein, die dein Telegram Bot ausführen soll. Beachte hierbei, dass du Aktionen bei einer bestimmten Nachricht ausführen lassen kannst oder auch selbst eine Nachricht versenden werden kann.",
|
||||||
|
senseBox_telegram_do_on_message: "bei Nachricht",
|
||||||
|
senseBox_telegram_message: "Nachricht",
|
||||||
|
senseBox_telegram_message_tooltip: "Führe eine Aktion aus, wenn der Telegram eine *Nachricht* empfangen hat.",
|
||||||
|
senseBox_telegram_send: "Sende Nachricht",
|
||||||
|
senseBox_telegram_send_tooltip: "Dein Telgram Bot sendet dir eine Nachricht auf dein Handy. Die Nachricht kann zum Beispiel ein Alarm oder auch ein Messwert sein",
|
||||||
|
senseBox_telegram_init_tooltip: "Initialisiere den Telegram Bot. Verwende diesen Block in der **Setup()-Schleife**. Den Token kannst du dir über den Telegram erstellen.",
|
||||||
|
senseBox_telegram_helpurl: "https://sensebox.de/projects/de/2019-12-15-telegram-blockly",
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
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/",
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
export const SENSEBOX = {
|
||||||
|
/**
|
||||||
|
* Multiplexer
|
||||||
|
*/
|
||||||
|
senseBox_multiplexer_init: "Initialisiere Multiplexer mit ",
|
||||||
|
senseBox_multiplexer_init_tooltip:
|
||||||
|
"Schließe den Multiplexer mit einem JST-JST Kabel an einen der 5 I2C-Ports an. Nun kannst du bis zu 8 gleiche Sensoren verwenden über die entsprechenden Kanäle ansprechen. Gib im Block die Anzahl der verwendeten Kanäle an",
|
||||||
|
senseBox_multiplexer_init_helpurl:
|
||||||
|
"https://docs.sensebox.de/hardware/zubehoer-multiplexer/",
|
||||||
|
senseBox_multplexer_nchannels: "Kanälen",
|
||||||
|
senseBox_multiplexer_changeChannel: "Wechsel Kanal auf:",
|
||||||
|
sensebox_multiplexer_changeChannel_tooltip:
|
||||||
|
"Wähle den entsprechenden Kanal aus",
|
||||||
|
sensebox_multiplexer_changeChannel_helpurl:
|
||||||
|
"https://docs.sensebox.de/hardware/zubehoer-multiplexer/",
|
||||||
|
};
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
export const TEXT = {
|
||||||
|
|
||||||
|
TEXT_APPEND_APPENDTEXT: "Text anhängen",
|
||||||
|
TEXT_APPEND_HELPURL: "https://github.com/google/blockly/wiki/Text#text-modification", // untranslated
|
||||||
|
TEXT_APPEND_TO: "An",
|
||||||
|
TEXT_APPEND_TOOLTIP: "Text an die Variable \"%1\" anhängen.",
|
||||||
|
TEXT_CHANGECASE_HELPURL: "https://github.com/google/blockly/wiki/Text#adjusting-text-case", // untranslated
|
||||||
|
TEXT_CHANGECASE_OPERATOR_LOWERCASE: "umwandeln in kleinbuchstaben",
|
||||||
|
TEXT_CHANGECASE_OPERATOR_TITLECASE: "umwandeln in Substantive",
|
||||||
|
TEXT_CHANGECASE_OPERATOR_UPPERCASE: "umwandeln in GROSSBUCHSTABEN",
|
||||||
|
TEXT_CHANGECASE_TOOLTIP: "Wandelt Schreibweise von Texten um, in Großbuchstaben, Kleinbuchstaben oder den ersten Buchstaben jedes Wortes groß und die anderen klein.",
|
||||||
|
TEXT_CHARAT_FIRST: "Nehme ersten Buchstaben",
|
||||||
|
TEXT_CHARAT_FROM_END: "Nehme #ten Buchstaben von hinten",
|
||||||
|
TEXT_CHARAT_FROM_START: "Nehme #ten Buchstaben",
|
||||||
|
TEXT_CHARAT_HELPURL: "http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic:%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm",
|
||||||
|
TEXT_CHARAT_INPUT_INTEXT: "vom Text",
|
||||||
|
TEXT_CHARAT_LAST: "Nehme letzten Buchstaben",
|
||||||
|
TEXT_CHARAT_RANDOM: "Nehme zufälligen Buchstaben",
|
||||||
|
TEXT_CHARAT_TAIL: "",
|
||||||
|
TEXT_CHARAT_TOOLTIP: "Extrahiere einen Buchstaben von einer spezifizierten Position.",
|
||||||
|
TEXT_CREATE_JOIN_ITEM_TOOLTIP: "Ein Element zum Text hinzufügen.",
|
||||||
|
TEXT_CREATE_JOIN_TITLE_JOIN: "verbinden",
|
||||||
|
TEXT_CREATE_JOIN_TOOLTIP: "Hinzufügen, entfernen und sortieren von Elementen.",
|
||||||
|
TEXT_GET_SUBSTRING_END_FROM_END: "bis zum #ten Buchstaben von hinten",
|
||||||
|
TEXT_GET_SUBSTRING_END_FROM_START: "bis zum #ten Buchstaben",
|
||||||
|
TEXT_GET_SUBSTRING_END_LAST: "bis zum letzten Buchstaben",
|
||||||
|
TEXT_GET_SUBSTRING_HELPURL: "http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic:%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm",
|
||||||
|
TEXT_GET_SUBSTRING_INPUT_IN_TEXT: "in Text",
|
||||||
|
TEXT_GET_SUBSTRING_START_FIRST: "vom ersten Buchstaben",
|
||||||
|
TEXT_GET_SUBSTRING_START_FROM_END: "vom #ten Buchstaben von hinten",
|
||||||
|
TEXT_GET_SUBSTRING_START_FROM_START: "vom #ten Buchstaben",
|
||||||
|
TEXT_GET_SUBSTRING_TAIL: "",
|
||||||
|
TEXT_GET_SUBSTRING_TOOLTIP: "Gibt den angegebenen Textabschnitt zurück.",
|
||||||
|
TEXT_INDEXOF_HELPURL: "http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic:%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm",
|
||||||
|
TEXT_INDEXOF_INPUT_INTEXT: "im Text",
|
||||||
|
TEXT_INDEXOF_OPERATOR_FIRST: "Suche erstes Auftreten des Begriffs",
|
||||||
|
TEXT_INDEXOF_OPERATOR_LAST: "Suche letztes Auftreten des Begriffs",
|
||||||
|
TEXT_INDEXOF_TAIL: "",
|
||||||
|
TEXT_INDEXOF_TOOLTIP: "Findet das erste / letzte Auftreten eines Suchbegriffs in einem Text. Gibt die Position des Begriffs oder 0 zurück.",
|
||||||
|
TEXT_ISEMPTY_HELPURL: "https://github.com/google/blockly/wiki/Text#checking-for-empty-text", // untranslated
|
||||||
|
TEXT_ISEMPTY_TITLE: "%1 ist leer?",
|
||||||
|
TEXT_ISEMPTY_TOOLTIP: "Ist wahr (true), wenn der Text keine Zeichen enthält ist.",
|
||||||
|
TEXT_JOIN_HELPURL: "",
|
||||||
|
TEXT_JOIN_TITLE_CREATEWITH: "Erstelle Text aus",
|
||||||
|
TEXT_JOIN_TOOLTIP: "Erstellt einen Text durch das Verbinden von mehreren Textelementen.",
|
||||||
|
TEXT_LENGTH_HELPURL: "https://github.com/google/blockly/wiki/Text#text-modification", // untranslated
|
||||||
|
TEXT_LENGTH_TITLE: "Länge %1",
|
||||||
|
TEXT_LENGTH_TOOLTIP: "Die Anzahl von Zeichen in einem Text. (inkl. Leerzeichen)",
|
||||||
|
TEXT_PRINT_HELPURL: "https://github.com/google/blockly/wiki/Text#printing-text", // untranslated
|
||||||
|
TEXT_PRINT_TITLE: "Ausgabe %1",
|
||||||
|
TEXT_PRINT_TOOLTIP: "Gib den Inhalt einer Variable aus.",
|
||||||
|
TEXT_PROMPT_HELPURL: "https://github.com/google/blockly/wiki/Text#getting-input-from-the-user", // untranslated
|
||||||
|
TEXT_PROMPT_TOOLTIP_NUMBER: "Fragt den Benutzer nach einer Zahl.",
|
||||||
|
TEXT_PROMPT_TOOLTIP_TEXT: "Fragt den Benutzer nach einem Text.",
|
||||||
|
TEXT_PROMPT_TYPE_NUMBER: "Fragt nach Zahl mit Hinweis",
|
||||||
|
TEXT_PROMPT_TYPE_TEXT: "Fragt nach Text mit Hinweis",
|
||||||
|
TEXT_TEXT_HELPURL: "https://de.wikipedia.org/wiki/Zeichenkette",
|
||||||
|
TEXT_TEXT_TOOLTIP: "Ein Buchstabe, Text oder Satz.",
|
||||||
|
TEXT_TRIM_HELPURL: "https://github.com/google/blockly/wiki/Text#trimming-removing-spaces", // untranslated
|
||||||
|
TEXT_TRIM_OPERATOR_BOTH: "entferne Leerzeichen vom Anfang und vom Ende (links und rechts)",
|
||||||
|
TEXT_TRIM_OPERATOR_LEFT: "entferne Leerzeichen vom Anfang (links)",
|
||||||
|
TEXT_TRIM_OPERATOR_RIGHT: "entferne Leerzeichen vom Ende (rechts)",
|
||||||
|
TEXT_TRIM_TOOLTIP: "Entfernt Leerzeichen vom Anfang und / oder Ende eines Textes.",
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
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",
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
export const TOURS = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Home Tour
|
||||||
|
*/
|
||||||
|
hometour_wrapper: "Willkommen zu Blockly für die senseBox. In dieser Tour werde ich dir alle wichtigen Funktionen der Oberfläche zeigen",
|
||||||
|
hometour_workspaceFunc: "Hier findest du alle Buttons um dein Programm zu übertragen, zu speichern oder zu teilen",
|
||||||
|
hometour_blocklyWindow: "Dies ist deine Arbeitsfläche. Hier kannst du mithilfe der Blöcke deinen Programmcode erstellen",
|
||||||
|
hometour_blocklyToolboxDiv: "In der Toolbox befinden sich alle Blöcke. Verbinde diese in der Arbeitsfläche und erstelle dein Programmcode",
|
||||||
|
hometour_compileBlocks: "Wenn du fertig mit dem Programmieren bist und deinen Programmcode auf die senseBox übertragen möchtest klicke hier um deinen Programmcode zu kompilieren.",
|
||||||
|
hometour_menuButton: "Im Menü findest du Tutorials und eine Gallery mit verschiedenen Beispiel Programmen. Logge dich über deinen openSenseMap Account ein und du erhälst noch mehr Funktionen",
|
||||||
|
hometour_showCode: "Über diesen Button kannst du dir den generierten Programmcode anzeigen lassen",
|
||||||
|
hometour_shareBlocks: "Erstelle über diesen Button einen Kurzlink und teile deine Blöcke mit anderen Nutzer:innen",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assessment Tour
|
||||||
|
*/
|
||||||
|
|
||||||
|
assessmenttour_solutionCheck: "Wenn deine Lösung fertig ist klicke hier um diese zu überprüfen",
|
||||||
|
assessmenttour_assessmentDiv: "Los gehts! Löse die folgende Aufgabe, um das Tutorial abzuschließen.",
|
||||||
|
assessmenttour_injectionDiv: "Erstelle hier deine Lösung. Du kannst alle Blöcke aus der Toolbox verwenden.",
|
||||||
|
}
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
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",
|
||||||
|
|
||||||
|
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 …",
|
||||||
|
|
||||||
|
/*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",
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,256 @@
|
|||||||
|
export const UI = {
|
||||||
|
/**
|
||||||
|
* Toolbox
|
||||||
|
*/
|
||||||
|
toolbox_sensors: "Sensoren",
|
||||||
|
toolbox_logic: "Logik",
|
||||||
|
toolbox_loops: "Schleifen",
|
||||||
|
toolbox_math: "Mathematik",
|
||||||
|
toolbox_io: "Eingang/Ausgang",
|
||||||
|
toolbox_time: "Zeit",
|
||||||
|
toolbox_functions: "Funktionen",
|
||||||
|
toolbox_variables: "Variablen",
|
||||||
|
variable_NUMBER: "Zahl (int)",
|
||||||
|
variable_SHORT_NUMBER: "char",
|
||||||
|
variable_LONG: "große Zahl (long)",
|
||||||
|
variable_DECIMAL: "Kommazahl (float)",
|
||||||
|
variables_TEXT: "Text (string)",
|
||||||
|
variables_ARRAY: "Array (array)",
|
||||||
|
variables_CHARACTER: "char (char)",
|
||||||
|
variables_BOOLEAN: "Boolean (boolean)",
|
||||||
|
variables_NULL: "void (void)",
|
||||||
|
variables_UNDEF: "undefined",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tooltips
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
tooltip_compile_code: "Code kompilieren",
|
||||||
|
tooltip_save_blocks: "Blöcke speichern",
|
||||||
|
tooltip_open_blocks: "Blöcke öffnen",
|
||||||
|
tooltip_screenshot: "Screenshot erstellen",
|
||||||
|
tooltip_clear_workspace: "Workspace zurücksetzen",
|
||||||
|
tooltip_share_blocks: "Blöcke teilen",
|
||||||
|
tooltip_show_code: "Code anzeigen",
|
||||||
|
tooltip_hide_code: "Code ausblenden",
|
||||||
|
tooltip_delete_project: "Projekt löschen",
|
||||||
|
tooltip_project_name: "Name des Projektes",
|
||||||
|
tooltip_download_project: "Projekt herunterladen",
|
||||||
|
tooltip_open_project: "Projekt öffnen",
|
||||||
|
tooltip_update_project: "Projekt aktualisieren",
|
||||||
|
tooltip_save_project: "Projekt speichern",
|
||||||
|
tooltip_create_project: "Projekt erstellen",
|
||||||
|
tooltip_share_project: "Projekt teilen",
|
||||||
|
tooltip_reset_workspace: "Workspace zurücksetzen",
|
||||||
|
tooltip_copy_link: "Link kopieren",
|
||||||
|
tooltip_trashcan_hide: "gelöschte Blöcke ausblenden",
|
||||||
|
tooltip_trashcan_delete: "Blöcke endgültig löschen",
|
||||||
|
tooltip_project_title: "Titel des Projektes",
|
||||||
|
tooltip_check_solution: "Lösung kontrollieren",
|
||||||
|
tooltip_copy_code: "Code in die Zwischenablage kopieren",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Messages
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
messages_delete_project_failed:
|
||||||
|
"Fehler beim Löschen des Projektes. Versuche es noch einmal.",
|
||||||
|
messages_reset_workspace_success:
|
||||||
|
"Das Projekt wurde erfolgreich zurückgesetzt",
|
||||||
|
messages_PROJECT_UPDATE_SUCCESS:
|
||||||
|
"Das Projekt wurde erfolgreich aktualisiert.",
|
||||||
|
messages_GALLERY_UPDATE_SUCCESS:
|
||||||
|
"Das Galerie-Projekt wurde erfolgreich aktualisiert.",
|
||||||
|
messages_PROJECT_UPDATE_FAIL:
|
||||||
|
"Fehler beim Aktualisieren des Projektes. Versuche es noch einmal.",
|
||||||
|
messages_GALLERY_UPDATE_FAIL:
|
||||||
|
"Fehler beim Aktualisieren des Galerie-Projektes. Versuche es noch einmal.",
|
||||||
|
messages_gallery_save_fail_1: "Fehler beim Speichern des ",
|
||||||
|
messages_gallery_save_fail_2: "Projektes. Versuche es noch einmal.",
|
||||||
|
messages_SHARE_SUCCESS: "Programm teilen",
|
||||||
|
messages_SHARE_FAIL:
|
||||||
|
"Fehler beim Erstellen eines Links zum Teilen deines Programmes. Versuche es noch einmal.",
|
||||||
|
messages_copylink_success: "Link erfolgreich in Zwischenablage gespeichert.",
|
||||||
|
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",
|
||||||
|
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)",
|
||||||
|
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",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset Dialog
|
||||||
|
*/
|
||||||
|
|
||||||
|
resetDialog_headline: "Workspace zurücksetzen?",
|
||||||
|
resetDialog_text:
|
||||||
|
"Möchtest du wirklich die Workspace zurücksetzen? Hierbei werden alle Blöcke gelöscht!",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Share Dialog
|
||||||
|
*/
|
||||||
|
|
||||||
|
sharedialog_headline: "Dein Link wurde erstellt.",
|
||||||
|
sharedialog_text: "Über den folgenden Link kannst du dein Programm teilen.",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project rename Dialog
|
||||||
|
*/
|
||||||
|
|
||||||
|
renamedialog_headline: "Projekt benennen",
|
||||||
|
renamedialog_text:
|
||||||
|
"Bitte gib einen Namen für das Projekt ein und bestätige diesen mit einem Klick auf 'Bestätigen'.",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile Dialog
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
compiledialog_headline: "Fehler",
|
||||||
|
compiledialog_text:
|
||||||
|
"Beim kompilieren ist ein Fehler aufgetreten. Überprüfe deine Blöcke und versuche es erneut",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Buttons
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
button_cancel: "Abbrechen",
|
||||||
|
button_close: "Schließen",
|
||||||
|
button_accept: "Bestätigen",
|
||||||
|
button_compile: "Kompilieren",
|
||||||
|
button_create_variableCreate: "Erstelle Variable",
|
||||||
|
button_back: "Zurück",
|
||||||
|
button_next: "nächster Schritt",
|
||||||
|
button_tutorial_overview: "Tutorial Übersicht",
|
||||||
|
button_login: "Anmelden",
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
filename: "Dateiname",
|
||||||
|
projectname: "Projektname",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Settings
|
||||||
|
*/
|
||||||
|
settings_head: "Einstellungen",
|
||||||
|
settings_language: "Sprache",
|
||||||
|
settings_language_text:
|
||||||
|
"Auswahl der Sprache gilt für die gesamte Anwendung. Es kann zwischen Deutsch und Englisch unterschieden werden.",
|
||||||
|
settings_language_de: "Deutsch",
|
||||||
|
settings_language_en: "Englisch",
|
||||||
|
settings_renderer: "Renderer",
|
||||||
|
settings_renderer_text:
|
||||||
|
"Der eingestellte Renderer bestimmt das Aussehen der Blöcke. Es kann zwischen 'Geras' und 'Zelos' unterschieden werden, wobei 'Zelos' insbesondere für eine Touch-Anwendung geeignet ist.",
|
||||||
|
settings_statistics: "Statistiken",
|
||||||
|
settings_statistics_text:
|
||||||
|
"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",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 404
|
||||||
|
*/
|
||||||
|
|
||||||
|
notfound_head: "Die von Ihnen angeforderte Seite kann nicht gefunden werden.",
|
||||||
|
notfound_text:
|
||||||
|
"Die gesuchte Seite wurde möglicherweise entfernt, ihr Name wurde geändert oder sie ist vorübergehend nicht verfügbar.",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Labels
|
||||||
|
*/
|
||||||
|
|
||||||
|
labels_donotshowagain: "Dialog nicht mehr anzeigen",
|
||||||
|
labels_here: "hier",
|
||||||
|
labels_username: "E-Mail oder Nutzername",
|
||||||
|
labels_password: "Passwort",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tutorials
|
||||||
|
*/
|
||||||
|
|
||||||
|
tutorials_assessment_task: "Aufgabe",
|
||||||
|
tutorials_hardware_head: "Für die Umsetzung benötigst du folgende Hardware:",
|
||||||
|
tutorials_hardware_moreInformation:
|
||||||
|
"Weitere Informationen zur Hardware-Komponente findest du",
|
||||||
|
tutorials_hardware_here: "hier",
|
||||||
|
tutorials_requirements:
|
||||||
|
"Bevor du mit diesem Tutorial fortfährst solltest du folgende Tutorials erfolgreich abgeschlossen haben:",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tutorial Builder
|
||||||
|
*/
|
||||||
|
|
||||||
|
builder_solution: "Lösung",
|
||||||
|
builder_solution_submit: "Lösung einreichen",
|
||||||
|
builder_example_submit: "Beispiel einreichen",
|
||||||
|
builder_comment:
|
||||||
|
"Anmerkung: Man kann den initialen Setup()- bzw. Endlosschleifen()-Block löschen. Zusätzlich ist es möglich u.a. nur einen beliebigen Block auszuwählen, ohne dass dieser als deaktiviert dargestellt wird.",
|
||||||
|
builder_hardware_order:
|
||||||
|
"Beachte, dass die Reihenfolge des Auswählens maßgebend ist.",
|
||||||
|
builder_hardware_helper: "Wähle mindestens eine Hardware-Komponente aus.",
|
||||||
|
builder_requirements_head: "Voraussetzungen",
|
||||||
|
builder_requirements_order:
|
||||||
|
"Beachte, dass die Reihenfolge des Anhakens maßgebend ist.",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Login
|
||||||
|
*/
|
||||||
|
|
||||||
|
login_head: "Anmelden",
|
||||||
|
login_osem_account_01: "Du benötigst einen ",
|
||||||
|
login_osem_account_02: "Account um dich einzuloggen",
|
||||||
|
login_lostpassword: "Du hast dein Passwort vergessen?",
|
||||||
|
login_createaccount: "Falls du noch keinen Account hast erstellen einen auf ",
|
||||||
|
/**
|
||||||
|
* Navbar
|
||||||
|
*/
|
||||||
|
|
||||||
|
navbar_tutorials: "Tutorials",
|
||||||
|
navbar_tutorialbuilder: "Tutorial erstellen",
|
||||||
|
navbar_gallery: "Gallerie",
|
||||||
|
navbar_projects: "Projekte",
|
||||||
|
|
||||||
|
navbar_menu: "Menü",
|
||||||
|
navbar_login: "Einloggen",
|
||||||
|
navbar_account: "Konto",
|
||||||
|
navbar_logout: "Abmelden",
|
||||||
|
navbar_settings: "Einstellungen",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Codeviewer
|
||||||
|
*/
|
||||||
|
|
||||||
|
codeviewer_arduino: "Arduino Quellcode",
|
||||||
|
codeviewer_xml: "XML Blöcke",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overlay
|
||||||
|
*/
|
||||||
|
|
||||||
|
compile_overlay_head: "Dein Programm wird nun kompiliert und heruntergeladen",
|
||||||
|
compile_overlay_text: "Kopiere es anschließend auf deine senseBox MCU",
|
||||||
|
compile_overlay_help: "Benötigst du mehr Hilfe? Dann schaue hier: ",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tooltip Viewer
|
||||||
|
*/
|
||||||
|
|
||||||
|
tooltip_viewer: "Hilfe",
|
||||||
|
tooltip_moreInformation: "Mehr Informationen findest du ",
|
||||||
|
tooltip_hint: "Wähle einen Block aus um dir die Hilfe anzeigen zu lassen",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IDEDrawer
|
||||||
|
*/
|
||||||
|
drawer_ideerror_head: "Hoppla da ist was schief gegangen.",
|
||||||
|
drawer_ideerror_text:
|
||||||
|
"Beim kompilieren ist ein Fehler aufgetreten, überprüfe deine Blöcke.",
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
export const VARIABLES = {
|
||||||
|
/**
|
||||||
|
* Typed Variable Modal
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
TYPED_VAR_MODAL_CONFIRM_BUTTON: "Ok",
|
||||||
|
TYPED_VAR_MODAL_VARIABLE_NAME_LABEL: "Variablen Name: ",
|
||||||
|
TYPED_VAR_MODAL_TYPES_LABEL: "Variable Typen",
|
||||||
|
TYPED_VAR_MODAL_CANCEL_BUTTON: "Abbrechen",
|
||||||
|
TYPED_VAR_MODAL_TITLE: "Erstelle Variable",
|
||||||
|
TYPED_VAR_MODAL_INVALID_NAME: "Der Name ist ungültig, bitte versuche einen anderen.",
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
export const WEBSERVER = {
|
||||||
|
/**
|
||||||
|
* Webserver
|
||||||
|
*/
|
||||||
|
|
||||||
|
senseBox_ip_address: "IP-Adresse",
|
||||||
|
senseBox_ip_address_tip: "Gibt die IP-Adresse als Zeichenkette zurück.",
|
||||||
|
senseBox_init_http_server_tip: "Initialisiert einen http-Server auf dem angegebenen Port",
|
||||||
|
senseBox_init_http_server: "HTTP-Server initialisieren",
|
||||||
|
senseBox_http_on_client_connect: "Wenn Client verbunden ist:",
|
||||||
|
senseBox_http_on_client_connect_tip: "Überprüft, ob ein Client verbunden ist und führt in diesem Fall die angegebene Anweisung aus",
|
||||||
|
senseBox_http_method: "Methode",
|
||||||
|
senseBox_http_method_tip: "Methode des aktuellen HTTP-Requests",
|
||||||
|
senseBox_http_uri: "URI",
|
||||||
|
senseBox_http_uri_tip: "URI der angeforderten Ressource der aktuellen HTTP-Anfrage",
|
||||||
|
senseBox_http_user_agent: "User-Agent",
|
||||||
|
senseBox_http_user_agent_tip: "Der Benutzer-Agent sendet zusammen mit der aktuellen HTTP-Anfrage",
|
||||||
|
senseBox_http_protocol_version: "HTTP Version",
|
||||||
|
senseBox_http_protocol_version_tip: "The HTTP Version of the current HTTP request",
|
||||||
|
senseBox_http_success_tip: "Senden einer erfolgreichen HTTP-Antwort mit Inhalt",
|
||||||
|
senseBox_http_not_found_tip: "Senden einer vordefinierten 404 HTTP-Antwort.",
|
||||||
|
senseBox_http_success: "Erfolgreiche",
|
||||||
|
senseBox_http_success_l2: "HTTP-Antwort",
|
||||||
|
senseBox_http_success_buildhtml: "HTML:",
|
||||||
|
senseBox_http_not_found: "404 Fehler",
|
||||||
|
senseBox_html_document: "HTML",
|
||||||
|
senseBox_html_header: "<head>",
|
||||||
|
senseBox_html_header_end: "</head>",
|
||||||
|
senseBox_html_body: "<body>",
|
||||||
|
senseBox_html_body_end: "</body>",
|
||||||
|
senseBox_html_general_tag_tip: "Ein allgemeiner HTML-Tag-Baustein.",
|
||||||
|
senseBox_html_document_tip: "Ein Block zum Erzeugen eines HTML-Dokuments...",
|
||||||
|
senseBox_tag_first_mutator_tip: "Mögliche Erweiterungen zu diesem Block...",
|
||||||
|
senseBox_tag_optional_mutator_tip: "Mehr Tags zum Block hinzufügen",
|
||||||
|
senseBox_sd_web_readHTML: "Lese HTML von SD Karte",
|
||||||
|
sensebox_web_readHTML_filename: "Datei:",
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
|||||||
|
export const AUDIO = {
|
||||||
|
|
||||||
|
ARD_TONEFREQ: "at frequency",
|
||||||
|
ARD_TONE_FREQ: "frequency",
|
||||||
|
ARD_TONE_PIN: "Tone PIN#",
|
||||||
|
ARD_TONE_PIN_TIP: "Generate audio tones on a pin",
|
||||||
|
ARD_TONE_TIP: "Sets tone on pin to specified frequency within range 31 - 65535 Hz",
|
||||||
|
ARD_TONE_WARNING: "Frequency must be in range 31 - 65535",
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
export const 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.
|
||||||
|
#### 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>
|
||||||
|
|
||||||
|
#### Copying programs under macOS
|
||||||
|
Copying programs under MacOS does not work via the Finder, but there are still two different ways to copy the programs:
|
||||||
|
- [senseBox Copy Tool](https://sensebox.de/docs/senseBox_Sketch_Uploader_DE.zip)
|
||||||
|
- [muCommander](https://www.mucommander.com/)
|
||||||
|
`,
|
||||||
|
|
||||||
|
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: `
|
||||||
|
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
|
||||||
|
`,
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
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:",
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
export const LOGIC = {
|
||||||
|
|
||||||
|
CONTROLS_IF_ELSEIF_TOOLTIP: "Add a condition to the if block.",
|
||||||
|
CONTROLS_IF_ELSE_TOOLTIP: "Add a final, catch-all condition to the if block.",
|
||||||
|
CONTROLS_IF_HELPURL: "https://github.com/google/blockly/wiki/IfElse",
|
||||||
|
CONTROLS_IF_IF_TOOLTIP: "Add, remove, or reorder sections to reconfigure this if block.",
|
||||||
|
CONTROLS_IF_MSG_ELSE: "else",
|
||||||
|
CONTROLS_IF_MSG_ELSEIF: "else if",
|
||||||
|
CONTROLS_IF_MSG_IF: "if",
|
||||||
|
CONTROLS_IF_TOOLTIP_1: "If a value is true, then do some statements.",
|
||||||
|
CONTROLS_IF_TOOLTIP_2: "If a value is true, then do the first block of statements. Otherwise, do the second block of statements.",
|
||||||
|
CONTROLS_IF_TOOLTIP_3: "If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements.",
|
||||||
|
CONTROLS_IF_TOOLTIP_4: "If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements. If none of the values are true, do the last block of statements.",
|
||||||
|
LOGIC_BOOLEAN_FALSE: "false",
|
||||||
|
LOGIC_BOOLEAN_HELPURL: "https://github.com/google/blockly/wiki/Logic#values",
|
||||||
|
LOGIC_BOOLEAN_TOOLTIP: "Returns either true or false.",
|
||||||
|
LOGIC_BOOLEAN_TRUE: "true",
|
||||||
|
LOGIC_COMPARE_HELPURL: "https://en.wikipedia.org/wiki/Inequality_(mathematics)",
|
||||||
|
LOGIC_COMPARE_TOOLTIP_EQ: "Return true if both inputs equal each other.",
|
||||||
|
LOGIC_COMPARE_TOOLTIP_GT: "Return true if the first input is greater than the second input.",
|
||||||
|
LOGIC_COMPARE_TOOLTIP_GTE: "Return true if the first input is greater than or equal to the second input.",
|
||||||
|
LOGIC_COMPARE_TOOLTIP_LT: "Return true if the first input is smaller than the second input.",
|
||||||
|
LOGIC_COMPARE_TOOLTIP_LTE: "Return true if the first input is smaller than or equal to the second input.",
|
||||||
|
LOGIC_COMPARE_TOOLTIP_NEQ: "Return true if both inputs are not equal to each other.",
|
||||||
|
LOGIC_NEGATE_HELPURL: "https://github.com/google/blockly/wiki/Logic#not",
|
||||||
|
LOGIC_NEGATE_TITLE: "not %1",
|
||||||
|
LOGIC_NEGATE_TOOLTIP: "Returns true if the input is false. Returns false if the input is true.",
|
||||||
|
LOGIC_NULL: "null",
|
||||||
|
LOGIC_NULL_HELPURL: "https://en.wikipedia.org/wiki/Nullable_type",
|
||||||
|
LOGIC_NULL_TOOLTIP: "Returns null.",
|
||||||
|
LOGIC_OPERATION_AND: "and",
|
||||||
|
LOGIC_OPERATION_HELPURL: "https://github.com/google/blockly/wiki/Logic#logical-operations",
|
||||||
|
LOGIC_OPERATION_OR: "or",
|
||||||
|
LOGIC_OPERATION_TOOLTIP_AND: "Return true if both inputs are true.",
|
||||||
|
LOGIC_OPERATION_TOOLTIP_OR: "Return true if at least one of the inputs is true.",
|
||||||
|
LOGIC_TERNARY_CONDITION: "test",
|
||||||
|
LOGIC_TERNARY_HELPURL: "https://en.wikipedia.org/wiki/%3F:",
|
||||||
|
LOGIC_TERNARY_IF_FALSE: "if false",
|
||||||
|
LOGIC_TERNARY_IF_TRUE: "if true",
|
||||||
|
LOGIC_TERNARY_TOOLTIP: "Check the condition in 'test'. If the condition is true, returns the 'if true' value, otherwise returns the 'if false' value.",
|
||||||
|
|
||||||
|
|
||||||
|
cases_add: "Case",
|
||||||
|
cases_condition: "Case (Variable) : ",
|
||||||
|
cases_do: "Do",
|
||||||
|
cases_switch: "Variable",
|
||||||
|
cases_tooltip: "Does something if the condition is true. If there isn't a matching case the default function will be executed.",
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
export const LOOPS = {
|
||||||
|
|
||||||
|
CONTROLS_FLOW_STATEMENTS_HELPURL: "https://github.com/google/blockly/wiki/Loops#loop-termination-blocks",
|
||||||
|
CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK: "break out of loop",
|
||||||
|
CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE: "continue with next iteration of loop",
|
||||||
|
CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK: "Break out of the containing loop.",
|
||||||
|
CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE: "Skip the rest of this loop, and continue with the next iteration.",
|
||||||
|
CONTROLS_FLOW_STATEMENTS_WARNING: "Warning: This block may only be used within a loop.",
|
||||||
|
CONTROLS_FOREACH_HELPURL: "https://github.com/google/blockly/wiki/Loops#for-each",
|
||||||
|
CONTROLS_FOREACH_TITLE: "for each item %1 in list %2",
|
||||||
|
CONTROLS_FOREACH_TOOLTIP: "For each item in a list, set the variable '%1' to the item, and then do some statements.",
|
||||||
|
CONTROLS_FOR_HELPURL: "https://github.com/google/blockly/wiki/Loops#count-with",
|
||||||
|
CONTROLS_FOR_TITLE: "count with %1 from %2 to %3 by %4",
|
||||||
|
CONTROLS_FOR_TOOLTIP: "Have the variable '%1' take on the values from the start number to the end number, counting by the specified interval, and do the specified blocks.",
|
||||||
|
CONTROLS_REPEAT_HELPURL: "https://en.wikipedia.org/wiki/For_loop",
|
||||||
|
CONTROLS_REPEAT_INPUT_DO: "do",
|
||||||
|
CONTROLS_REPEAT_TITLE: "repeat %1 times",
|
||||||
|
CONTROLS_REPEAT_TOOLTIP: "Do some statements several times.",
|
||||||
|
CONTROLS_WHILEUNTIL_HELPURL: "https://github.com/google/blockly/wiki/Loops#repeat",
|
||||||
|
CONTROLS_WHILEUNTIL_OPERATOR_UNTIL: "repeat until",
|
||||||
|
CONTROLS_WHILEUNTIL_OPERATOR_WHILE: "repeat while",
|
||||||
|
CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL: "While a value is false, then do some statements.",
|
||||||
|
CONTROLS_WHILEUNTIL_TOOLTIP_WHILE: "While a value is true, then do some statements.",
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
export const MATH = {
|
||||||
|
|
||||||
|
MATH_ADDITION_SYMBOL: "+",
|
||||||
|
MATH_ARITHMETIC_HELPURL: "https://en.wikipedia.org/wiki/Arithmetic",
|
||||||
|
MATH_ARITHMETIC_TOOLTIP_ADD: "Return the sum of the two numbers.",
|
||||||
|
MATH_ARITHMETIC_TOOLTIP_DIVIDE: "Return the quotient of the two numbers.",
|
||||||
|
MATH_ARITHMETIC_TOOLTIP_MINUS: "Return the difference of the two numbers.",
|
||||||
|
MATH_ARITHMETIC_TOOLTIP_MULTIPLY: "Return the product of the two numbers.",
|
||||||
|
MATH_ARITHMETIC_TOOLTIP_POWER: "Return the first number raised to the power of the second number.",
|
||||||
|
MATH_CHANGE_HELPURL: "https://en.wikipedia.org/wiki/Programming_idiom#Incrementing_a_counter",
|
||||||
|
MATH_CHANGE_TITLE: "change %1 by %2",
|
||||||
|
MATH_CHANGE_TOOLTIP: "Add a number to variable '%1'.",
|
||||||
|
MATH_CONSTANT_HELPURL: "https://en.wikipedia.org/wiki/Mathematical_constant",
|
||||||
|
MATH_CONSTANT_TOOLTIP: "Return one of the common constants: π (3.141…), e (2.718…), φ (1.618…), sqrt(2) (1.414…), sqrt(½) (0.707…), or ∞ (infinity).",
|
||||||
|
MATH_CONSTRAIN_HELPURL: "https://en.wikipedia.org/wiki/Clamping_%28graphics%29",
|
||||||
|
MATH_CONSTRAIN_TITLE: "constrain %1 low %2 high %3",
|
||||||
|
MATH_CONSTRAIN_TOOLTIP: "Constrain a number to be between the specified limits (inclusive).",
|
||||||
|
MATH_DIVISION_SYMBOL: "÷",
|
||||||
|
MATH_IS_DIVISIBLE_BY: "is divisible by",
|
||||||
|
MATH_IS_EVEN: "is even",
|
||||||
|
MATH_IS_NEGATIVE: "is negative",
|
||||||
|
MATH_IS_ODD: "is odd",
|
||||||
|
MATH_IS_POSITIVE: "is positive",
|
||||||
|
MATH_IS_PRIME: "is prime",
|
||||||
|
MATH_IS_TOOLTIP: "Check if a number is an even, odd, prime, whole, positive, negative, or if it is divisible by certain number. Returns true or false.",
|
||||||
|
MATH_IS_WHOLE: "is whole",
|
||||||
|
MATH_MODULO_HELPURL: "https://en.wikipedia.org/wiki/Modulo_operation",
|
||||||
|
MATH_MODULO_TITLE: "remainder of %1 ÷ %2",
|
||||||
|
MATH_MODULO_TOOLTIP: "Return the remainder from dividing the two numbers.",
|
||||||
|
MATH_MULTIPLICATION_SYMBOL: "×",
|
||||||
|
MATH_NUMBER_HELPURL: "https://en.wikipedia.org/wiki/Number",
|
||||||
|
MATH_NUMBER_TOOLTIP: "A number.",
|
||||||
|
MATH_ONLIST_HELPURL: "",
|
||||||
|
MATH_ONLIST_OPERATOR_AVERAGE: "average of list",
|
||||||
|
MATH_ONLIST_OPERATOR_MAX: "max of list",
|
||||||
|
MATH_ONLIST_OPERATOR_MEDIAN: "median of list",
|
||||||
|
MATH_ONLIST_OPERATOR_MIN: "min of list",
|
||||||
|
MATH_ONLIST_OPERATOR_MODE: "modes of list",
|
||||||
|
MATH_ONLIST_OPERATOR_RANDOM: "random item of list",
|
||||||
|
MATH_ONLIST_OPERATOR_STD_DEV: "standard deviation of list",
|
||||||
|
MATH_ONLIST_OPERATOR_SUM: "sum of list",
|
||||||
|
MATH_ONLIST_TOOLTIP_AVERAGE: "Return the average (arithmetic mean) of the numeric values in the list.",
|
||||||
|
MATH_ONLIST_TOOLTIP_MAX: "Return the largest number in the list.",
|
||||||
|
MATH_ONLIST_TOOLTIP_MEDIAN: "Return the median number in the list.",
|
||||||
|
MATH_ONLIST_TOOLTIP_MIN: "Return the smallest number in the list.",
|
||||||
|
MATH_ONLIST_TOOLTIP_MODE: "Return a list of the most common item(s) in the list.",
|
||||||
|
MATH_ONLIST_TOOLTIP_RANDOM: "Return a random element from the list.",
|
||||||
|
MATH_ONLIST_TOOLTIP_STD_DEV: "Return the standard deviation of the list.",
|
||||||
|
MATH_ONLIST_TOOLTIP_SUM: "Return the sum of all the numbers in the list.",
|
||||||
|
MATH_POWER_SYMBOL: "^",
|
||||||
|
MATH_RANDOM_FLOAT_HELPURL: "https://en.wikipedia.org/wiki/Random_number_generation",
|
||||||
|
MATH_RANDOM_FLOAT_TITLE_RANDOM: "random fraction",
|
||||||
|
MATH_RANDOM_FLOAT_TOOLTIP: "Return a random fraction between 0.0 (inclusive) and 1.0 (exclusive).",
|
||||||
|
MATH_RANDOM_INT_HELPURL: "https://en.wikipedia.org/wiki/Random_number_generation",
|
||||||
|
MATH_RANDOM_INT_TITLE: "random integer from %1 to %2",
|
||||||
|
MATH_RANDOM_INT_TOOLTIP: "Return a random integer between the two specified limits, inclusive.",
|
||||||
|
MATH_ROUND_HELPURL: "https://en.wikipedia.org/wiki/Rounding",
|
||||||
|
MATH_ROUND_OPERATOR_ROUND: "round",
|
||||||
|
MATH_ROUND_OPERATOR_ROUNDDOWN: "round down",
|
||||||
|
MATH_ROUND_OPERATOR_ROUNDUP: "round up",
|
||||||
|
MATH_ROUND_TOOLTIP: "Round a number up or down.",
|
||||||
|
MATH_SINGLE_HELPURL: "https://en.wikipedia.org/wiki/Square_root",
|
||||||
|
MATH_SINGLE_OP_ABSOLUTE: "absolute",
|
||||||
|
MATH_SINGLE_OP_ROOT: "square root",
|
||||||
|
MATH_SINGLE_TOOLTIP_ABS: "Return the absolute value of a number.",
|
||||||
|
MATH_SINGLE_TOOLTIP_EXP: "Return e to the power of a number.",
|
||||||
|
MATH_SINGLE_TOOLTIP_LN: "Return the natural logarithm of a number.",
|
||||||
|
MATH_SINGLE_TOOLTIP_LOG10: "Return the base 10 logarithm of a number.",
|
||||||
|
MATH_SINGLE_TOOLTIP_NEG: "Return the negation of a number.",
|
||||||
|
MATH_SINGLE_TOOLTIP_POW10: "Return 10 to the power of a number.",
|
||||||
|
MATH_SINGLE_TOOLTIP_ROOT: "Return the square root of a number.",
|
||||||
|
MATH_SUBTRACTION_SYMBOL: "-",
|
||||||
|
MATH_TRIG_ACOS: "acos",
|
||||||
|
MATH_TRIG_ASIN: "asin",
|
||||||
|
MATH_TRIG_ATAN: "atan",
|
||||||
|
MATH_TRIG_COS: "cos",
|
||||||
|
MATH_TRIG_HELPURL: "https://en.wikipedia.org/wiki/Trigonometric_functions",
|
||||||
|
MATH_TRIG_SIN: "sin",
|
||||||
|
MATH_TRIG_TAN: "tan",
|
||||||
|
MATH_TRIG_TOOLTIP_ACOS: "Return the arccosine of a number.",
|
||||||
|
MATH_TRIG_TOOLTIP_ASIN: "Return the arcsine of a number.",
|
||||||
|
MATH_TRIG_TOOLTIP_ATAN: "Return the arctangent of a number.",
|
||||||
|
MATH_TRIG_TOOLTIP_COS: "Return the cosine of a degree (not radian).",
|
||||||
|
MATH_TRIG_TOOLTIP_SIN: "Return the sine of a degree (not radian).",
|
||||||
|
MATH_TRIG_TOOLTIP_TAN: "Return the tangent of a degree (not radian).",
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
export const MQTT = {
|
||||||
|
|
||||||
|
/***
|
||||||
|
* MQTT
|
||||||
|
*/
|
||||||
|
|
||||||
|
senseBox_mqtt_init: "Connect to MQTT Broker",
|
||||||
|
senseBox_mqtt_server: "Server",
|
||||||
|
senseBox_mqtt_port: "Port",
|
||||||
|
senseBox_mqtt_username: "Username",
|
||||||
|
senseBox_mqtt_password: "Password",
|
||||||
|
sensebox_mqtt_subscribe: "Subscribe to Feed",
|
||||||
|
senseBox_mqtt_publish: "Publish to Feed/Topic",
|
||||||
|
senseBox_mqtt_init_tooltip: "Initialise a connection to a MQTT Broker. Use this Block inside the setup()-function and make sure to connect to your wifi first.",
|
||||||
|
senseBox_mqtt_publish_tooltip: "Publish something to a specific topic to your MQTT Broker.",
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
export const BLE = {
|
||||||
|
/**
|
||||||
|
* Phyphox Init
|
||||||
|
*/
|
||||||
|
sensebox_phyphox_init: "Initialise Phyphox device with name:",
|
||||||
|
sensebox_phyphox_createExperiment: "Create experiment",
|
||||||
|
sensebox_phyphox_experimentName: "Name of experiment",
|
||||||
|
sensebox_phyphox_experimentTitle: "Title",
|
||||||
|
sensebox_phyphox_experimentCategory: "Category",
|
||||||
|
sensebox_phyphox_experimentDescription: "Description",
|
||||||
|
sensebox_phyphox_experiment_description:
|
||||||
|
"Short description of the experiment",
|
||||||
|
sensebox_phyphox_writeValues: "Send values",
|
||||||
|
sensebox_phyphox_createView: "With graphs:",
|
||||||
|
sensebox_phyphox_createGraph: "Create Graph",
|
||||||
|
sensebox_phyphox_graphLabel: "",
|
||||||
|
sensebox_phyphox_unitx: "Unit x-axis",
|
||||||
|
sensebox_phyphox_unity: "Unit y-axis",
|
||||||
|
sensebox_phyphox_labelx: "Label x-axis",
|
||||||
|
sensebox_phyphox_labely: "Label y-axis",
|
||||||
|
sensebox_phyphox_channel0: "x-axis value",
|
||||||
|
sensebox_phyphox_channel1: "y-axis value",
|
||||||
|
sensebox_phyphox_style_dots: "Dots",
|
||||||
|
sensebox_phyphox_style_line: "Line",
|
||||||
|
sensebox_phyphox_timestamp: "Timestamp",
|
||||||
|
sensebox_phyphox_channel: "Channel",
|
||||||
|
sensebox_phyphox_sendchannel: "send to channel:",
|
||||||
|
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",
|
||||||
|
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:
|
||||||
|
"Creates a new graph for the experiment. Specify the unit and label for the axes and choose the style of visualisation of the measured values. Add to the interfaces for the values of the X- and Y-axis the channel on which the measured values will be sent later. If you want to create a timestamp via the Phyphox app, connect the block *Timestamp*",
|
||||||
|
sensebox_phyphox_timestamp_tooltip:
|
||||||
|
"Use this block to have a timestamp created via the Phyphox app",
|
||||||
|
sensebox_phyphox_sendchannel_tooltip:
|
||||||
|
"Sends a reading to the selected channel",
|
||||||
|
sensebox_phyphox_experiment_send_tooltip:
|
||||||
|
"Sends the measured values to the Phyphox App",
|
||||||
|
};
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
export const DISPLAY = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display
|
||||||
|
*/
|
||||||
|
|
||||||
|
senseBox_display_beginDisplay: "Initialize Display",
|
||||||
|
senseBox_display_beginDisplay_tooltip: `Connect the Display to one of the five **I2C-Ports**. Use this Block inside the setup()-function.`,
|
||||||
|
senseBox_display_clearDisplay_tooltip: "Löscht die Anzeige auf dem Display. Sollte immer zu Begin oder am Ende der Endlosschleife aufgerufen werden.",
|
||||||
|
senseBox_display_clearDisplay: "Clear Display",
|
||||||
|
senseBox_display_printDisplay: "Show Text/Number",
|
||||||
|
senseBox_display_printDisplay_tooltip: "Shows a number/text on the display. The position on the display can be determined via the X and Y coordinates. The font size can be set in integer values between 1 and 4. The display has a resolution of 128x64 pixels (X and Y axis).",
|
||||||
|
senseBox_display_printDisplay_x: "x-Coordinates",
|
||||||
|
senseBox_display_printDisplay_y: "y-Coordinates",
|
||||||
|
senseBox_display_printDisplay_value: "Value",
|
||||||
|
senseBox_display_setSize: "Fontsize",
|
||||||
|
senseBox_display_setSize_tip: "Change the fontsize with a value between 1 and 4",
|
||||||
|
senseBox_display_color: "Font color",
|
||||||
|
senseBox_display_white: "White",
|
||||||
|
senseBox_display_black: "Black",
|
||||||
|
sensebox_display_show: "Print on display",
|
||||||
|
sensebox_display_show_tip: "Show the following content on the Display",
|
||||||
|
senseBox_dipslay_plotTitle: "Title",
|
||||||
|
senseBox_display_plotDisplay: "Plot Diagram",
|
||||||
|
senseBox_display_plotXLabel: "X-Axis Label",
|
||||||
|
senseBox_display_plotYLabel: "Y-Axis Label",
|
||||||
|
senseBox_display_plotXRange1: "X-Range Begin",
|
||||||
|
senseBox_display_plotXRange2: "X-Range End",
|
||||||
|
senseBox_display_plotYRange1: "Y-Range Begin",
|
||||||
|
senseBox_display_plotYRange2: "Y-Range End",
|
||||||
|
senseBox_display_plotYTick: "Y-Tick",
|
||||||
|
senseBox_display_plotXTick: "X-Tick",
|
||||||
|
senseBox_display_plotTimeFrame: "TimeFrame",
|
||||||
|
sensebox_display_fillCircle: "Draw Point",
|
||||||
|
sensebox_display_fillCircle_radius: "Radius",
|
||||||
|
senseBox_display_fillCircle_tooltip: "This block can be used to show a point on the display. You can use the coordinates to place the point on the display and use the radius to determine the size.",
|
||||||
|
sensebox_display_drawRectangle: "Draw Rectangle",
|
||||||
|
sensebox_display_drawRectangle_width: "Width",
|
||||||
|
sensebox_display_drawRectangle_height: "Height",
|
||||||
|
senseBox_display_drawRectangle_tooltip: "This block draws a rectangle on the display. The X and Y coordinates are used to determine the position of the top left corner of the rectangle on the display. The height and width are specified in pixels and the 'Filled' checkbox can be used to select whether the rectangle is filled or just displayed as a frame.",
|
||||||
|
senseBox_display_filled: "filled",
|
||||||
|
senseBox_display_fastPrint_show: "Show Measurements",
|
||||||
|
senseBox_display_fastPrint_title: "Title",
|
||||||
|
senseBox_display_fastPrint_value: "Value",
|
||||||
|
senseBox_display_fastPrint_dimension: "Unit",
|
||||||
|
sensebox_display_fastPrint_tooltip: "Show two measurements with title and dimension on the display",
|
||||||
|
senseBox_display_helpurl: "https://en.docs.sensebox.de/blockly/blockly-display/"
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
export const LED = {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
senseBox_led: "LED connected to digital",
|
||||||
|
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",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.",
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
export const LORA = {
|
||||||
|
/*
|
||||||
|
* 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_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**.",
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
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",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
export const RTC = {
|
||||||
|
sensebox_rtc_init: "Initialise RTC",
|
||||||
|
sensebox_rtc_init_tooltip:
|
||||||
|
"Initialise the RTC. Connect it to one of the 5 I2C/Wire connections and insert the battery. Before you can read out the time, it must first be set. This step usually only needs to be done once.",
|
||||||
|
sensebox_rtc_set: "Set RTC time/date:",
|
||||||
|
sensebox_rtc_set_tooltip:
|
||||||
|
"Sets the time of the RTC. Note that you execute this block in the setup.",
|
||||||
|
sensebox_rtc_get_timestamp: "Get timestamp",
|
||||||
|
sensebox_rtc_get_timestamp_tooltip:
|
||||||
|
"Returns a timestamp formatted in ISO 8601. Ex: 2021-12-24T18:21Z",
|
||||||
|
sensebox_rtc_get_tooltip: "Returns the selected value",
|
||||||
|
sensebox_rtc_set_ntp: "Set time via NTP-Server",
|
||||||
|
sensebox_rtc_get: "Get: ",
|
||||||
|
sensebox_rtc_second: "seconds",
|
||||||
|
sensebox_rtc_minutes: "minutes",
|
||||||
|
sensebox_rtc_hour: "hour",
|
||||||
|
sensebox_rtc_day: "day",
|
||||||
|
sensebox_rtc_month: "month",
|
||||||
|
sensebox_rtc_year: "year",
|
||||||
|
};
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
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",
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
export const SENSORS = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sensors
|
||||||
|
* ---------------------------------------------------
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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: "",
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 %",
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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:
|
||||||
|
- Trigger: Green Cable
|
||||||
|
- Echo: Yellow Cable`,
|
||||||
|
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/",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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_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.
|
||||||
|
**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/",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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/",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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,
|
||||||
|
- IAQ Accuracy : 1 means value is inaccurate,
|
||||||
|
- IAQ Accuracy : 2 means sensor is being calibrated,
|
||||||
|
- 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/",
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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/",
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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:
|
||||||
|
- "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_watertemperature: "Water Temperature",
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
export const TELEGRAM = {
|
||||||
|
/*
|
||||||
|
* Telegram
|
||||||
|
*/
|
||||||
|
senseBox_telegram_init: "Initialize Telegram Bot",
|
||||||
|
senseBox_telegram_token: "Token",
|
||||||
|
senseBox_telegram_do: "Telegram do",
|
||||||
|
senseBox_telegram_do_tooltip: "Insert into this loop the blocks you want your Telegram bot to execute. Note here that you can have actions performed on a specific message, or you can send a message yourself.",
|
||||||
|
senseBox_telegram_do_on_message: "on message",
|
||||||
|
senseBox_telegram_message: "Message",
|
||||||
|
senseBox_telegram_message_tooltip: "Perform an action when the Telegram has received a *message*.",
|
||||||
|
senseBox_telegram_send: "Send Message",
|
||||||
|
senseBox_telegram_send_tooltip: "Your Telgram bot is sending you a message to your phone. The message can be, for example, an alarm or even a reading",
|
||||||
|
senseBox_telegram_init_tooltip: "Initialize the Telegram bot. Use this block in the **setup() loop**. You can create the token using Telegram.",
|
||||||
|
senseBox_telegram_helpurl: "https://sensebox.de/projects/de/2019-12-15-telegram-blockly",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
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/",
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
export const SENSEBOX = {
|
||||||
|
/**
|
||||||
|
* Multiplexer
|
||||||
|
*/
|
||||||
|
senseBox_multiplexer_init: "Initialise Multiplexer with ",
|
||||||
|
senseBox_multiplexer_init_tooltip:
|
||||||
|
"Connect the multiplexer with a JST-JST cable to one of the 5 I2C ports. Now you can use up to 8 sensors of the same type and address them via the corresponding channels. Enter the number of used channels in the block",
|
||||||
|
senseBox_multiplexer_init_helpurl:
|
||||||
|
"https://en.docs.sensebox.de/hardware/zubehoer-multiplexer/",
|
||||||
|
senseBox_multplexer_nchannels: "Channels",
|
||||||
|
senseBox_multiplexer_changeChannel: "Change active channel to:",
|
||||||
|
sensebox_multiplexer_changeChannel_tooltip:
|
||||||
|
"Changes the active channel to the selected number",
|
||||||
|
sensebox_multiplexer_changeChannel_helpurl:
|
||||||
|
"https://en.docs.sensebox.de/hardware/zubehoer-multiplexer/",
|
||||||
|
};
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
export const TEXT = {
|
||||||
|
|
||||||
|
TEXT_APPEND_APPENDTEXT: "append text",
|
||||||
|
TEXT_APPEND_HELPURL: "https://github.com/google/blockly/wiki/Text#text-modification",
|
||||||
|
TEXT_APPEND_TO: "to",
|
||||||
|
TEXT_APPEND_TOOLTIP: "Append some text to variable '%1'.",
|
||||||
|
TEXT_CHANGECASE_HELPURL: "https://github.com/google/blockly/wiki/Text#adjusting-text-case",
|
||||||
|
TEXT_CHANGECASE_OPERATOR_LOWERCASE: "to lower case",
|
||||||
|
TEXT_CHANGECASE_OPERATOR_TITLECASE: "to Title Case",
|
||||||
|
TEXT_CHANGECASE_OPERATOR_UPPERCASE: "to UPPER CASE",
|
||||||
|
TEXT_CHANGECASE_TOOLTIP: "Return a copy of the text in a different case.",
|
||||||
|
TEXT_CHARAT_FIRST: "get first letter",
|
||||||
|
TEXT_CHARAT_FROM_END: "get letter # from end",
|
||||||
|
TEXT_CHARAT_FROM_START: "get letter #",
|
||||||
|
TEXT_CHARAT_HELPURL: "https://github.com/google/blockly/wiki/Text#extracting-text",
|
||||||
|
TEXT_CHARAT_INPUT_INTEXT: "in text",
|
||||||
|
TEXT_CHARAT_LAST: "get last letter",
|
||||||
|
TEXT_CHARAT_RANDOM: "get random letter",
|
||||||
|
TEXT_CHARAT_TAIL: "",
|
||||||
|
TEXT_CHARAT_TOOLTIP: "Returns the letter at the specified position.",
|
||||||
|
TEXT_CREATE_JOIN_ITEM_TOOLTIP: "Add an item to the text.",
|
||||||
|
TEXT_CREATE_JOIN_TITLE_JOIN: "join",
|
||||||
|
TEXT_CREATE_JOIN_TOOLTIP: "Add, remove, or reorder sections to reconfigure this text block.",
|
||||||
|
TEXT_GET_SUBSTRING_END_FROM_END: "to letter # from end",
|
||||||
|
TEXT_GET_SUBSTRING_END_FROM_START: "to letter #",
|
||||||
|
TEXT_GET_SUBSTRING_END_LAST: "to last letter",
|
||||||
|
TEXT_GET_SUBSTRING_HELPURL: "https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text",
|
||||||
|
TEXT_GET_SUBSTRING_INPUT_IN_TEXT: "in text",
|
||||||
|
TEXT_GET_SUBSTRING_START_FIRST: "get substring from first letter",
|
||||||
|
TEXT_GET_SUBSTRING_START_FROM_END: "get substring from letter # from end",
|
||||||
|
TEXT_GET_SUBSTRING_START_FROM_START: "get substring from letter #",
|
||||||
|
TEXT_GET_SUBSTRING_TAIL: "",
|
||||||
|
TEXT_GET_SUBSTRING_TOOLTIP: "Returns a specified portion of the text.",
|
||||||
|
TEXT_INDEXOF_HELPURL: "https://github.com/google/blockly/wiki/Text#finding-text",
|
||||||
|
TEXT_INDEXOF_INPUT_INTEXT: "in text",
|
||||||
|
TEXT_INDEXOF_OPERATOR_FIRST: "find first occurrence of text",
|
||||||
|
TEXT_INDEXOF_OPERATOR_LAST: "find last occurrence of text",
|
||||||
|
TEXT_INDEXOF_TAIL: "",
|
||||||
|
TEXT_INDEXOF_TOOLTIP: "Returns the index of the first/last occurrence of the first text in the second text. Returns 0 if text is not found.",
|
||||||
|
TEXT_ISEMPTY_HELPURL: "https://github.com/google/blockly/wiki/Text#checking-for-empty-text",
|
||||||
|
TEXT_ISEMPTY_TITLE: "%1 is empty",
|
||||||
|
TEXT_ISEMPTY_TOOLTIP: "Returns true if the provided text is empty.",
|
||||||
|
TEXT_JOIN_HELPURL: "https://github.com/google/blockly/wiki/Text#text-creation",
|
||||||
|
TEXT_JOIN_TITLE_CREATEWITH: "create text with",
|
||||||
|
TEXT_JOIN_TOOLTIP: "Create a piece of text by joining together any number of items.",
|
||||||
|
TEXT_LENGTH_HELPURL: "https://github.com/google/blockly/wiki/Text#text-modification",
|
||||||
|
TEXT_LENGTH_TITLE: "length of %1",
|
||||||
|
TEXT_LENGTH_TOOLTIP: "Returns the number of letters (including spaces) in the provided text.",
|
||||||
|
TEXT_PRINT_HELPURL: "https://github.com/google/blockly/wiki/Text#printing-text",
|
||||||
|
TEXT_PRINT_TITLE: "print %1",
|
||||||
|
TEXT_PRINT_TOOLTIP: "Print the specified text, number or other value.",
|
||||||
|
TEXT_PROMPT_HELPURL: "https://github.com/google/blockly/wiki/Text#getting-input-from-the-user",
|
||||||
|
TEXT_PROMPT_TOOLTIP_NUMBER: "Prompt for user for a number.",
|
||||||
|
TEXT_PROMPT_TOOLTIP_TEXT: "Prompt for user for some text.",
|
||||||
|
TEXT_PROMPT_TYPE_NUMBER: "prompt for number with message",
|
||||||
|
TEXT_PROMPT_TYPE_TEXT: "prompt for text with message",
|
||||||
|
TEXT_TEXT_HELPURL: "https://en.wikipedia.org/wiki/String_(computer_science)",
|
||||||
|
TEXT_TEXT_TOOLTIP: "A letter, word, or line of text.",
|
||||||
|
TEXT_TRIM_HELPURL: "https://github.com/google/blockly/wiki/Text#trimming-removing-spaces",
|
||||||
|
TEXT_TRIM_OPERATOR_BOTH: "trim spaces from both sides of",
|
||||||
|
TEXT_TRIM_OPERATOR_LEFT: "trim spaces from left side of",
|
||||||
|
TEXT_TRIM_OPERATOR_RIGHT: "trim spaces from right side of",
|
||||||
|
TEXT_TRIM_TOOLTIP: "Return a copy of the text with spaces removed from one or both ends.",
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
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",
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
export const TOURS = {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Home Tour
|
||||||
|
*/
|
||||||
|
hometour_wrapper: "Welcome to the new Learn- and Programmingapp for the senseBox. In this tour I will show you all the important features of the interface",
|
||||||
|
hometour_workspaceFunc: "Here you will find all the buttons to compile, save or share your program",
|
||||||
|
hometour_blocklyWindow: "This is your workspace. Here you can use the blocks to create your program code",
|
||||||
|
hometour_blocklyToolboxDiv: "The toolbox contains all the blocks. Connect them in the workspace and create your program code.",
|
||||||
|
hometour_compileBlocks: "When you are done programming and want to transfer your program code to the senseBox click here to compile your program code.",
|
||||||
|
hometour_menuButton: "In the menu you will find tutorials and a gallery with different example programs. Log in with your openSenseMap account and you will get even more features.",
|
||||||
|
hometour_showCode: "With this button you can show the generated program code",
|
||||||
|
hometour_shareBlocks: "Use this button to create a short link and share your blocks with other users",
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assessment Tour
|
||||||
|
*/
|
||||||
|
|
||||||
|
assessmenttour_solutionCheck: "When your solution is ready click here to check it",
|
||||||
|
assessmenttour_assessmentDiv: "Let's go! Solve the following task to complete the tutorial.",
|
||||||
|
assessmenttour_injectionDiv: "Create your solution here. You can use any blocks from the toolbox.",
|
||||||
|
}
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
export const TRANSLATIONS = {
|
||||||
|
|
||||||
|
ADD_COMMENT: "Add Comment",
|
||||||
|
AUTH: "Please authorize this app to enable your work to be saved and to allow it to be shared by you.",
|
||||||
|
CHANGE_VALUE_TITLE: "Change value:",
|
||||||
|
CHAT: "Chat with your collaborator by typing in this box!",
|
||||||
|
CLEAN_UP: "Clean up Blocks",
|
||||||
|
COLLAPSE_ALL: "Collapse Blocks",
|
||||||
|
COLLAPSE_BLOCK: "Collapse Block",
|
||||||
|
DELETE_ALL_BLOCKS: "Delete all %1 blocks?",
|
||||||
|
DELETE_BLOCK: "Delete Block",
|
||||||
|
DELETE_X_BLOCKS: "Delete %1 Blocks",
|
||||||
|
DISABLE_BLOCK: "Disable Block",
|
||||||
|
DUPLICATE_BLOCK: "Duplicate",
|
||||||
|
ENABLE_BLOCK: "Enable Block",
|
||||||
|
EXPAND_ALL: "Expand Blocks",
|
||||||
|
EXPAND_BLOCK: "Expand Block",
|
||||||
|
EXTERNAL_INPUTS: "External Inputs",
|
||||||
|
HELP: "Help",
|
||||||
|
INLINE_INPUTS: "Inline Inputs",
|
||||||
|
LISTS_CREATE_EMPTY_HELPURL: "https://github.com/google/blockly/wiki/Lists#create-empty-list",
|
||||||
|
LISTS_CREATE_EMPTY_TITLE: "create empty list",
|
||||||
|
LISTS_CREATE_EMPTY_TOOLTIP: "Returns a list, of length 0, containing no data records",
|
||||||
|
LISTS_CREATE_WITH_CONTAINER_TITLE_ADD: "list",
|
||||||
|
LISTS_CREATE_WITH_CONTAINER_TOOLTIP: "Add, remove, or reorder sections to reconfigure this list block.",
|
||||||
|
LISTS_CREATE_WITH_HELPURL: "https://github.com/google/blockly/wiki/Lists#create-list-with",
|
||||||
|
LISTS_CREATE_WITH_INPUT_WITH: "create list with",
|
||||||
|
LISTS_CREATE_WITH_ITEM_TOOLTIP: "Add an item to the list.",
|
||||||
|
LISTS_CREATE_WITH_TOOLTIP: "Create a list with any number of items.",
|
||||||
|
LISTS_GET_INDEX_FIRST: "first",
|
||||||
|
LISTS_GET_INDEX_FROM_END: "# from end",
|
||||||
|
LISTS_GET_INDEX_FROM_START: "#",
|
||||||
|
LISTS_GET_INDEX_GET: "get",
|
||||||
|
LISTS_GET_INDEX_GET_REMOVE: "get and remove",
|
||||||
|
LISTS_GET_INDEX_LAST: "last",
|
||||||
|
LISTS_GET_INDEX_RANDOM: "random",
|
||||||
|
LISTS_GET_INDEX_REMOVE: "remove",
|
||||||
|
LISTS_GET_INDEX_TAIL: "",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_GET_FIRST: "Returns the first item in a list.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_GET_FROM_END: "Returns the item at the specified position in a list. #1 is the last item.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_GET_FROM_START: "Returns the item at the specified position in a list. #1 is the first item.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_GET_LAST: "Returns the last item in a list.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_GET_RANDOM: "Returns a random item in a list.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST: "Removes and returns the first item in a list.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM_END: "Removes and returns the item at the specified position in a list. #1 is the last item.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM_START: "Removes and returns the item at the specified position in a list. #1 is the first item.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST: "Removes and returns the last item in a list.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM: "Removes and returns a random item in a list.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST: "Removes the first item in a list.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM_END: "Removes the item at the specified position in a list. #1 is the last item.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM_START: "Removes the item at the specified position in a list. #1 is the first item.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST: "Removes the last item in a list.",
|
||||||
|
LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM: "Removes a random item in a list.",
|
||||||
|
LISTS_GET_SUBLIST_END_FROM_END: "to # from end",
|
||||||
|
LISTS_GET_SUBLIST_END_FROM_START: "to #",
|
||||||
|
LISTS_GET_SUBLIST_END_LAST: "to last",
|
||||||
|
LISTS_GET_SUBLIST_HELPURL: "https://github.com/google/blockly/wiki/Lists#getting-a-sublist",
|
||||||
|
LISTS_GET_SUBLIST_START_FIRST: "get sub-list from first",
|
||||||
|
LISTS_GET_SUBLIST_START_FROM_END: "get sub-list from # from end",
|
||||||
|
LISTS_GET_SUBLIST_START_FROM_START: "get sub-list from #",
|
||||||
|
LISTS_GET_SUBLIST_TAIL: "",
|
||||||
|
LISTS_GET_SUBLIST_TOOLTIP: "Creates a copy of the specified portion of a list.",
|
||||||
|
LISTS_INDEX_OF_FIRST: "find first occurrence of item",
|
||||||
|
LISTS_INDEX_OF_HELPURL: "https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list",
|
||||||
|
LISTS_INDEX_OF_LAST: "find last occurrence of item",
|
||||||
|
LISTS_INDEX_OF_TOOLTIP: "Returns the index of the first/last occurrence of the item in the list. Returns 0 if item is not found.",
|
||||||
|
LISTS_INLIST: "in list",
|
||||||
|
LISTS_ISEMPTY_HELPURL: "https://github.com/google/blockly/wiki/Lists#is-empty",
|
||||||
|
LISTS_ISEMPTY_TITLE: "%1 is empty",
|
||||||
|
LISTS_ISEMPTY_TOOLTIP: "Returns true if the list is empty.",
|
||||||
|
LISTS_LENGTH_HELPURL: "https://github.com/google/blockly/wiki/Lists#length-of",
|
||||||
|
LISTS_LENGTH_TITLE: "length of %1",
|
||||||
|
LISTS_LENGTH_TOOLTIP: "Returns the length of a list.",
|
||||||
|
LISTS_REPEAT_HELPURL: "https://github.com/google/blockly/wiki/Lists#create-list-with",
|
||||||
|
LISTS_REPEAT_TITLE: "create list with item %1 repeated %2 times",
|
||||||
|
LISTS_REPEAT_TOOLTIP: "Creates a list consisting of the given value repeated the specified number of times.",
|
||||||
|
LISTS_SET_INDEX_HELPURL: "https://github.com/google/blockly/wiki/Lists#in-list--set",
|
||||||
|
LISTS_SET_INDEX_INPUT_TO: "as",
|
||||||
|
LISTS_SET_INDEX_INSERT: "insert at",
|
||||||
|
LISTS_SET_INDEX_SET: "set",
|
||||||
|
LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST: "Inserts the item at the start of a list.",
|
||||||
|
LISTS_SET_INDEX_TOOLTIP_INSERT_FROM_END: "Inserts the item at the specified position in a list. #1 is the last item.",
|
||||||
|
LISTS_SET_INDEX_TOOLTIP_INSERT_FROM_START: "Inserts the item at the specified position in a list. #1 is the first item.",
|
||||||
|
LISTS_SET_INDEX_TOOLTIP_INSERT_LAST: "Append the item to the end of a list.",
|
||||||
|
LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM: "Inserts the item randomly in a list.",
|
||||||
|
LISTS_SET_INDEX_TOOLTIP_SET_FIRST: "Sets the first item in a list.",
|
||||||
|
LISTS_SET_INDEX_TOOLTIP_SET_FROM_END: "Sets the item at the specified position in a list. #1 is the last item.",
|
||||||
|
LISTS_SET_INDEX_TOOLTIP_SET_FROM_START: "Sets the item at the specified position in a list. #1 is the first item.",
|
||||||
|
LISTS_SET_INDEX_TOOLTIP_SET_LAST: "Sets the last item in a list.",
|
||||||
|
LISTS_SET_INDEX_TOOLTIP_SET_RANDOM: "Sets a random item in a list.",
|
||||||
|
LISTS_SORT_HELPURL: "https://github.com/google/blockly/wiki/Lists#sorting-a-list",
|
||||||
|
LISTS_SORT_ORDER_ASCENDING: "ascending",
|
||||||
|
LISTS_SORT_ORDER_DESCENDING: "descending",
|
||||||
|
LISTS_SORT_TITLE: "sort %1 %2 %3",
|
||||||
|
LISTS_SORT_TOOLTIP: "Sort a copy of a list.",
|
||||||
|
LISTS_SORT_TYPE_IGNORECASE: "alphabetic, ignore case",
|
||||||
|
LISTS_SORT_TYPE_NUMERIC: "numeric",
|
||||||
|
LISTS_SORT_TYPE_TEXT: "alphabetic",
|
||||||
|
LISTS_SPLIT_HELPURL: "https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists",
|
||||||
|
LISTS_SPLIT_LIST_FROM_TEXT: "make list from text",
|
||||||
|
LISTS_SPLIT_TEXT_FROM_LIST: "make text from list",
|
||||||
|
LISTS_SPLIT_TOOLTIP_JOIN: "Join a list of texts into one text, separated by a delimiter.",
|
||||||
|
LISTS_SPLIT_TOOLTIP_SPLIT: "Split text into a list of texts, breaking at each delimiter.",
|
||||||
|
LISTS_SPLIT_WITH_DELIMITER: "with delimiter",
|
||||||
|
ME: "Me",
|
||||||
|
NEW_VARIABLE: "New variable...",
|
||||||
|
NEW_VARIABLE_TITLE: "New variable name:",
|
||||||
|
ORDINAL_NUMBER_SUFFIX: "",
|
||||||
|
PROCEDURES_ALLOW_STATEMENTS: "allow statements",
|
||||||
|
PROCEDURES_BEFORE_PARAMS: "with inputs:",
|
||||||
|
PROCEDURES_CALLNORETURN_HELPURL: "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29",
|
||||||
|
PROCEDURES_CALLNORETURN_TOOLTIP: "Run the user-defined function '%1'.",
|
||||||
|
PROCEDURES_CALLRETURN_HELPURL: "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29",
|
||||||
|
PROCEDURES_CALLRETURN_TOOLTIP: "Run the user-defined function '%1' and use its output.",
|
||||||
|
PROCEDURES_CALL_BEFORE_PARAMS: "with Inputs:",
|
||||||
|
PROCEDURES_CALL: "Call",
|
||||||
|
PROCEDURES_CALL_END: '',
|
||||||
|
PROCEDURES_CREATE_DO: "Create '%1'",
|
||||||
|
PROCEDURES_DEFNORETURN_COMMENT: "Describe this function...",
|
||||||
|
PROCEDURES_DEFNORETURN: "Create Function",
|
||||||
|
PROCEDURES_DEFNORETURN_DO: "",
|
||||||
|
PROCEDURES_DEFNORETURN_HELPURL: "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29",
|
||||||
|
PROCEDURES_DEFNORETURN_PROCEDURE: "do something",
|
||||||
|
PROCEDURES_DEFNORETURN_TITLE: "to",
|
||||||
|
PROCEDURES_DEFNORETURN_TOOLTIP: "Creates a function with no output.",
|
||||||
|
PROCEDURES_DEFRETURN_HELPURL: "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29",
|
||||||
|
PROCEDURES_DEFRETURN_RETURN_TYPE: "return Type",
|
||||||
|
PROCEDURES_DEFRETURN_RETURN: "return",
|
||||||
|
PROCEDURES_DEFRETURN_TOOLTIP: "Creates a function with an output.",
|
||||||
|
PROCEDURES_DEF_DUPLICATE_WARNING: "Warning: This function has duplicate parameters.",
|
||||||
|
PROCEDURES_HIGHLIGHT_DEF: "Highlight function definition",
|
||||||
|
PROCEDURES_IFRETURN_HELPURL: "http://c2.com/cgi/wiki?GuardClause",
|
||||||
|
PROCEDURES_IFRETURN_TOOLTIP: "If a value is true, then return a second value.",
|
||||||
|
PROCEDURES_IFRETURN_WARNING: "Warning: This block may be used only within a function definition.",
|
||||||
|
PROCEDURES_MUTATORARG_TITLE: "input name:",
|
||||||
|
PROCEDURES_MUTATORARG_TOOLTIP: "Add an input to the function.",
|
||||||
|
PROCEDURES_MUTATORCONTAINER_TITLE: "inputs",
|
||||||
|
PROCEDURES_MUTATORCONTAINER_TOOLTIP: "Add, remove, or reorder inputs to this function.",
|
||||||
|
REDO: "Redo",
|
||||||
|
REMOVE_COMMENT: "Remove Comment",
|
||||||
|
RENAME_VARIABLE: "Rename variable...",
|
||||||
|
RENAME_VARIABLE_TITLE: "Rename all '%1' variables to:",
|
||||||
|
|
||||||
|
TODAY: "Today",
|
||||||
|
UNDO: "Undo",
|
||||||
|
PROCEDURES_DEFRETURN_TITLE: "zu",
|
||||||
|
CONTROLS_IF_IF_TITLE_IF: "if",
|
||||||
|
CONTROLS_WHILEUNTIL_INPUT_DO: "do",
|
||||||
|
CONTROLS_IF_MSG_THEN: "do",
|
||||||
|
CONTROLS_IF_ELSE_TITLE_ELSE: "else",
|
||||||
|
PROCEDURES_DEFRETURN_PROCEDURE: "do something",
|
||||||
|
LISTS_GET_SUBLIST_INPUT_IN_LIST: "in List",
|
||||||
|
LISTS_GET_INDEX_INPUT_IN_LIST: "in List",
|
||||||
|
PROCEDURES_DEFRETURN_DO: "",
|
||||||
|
CONTROLS_IF_ELSEIF_TITLE_ELSEIF: "else if",
|
||||||
|
LISTS_GET_INDEX_HELPURL: "https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list",
|
||||||
|
CONTROLS_FOREACH_INPUT_DO: "do",
|
||||||
|
LISTS_SET_INDEX_INPUT_IN_LIST: "in List",
|
||||||
|
CONTROLS_FOR_INPUT_DO: "do",
|
||||||
|
LISTS_CREATE_WITH_ITEM_TITLE: "item",
|
||||||
|
TEXT_APPEND_VARIABLE: "item",
|
||||||
|
TEXT_CREATE_JOIN_ITEM_TITLE_ITEM: "item",
|
||||||
|
LISTS_INDEX_OF_INPUT_IN_LIST: "in List",
|
||||||
|
PROCEDURES_DEFRETURN_COMMENT: "describe this function…",
|
||||||
|
|
||||||
|
|
||||||
|
senseBox_basic_blue: "Blue",
|
||||||
|
senseBox_basic_green: "Gree",
|
||||||
|
senseBox_basic_red: "Red",
|
||||||
|
senseBox_basic_state: "Status",
|
||||||
|
|
||||||
|
senseBox_foto: "Light Dependent Resistor",
|
||||||
|
senseBox_foto_tip: "simple light depending resistor, gives values between 0 and 1023",
|
||||||
|
senseBox_gas: "Gas (VOC)",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
senseBox_ir: "infrared distance sensor",
|
||||||
|
senseBox_ir_tip: "infrared distance sensor can measure the distance between 10 and 80 cm",
|
||||||
|
|
||||||
|
|
||||||
|
senseBox_lux: "lightsensor",
|
||||||
|
senseBox_lux_tip: "Light Sensor can measure the illuminance in lux",
|
||||||
|
senseBox_measurement: "Measurement",
|
||||||
|
senseBox_measurements: "Measurements",
|
||||||
|
senseBox_off: "off",
|
||||||
|
senseBox_on: "on",
|
||||||
|
|
||||||
|
senseBox_output_filename: "filename",
|
||||||
|
senseBox_output_format: "format:",
|
||||||
|
senseBox_output_linebreak: "linebreak",
|
||||||
|
senseBox_output_networkid: "networkID",
|
||||||
|
senseBox_output_password: "Password",
|
||||||
|
senseBox_output_safetosd: "safe to sd",
|
||||||
|
senseBox_output_safetosd_tip: "Save Measurment to SD-Card",
|
||||||
|
senseBox_output_serialprint: "Print on Serial Monitor",
|
||||||
|
senseBox_output_timestamp: "timestamp",
|
||||||
|
senseBox_piezo_tip: "simple piezo to make sound",
|
||||||
|
senseBox_poti: "Potentiometer",
|
||||||
|
senseBox_poti_tip: "Potentiometer",
|
||||||
|
|
||||||
|
senseBox_sensor: "Sensors",
|
||||||
|
senseBox_serial_tip: "prints the values to the serial monitor in the arduino IDE. Good way to have a fast and easy feedback for your programm",
|
||||||
|
senseBox_soil: "Soil Moisture",
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
export const UI = {
|
||||||
|
/**
|
||||||
|
* Toolbox
|
||||||
|
*/
|
||||||
|
toolbox_sensors: "Sensors",
|
||||||
|
toolbox_logic: "Logic",
|
||||||
|
toolbox_loops: "Loops",
|
||||||
|
toolbox_math: "Math",
|
||||||
|
toolbox_io: "Input/Output",
|
||||||
|
toolbox_time: "Time",
|
||||||
|
toolbox_functions: "Functions",
|
||||||
|
toolbox_variables: "Variables",
|
||||||
|
variable_NUMBER: "Number (int)",
|
||||||
|
variable_SHORT_NUMBER: "char",
|
||||||
|
variable_LONG: " Zahl (long)",
|
||||||
|
variable_DECIMAL: "Decimal (float)",
|
||||||
|
variables_TEXT: "Text (string)",
|
||||||
|
variables_ARRAY: "Array (array)",
|
||||||
|
variables_CHARACTER: "char (char)",
|
||||||
|
variables_BOOLEAN: "Boolean (boolean)",
|
||||||
|
variables_NULL: "void (void)",
|
||||||
|
variables_UNDEF: "undefined",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tooltips
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
tooltip_compile_code: "Compile code",
|
||||||
|
tooltip_save_blocks: "Save blocks",
|
||||||
|
tooltip_open_blocks: "Open blocks",
|
||||||
|
tooltip_screenshot: "Download screenshot",
|
||||||
|
tooltip_clear_workspace: "Reset workspace",
|
||||||
|
tooltip_share_blocks: "Share blocks",
|
||||||
|
tooltip_show_code: "Show code",
|
||||||
|
tooltip_hide_code: "Hide code",
|
||||||
|
tooltip_delete_project: "Delete project",
|
||||||
|
tooltip_project_name: "Project name",
|
||||||
|
tooltip_download_project: "Download project",
|
||||||
|
tooltip_open_project: "Open project",
|
||||||
|
tooltip_update_project: "Update project",
|
||||||
|
tooltip_save_project: "Save project",
|
||||||
|
tooltip_create_project: "Create project",
|
||||||
|
tooltip_share_project: "Share project",
|
||||||
|
tooltip_reset_workspace: "Reset workspace",
|
||||||
|
tooltip_copy_link: "Cooy link",
|
||||||
|
tooltip_trashcan_hide: "hide deleted blocks",
|
||||||
|
tooltip_trashcan_delete: "empty trashcan",
|
||||||
|
tooltip_project_title: "Project title",
|
||||||
|
tooltip_check_solution: "Check solution",
|
||||||
|
tooltip_copy_code: "Copy Code to clipboard",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Messages
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
messages_delete_project_failed: "Error deleting the project. Try again.",
|
||||||
|
messages_reset_workspace_success: "The project has been successfully reset.",
|
||||||
|
messages_PROJECT_UPDATE_SUCCESS: "The project was successfully updated.",
|
||||||
|
messages_GALLERY_UPDATE_SUCCESS:
|
||||||
|
"The gallery project was successfully updated.",
|
||||||
|
messages_PROJECT_UPDATE_FAIL: "Error updating the project. Try again.",
|
||||||
|
messages_GALLERY_UPDATE_FAIL:
|
||||||
|
"Error updating the gallery project. Try again.",
|
||||||
|
messages_gallery_save_fail_1: "Error saving the ",
|
||||||
|
messages_gallery_save_fail_2: "Project. Try again.",
|
||||||
|
messages_SHARE_SUCCESS: "Share program",
|
||||||
|
messages_SHARE_FAIL:
|
||||||
|
"Error creating a link to share your program. Try again.",
|
||||||
|
messages_copylink_success: "Link successfully saved to clipboard.",
|
||||||
|
messages_rename_success_01: "The project was successfully saved to ",
|
||||||
|
messages_rename_success_02: "renamed.",
|
||||||
|
messages_newblockly_head:
|
||||||
|
"Welcome to the new version Blockly for the senseBox",
|
||||||
|
messages_newblockly_text:
|
||||||
|
"The new Blockly version is currently in testing. If you find any errors please report them in our [forum](https://forum.sensebox.de/t/neue-blockly-version-beta-test-und-feedback/1176). You can find an overview of all new features [here](/news)",
|
||||||
|
messages_GET_TUTORIAL_FAIL: "Back to tutorials overview",
|
||||||
|
messages_LOGIN_FAIL: "The username or password is incorrect.",
|
||||||
|
messages_login_error: "Enter both a username and a password.",
|
||||||
|
messages_copy_code: "Copy code to clipboard succesfull",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset Dialog
|
||||||
|
*/
|
||||||
|
|
||||||
|
resetDialog_headline: "Reset workspace?",
|
||||||
|
resetDialog_text:
|
||||||
|
"Do you really want to reset the workspace? All blocks will be deleted!",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Share Dialog
|
||||||
|
*/
|
||||||
|
|
||||||
|
sharedialog_headline: "Your link has been created.",
|
||||||
|
sharedialog_text: "You can share your program using the following link.",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project rename Dialog
|
||||||
|
*/
|
||||||
|
|
||||||
|
renamedialog_headline: "Rename project",
|
||||||
|
renamedialog_text:
|
||||||
|
"Please enter a name for the project and confirm it by clicking 'Confirm'.",
|
||||||
|
/**
|
||||||
|
* Compile Dialog
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
compiledialog_headline: "Error",
|
||||||
|
compiledialog_text:
|
||||||
|
"While compiling an error occured. Please check your blocks and try again",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Buttons
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
button_cancel: "Cancel",
|
||||||
|
button_close: "Close",
|
||||||
|
button_accept: "Ok",
|
||||||
|
button_compile: "Compile",
|
||||||
|
button_create_variableCreate: "Create Variable",
|
||||||
|
button_back: "Back",
|
||||||
|
button_next: "Next step",
|
||||||
|
button_tutorial_overview: "Tutorial overview",
|
||||||
|
button_login: "Login",
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
filename: "Filename",
|
||||||
|
projectname: "Projectname",
|
||||||
|
/**
|
||||||
|
* Settings
|
||||||
|
*/
|
||||||
|
settings_head: "Settings",
|
||||||
|
settings_language: "Language",
|
||||||
|
settings_language_text:
|
||||||
|
"Selection of the language applies to the entire application. A distinction can be made between German and English.",
|
||||||
|
settings_language_de: "German",
|
||||||
|
settings_language_en: "English",
|
||||||
|
settings_renderer: "Renderer",
|
||||||
|
settings_renderer_text:
|
||||||
|
"The selected renderer determines the appearance of the blocks. A distinction can be made between 'Geras' and 'Zelos', whereby 'Zelos' is particularly suitable for a touch application.",
|
||||||
|
settings_statistics: "Statistics",
|
||||||
|
settings_statistics_text:
|
||||||
|
"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",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 404
|
||||||
|
*/
|
||||||
|
|
||||||
|
notfound_head: "The page you requested cannot be found.",
|
||||||
|
notfound_text:
|
||||||
|
"The page you are looking for may have been removed, its name changed, or it may be temporarily unavailable.",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Labels
|
||||||
|
*/
|
||||||
|
labels_donotshowagain: "Do not show dialog again",
|
||||||
|
labels_here: "here",
|
||||||
|
labels_username: "Email or username",
|
||||||
|
labels_password: "Password",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tutorials
|
||||||
|
*/
|
||||||
|
|
||||||
|
tutorials_assessment_task: "Task",
|
||||||
|
tutorials_hardware_head:
|
||||||
|
"For the implementation you need the following hardware:",
|
||||||
|
tutorials_hardware_moreInformation:
|
||||||
|
"You can find more information about the hardware component.",
|
||||||
|
tutorials_hardware_here: "here",
|
||||||
|
tutorials_requirements:
|
||||||
|
"Before continuing with this tutorial, you should have successfully completed the following tutorials:",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tutorial Builder
|
||||||
|
*/
|
||||||
|
|
||||||
|
builder_solution: "Solution",
|
||||||
|
builder_solution_submit: "Submit Solution",
|
||||||
|
builder_example_submit: "Submit example",
|
||||||
|
builder_comment:
|
||||||
|
"Note: You can delete the initial setup() or infinite loop() block. Additionally, it is possible to select only any block, among others, without displaying it as disabled.",
|
||||||
|
builder_hardware_order: "Note that the order of selection is authoritative.",
|
||||||
|
builder_hardware_helper: "Select at least one hardware component.",
|
||||||
|
builder_requirements_head: "Requirements.",
|
||||||
|
builder_requirements_order:
|
||||||
|
"Note that the order of ticking is authoritative.",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Login
|
||||||
|
*/
|
||||||
|
|
||||||
|
login_head: "Login",
|
||||||
|
login_osem_account_01: "You need to have an ",
|
||||||
|
login_osem_account_02: "Account to login",
|
||||||
|
login_lostpassword: "Lost your password?",
|
||||||
|
login_createaccount:
|
||||||
|
"If you don't have an openSenseMap account please register on ",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navbar
|
||||||
|
*/
|
||||||
|
|
||||||
|
navbar_tutorials: "Tutorials",
|
||||||
|
navbar_tutorialbuilder: "Create tutorial",
|
||||||
|
navbar_gallery: "Gallery",
|
||||||
|
navbar_projects: "Projects",
|
||||||
|
|
||||||
|
navbar_menu: "Menu",
|
||||||
|
navbar_login: "Login",
|
||||||
|
navbar_account: "Account",
|
||||||
|
navbar_logout: "Logout",
|
||||||
|
navbar_settings: "Settings",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Codeviewer
|
||||||
|
*/
|
||||||
|
|
||||||
|
codeviewer_arduino: "Arduino Source Code",
|
||||||
|
codeviewer_xml: "XML Blocks",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overlay
|
||||||
|
*/
|
||||||
|
|
||||||
|
compile_overlay_head: "Your program is now compiled and downloaded",
|
||||||
|
compile_overlay_text: "Then copy it to your senseBox MCU",
|
||||||
|
compile_overlay_help: "You need help? Have a look here: ",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tooltip Viewer
|
||||||
|
*/
|
||||||
|
|
||||||
|
tooltip_viewer: "Help",
|
||||||
|
tooltip_moreInformation: "More informations can be found ",
|
||||||
|
tooltip_hint: "Select a Block to show the hint",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IDEDrawer
|
||||||
|
*/
|
||||||
|
drawer_ideerror_head: "Oops something went wrong",
|
||||||
|
drawer_ideerror_text: "An error occurred while compiling, check your blocks",
|
||||||
|
};
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
export const VARIABLES = {
|
||||||
|
/**
|
||||||
|
* Typed Variable Modal
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
TYPED_VAR_MODAL_CONFIRM_BUTTON: "Ok",
|
||||||
|
TYPED_VAR_MODAL_VARIABLE_NAME_LABEL: "Variablen Name: ",
|
||||||
|
TYPED_VAR_MODAL_TYPES_LABEL: "Variable Typen",
|
||||||
|
TYPED_VAR_MODAL_CANCEL_BUTTON: "Abbrechen",
|
||||||
|
TYPED_VAR_MODAL_TITLE: "Erstelle Variable",
|
||||||
|
TYPED_VAR_MODAL_INVALID_NAME: "Der Name ist ungültig, bitte versuche einen anderen.",
|
||||||
|
|
||||||
|
VARIABLES_DEFAULT_NAME: "item",
|
||||||
|
VARIABLES_GET_CREATE_SET: "Create 'set %1'",
|
||||||
|
VARIABLES_GET_HELPURL: "https://github.com/google/blockly/wiki/Variables#get",
|
||||||
|
VARIABLES_GET_TOOLTIP: "Returns the value of this variable.",
|
||||||
|
VARIABLES_SET: "set %1 to %2",
|
||||||
|
VARIABLES_SET_CREATE_GET: "Create 'get %1'",
|
||||||
|
VARIABLES_SET_HELPURL: "https://github.com/google/blockly/wiki/Variables#set",
|
||||||
|
VARIABLES_SET_TOOLTIP: "Sets this variable to be equal to the input.",
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
export const WEBSERVER = {
|
||||||
|
/**
|
||||||
|
* Webserver
|
||||||
|
*/
|
||||||
|
|
||||||
|
senseBox_ip_address: "IP-Address",
|
||||||
|
senseBox_ip_address_tip: "Returns the IP address as a string.",
|
||||||
|
senseBox_init_http_server_tip: "Initializes a http server on the specified port.",
|
||||||
|
senseBox_init_http_server: "Initialize HTTP-Server",
|
||||||
|
senseBox_http_on_client_connect: "If client is connected:",
|
||||||
|
senseBox_http_on_client_connect_tip: "Checks if a client is connected and executes given statement in that case.",
|
||||||
|
senseBox_http_method: "Method",
|
||||||
|
senseBox_http_method_tip: "Method of the current HTTP request",
|
||||||
|
senseBox_http_uri: "URI",
|
||||||
|
senseBox_http_uri_tip: "URI of requested resource of the current HTTP request",
|
||||||
|
senseBox_http_user_agent: "User-Agent",
|
||||||
|
senseBox_http_user_agent_tip: "The User-Agent send along with the current HTTP request",
|
||||||
|
senseBox_http_protocol_version: "HTTP Version",
|
||||||
|
senseBox_http_protocol_version_tip: "The HTTP Version of the current HTTP request",
|
||||||
|
senseBox_http_success_tip: "Send a successful HTTP response with content.",
|
||||||
|
senseBox_http_not_found_tip: "Send a predefined 404 HTTP response.",
|
||||||
|
senseBox_http_success: "Succesful",
|
||||||
|
senseBox_http_success_l2: "HTTP reponse",
|
||||||
|
senseBox_http_success_buildhtml: "HTML:",
|
||||||
|
senseBox_http_not_found: "404 Not found",
|
||||||
|
senseBox_html_document: "HTML",
|
||||||
|
senseBox_html_header: "<head>",
|
||||||
|
senseBox_html_header_end: "</head>",
|
||||||
|
senseBox_html_body: "<body>",
|
||||||
|
senseBox_html_body_end: "</body>",
|
||||||
|
senseBox_html_general_tag_tip: "A general HTML tag building block.",
|
||||||
|
senseBox_html_document_tip: "A block for generating a HTML document.",
|
||||||
|
|
||||||
|
senseBox_tag_first_mutator_tip: "Mandatory children to this block.",
|
||||||
|
senseBox_tag_optional_mutator_tip: "Add more children to the block.",
|
||||||
|
sensebox_web_readHTML_filename: "File:",
|
||||||
|
senseBox_sd_web_readHTML: "Read HTML from SD Card",
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user