Compare commits

..
Author SHA1 Message Date
Mario Pesch 0f0bd2aea4 update output 2023-05-08 14:17:18 +02:00
Mario Pesch e685724a1f add bn880 gps 2023-05-04 15:12:12 +02:00
Mario PeschandGitHub 7524e78fc6 Merge pull request #239 from sensebox/development
Development
2023-04-03 12:46:22 +02:00
Mario PeschandGitHub f8cfb6691b Merge pull request #238 from sensebox/dev/update-mini-ports
update ports for senseBox MCU mini
2023-04-03 12:39:04 +02:00
Mario PeschandGitHub abce42f764 Merge pull request #237 from sensebox/dev/button_asSwitch
add Button as Switch
2023-04-03 12:35:07 +02:00
Mario Pesch 7c60869124 add Button as Switch 2023-04-03 12:26:43 +02:00
Mario Pesch 2f4538dc89 update ports for senseBox MCU mini 2023-03-30 10:31:05 +02:00
Mario PeschandGitHub d87e47205f Merge pull request #236 from sensebox/development
fix getSelected block
2023-02-14 10:13:57 +01:00
Mario Pesch 7ca5287b86 fix getSelected block 2023-02-14 09:55:17 +01:00
Mario PeschandGitHub 67bac98e65 Merge pull request #199 from sensebox/development
Development
2023-02-13 16:24:20 +01:00
Mario Pesch 2ea773601e fix double var declaration 2023-02-13 16:10:43 +01:00
Mario PeschandGitHub 7969bf2ed7 Merge pull request #235 from sensebox/dev/fix-navbar-visibility
fix navbar visibility
2023-02-12 17:49:29 +01:00
Frederick BruchandGitHub 684417750a Merge branch 'development' into dev/fix-navbar-visibility 2023-02-10 13:59:44 +01:00
fbruc03 df4db30c72 navbar only on root and md breakpoint 2023-02-10 13:56:01 +01:00
Mario PeschandGitHub 2064fa2fb3 Merge pull request #234 from sensebox/dev/fix-gallery
fix gallery
2023-02-10 12:15:55 +01:00
Mario Pesch 98f97d6313 fix gallery 2023-02-10 12:04:10 +01:00
Mario PeschandGitHub ace2237529 Merge pull request #233 from sensebox/dev/update-blockly-v9
Dev/update blockly v9
2023-02-06 17:59:49 +01:00
Mario Pesch 07cd39f364 add account to navbar 2023-02-06 17:56:05 +01:00
Mario Pesch 02de052879 update blockly to v9 2023-02-06 17:55:57 +01:00
Mario PeschandGitHub ade6f3d4bd Merge branch 'master' into development 2023-02-06 15:06:50 +01:00
Mario PeschandGitHub 53d7c77eb5 Merge pull request #229 from sensebox/dev/newNavbarFeatures
add new navbar
2023-02-06 14:53:13 +01:00
fbruc03 426d618769 fix XML on change 2023-02-06 12:57:23 +01:00
Mario PeschandGitHub 69f3bf1db0 Merge pull request #231 from sensebox/fix-bme-dimension
hPa -> Pa
2023-01-13 07:43:15 +01:00
fbruc03 e1b659cda5 menu anchor always on button 2023-01-12 23:30:32 +01:00
fbruc03 2c1594227e style navbar items 2023-01-12 22:30:41 +01:00
Mario Pesch 512839e1f5 hPa -> Pa 2023-01-12 15:17:09 +01:00
Mario PeschandGitHub ec141088cc Merge pull request #230 from sensebox/fix-rtc-hours
Update sensebox-rtc.js
2023-01-12 14:33:38 +01:00
Mario Pesch be51eff3c8 Update sensebox-rtc.js 2023-01-12 14:30:01 +01:00
fbruc03 d05eede14f add new navbar 2023-01-12 12:39:21 +01:00
Mario PeschandGitHub d1b3761349 Merge pull request #228 from sensebox/fix-variable-type
fix variable type in block
2023-01-10 11:51:23 +01:00
Mario Pesch fb9e5c53ff fix variable type in block 2023-01-10 11:43:21 +01:00
Mario PeschandGitHub cfd6fedc6e Merge pull request #227 from sensebox/new-components
add new components
2023-01-06 17:09:18 +01:00
Mario Pesch 126606f4f5 add new components 2023-01-06 17:06:39 +01:00
Mario PeschandGitHub cb12aef535 Merge pull request #222 from sensebox/block/add-internalRTC-NTP
Block/add internal rtc ntp
2022-12-14 15:39:18 +01:00
Mario PeschandGitHub 345c15ed77 Merge pull request #221 from sensebox/block/add-sps30
init implementation of sps30 block
2022-12-14 15:35:19 +01:00
Mario Pesch b05b3017e1 remove duplicate variable 2022-12-14 13:59:31 +01:00
Mario Pesch a4641938f0 add block for timestamp from internal rtc 2022-12-14 08:56:55 +01:00
Mario Pesch 9526b154bf add blocks for internal RTC and NTP 2022-12-13 14:44:53 +01:00
Mario Pesch 745f6940ec update tooltip 2022-12-13 09:43:24 +01:00
Mario Pesch 2874620a9f init implementation of sps30 block
closes #218
2022-12-12 10:59:27 +01:00
Mario PeschandGitHub 9bf17aed67 Merge pull request #194 from sensebox/feat/mode-query-param
Add mode query parameter for opening from inside Connect App
2022-11-16 09:51:37 +01:00
Mario PeschandGitHub f6e5d086b5 Merge pull request #214 from sensebox/codegenerator/fix-co2-zeros
fix co2 zero issue
2022-11-11 15:13:39 +01:00
Mario Pesch 50ffad0ad2 fix co2 zero issue
closes #170
2022-11-11 15:08:16 +01:00
Mario PeschandGitHub 3a6fd07647 Update issue templates 2022-11-11 09:55:38 +01:00
Mario PeschandGitHub 9295d92c65 Merge pull request #205 from sensebox/fix/Serial-for-Sensors
fix Serial Ports for Sensors
2022-11-10 13:34:00 +01:00
Mario Pesch 338a0aada6 fix Serial Ports for Sensors 2022-11-10 12:40:51 +01:00
Mario PeschandGitHub a528bb7378 Merge pull request #197 from sensebox/fix/variable_db
fix variable db
2022-11-03 13:14:34 +01:00
Mario Pesch 719be33756 fix variable db
closes #192
2022-11-03 13:05:55 +01:00
Matthias Pfeil d983677d22 Add mode query parameter for opening from inside Connect App 2022-10-25 10:28:15 +02:00
53 changed files with 1055 additions and 416 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
REACT_APP_COMPILER_URL=https://compiler.sensebox.de #REACT_APP_COMPILER_URL=https://compiler.sensebox.de
REACT_APP_COMPILER_URL=http://localhost:3000
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
+38
View File
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+14
View File
@@ -0,0 +1,14 @@
---
name: Short Issue
about: Template for Short Issues
title: ''
labels: ''
assignees: ''
---
### Current behaviour
Describe the current behaviour
### Expected behaviour
Describe how it is supposed to work
+11 -11
View File
@@ -3,18 +3,18 @@
"version": "1.0.0", "version": "1.0.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@blockly/block-plus-minus": "^3.0.5", "@blockly/block-plus-minus": "^4.0.4",
"@blockly/field-grid-dropdown": "^1.0.31", "@blockly/field-grid-dropdown": "^2.0.4",
"@blockly/field-slider": "^3.0.5", "@blockly/field-slider": "4.0.4",
"@blockly/plugin-scroll-options": "^2.0.5", "@blockly/plugin-scroll-options": "^3.0.5",
"@blockly/plugin-typed-variable-modal": "^4.0.5", "@blockly/plugin-typed-variable-modal": "^5.0.6",
"@blockly/workspace-backpack": "^2.0.12", "@blockly/workspace-backpack": "^3.0.4",
"@blockly/zoom-to-fit": "^2.0.14", "@blockly/zoom-to-fit": "^3.0.4",
"@emotion/react": "^11.10.5", "@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5", "@emotion/styled": "^11.10.5",
"@fortawesome/fontawesome-svg-core": "^1.2.36", "@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^5.15.4", "@fortawesome/free-solid-svg-icons": "^6.2.1",
"@fortawesome/react-fontawesome": "^0.1.19", "@fortawesome/react-fontawesome": "^0.2.0",
"@monaco-editor/react": "^4.3.1", "@monaco-editor/react": "^4.3.1",
"@mui/lab": "^5.0.0-alpha.110", "@mui/lab": "^5.0.0-alpha.110",
"@mui/material": "^5.10.16", "@mui/material": "^5.10.16",
@@ -23,7 +23,7 @@
"@testing-library/react": "^12.1.2", "@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^7.2.1", "@testing-library/user-event": "^7.2.1",
"axios": "^0.22.0", "axios": "^0.22.0",
"blockly": "^8.0.3", "blockly": "^9.2.0",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"markdown-it": "^12.3.2", "markdown-it": "^12.3.2",
"mnemonic-id": "^3.2.7", "mnemonic-id": "^3.2.7",
Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

-150
View File
@@ -1,150 +0,0 @@
import { GET_ARDUINO_EXAMPLES } from './types';
import axios from 'axios';
import { returnErrors, returnSuccess } from './messageActions';
export const getArduinoExamples = () => (dispatch) => {
const config = {
success: res => {
var examples = res.data.arduinoExamples;
console.log(examples);
dispatch({
type: GET_ARDUINO_EXAMPLES,
payload: examples
});
dispatch(returnSuccess(res.data.message, res.status));
},
error: err => {
if (err.response) {
dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_PROJECTS_FAIL'));
}
}
};
axios.get(`${process.env.REACT_APP_BLOCKLY_API}/arduino`, config)
.then(res => {
res.config.success(res);
})
.catch(err => {
err.config.error(err);
});
};
// export const updateProject = (type, id) => (dispatch, getState) => {
// var workspace = getState().workspace;
// var body = {
// xml: workspace.code.xml,
// title: workspace.name,
// board: getState().board.board,
// };
// var project = getState().project;
// if (type === 'gallery') {
// body.description = project.description;
// }
// const config = {
// success: res => {
// var project = res.data[type];
// var projects = getState().project.projects;
// var index = projects.findIndex(res => res._id === project._id);
// projects[index] = project;
// dispatch({
// type: GET_PROJECTS,
// payload: projects
// });
// if (type === 'project') {
// dispatch(returnSuccess(res.data.message, res.status, 'PROJECT_UPDATE_SUCCESS'));
// } else {
// dispatch(returnSuccess(res.data.message, res.status, 'GALLERY_UPDATE_SUCCESS'));
// }
// },
// error: err => {
// if (err.response) {
// if (type === 'project') {
// dispatch(returnErrors(err.response.data.message, err.response.status, 'PROJECT_UPDATE_FAIL'));
// } else {
// dispatch(returnErrors(err.response.data.message, err.response.status, 'GALLERY_UPDATE_FAIL'));
// }
// }
// }
// };
// axios.put(`${process.env.REACT_APP_BLOCKLY_API}/${type}/${id}`, body, config)
// .then(res => {
// res.config.success(res);
// })
// .catch(err => {
// err.config.error(err);
// });
// };
// export const deleteProject = (type, id) => (dispatch, getState) => {
// const config = {
// success: res => {
// var projects = getState().project.projects;
// var index = projects.findIndex(res => res._id === id);
// projects.splice(index, 1)
// dispatch({
// type: GET_PROJECTS,
// payload: projects
// });
// if (type === 'project') {
// dispatch(returnSuccess(res.data.message, res.status, 'PROJECT_DELETE_SUCCESS'));
// } else {
// dispatch(returnSuccess(res.data.message, res.status, 'GALLERY_DELETE_SUCCESS'));
// }
// },
// error: err => {
// dispatch(returnErrors(err.response.data.message, err.response.status, 'PROJECT_DELETE_FAIL'));
// }
// };
// axios.delete(`${process.env.REACT_APP_BLOCKLY_API}/${type}/${id}`, config)
// .then(res => {
// res.config.success(res);
// })
// .catch(err => {
// if (err.response && err.response.status !== 401) {
// err.config.error(err);
// }
// });
// };
// export const shareProject = (title, type, id) => (dispatch, getState) => {
// var body = {
// title: title,
// board: getState().board.board
// };
// if (type === 'project') {
// body.projectId = id;
// } else {
// body.xml = getState().workspace.code.xml;
// }
// axios.post(`${process.env.REACT_APP_BLOCKLY_API}/share`, body)
// .then(res => {
// var shareContent = res.data.content;
// if (body.projectId) {
// var projects = getState().project.projects;
// var index = projects.findIndex(res => res._id === id);
// projects[index].shared = shareContent.expiresAt;
// dispatch({
// type: GET_PROJECTS,
// payload: projects
// });
// }
// dispatch(returnSuccess(res.data.message, shareContent._id, 'SHARE_SUCCESS'));
// })
// .catch(err => {
// if (err.response) {
// dispatch(returnErrors(err.response.data.message, err.response.status, 'SHARE_FAIL'));
// }
// });
// };
// export const resetProject = () => (dispatch) => {
// dispatch({
// type: GET_PROJECTS,
// payload: []
// });
// dispatch(setType(''));
// dispatch(setDescription(''));
// };
+2 -4
View File
@@ -90,8 +90,7 @@ export const updateProject = (type, id) => (dispatch, getState) => {
var workspace = getState().workspace; var workspace = getState().workspace;
var body = { var body = {
xml: workspace.code.xml, xml: workspace.code.xml,
title: workspace.name, title: workspace.name
board: getState().board.board,
}; };
var project = getState().project; var project = getState().project;
if (type === 'gallery') { if (type === 'gallery') {
@@ -166,8 +165,7 @@ export const deleteProject = (type, id) => (dispatch, getState) => {
export const shareProject = (title, type, id) => (dispatch, getState) => { export const shareProject = (title, type, id) => (dispatch, getState) => {
var body = { var body = {
title: title, title: title
board: getState().board.board
}; };
if (type === 'project') { if (type === 'project') {
body.projectId = id; body.projectId = id;
-2
View File
@@ -64,7 +64,5 @@ 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";
export const GET_ARDUINO_EXAMPLES = "GET_ARDUINO_EXAMPLES";
//board //board
export const BOARD = "BOARD"; export const BOARD = "BOARD";
+1 -1
View File
@@ -16,7 +16,7 @@ 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 var selectedBlock = Blockly.getSelected();
if (selectedBlock !== null) { if (selectedBlock !== null) {
code.helpurl = selectedBlock.helpUrl code.helpurl = selectedBlock.helpUrl
code.tooltip = selectedBlock.tooltip code.tooltip = selectedBlock.tooltip
+2
View File
@@ -45,6 +45,7 @@ class BlocklyWindow extends Component {
const workspace = Blockly.getMainWorkspace(); const workspace = Blockly.getMainWorkspace();
var xml = this.props.initialXml; var xml = this.props.initialXml;
if (props.selectedBoard !== this.props.selectedBoard) { if (props.selectedBoard !== this.props.selectedBoard) {
xml = localStorage.getItem("autoSaveXML");
// change board // change board
if(!xml) xml = initialXml; if(!xml) xml = initialXml;
var xmlDom = Blockly.Xml.textToDom(xml); var xmlDom = Blockly.Xml.textToDom(xml);
@@ -62,6 +63,7 @@ class BlocklyWindow extends Component {
} }
if (props.language !== this.props.language) { if (props.language !== this.props.language) {
// change language // change language
xml = localStorage.getItem("autoSaveXML");
if (!xml) xml = initialXml; if (!xml) xml = initialXml;
xmlDom = Blockly.Xml.textToDom(xml); xmlDom = Blockly.Xml.textToDom(xml);
Blockly.Xml.clearWorkspaceAndLoadFromXml(xmlDom, workspace); Blockly.Xml.clearWorkspaceAndLoadFromXml(xmlDom, workspace);
+1
View File
@@ -10,6 +10,7 @@ import "./sensebox-motors";
import "./sensebox-lora"; import "./sensebox-lora";
import "./sensebox-led"; import "./sensebox-led";
import "./sensebox-rtc"; import "./sensebox-rtc";
import "./sensebox-ntp";
import "./sensebox-ble"; import "./sensebox-ble";
import "./sensebox-sd"; import "./sensebox-sd";
import "./mqtt"; import "./mqtt";
@@ -0,0 +1,42 @@
import * as Blockly from "blockly";
import { getColour } from "../helpers/colour";
import * as Types from "../helpers/types";
Blockly.Blocks["sensebox_ntp_init"] = {
init: function () {
this.setHelpUrl(Blockly.Msg.sensebox_ntp_helpurl);
this.setColour(getColour().time);
this.appendDummyInput().appendField(Blockly.Msg.sensebox_ntp_init);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.sensebox_ntp_tooltip);
},
};
Blockly.Blocks["sensebox_ntp_get"] = {
init: function () {
this.setHelpUrl(Blockly.Msg.sensebox_ntp_get_helpurl);
this.setColour(getColour().time);
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_ntp_get)
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.sensebox_ntp_epochTime, "getEpochTime"],
[Blockly.Msg.sensebox_ntp_formattedTimeStamp, "getFormattedTime"],
]),
"dropdown"
);
this.setOutput(true, Types.LARGE_NUMBER.typeName);
this.setTooltip(Blockly.Msg.sensebox_rtc_get_tooltip);
},
};
Blockly.Blocks["sensebox_ntp_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);
},
};
@@ -76,3 +76,67 @@ Blockly.Blocks["sensebox_rtc_get_timestamp"] = {
this.setTooltip(Blockly.Msg.sensebox_rtc_get_timestamp_tooltip); this.setTooltip(Blockly.Msg.sensebox_rtc_get_timestamp_tooltip);
}, },
}; };
/**
* Internal RTC
*
*/
Blockly.Blocks["sensebox_internal_rtc_init"] = {
init: function () {
this.setHelpUrl(Blockly.Msg.sensebox_internal_rtc_helpurl);
this.setColour(getColour().time);
this.appendDummyInput().appendField(Blockly.Msg.sensebox_internal_rtc_init);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.sensebox_internal_rtc_init_tooltip);
},
};
Blockly.Blocks["sensebox_internal_rtc_set"] = {
init: function () {
this.setHelpUrl(Blockly.Msg.sensebox_rtc_helpurl);
this.setColour(getColour().time);
this.appendValueInput("time").appendField(
Blockly.Msg.sensebox_internal_rtc_set
);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.sensebox_internal_rtc_set_tooltip);
},
};
Blockly.Blocks["sensebox_internal_rtc_get"] = {
init: function () {
this.setHelpUrl(Blockly.Msg.sensebox_rtc_helpurl);
this.setColour(getColour().time);
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_internal_rtc_get)
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.sensebox_internal_rtc_epoch, "Epoch"],
[Blockly.Msg.sensebox_internal_rtc_year, "Year"],
[Blockly.Msg.sensebox_internal_rtc_month, "Month"],
[Blockly.Msg.sensebox_internal_rtc_day, "Day"],
[Blockly.Msg.sensebox_internal_rtc_hour, "Hours"],
[Blockly.Msg.sensebox_internal_rtc_minutes, "Minutes"],
[Blockly.Msg.sensebox_internal_rtc_seconds, "Seconds"],
]),
"dropdown"
);
this.setOutput(true, Types.LARGE_NUMBER.typeName);
this.setTooltip(Blockly.Msg.sensebox_internal_rtc_get_tooltip);
},
};
Blockly.Blocks["sensebox_internal_rtc_get_timestamp"] = {
init: function () {
this.setHelpUrl(Blockly.Msg.sensebox_internal_rtc_helpurl);
this.setColour(getColour().time);
this.appendDummyInput().appendField(
Blockly.Msg.sensebox_internal_rtc_get_timestamp
);
this.setOutput(true);
this.setTooltip(Blockly.Msg.sensebox_internal_rtc_get_timestamp_tooltip);
},
};
@@ -118,7 +118,7 @@ Blockly.Blocks["sensebox_sensor_sds011"] = {
.appendField(Blockly.Msg.senseBox_sds011_dimension) .appendField(Blockly.Msg.senseBox_sds011_dimension)
.appendField( .appendField(
new Blockly.FieldDropdown( new Blockly.FieldDropdown(
selectedBoard().serial), selectedBoard().serialSensors),
"SERIAL" "SERIAL"
); );
this.setOutput(true, Types.DECIMAL.typeName); this.setOutput(true, Types.DECIMAL.typeName);
@@ -191,7 +191,7 @@ Blockly.Blocks["sensebox_sensor_bme680_bsec"] = {
var dropdownOptions = [ var dropdownOptions = [
[Blockly.Msg.senseBox_temp, "temperature"], [Blockly.Msg.senseBox_temp, "temperature"],
[Blockly.Msg.senseBox_hum, "humidity"], [Blockly.Msg.senseBox_hum, "humidity"],
[Blockly.Msg.senseBox_pressure, "pressure"], [Blockly.Msg.senseBox_bme_pressure, "pressure"],
[Blockly.Msg.senseBox_bme_iaq, "IAQ"], [Blockly.Msg.senseBox_bme_iaq, "IAQ"],
[Blockly.Msg.senseBox_bme_iaq_accuracy, "IAQAccuracy"], [Blockly.Msg.senseBox_bme_iaq_accuracy, "IAQAccuracy"],
[Blockly.Msg.senseBox_bme_co2, "CO2"], [Blockly.Msg.senseBox_bme_co2, "CO2"],
@@ -218,12 +218,7 @@ Blockly.Blocks["sensebox_sensor_bme680_bsec"] = {
Blockly.Blocks["sensebox_sensor_ultrasonic_ranger"] = { Blockly.Blocks["sensebox_sensor_ultrasonic_ranger"] = {
init: function () { init: function () {
var dropdownOptions = [ var dropdown = new FieldGridDropdown(selectedBoard().digitalPorts, function (option) {
[Blockly.Msg.senseBox_ultrasonic_port_A, "A"],
[Blockly.Msg.senseBox_ultrasonic_port_B, "B"],
[Blockly.Msg.senseBox_ultrasonic_port_C, "C"],
];
var dropdown = new FieldGridDropdown(dropdownOptions, function (option) {
var input = option === "A" || option === "B" || option === "C"; var input = option === "A" || option === "B" || option === "C";
this.sourceBlock_.updateShape_(input); this.sourceBlock_.updateShape_(input);
}); });
@@ -336,6 +331,7 @@ Blockly.Blocks["sensebox_button"] = {
[Blockly.Msg.senseBox_button_isPressed, "isPressed"], [Blockly.Msg.senseBox_button_isPressed, "isPressed"],
[Blockly.Msg.senseBox_button_wasPressed, "wasPressed"], [Blockly.Msg.senseBox_button_wasPressed, "wasPressed"],
[Blockly.Msg.senseBox_button_longPress, "longPress"], [Blockly.Msg.senseBox_button_longPress, "longPress"],
[Blockly.Msg.senseBox_button_switch,"toggleButton"]
]), ]),
"FUNCTION" "FUNCTION"
) )
@@ -433,17 +429,12 @@ Blockly.Blocks["sensebox_gps"] = {
*/ */
Blockly.Blocks["sensebox_sensor_truebner_smt50"] = { Blockly.Blocks["sensebox_sensor_truebner_smt50"] = {
init: function () { 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.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_smt50); this.appendDummyInput().appendField(Blockly.Msg.senseBox_smt50);
this.appendDummyInput() this.appendDummyInput()
.appendField("Port:") .appendField("Port:")
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port"); .appendField(new Blockly.FieldDropdown(selectedBoard().digitalPorts), "Port");
this.appendDummyInput() this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_value) .appendField(Blockly.Msg.senseBox_value)
.appendField( .appendField(
@@ -467,16 +458,12 @@ Blockly.Blocks["sensebox_sensor_truebner_smt50"] = {
Blockly.Blocks["sensebox_sensor_watertemperature"] = { Blockly.Blocks["sensebox_sensor_watertemperature"] = {
init: function () { 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.setColour(getColour().sensebox);
this.appendDummyInput() this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_watertemperature) .appendField(Blockly.Msg.senseBox_watertemperature)
.appendField("Port:") .appendField("Port:")
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port"); .appendField(new Blockly.FieldDropdown(selectedBoard().digitalPorts), "Port");
this.setOutput(true, Types.NUMBER.typeName); this.setOutput(true, Types.NUMBER.typeName);
this.setTooltip(Blockly.Msg.senseBox_watertemperature_tip); this.setTooltip(Blockly.Msg.senseBox_watertemperature_tip);
this.data = {name: "ds18b20"}; this.data = {name: "ds18b20"};
@@ -506,16 +493,11 @@ Blockly.Blocks['sensebox_windspeed'] = {
Blockly.Blocks["sensebox_soundsensor_dfrobot"] = { Blockly.Blocks["sensebox_soundsensor_dfrobot"] = {
init: function () { 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.setColour(getColour().sensebox);
this.appendDummyInput() this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_soundsensor_dfrobot) .appendField(Blockly.Msg.senseBox_soundsensor_dfrobot)
.appendField("Port:") .appendField("Port:")
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port"); .appendField(new Blockly.FieldDropdown(selectedBoard().digitalPorts), "Port");
this.setOutput(true, Types.DECIMAL.typeName); this.setOutput(true, Types.DECIMAL.typeName);
this.setTooltip(Blockly.Msg.senseBox_soundsensor_dfrobot_tooltip); this.setTooltip(Blockly.Msg.senseBox_soundsensor_dfrobot_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_soundsensor_dfrobot_helpurl); this.setHelpUrl(Blockly.Msg.senseBox_soundsensor_dfrobot_helpurl);
@@ -573,3 +555,74 @@ Blockly.Blocks["sensebox_sensor_dps310"] = {
} }
}, },
}; };
/**
* Sensirion SPS30 Fine Particular Matter Sensor
* added 02.12.2022
*/
Blockly.Blocks["sensebox_sensor_sps30"] = {
init: function () {
this.appendDummyInput().appendField(Blockly.Msg.senseBox_sps30);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_value)
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_sps30_1p0, "1p0"],
[Blockly.Msg.senseBox_sps30_2p5, "2p5"],
[Blockly.Msg.senseBox_sps30_4p0, "4p0"],
[Blockly.Msg.senseBox_sps30_10p0, "10p0"],
]),
"value"
)
.appendField(Blockly.Msg.senseBox_sps30_dimension);
this.setOutput(true, Types.DECIMAL.typeName);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_sps30_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_sps30_helpurl);
},
};
/**
* GPS Module BN880
*
*/
Blockly.Blocks["sensebox_gps_bn880"] = {
init: function () {
var dropdownOptions = [
[Blockly.Msg.senseBox_gps_lat, "latitude"],
[Blockly.Msg.senseBox_gps_lng, "longitude"],
[Blockly.Msg.senseBox_gps_alt, "altitude"],
[Blockly.Msg.senseBox_gps_timeStamp, "timestamp"],
];
this.appendDummyInput().appendField("GPS Modul BN-880");
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_value)
.appendField(new Blockly.FieldDropdown(dropdownOptions), "dropdown");
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("Serial Port:")
.appendField(
new Blockly.FieldDropdown(
selectedBoard().serialSensors),
"serial"
);
this.setOutput(true);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_gps_tooltip);
},
};
Blockly.Blocks["sensebox_gps_isValid"] = {
init: function () {
this.appendDummyInput().appendField("GPS Modul is valid");
this.setOutput(true, Types.BOOLEAN.typeName);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_gps_tooltip);
},
};
+1 -1
View File
@@ -10,7 +10,7 @@ Blockly.Blocks["variables_set_dynamic"] = {
this.setNextStatement(true, null); this.setNextStatement(true, null);
this.appendValueInput("VALUE") this.appendValueInput("VALUE")
.appendField(Blockly.Msg.variables_set, Blockly.Msg.variables_set) .appendField(Blockly.Msg.variables_set, Blockly.Msg.variables_set)
// .appendField("", "type") .appendField("", "type")
.appendField(new Blockly.FieldVariable("VAR"), "VAR") .appendField(new Blockly.FieldVariable("VAR"), "VAR")
.appendField(Blockly.Msg.variables_to); .appendField(Blockly.Msg.variables_to);
}, },
@@ -10,6 +10,7 @@ import "./sensebox-lora";
import "./sensebox-led"; import "./sensebox-led";
import "./sensebox"; import "./sensebox";
import "./sensebox-rtc"; import "./sensebox-rtc";
import "./sensebox-ntp";
import "./sensebox-ble"; import "./sensebox-ble";
import "./sensebox-sd"; import "./sensebox-sd";
import "./mqtt"; import "./mqtt";
+9 -4
View File
@@ -275,10 +275,15 @@ Blockly.Arduino["math_change"] = function (block) {
"DELTA", "DELTA",
Blockly.Arduino.ORDER_ADDITIVE Blockly.Arduino.ORDER_ADDITIVE
) || "0"; ) || "0";
var varName = Blockly.Arduino.nameDB_.getName( var id = block.getFieldValue("VAR")
block.getFieldValue("VAR"), const varName = Blockly.Variables.getVariable(
Blockly.Variables.NAME_TYPE Blockly.getMainWorkspace(),
); id
).name;
// var varName = Blockly.Arduino.nameDB_.getName(
// block.getFieldValue("VAR"),
// Blockly.Variables.NAME_TYPE
// );
return varName + " += " + argument0 + ";\n"; return varName + " += " + argument0 + ";\n";
}; };
@@ -0,0 +1,19 @@
import Blockly from "blockly";
Blockly.Arduino.sensebox_ntp_init = function () {
Blockly.Arduino.libraries_["WiFiUdp"] = `#include <WiFiUdp.h>`;
Blockly.Arduino.libraries_["NTPClient"] = `#include <NTPClient.h>`;
Blockly.Arduino.definitions_["WiFiUDP"] = `WiFiUDP ntpUDP;`;
Blockly.Arduino.definitions_["NTPClient"] = `NTPClient timeClient(ntpUDP);`;
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.setupCode_["timeclient.begin"] = `timeClient.begin();`;
Blockly.Arduino.setupCode_["timeclient.update"] = `timeClient.update();`;
var code = ``;
return code;
};
Blockly.Arduino.sensebox_ntp_get = function () {
var format = this.getFieldValue("dropdown");
var code = `timeClient.${format}()`;
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
@@ -94,3 +94,46 @@ uint8_t sec, min, hour, day, month;
var code = `getTimeStamp()`; var code = `getTimeStamp()`;
return [code, Blockly.Arduino.ORDER_ATOMIC]; return [code, Blockly.Arduino.ORDER_ATOMIC];
}; };
Blockly.Arduino.sensebox_internal_rtc_init = function () {
Blockly.Arduino.libraries_["RTClib"] = `#include <RTCZero.h>`;
Blockly.Arduino.definitions_["RTC"] = `RTCZero rtc;`;
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.setupCode_["rtc.begin"] = `rtc.begin();`;
return "";
};
Blockly.Arduino.sensebox_internal_rtc_set = function () {
var branch =
Blockly.Arduino.valueToCode(this, "time", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
Blockly.Arduino.setupCode_["rtc.setEpoch"] = `rtc.setEpoch(${branch});`;
var code = ``;
return code;
};
Blockly.Arduino.sensebox_internal_rtc_get = function () {
var dropdown = this.getFieldValue("dropdown");
var code = `rtc.get${dropdown}()`;
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_internal_rtc_get_timestamp = function () {
Blockly.Arduino.variables_["rtc_timestamp"] = `char timestamp[20];`;
Blockly.Arduino.codeFunctions_["getTimeStamp"] = `
char* getTimeStamp() {
uint8_t sec, min, hour, day, month;
uint16_t year;
sec = rtc.getSeconds();
min = rtc.getMinutes();
hour = rtc.getHours();
day = rtc.getDay();
month = rtc.getMonth();
year = rtc.getYear();
sprintf(timestamp, "%02d-%02d-%02dT%02d:%02d:%02dZ", year, month, day, hour, min, sec);
return timestamp;
}
`;
var code = `getTimeStamp()`;
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
@@ -399,6 +399,7 @@ Blockly.Arduino.sensebox_button = function () {
Blockly.Arduino.libraries_[ Blockly.Arduino.libraries_[
"library_jcButtons" "library_jcButtons"
] = `#include <JC_Button.h> // http://librarymanager/All#JC_Button`; ] = `#include <JC_Button.h> // http://librarymanager/All#JC_Button`;
Blockly.Arduino.definitions_["define_button" + dropdown_pin + ""] = Blockly.Arduino.definitions_["define_button" + dropdown_pin + ""] =
"Button button_" + dropdown_pin + "(" + dropdown_pin + ");"; "Button button_" + dropdown_pin + "(" + dropdown_pin + ");";
Blockly.Arduino.setupCode_["setup_button" + dropdown_pin + ""] = Blockly.Arduino.setupCode_["setup_button" + dropdown_pin + ""] =
@@ -413,6 +414,10 @@ Blockly.Arduino.sensebox_button = function () {
} else if (dropown_function === "longPress") { } else if (dropown_function === "longPress") {
var time = this.getFieldValue("time"); var time = this.getFieldValue("time");
code = "button_" + dropdown_pin + ".pressedFor(" + time + ")"; code = "button_" + dropdown_pin + ".pressedFor(" + time + ")";
} else if (dropown_function === "toggleButton") {
code = "button_" + dropdown_pin + ".toggleState()";
Blockly.Arduino.definitions_["define_button" + dropdown_pin + ""] =
"ToggleButton button_" + dropdown_pin + "(" + dropdown_pin + ");";
} }
return [code, Blockly.Arduino.ORDER_ATOMIC]; return [code, Blockly.Arduino.ORDER_ATOMIC];
}; };
@@ -429,11 +434,13 @@ Blockly.Arduino.sensebox_scd30 = function () {
"#include <SparkFun_SCD30_Arduino_Library.h> // http://librarymanager/All#SparkFun_SCD30_Arduino_Library"; "#include <SparkFun_SCD30_Arduino_Library.h> // http://librarymanager/All#SparkFun_SCD30_Arduino_Library";
Blockly.Arduino.definitions_["SCD30"] = "SCD30 airSensor;"; Blockly.Arduino.definitions_["SCD30"] = "SCD30 airSensor;";
Blockly.Arduino.setupCode_["init_scd30"] = ` Wire.begin(); Blockly.Arduino.setupCode_["init_scd30"] = ` Wire.begin();
if (airSensor.begin() == false) if (airSensor.begin() == false)
{ {
while (1) while (1)
; ;
}`; }`;
Blockly.Arduino.setupCode_["scd30_staleData"] =
"airSensor.useStaleData(true);";
var code = ""; var code = "";
switch (dropdown) { switch (dropdown) {
case "temperature": case "temperature":
@@ -692,3 +699,112 @@ Blockly.Arduino.sensebox_sensor_dps310 = function () {
} }
return [code, Blockly.Arduino.ORDER_ATOMIC]; return [code, Blockly.Arduino.ORDER_ATOMIC];
}; };
/**
* Sensirion SPS30 Fine Particlar Matter
*
*/
Blockly.Arduino.sensebox_sensor_sps30 = function () {
var dropdown_name = this.getFieldValue("value");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_[
"sps30"
] = `#include <sps30.h> // http://librarymanager/All#`;
Blockly.Arduino.variables_["sps30_measurement"] =
"struct sps30_measurement m;";
Blockly.Arduino.variables_["sps30_auto_clean_days"] =
"uint32_t auto_clean_days = 4;";
Blockly.Arduino.variables_["sps30_interval_intervalsps"] =
"const long intervalsps = 1000;";
Blockly.Arduino.variables_["sps30_time_startsps"] =
"unsigned long time_startsps = 0;";
Blockly.Arduino.variables_["sps30_time_actualsps"] =
"unsigned long time_actualsps = 0;";
Blockly.Arduino.codeFunctions_["sps30_getData"] = `
void getSPS30Data(){
uint16_t data_ready;
int16_t ret;
do {
ret = sps30_read_data_ready(&data_ready);
if (ret < 0) {
} else if (!data_ready) {}
else
break;
delay(100); /* retry in 100ms */
} while (1);
ret = sps30_read_measurement(&m);
}
`;
Blockly.Arduino.setupCode_["sps30_begin"] = "sensirion_i2c_init();";
Blockly.Arduino.setupCode_["sps30_setFanCleaningInterval"] =
"sps30_set_fan_auto_cleaning_interval_days(auto_clean_days);";
Blockly.Arduino.setupCode_["sps30_startMeasurement"] =
"sps30_start_measurement();";
Blockly.Arduino.loopCodeOnce_["getSPS30Data();"] = `
time_startsps = millis();
if (time_startsps > time_actualsps + intervalsps) {
time_actualsps = millis();
getSPS30Data();
}`;
var code = `m.mc_${dropdown_name}`;
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* GPS Module
*
*/
Blockly.Arduino.sensebox_gps_bn880 = function () {
var dropdown = this.getFieldValue("dropdown");
var serial = this.getFieldValue("serial");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["tinygps_library"] =
"#include <TinyGPSPlus.h> // http://librarymanager/All#SparkFun_u-blox_GNSS_Arduino_Library";
Blockly.Arduino.definitions_["TinyGPS"] = "TinyGPSPlus gps;";
Blockly.Arduino.setupCode_["init_tinygps"] = `
${serial}.begin(9600); // BN880
while (gps.location.lat() == 0.0 && gps.location.lng() == 0.0);
`
var code = "";
switch (dropdown) {
case "latitude":
code = "gps.location.lat()";
break;
case "longitude":
code = "gps.location.lng()";
break;
case "altitude":
code = "gps.altitude.meters()";
break;
case "timestamp":
Blockly.Arduino.variables_["define_tsBuffer"] = `char tsBuffer[21];`
Blockly.Arduino.codeFunctions_["getTimeStamp()"] = `
char *getTimeStamp()
{
memset(tsBuffer, 0, sizeof(tsBuffer));
if ((gps.date.isValid() == true) && (gps.time.isValid() == true))
{
sprintf(tsBuffer, "%04d-%02d-%02dT%02d:%02d:%02dZ",
gps.date.year(), gps.date.month(), gps.date.day(), gps.time.hour(), gps.time.minute(), gps.time.second());
}
return tsBuffer;
}
`;
code = "getTimeStamp()";
break;
default:
code = "";
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_gps_isValid = function () {
var code ="gps.location.isValid()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
+21 -7
View File
@@ -13,6 +13,11 @@ const sensebox_mcu = {
["C5", "5"], ["C5", "5"],
["C6", "6"], ["C6", "6"],
], ],
digitalPorts: [
["A", "A"],
["B", "B"],
["C", "C"],
],
digitalPinsLED: [ digitalPinsLED: [
["BUILTIN_1", "7"], ["BUILTIN_1", "7"],
["BUILTIN_2", "8"], ["BUILTIN_2", "8"],
@@ -46,9 +51,13 @@ const sensebox_mcu = {
["C6", "6"], ["C6", "6"],
], ],
serial: [ serial: [
["serial", "SerialUSB"], ["SerialUSB", "SerialUSB"],
["serial_1", "Serial1"], ["Serial1", "Serial1"],
["serial_2", "Serial2"], ["Serial2", "Serial2"],
],
serialSensors: [
["Serial1", "Serial1"],
["Serial2", "Serial2"],
], ],
serialPins: { serialPins: {
SerialUSB: [ SerialUSB: [
@@ -139,6 +148,9 @@ const sensebox_mini = {
["IO1", "1"], ["IO1", "1"],
["IO2", "2"], ["IO2", "2"],
], ],
digitalPorts: [
["IO1-2", "A"],
],
digitalPinsLED: [ digitalPinsLED: [
["BUILTIN_1", "7"], ["BUILTIN_1", "7"],
["BUILTIN_2", "8"], ["BUILTIN_2", "8"],
@@ -147,8 +159,7 @@ const sensebox_mini = {
], ],
digitalPinsRGB: [ digitalPinsRGB: [
["on Board", "6"], ["on Board", "6"],
["IO1", "1"], ["IO1-2", "1"],
["IO2", "2"],
], ],
digitalPinsButton: [ digitalPinsButton: [
["on Board", "0"], ["on Board", "0"],
@@ -161,8 +172,11 @@ const sensebox_mini = {
["IO2", "2"], ["IO2", "2"],
], ],
serial: [ serial: [
["serial", "SerialUSB"], ["SerialUSB", "SerialUSB"],
["serial_1", "Serial1"], ["Serial1", "Serial1"],
],
serialSensors: [
["Serial1", "Serial1"],
], ],
serialPins: { serialPins: {
SerialUSB: [ SerialUSB: [
@@ -13,6 +13,8 @@ const maxInstances = {
sensebox_lora_initialize_otaa: 1, sensebox_lora_initialize_otaa: 1,
sensebox_lora_initialize_abp: 1, sensebox_lora_initialize_abp: 1,
sensebox_phyphox_init: 1, sensebox_phyphox_init: 1,
sensebox_phyphox_experiment: 1,
sensebox_phyphox_experiment_send: 1,
sensebox_ethernet: 1, sensebox_ethernet: 1,
}; };
+1 -1
View File
@@ -104,4 +104,4 @@ export const getCompatibleTypes = (type) => {
return compatibleTypes[type]; return compatibleTypes[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 = [['NUMBER', 'int'], ['DECIMAL', 'long'], ['TEXT', 'String'], ['CHARACTER', 'char'], ['BOOLEAN', 'boolean'], ['NULL', 'void'], ['UNDEF', 'undefined']];
+31 -19
View File
@@ -1,6 +1,6 @@
/** /**
* @license * @license
* *
* Copyright 2019 Google LLC * Copyright 2019 Google LLC
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,39 +21,51 @@
* @author samelh@google.com (Sam El-Husseini) * @author samelh@google.com (Sam El-Husseini)
*/ */
import React from 'react'; import React from "react";
import BlocklyComponent from './BlocklyComponent'; import BlocklyComponent from "./BlocklyComponent";
export default BlocklyComponent; export default BlocklyComponent;
const Block = (p) => { const Block = (p) => {
const { children, ...props } = p; const { children, ...props } = p;
props.is = "blockly"; props.is = "blockly";
return React.createElement("block", props, children); return React.createElement("block", props, children);
}; };
const Category = (p) => { const Category = (p) => {
const { children, ...props } = p; const { children, ...props } = p;
props.is = "blockly"; props.is = "blockly";
return React.createElement("category", props, children); return React.createElement("category", props, children);
}; };
const Value = (p) => { const Value = (p) => {
const { children, ...props } = p; const { children, ...props } = p;
props.is = "blockly"; props.is = "blockly";
return React.createElement("value", props, children); return React.createElement("value", props, children);
}; };
const Field = (p) => { const Field = (p) => {
const { children, ...props } = p; const { children, ...props } = p;
props.is = "blockly"; props.is = "blockly";
return React.createElement("field", props, children); return React.createElement("field", props, children);
}; };
const Shadow = (p) => { const Shadow = (p) => {
const { children, ...props } = p; const { children, ...props } = p;
props.is = "blockly"; props.is = "blockly";
return React.createElement("shadow", props, children); return React.createElement("shadow", props, children);
}; };
export { Block, Category, Value, Field, Shadow } const Sep = (p) => {
const { children, ...props } = p;
props.is = "blockly";
return React.createElement("sep", props, children);
};
const Label = (p) => {
const { children, ...props } = p;
props.is = "blockly";
return React.createElement("label", props, children);
};
export { Block, Category, Value, Field, Shadow, Sep, Label };
+2
View File
@@ -12,6 +12,7 @@ import { LED } from "./de/sensebox-led";
import { LORA } from "./de/sensebox-lora"; import { LORA } from "./de/sensebox-lora";
import { OSEM } from "./de/sensebox-osem"; import { OSEM } from "./de/sensebox-osem";
import { RTC } from "./de/sensebox-rtc"; import { RTC } from "./de/sensebox-rtc";
import { NTP } from "./de/sensebox-ntp";
import { SD } from "./de/sensebox-sd"; import { SD } from "./de/sensebox-sd";
import { SENSORS } from "./de/sensebox-sensors"; import { SENSORS } from "./de/sensebox-sensors";
import { SENSEBOX } from "./de/sensebox"; import { SENSEBOX } from "./de/sensebox";
@@ -40,6 +41,7 @@ export const De = {
...LORA, ...LORA,
...OSEM, ...OSEM,
...RTC, ...RTC,
...NTP,
...SD, ...SD,
...SENSORS, ...SENSORS,
...SENSEBOX, ...SENSEBOX,
@@ -0,0 +1,11 @@
export const NTP = {
sensebox_ntp_init: "Initialisiere NTP",
sensebox_ntp_init_tooltip: "Initialisiere den NTP Server.",
sensebox_ntp_get: "Hole Zeit von NTP Server: ",
sensebox_ntp_get_timestamp_tooltip:
"Gibt dir einen in ISO 8601 formatierten Zeitstempel zurück. Bsp: 2021-12-24T18:21Z",
sensebox_ntp_get_tooltip:
"Gibt dir den ausgewählten Wert zurück. Unix Zeit entspricht der Anzahl der Sekunden seit dem 1.1.1970",
sensebox_ntp_epochTime: "Unix Zeit",
sensebox_ntp_formattedTimeStamp: "Zeitstempel (hh:mm:ss)",
};
+22 -4
View File
@@ -1,14 +1,14 @@
export const RTC = { export const RTC = {
sensebox_rtc_init: "Initialisiere RTC", sensebox_rtc_init: "Initialisiere externe RTC",
sensebox_rtc_init_tooltip: 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.", "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: "Setze Uhrzeit/Datum der externen RTC",
sensebox_rtc_set_tooltip: sensebox_rtc_set_tooltip:
"Stellt die Uhrzeit der RTC ein. Beachte, dass du diesen Block im Setup ausführst.", "Stellt die Uhrzeit der RTC ein. Beachte, dass du diesen Block im Setup ausführst.",
sensebox_rtc_get_timestamp: "Zeitstempel (RFC 3339)", sensebox_rtc_get_timestamp: "Zeitstempel externe RTC (RFC 3339)",
sensebox_rtc_get_timestamp_tooltip: sensebox_rtc_get_timestamp_tooltip:
"Gibt dir einen in ISO 8601 formatierten Zeitstempel zurück. Bsp: 2021-12-24T18:21Z", "Gibt dir einen in ISO 8601 formatierten Zeitstempel zurück. Bsp: 2021-12-24T18:21Z",
sensebox_rtc_get: "Wert: ", sensebox_rtc_get: "Wert (externe RTC): ",
sensebox_rtc_get_tooltip: "Gibt dir den ausgewählten Wert zurück.", sensebox_rtc_get_tooltip: "Gibt dir den ausgewählten Wert zurück.",
sensebox_rtc_second: "Sekunden", sensebox_rtc_second: "Sekunden",
sensebox_rtc_minutes: "Minuten", sensebox_rtc_minutes: "Minuten",
@@ -16,4 +16,22 @@ export const RTC = {
sensebox_rtc_day: "Tag", sensebox_rtc_day: "Tag",
sensebox_rtc_month: "Monat", sensebox_rtc_month: "Monat",
sensebox_rtc_year: "Jahr", sensebox_rtc_year: "Jahr",
sensebox_internal_rtc_init: "Initialisiere interne RTC",
sensebox_internal_rtc_init_tooltip:
"Initialisieren der internen RTC. Diese RTC ist nicht batteriegepuffert und wird bei jedem Einschaltvorgang zurückgesetzt",
sensebox_internal_rtc_set: "Setze interne RTC Zeit/Datum (Unix Time)",
sensebox_internal_rtc_set_tooltip:
"Setzt die Zeit der internen RTC. Führe den Block einmalig im Setup aus und setzte die Uhrzeit über die Unix Zeit.",
sensebox_internal_rtc_get: "Wert (interne RTC): ",
sensebox_internal_rtc_get_timestamp: "Zeitstempel interne RTC (RFC 3339)",
sensebox_internal_rtc_get_timestamp_tooltip:
"Returns a timestamp formatted in ISO 8601. Ex: 2021-12-24T18:21Z",
sensebox_internal_rtc_get_tooltip: "Gibt den ausgewählten Wert zurück",
sensebox_internal_rtc_epoch: "Unix Zeit",
sensebox_internal_rtc_year: "Jahr",
sensebox_internal_rtc_month: "Monat",
sensebox_internal_rtc_day: "Tag",
sensebox_internal_rtc_hour: "Stunde",
sensebox_internal_rtc_minutes: "Minute",
sensebox_internal_rtc_seconds: "Sekunde",
}; };
@@ -140,6 +140,7 @@ Wenn die maximale Distanz überschritten wird, wird ein Wert von **O** ausgegebe
senseBox_bme_iaq: "Innenraumluftqualität (IAQ)", senseBox_bme_iaq: "Innenraumluftqualität (IAQ)",
senseBox_bme_iaq_accuracy: "Kalibrierungswert", senseBox_bme_iaq_accuracy: "Kalibrierungswert",
senseBox_bme_co2: "CO2 Äquivalent", senseBox_bme_co2: "CO2 Äquivalent",
senseBox_bme_pressure: "Luftdruck in Pa",
senseBox_bme_breatheVocEquivalent: "Atemluft VOC Ä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. 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: Den Status der Kalibrierung kann über den Kalibrierungswert abgelesen werden. Er ist entweder 0, 1, 2 oder 3 und sagt folgendes aus:
@@ -175,7 +176,7 @@ Die Messwerte für Temperatur, Luftfeuchtigkeit und Luftdruck können direkt ver
* Feinstaubsensor (SDS011) * Feinstaubsensor (SDS011)
*/ */
senseBox_sds011: "Feinstaubsensor", senseBox_sds011: "Feinstaubsensor SDS011",
senseBox_sds011_dimension: "in µg/m³ an", senseBox_sds011_dimension: "in µg/m³ an",
senseBox_sds011_pm25: "PM2.5", senseBox_sds011_pm25: "PM2.5",
senseBox_sds011_pm10: "PM10", senseBox_sds011_pm10: "PM10",
@@ -200,4 +201,23 @@ Die Messwerte für Temperatur, Luftfeuchtigkeit und Luftdruck können direkt ver
- "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 - "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`, - "als Schalter": Wenn du diesen Block verwendest kannst du den Knopf wie ein Lichtschalter verwenden. Der Status wird gespeichert bis der Button erneut gedrückt wird`,
senseBox_button_helpurl: "", senseBox_button_helpurl: "",
};
/**
* Feinstaubsensor Sensirion SPS30
*/
senseBox_sps30: "Feinstaubsensor Sensirion SPS30",
senseBox_sps30_dimension: "in µg/m³",
senseBox_sps30_1p0: "PM1.0",
senseBox_sps30_2p5: "PM2.5",
senseBox_sps30_4p0: "PM4.0",
senseBox_sps30_10p0: "PM10",
senseBox_sps30_tooltip:"Dieser Block gibt dir den Messwert des Sensirion SPS30 Feinstaubsensor. Schließe den Feinstaubsensor an einen der 5 **I2C** Anschlüssen an. Im Dropdown Menü zwischen PM1.0, PM2.5, PM4.0 und PM10 auswählen. Der Messwert wird dir als **Kommazahl** in µg/m3",
senseBox_sps30_helpurl:
"https://docs.sensebox.de/hardware/sensoren-feinstaub/",
};
+6 -1
View File
@@ -8,11 +8,15 @@ export const UI = {
toolbox_math: "Mathematik", toolbox_math: "Mathematik",
toolbox_io: "Eingang/Ausgang", toolbox_io: "Eingang/Ausgang",
toolbox_time: "Zeit", toolbox_time: "Zeit",
toolbox_rtc: "RTC",
toolbox_ntp: "NTP",
toolbox_functions: "Funktionen", toolbox_functions: "Funktionen",
toolbox_variables: "Variablen", toolbox_variables: "Variablen",
toolbox_serial: "Seriell", toolbox_serial: "Seriell",
toolbox_advanced: "Erweitert", toolbox_advanced: "Erweitert",
toolbox_motors: "Motoren", toolbox_motors: "Motoren",
toolbox_label_externalRTC: "Externe RTC",
toolbox_label_internalRTC: "Interne RTC",
variable_NUMBER: "Zahl (int)", variable_NUMBER: "Zahl (int)",
variable_SHORT_NUMBER: "char", variable_SHORT_NUMBER: "char",
variable_LONG: "große Zahl (long)", variable_LONG: "große Zahl (long)",
@@ -312,7 +316,8 @@ export const UI = {
* Device Selction * Device Selction
* */ * */
deviceselection_head: "Welches Board benutzt du?", deviceselection_head: "Welches Board benutzt du?",
deviceselection_keep_selection: "Speichere meine Auswahl fürs nächste Mal (Du kannst das Board später in den Einstellungen wechseln)", deviceselection_keep_selection:
"Speichere meine Auswahl fürs nächste Mal (Du kannst das Board später in den Einstellungen wechseln)",
deviceselection_footnote: "Hier kommst du zur alten Blockly Version für den ", deviceselection_footnote: "Hier kommst du zur alten Blockly Version für den ",
deviceselection_footnote_02: "oder die", deviceselection_footnote_02: "oder die",
+2
View File
@@ -13,6 +13,7 @@ import { LED } from "./en/sensebox-led";
import { LORA } from "./en/sensebox-lora"; import { LORA } from "./en/sensebox-lora";
import { OSEM } from "./en/sensebox-osem"; import { OSEM } from "./en/sensebox-osem";
import { RTC } from "./en/sensebox-rtc"; import { RTC } from "./en/sensebox-rtc";
import { NTP } from "./en/sensebox-ntp";
import { SD } from "./en/sensebox-sd"; import { SD } from "./en/sensebox-sd";
import { SENSORS } from "./en/sensebox-sensors"; import { SENSORS } from "./en/sensebox-sensors";
import { TELEGRAM } from "./en/sensebox-telegram"; import { TELEGRAM } from "./en/sensebox-telegram";
@@ -40,6 +41,7 @@ export const En = {
...LORA, ...LORA,
...OSEM, ...OSEM,
...RTC, ...RTC,
...NTP,
...SD, ...SD,
...SENSORS, ...SENSORS,
...SENSEBOX, ...SENSEBOX,
@@ -0,0 +1,10 @@
export const NTP = {
sensebox_ntp_init: "Initialise NTP",
sensebox_ntp_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_ntp_get: "Get time from NTP Server: ",
sensebox_ntp_get_tooltip:
"Gibt dir den ausgewählten Wert zurück. Unix Zeit entspricht der Anzahl der Sekunden seit dem 1.1.1970",
sensebox_ntp_epochTime: "Unix time",
sensebox_ntp_formattedTimeStamp: "Timestamp (hh:mm:ss)",
};
+20 -2
View File
@@ -1,11 +1,11 @@
export const RTC = { export const RTC = {
sensebox_rtc_init: "Initialise RTC", sensebox_rtc_init: "Initialise external RTC",
sensebox_rtc_init_tooltip: 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.", "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: "Set RTC time/date:",
sensebox_rtc_set_tooltip: sensebox_rtc_set_tooltip:
"Sets the time of the RTC. Note that you execute this block in the setup.", "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: "Timestamp external RTC (RFC 3339)",
sensebox_rtc_get_timestamp_tooltip: sensebox_rtc_get_timestamp_tooltip:
"Returns a timestamp formatted in ISO 8601. Ex: 2021-12-24T18:21Z", "Returns a timestamp formatted in ISO 8601. Ex: 2021-12-24T18:21Z",
sensebox_rtc_get_tooltip: "Returns the selected value", sensebox_rtc_get_tooltip: "Returns the selected value",
@@ -17,4 +17,22 @@ export const RTC = {
sensebox_rtc_day: "day", sensebox_rtc_day: "day",
sensebox_rtc_month: "month", sensebox_rtc_month: "month",
sensebox_rtc_year: "year", sensebox_rtc_year: "year",
sensebox_internal_rtc_init: "Initialise internal RTC",
sensebox_internal_rtc_init_tooltip:
"Initialise the internal RTC. This RTC is not battery backed and will be reset on every power cycle.",
sensebox_internal_rtc_set: "Set internal RTC time/date:",
sensebox_internal_rtc_set_tooltip:
"Sets the time of the internal RTC. Note that you execute this block in the setup.",
sensebox_internal_rtc_get: "Get: ",
sensebox_internal_rtc_get_timestamp: "Timestamp internal RTC (RFC 3339)",
sensebox_internal_rtc_get_timestamp_tooltip:
"Returns a timestamp formatted in ISO 8601. Ex: 2021-12-24T18:21Z",
sensebox_internal_rtc_get_tooltip: "Returns the selected value",
sensebox_internal_rtc_epoch: "Unix Time",
sensebox_internal_rtc_year: "year",
sensebox_internal_rtc_month: "month",
sensebox_internal_rtc_day: "day",
sensebox_internal_rtc_hour: "hour",
sensebox_internal_rtc_minutes: "minutes",
sensebox_internal_rtc_seconds: "seconds",
}; };
@@ -141,6 +141,7 @@ If the max distance is reached the a value of **O** will be returned`,
senseBox_bme680: "Environmental sensor (BME680)", senseBox_bme680: "Environmental sensor (BME680)",
senseBox_bme_iaq: "Indoor Air Quality (IAQ)", senseBox_bme_iaq: "Indoor Air Quality (IAQ)",
senseBox_bme_iaq_accuracy: "Calibration Value", senseBox_bme_iaq_accuracy: "Calibration Value",
senseBox_bme_pressure: "Airpressure in Pa",
senseBox_bme_co2: "CO2 Equivalent", senseBox_bme_co2: "CO2 Equivalent",
senseBox_bme_breatheVocEquivalent: "Breathe VOC 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. senseBox_bme_tooltip: `Connect the environmental sensor to one of the 5 **I2C ports**. **Note:** The sensor needs some time to calibrate.
@@ -205,4 +206,23 @@ The measured values for temperature, humidity and air pressure can be used direc
* *
*/ */
senseBox_watertemperature: "Water Temperature", senseBox_watertemperature: "Water Temperature",
/**
* Feinstaubsensor Sensirion SPS30
*/
senseBox_sps30: "Particulate Matter Sensor (Sensirion SPS30)",
senseBox_sps30_dimension: "in µg/m³",
senseBox_sps30_1p0: "PM1.0",
senseBox_sps30_2p5: "PM2.5",
senseBox_sps30_4p0: "PM4.0",
senseBox_sps30_10p0: "PM10",
senseBox_sps30_tooltip:
"This block gives you the measured value of the Sensirion SPS30 fine dust sensor. Connect the fine dust sensor to one of the 5 **I2C** connectors. Select between PM1.0, PM2.5, PM4.0 and PM10 in the dropdown menu. The measured value will be displayed as **decimal** in µg/m3",
senseBox_sps30_helpurl:
"https://docs.sensebox.de/hardware/sensoren-feinstaub/",
}; };
+10 -3
View File
@@ -8,11 +8,15 @@ export const UI = {
toolbox_math: "Math", toolbox_math: "Math",
toolbox_io: "Input/Output", toolbox_io: "Input/Output",
toolbox_time: "Time", toolbox_time: "Time",
toolbox_rtc: "RTC",
toolbox_ntp: "NTP",
toolbox_functions: "Functions", toolbox_functions: "Functions",
toolbox_variables: "Variables", toolbox_variables: "Variables",
toolbox_serial: "Serial", toolbox_serial: "Serial",
toolbox_advanced: "Erweitert", toolbox_advanced: "Erweitert",
toolbox_motors: "Motors", toolbox_motors: "Motors",
toolbox_label_externalRTC: "External RTC",
toolbox_label_internalRTC: "Internal RTC",
variable_NUMBER: "Number (int)", variable_NUMBER: "Number (int)",
variable_SHORT_NUMBER: "char", variable_SHORT_NUMBER: "char",
variable_LONG: "Big number (long)", variable_LONG: "Big number (long)",
@@ -304,11 +308,14 @@ export const UI = {
"Your code will now be compiled and then downloaded to your computer", "Your code will now be compiled and then downloaded to your computer",
/** /**
* Device Selction * Device Selection
* */ * */
deviceselection_head: "Which board are you using?", deviceselection_head: "Which board are you using?",
deviceselection_keep_selection: "Save my choice (You can change the board later in the settings)", deviceselection_keep_selection:
deviceselection_footnote: "Here you can access the old blockly Version for the", "Save my choice (You can change the board later in the settings)",
deviceselection_footnote:
"Here you can access the old blockly Version for the",
deviceselection_footnote_02: "or the", deviceselection_footnote_02: "or the",
/** /**
+76 -49
View File
@@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { Block, Value, Field, Shadow, Category } from "../"; import { Block, Value, Field, Shadow, Category, Sep, Label } from "../";
import { getColour } from "../helpers/colour"; import { getColour } from "../helpers/colour";
import "@blockly/block-plus-minus"; import "@blockly/block-plus-minus";
import { TypedVariableModal } from "@blockly/plugin-typed-variable-modal"; import { TypedVariableModal } from "@blockly/plugin-typed-variable-modal";
@@ -61,6 +61,7 @@ class Toolbox extends React.Component {
<Block type="sensebox_sensor_uv_light" /> <Block type="sensebox_sensor_uv_light" />
<Block type="sensebox_sensor_bmx055_accelerometer" /> <Block type="sensebox_sensor_bmx055_accelerometer" />
<Block type="sensebox_sensor_sds011" /> <Block type="sensebox_sensor_sds011" />
<Block type="sensebox_sensor_sps30" />
<Block type="sensebox_sensor_pressure" /> <Block type="sensebox_sensor_pressure" />
<Block type="sensebox_sensor_dps310" /> <Block type="sensebox_sensor_dps310" />
<Block type="sensebox_sensor_bme680_bsec" /> <Block type="sensebox_sensor_bme680_bsec" />
@@ -295,7 +296,7 @@ class Toolbox extends React.Component {
</Value> </Value>
</Block> </Block>
</Category> </Category>
{/* <Category name="Telegram" colour={getColour().sensebox}> {/* <Category name="Telegram" colour={getColour().sensebox}>
<Block type="sensebox_telegram" /> <Block type="sensebox_telegram" />
<Block type="sensebox_telegram_do" /> <Block type="sensebox_telegram_do" />
@@ -502,42 +503,63 @@ class Toolbox extends React.Component {
<Block type="time_micros"></Block> <Block type="time_micros"></Block>
<Block type="infinite_loop"></Block> <Block type="infinite_loop"></Block>
<Block type="sensebox_interval_timer"></Block> <Block type="sensebox_interval_timer"></Block>
<Block type="sensebox_rtc_init"></Block> <Category
<Block type="sensebox_rtc_set"> id="time"
<Value name="second"> name={Blockly.Msg.toolbox_rtc}
<Block type="math_number"> colour={getColour().time}
<Field name="NUM">00</Field> >
</Block> <Label text={Blockly.Msg.toolbox_label_externalRTC}></Label>
</Value> <Block type="sensebox_rtc_init"></Block>
<Value name="minutes"> <Block type="sensebox_rtc_set">
<Block type="math_number"> <Value name="second">
<Field name="NUM">00</Field> <Block type="math_number">
</Block> <Field name="NUM">00</Field>
</Value> </Block>
<Value name="hour"> </Value>
<Block type="math_number"> <Value name="minutes">
<Field name="NUM">00</Field> <Block type="math_number">
</Block> <Field name="NUM">00</Field>
</Value> </Block>
<Value name="day"> </Value>
<Block type="math_number"> <Value name="hour">
<Field name="NUM">01</Field> <Block type="math_number">
</Block> <Field name="NUM">00</Field>
</Value> </Block>
<Value name="month"> </Value>
<Block type="math_number"> <Value name="day">
<Field name="NUM">01</Field> <Block type="math_number">
</Block> <Field name="NUM">01</Field>
</Value> </Block>
<Value name="year"> </Value>
<Block type="math_number"> <Value name="month">
<Field name="NUM">1970</Field> <Block type="math_number">
</Block> <Field name="NUM">01</Field>
</Value> </Block>
</Block> </Value>
{/* <Block type="sensebox_rtc_set_ntp"></Block> */} <Value name="year">
<Block type="sensebox_rtc_get"></Block> <Block type="math_number">
<Block type="sensebox_rtc_get_timestamp"></Block> <Field name="NUM">1970</Field>
</Block>
</Value>
</Block>
{/* <Block type="sensebox_rtc_set_ntp"></Block> */}
<Block type="sensebox_rtc_get"></Block>
<Block type="sensebox_rtc_get_timestamp"></Block>
<Sep gap="40"></Sep>
<Label text={Blockly.Msg.toolbox_label_internalRTC}></Label>
<Block type="sensebox_internal_rtc_init"></Block>
<Block type="sensebox_internal_rtc_set"></Block>
<Block type="sensebox_internal_rtc_get"></Block>
<Block type="sensebox_internal_rtc_get_timestamp"></Block>
</Category>
<Category
id="timeUTP"
name={Blockly.Msg.toolbox_ntp}
colour={getColour().time}
>
<Block type="sensebox_ntp_init"></Block>
<Block type="sensebox_ntp_get"></Block>
</Category>
</Category> </Category>
<Category <Category
id="math" id="math"
@@ -618,6 +640,8 @@ class Toolbox extends React.Component {
> >
<Block type="init_serial_monitor"></Block> <Block type="init_serial_monitor"></Block>
<Block type="print_serial_monitor"></Block> <Block type="print_serial_monitor"></Block>
<Block type="sensebox_gps_bn880" />
<Block type="sensebox_gps_isValid" />
</Category> </Category>
<Category name={Blockly.Msg.toolbox_io} colour={getColour().io}> <Category name={Blockly.Msg.toolbox_io} colour={getColour().io}>
<Block type="io_digitalwrite"></Block> <Block type="io_digitalwrite"></Block>
@@ -642,16 +666,19 @@ class Toolbox extends React.Component {
</Value> </Value>
</Block> </Block>
</Category> </Category>
<Category name={Blockly.Msg.toolbox_motors} colour={getColour().motors}> <Category
<Block type="sensebox_motors_beginServoMotor" /> name={Blockly.Msg.toolbox_motors}
<Block type="sensebox_motors_moveServoMotor"> colour={getColour().motors}
<Value name="degrees"> >
<Block type="math_number"> <Block type="sensebox_motors_beginServoMotor" />
<Field name="NUM">90</Field> <Block type="sensebox_motors_moveServoMotor">
</Block> <Value name="degrees">
</Value> <Block type="math_number">
</Block> <Field name="NUM">90</Field>
{/* <Block type="sensebox_motors_I2CMotorBoard_begin" /> </Block>
</Value>
</Block>
{/* <Block type="sensebox_motors_I2CMotorBoard_begin" />
<Block type="sensebox_motors_I2CMotorBoard_moveDCMotor"> <Block type="sensebox_motors_I2CMotorBoard_moveDCMotor">
<Value name="speed"> <Value name="speed">
<Block type="math_number"> <Block type="math_number">
@@ -668,7 +695,7 @@ class Toolbox extends React.Component {
</Block> </Block>
</Value> </Value>
</Block> */} </Block> */}
</Category> </Category>
<Category name="Watchdog" colour={getColour().io}> <Category name="Watchdog" colour={getColour().io}>
<Block type="watchdog_enable"></Block> <Block type="watchdog_enable"></Block>
<Block type="watchdog_reset"></Block> <Block type="watchdog_reset"></Block>
+12 -15
View File
@@ -1,4 +1,4 @@
import React, { useEffect } from "react"; import React from "react";
import Blockly from "blockly"; import Blockly from "blockly";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import Accordion from "@mui/material/Accordion"; import Accordion from "@mui/material/Accordion";
@@ -10,20 +10,17 @@ import { useMonaco } from "@monaco-editor/react";
import { Button } from "@mui/material"; import { Button } from "@mui/material";
import SerialMonitor from "./SerialMonitor.js"; import SerialMonitor from "./SerialMonitor.js";
import axios from "axios"; import axios from "axios";
import { useDispatch } from "react-redux";
import { getArduinoExamples } from "../../actions/arduinoActions";
//import getArduinoExamples from "../../reducers/arduinoReducer"
const Sidebar = () => { const Sidebar = () => {
//const [examples, setExamples] = React.useState([]);
const examples = useSelector((state) => state.arduino.examples);
const user = useSelector((state) => state.auth.user); const user = useSelector((state) => state.auth.user);
const dispatch = useDispatch() // useEffect(() => {
// axios
useEffect(() => { // .get("https://coelho.opensensemap.org/items/blocklysamples")
dispatch(getArduinoExamples()); // .then((res) => {
}, [dispatch]); // setExamples(res.data.data);
// });
// }, []);
const monaco = useMonaco(); const monaco = useMonaco();
const loadCode = (code) => { const loadCode = (code) => {
monaco.editor.getModels()[0].setValue(code); monaco.editor.getModels()[0].setValue(code);
@@ -55,7 +52,7 @@ const Sidebar = () => {
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>
) : null} ) : null}
<Accordion> {/* <Accordion>
<AccordionSummary <AccordionSummary
expandIcon={""} expandIcon={""}
aria-controls="panel1a-content" aria-controls="panel1a-content"
@@ -74,13 +71,13 @@ const Sidebar = () => {
key={i} key={i}
onClick={() => loadCode(object.code)} onClick={() => loadCode(object.code)}
> >
{object.title} {object.name}
</Button> </Button>
); );
})} })}
</Typography> </Typography>
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion> */}
{user ? ( {user ? (
<Accordion> <Accordion>
<AccordionSummary <AccordionSummary
+2 -9
View File
@@ -15,22 +15,15 @@ import { setBoard } from './Blockly/helpers/board';
class Content extends Component { class Content extends Component {
componentDidMount() { componentDidMount() {
console.log(this.props.board);
setBoard(this.props.board)
if (this.props.language === 'de_DE') { if (this.props.language === 'de_DE') {
Blockly.setLocale(De); Blockly.setLocale(De);
} else if (this.props.language === 'en_US') { } else if (this.props.language === 'en_US') {
Blockly.setLocale(En); Blockly.setLocale(En);
} }
setBoard(this.props.board)
} }
componentDidUpdate(props) { componentDidUpdate(props) {
console.log(props.board);
console.log(this.props.board);
// if (props.board !== this.props.board) {
setBoard(this.props.board);
if (props.language !== this.props.language) { if (props.language !== this.props.language) {
if (this.props.language === 'de_DE') { if (this.props.language === 'de_DE') {
Blockly.setLocale(De); Blockly.setLocale(De);
@@ -38,7 +31,7 @@ class Content extends Component {
Blockly.setLocale(En); Blockly.setLocale(En);
} }
} }
setBoard(this.props.board)
} }
render() { render() {
+1 -1
View File
@@ -5,8 +5,8 @@ import Dialog from "./Dialog";
import withStyles from '@mui/styles/withStyles'; import withStyles from '@mui/styles/withStyles';
import * as Blockly from "blockly"; import * as Blockly from "blockly";
import { setBoard } from "../actions/boardActions";
import { IconButton, Grid, Avatar, Typography } from "@mui/material"; import { IconButton, Grid, Avatar, Typography } from "@mui/material";
import { setBoard } from "../actions/boardAction";
const styles = (theme) => ({ const styles = (theme) => ({
link: { link: {
+4 -11
View File
@@ -2,10 +2,10 @@ 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 { clearStats, workspaceName } from "../actions/workspaceActions"; import { clearStats, workspaceName } from "../actions/workspaceActions";
import { setBoard } from "../actions/boardActions";
import * as Blockly from "blockly/core"; import * as Blockly from "blockly/core";
import { createNameId } from "mnemonic-id"; import { createNameId } from "mnemonic-id";
import * as BoardHelper from "./Blockly/helpers/board";
import WorkspaceStats from "./Workspace/WorkspaceStats"; import WorkspaceStats from "./Workspace/WorkspaceStats";
import WorkspaceFunc from "./Workspace/WorkspaceFunc"; import WorkspaceFunc from "./Workspace/WorkspaceFunc";
import BlocklyWindow from "./Blockly/BlocklyWindow"; import BlocklyWindow from "./Blockly/BlocklyWindow";
@@ -66,10 +66,6 @@ class Home extends Component {
this.setState({ stats: window.localStorage.getItem("stats") }); this.setState({ stats: window.localStorage.getItem("stats") });
if (!this.props.project) { if (!this.props.project) {
this.props.workspaceName(createNameId()); this.props.workspaceName(createNameId());
} else {
console.log(this.props.project);
this.props.setBoard(this.props.project.board);
BoardHelper.setBoard(this.props.project.board);
} }
if (this.props.message && this.props.message.id === "GET_SHARE_FAIL") { if (this.props.message && this.props.message.id === "GET_SHARE_FAIL") {
this.setState({ this.setState({
@@ -191,8 +187,7 @@ class Home extends Component {
</Grid> </Grid>
) : null} ) : null}
</Grid> </Grid>
{!this.props.board ? <DeviceSelection /> : null} <DeviceSelection />
{/* <DeviceSelection /> */}
{/* <HintTutorialExists /> */} {/* <HintTutorialExists /> */}
{this.props.platform ? ( {this.props.platform ? (
<Dialog <Dialog
@@ -225,7 +220,6 @@ class Home extends Component {
} }
Home.propTypes = { Home.propTypes = {
setBoard: PropTypes.func.isRequired,
clearStats: PropTypes.func.isRequired, clearStats: PropTypes.func.isRequired,
workspaceName: PropTypes.func.isRequired, workspaceName: PropTypes.func.isRequired,
message: PropTypes.object.isRequired, message: PropTypes.object.isRequired,
@@ -237,9 +231,8 @@ const mapStateToProps = (state) => ({
message: state.message, message: state.message,
statistics: state.general.statistics, statistics: state.general.statistics,
platform: state.general.platform, platform: state.general.platform,
board: state.board.board
}); });
export default connect(mapStateToProps, { clearStats, workspaceName, setBoard })( export default connect(mapStateToProps, { clearStats, workspaceName })(
withStyles(styles, { withTheme: true })(Home) withStyles(styles, { withTheme: true })(Home)
); );
+241 -50
View File
@@ -37,10 +37,20 @@ import {
faLightbulb, faLightbulb,
faCode, faCode,
faPuzzlePiece, faPuzzlePiece,
faUser,
faMicrochip,
faEarthEurope,
faEarthAmericas,
faCaretDown
} from "@fortawesome/free-solid-svg-icons"; } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import * as Blockly from "blockly"; import * as Blockly from "blockly";
import Tooltip from "@mui/material/Tooltip"; import Tooltip from "@mui/material/Tooltip";
import MenuItem from '@mui/material/MenuItem'
import Menu from '@mui/material/Menu'
import { setLanguage } from "../actions/generalActions";
import { setBoard } from "../actions/boardAction";
import { Button } from "@mui/material";
const styles = (theme) => ({ const styles = (theme) => ({
drawerWidth: { drawerWidth: {
@@ -60,9 +70,14 @@ const styles = (theme) => ({
class Navbar extends Component { class Navbar extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.langRef = React.createRef();
this.mcuRef = React.createRef();
this.state = { this.state = {
open: false, open: false,
isTourOpen: false, isTourOpen: false,
anchorElLang: null,
anchorElBoard: null,
anchorElUser: null
}; };
} }
@@ -80,7 +95,6 @@ class Navbar extends Component {
render() { render() {
var isHome = /^\/(\/.*$|$)/g.test(this.props.location.pathname); var isHome = /^\/(\/.*$|$)/g.test(this.props.location.pathname);
var isTutorial = /^\/tutorial(\/.*$|$)/g.test(this.props.location.pathname);
var isAssessment = var isAssessment =
/^\/tutorial\/.{1,}$/g.test(this.props.location.pathname) && /^\/tutorial\/.{1,}$/g.test(this.props.location.pathname) &&
!this.props.tutorialIsLoading && !this.props.tutorialIsLoading &&
@@ -127,55 +141,226 @@ class Navbar extends Component {
<Link to={"/"} style={{ marginLeft: "10px" }}> <Link to={"/"} style={{ marginLeft: "10px" }}>
<img src={senseboxLogo} alt="senseBox-Logo" width="30" /> <img src={senseboxLogo} alt="senseBox-Logo" width="30" />
</Link> </Link>
{isTutorial ? ( <div style={{ margin: "0 0 0 auto", display: "flex", alignItems: 'center', justifyContent: 'center' }}>
<Link {isHome ? (
to={"/tutorial"} <div style={{ display: "flex" }}>
style={{ <div style={{ padding: "12px" }}>
textDecoration: "none", <Button
color: "inherit", style={{ textTransform: 'none', cursor: "pointer", alignItems: "center", alignContent: "center", background: "transparent", color: "inherit", fontWeight: "bold", border: "2px solid white", borderRadius: "25px" }}
marginLeft: "10px", ref={this.mcuRef}
onClick={() => {
this.setState({ anchorElBoard: this.mcuRef.current })
}}
startIcon={<FontAwesomeIcon icon={faMicrochip} />}
endIcon={<FontAwesomeIcon icon={faCaretDown} />}
sx={{ display: { xs: "none", sm: "none", md: "flex" } }}
>
{this.props.selectedBoard}
</Button>
<Menu
anchorEl={this.state.anchorElBoard}
anchorOrigin={{
vertical: 'bottom',
horizontal: 'center',
}}
keepMounted
transformOrigin={{
vertical: 'top',
horizontal: 'center',
}}
open={Boolean(this.state.anchorElBoard)}
onClose={() => {
this.setState({ anchorElBoard: null });
}}
>
<MenuItem
value="mcu"
onClick={(event) => {
this.props.setBoard(event.currentTarget.getAttribute("value"));
this.setState({ anchorElBoard: null });
}}
>
mcu
</MenuItem>
<MenuItem
value="mini"
onClick={(event) => {
this.props.setBoard(event.currentTarget.getAttribute("value"));
this.setState({ anchorElBoard: null });
}}
>
mini
</MenuItem>
</Menu>
</div>
<div style={{ padding: "12px" }}>
{
this.props.language === "en_US" ?
(
<Button
style={{ textTransform: 'none', cursor: "pointer", alignItems: "center", alignContent: "center", background: "transparent", color: "inherit", fontWeight: "bold", border: "2px solid white", borderRadius: "25px" }}
ref={this.langRef}
onClick={() => {
this.setState({ anchorElLang: this.langRef.current })
}}
startIcon={<FontAwesomeIcon icon={faEarthAmericas} />}
endIcon={<FontAwesomeIcon icon={faCaretDown} />}
sx={{ display: { xs: "none", sm: "none", md: "flex" } }}
>
English
</Button>
) : (
<Button
style={{ textTransform: 'none', cursor: "pointer", alignItems: "center", alignContent: "center", background: "transparent", color: "inherit", fontWeight: "bold", border: "2px solid white", borderRadius: "25px" }}
ref={this.langRef}
onClick={() => {
this.setState({ anchorElLang: this.langRef.current })
}}
startIcon={<FontAwesomeIcon icon={faEarthEurope} />}
endIcon={<FontAwesomeIcon icon={faCaretDown} />}
sx={{ display: { xs: "none", sm: "none", md: "flex" } }}
>
Deutsch
</Button>
)
}
<Menu
anchorEl={this.state.anchorElLang}
anchorOrigin={{
vertical: 'bottom',
horizontal: 'center',
}}
keepMounted
transformOrigin={{
vertical: 'top',
horizontal: 'center',
}}
open={Boolean(this.state.anchorElLang)}
onClose={() => {
this.setState({ anchorElLang: null });
}}
>
<MenuItem
value="de_DE"
onClick={(event) => {
this.props.setLanguage(event.currentTarget.getAttribute("value"));
this.setState({ anchorElLang: null });
}}
>
Deutsch
</MenuItem>
<MenuItem
value="en_US"
onClick={(event) => {
this.props.setLanguage(event.currentTarget.getAttribute("value"));
this.setState({ anchorElLang: null });
}}
>
English
</MenuItem>
</Menu>
</div>
</div>
) : (null)}
{isHome ? (
<Tooltip title={'Start Tour'} arrow>
<IconButton
color="inherit"
className={`openTour ${this.props.classes.button}`}
onClick={() => {
this.openTour();
}}
size="large">
<FontAwesomeIcon icon={faQuestionCircle} />
</IconButton>
</Tooltip>
) : null}
{isAssessment ? (
<Tooltip title={'Start tour'} arrow>
<IconButton
color="inherit"
className={`openTour ${this.props.classes.button}`}
onClick={() => {
this.openTour();
}}
size="large">
<FontAwesomeIcon icon={faQuestionCircle} />
</IconButton>
</Tooltip>
) : null}
<Tour
steps={isHome ? home() : assessment()}
isOpen={this.state.isTourOpen}
onRequestClose={() => {
this.closeTour();
}} }}
> />
<Typography variant="h6" noWrap> {this.props.user ? (
Tutorial <div>
</Typography> <IconButton
</Link> color="inherit"
) : null} onClick={(event) => { this.setState({ anchorElUser: event.target }) }}
{isHome ? ( style={{ margin: "0 30px 0 0" }}
<Tooltip title={'Start Tour'} arrow> size="large"
<IconButton >
color="inherit" <FontAwesomeIcon icon={faUser} />
className={`openTour ${this.props.classes.button}`} </IconButton>
onClick={() => { <Menu
this.openTour(); anchorEl={this.state.anchorElUser}
}} anchorOrigin={{
style={{ margin: "0 30px 0 auto" }} vertical: 'bottom',
size="large"> horizontal: 'center',
<FontAwesomeIcon icon={faQuestionCircle} /> }}
</IconButton> keepMounted
</Tooltip> transformOrigin={{
) : null} vertical: 'top',
{isAssessment ? ( horizontal: 'center',
<Tooltip title={'Start tour'} arrow> }}
<IconButton open={Boolean(this.state.anchorElUser)}
color="inherit" onClose={() => { this.setState({ anchorElUser: null }); }}
className={`openTour ${this.props.classes.button}`} >
onClick={() => { <div className="" style={{ paddingLeft: "16px", paddingRight: "16px", paddingTop: "16px" }}>
this.openTour(); <p style={{ fontWeight: "bold", margin: "0px" }}>
}} {this.props.user.name}
style={{ margin: "0 30px 0 auto" }} </p>
size="large"> <p style={{ marginTop: "0px", color: "#696969" }}>
<FontAwesomeIcon icon={faQuestionCircle} /> {this.props.user.email}
</IconButton> </p>
</Tooltip> </div>
) : null} <hr style={{ borderTop: "3px solid #bbb", marginLeft: "5px", marginRight: "5px" }} />
<Tour <MenuItem>
steps={isHome ? home() : assessment()} <Link to={"/user"} style={{ textDecoration: 'none', color: "black" }}>
isOpen={this.state.isTourOpen} {Blockly.Msg.navbar_account}
onRequestClose={() => { </Link>
this.closeTour(); </MenuItem>
}} <MenuItem>
/> <Link to={"/settings"} style={{ textDecoration: 'none', color: "black" }}>
{Blockly.Msg.navbar_settings}
</Link>
</MenuItem>
<MenuItem
onClick={() => {
this.props.logout()
}}
>
{Blockly.Msg.navbar_logout}
</MenuItem>
</Menu>
</div>
)
:
(<Link to={"/user/login"} style={{ textDecoration: 'none', color: "white" }}>
<IconButton
color="inherit"
style={{ margin: "0 30px 0 auto" }}
>
<FontAwesomeIcon icon={faUser} />
</IconButton>
</Link>
)
}
</div>
</Toolbar> </Toolbar>
</AppBar> </AppBar>
<Drawer <Drawer
@@ -369,6 +554,10 @@ Navbar.propTypes = {
user: PropTypes.object, user: PropTypes.object,
tutorial: PropTypes.object, tutorial: PropTypes.object,
activeStep: PropTypes.number.isRequired, activeStep: PropTypes.number.isRequired,
setLanguage: PropTypes.func.isRequired,
language: PropTypes.string.isRequired,
setBoard: PropTypes.func.isRequired,
selectedBoard: PropTypes.string.isRequired
}; };
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
@@ -378,8 +567,10 @@ const mapStateToProps = (state) => ({
user: state.auth.user, user: state.auth.user,
tutorial: state.tutorial.tutorials[0], tutorial: state.tutorial.tutorials[0],
activeStep: state.tutorial.activeStep, activeStep: state.tutorial.activeStep,
language: state.general.language,
selectedBoard: state.board.board
}); });
export default connect(mapStateToProps, { logout })( export default connect(mapStateToProps, { logout, setLanguage, setBoard })(
withStyles(styles, { withTheme: true })(withRouter(Navbar)) withStyles(styles, { withTheme: true })(withRouter(Navbar))
); );
+1 -1
View File
@@ -140,7 +140,7 @@ class ProjectHome extends Component {
svg svg
blockDisabled blockDisabled
initialXml={project.xml} initialXml={project.xml}
/> />
<Typography <Typography
variant="body2" variant="body2"
style={{ style={{
+26 -2
View File
@@ -1,7 +1,7 @@
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 { visitPage } from "../../actions/generalActions"; import { visitPage, setPlatform } from "../../actions/generalActions";
import { Route, Switch, withRouter } from "react-router-dom"; import { Route, Switch, withRouter } from "react-router-dom";
@@ -27,6 +27,24 @@ import Faq from "../Faq";
import CodeEditor from "../CodeEditor/CodeEditor"; import CodeEditor from "../CodeEditor/CodeEditor";
class Routes extends Component { class Routes extends Component {
componentDidMount() {
const { location } = this.props;
const query = new URLSearchParams(location.search, [location.search]);
const mode = query.get('mode');
if (!this.props.platform && mode) {
switch (mode.toLowerCase()) {
case 'tablet':
this.props.setPlatform(true);
break;
default:
break;
}
}
}
componentDidUpdate() { componentDidUpdate() {
this.props.visitPage(); this.props.visitPage();
} }
@@ -105,6 +123,12 @@ class Routes extends Component {
Home.propTypes = { Home.propTypes = {
visitPage: PropTypes.func, visitPage: PropTypes.func,
platform: PropTypes.bool.isRequired,
setPlatform: PropTypes.func.isRequired
}; };
export default connect(null, { visitPage })(withRouter(Routes)); const mapStateToProps = (state) => ({
platform: state.general.platform,
});
export default connect(mapStateToProps, { visitPage, setPlatform })(withRouter(Routes));
+1 -1
View File
@@ -1,7 +1,7 @@
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 { setBoard } from '../../actions/boardActions'; import { setBoard } from '../../actions/boardAction';
import * as Blockly from 'blockly/core'; import * as Blockly from 'blockly/core';
+2 -6
View File
@@ -91,11 +91,8 @@ class SaveProject extends Component {
saveProject = () => { saveProject = () => {
var body = { var body = {
xml: this.props.xml, xml: this.props.xml,
title: this.props.name, title: this.props.name
board: this.props.board,
type: "blockly"
}; };
console.log(body);
if (this.state.projectType === 'gallery') { if (this.state.projectType === 'gallery') {
body.description = this.state.description; body.description = this.state.description;
} }
@@ -213,8 +210,7 @@ const mapStateToProps = state => ({
description: state.project.description, description: state.project.description,
xml: state.workspace.code.xml, xml: state.workspace.code.xml,
message: state.message, message: state.message,
user: state.auth.user, user: state.auth.user
board: state.board.board,
}); });
export default connect(mapStateToProps, { updateProject, setDescription })(withStyles(styles, { withTheme: true })(withRouter(SaveProject))); export default connect(mapStateToProps, { updateProject, setDescription })(withStyles(styles, { withTheme: true })(withRouter(SaveProject)));
+37 -3
View File
@@ -4,12 +4,22 @@
"name": "senseBox MCU", "name": "senseBox MCU",
"src": "senseboxmcu.png", "src": "senseboxmcu.png",
"url": "https://docs.sensebox.de/hardware/allgemein-sensebox-mcu/", "url": "https://docs.sensebox.de/hardware/allgemein-sensebox-mcu/",
"category": "boards",
"description": "test" "description": "test"
}, },
{
"id": "senseboxmcumini",
"name": "senseBox MCU:mini",
"src": "senseboxmcumini.png",
"url": "https://docs.sensebox.de/hardware/allgemein-sensebox-mcu-mini/",
"category": "boards",
"description": ""
},
{ {
"id": "breadboard", "id": "breadboard",
"name": "Breadboard", "name": "Breadboard",
"src": "breadboard.png", "src": "breadboard.png",
"category": "misc",
"url": "" "url": ""
}, },
{ {
@@ -56,10 +66,16 @@
}, },
{ {
"id": "feinstaub", "id": "feinstaub",
"name": "Feinstaubsensor", "name": "Feinstaubsensor (SDS011)",
"src": "feinstaub.png", "src": "feinstaub.png",
"url": "https://docs.sensebox.de/hardware/sensoren-feinstaub/" "url": "https://docs.sensebox.de/hardware/sensoren-feinstaub/"
}, },
{
"id": "feinstaub-sps30",
"name": "Feinstaubsensor (SPS30)",
"src": "sps30.png",
"url": "https://docs.sensebox.de/hardware/sensoren-feinstaub/"
},
{ {
"id": "gps", "id": "gps",
"name": "GPS-Modul", "name": "GPS-Modul",
@@ -140,8 +156,14 @@
}, },
{ {
"id": "ds1820b", "id": "ds1820b",
"name": "Wassertemperatur", "name": "Wassertemperatur Sensor",
"src": "ws2818.png", "src": "wassertemp.png",
"url": ""
},
{
"id": "expander",
"name": "I2C Expander",
"src": "expander.png",
"url": "" "url": ""
}, },
{ {
@@ -162,6 +184,18 @@
"src": "jst-jst.png", "src": "jst-jst.png",
"url": "" "url": ""
}, },
{
"id": "jst-qwiic",
"name": "JST-QWIIC Kabel",
"src": "jst-qwiic.png",
"url": ""
},
{
"id": "qwiic-qwiic",
"name": "QWIIC-QWICC Kabel",
"src": "qwiic-qwiic.png",
"url": ""
},
{ {
"id": "jumperwire", "id": "jumperwire",
"name": "Steckkabel", "name": "Steckkabel",
-20
View File
@@ -1,20 +0,0 @@
import { GET_ARDUINO_EXAMPLES } from '../actions/types';
const initialState = {
examples: [],
type: '',
description: '',
progress: false
};
export default function foo(state = initialState, action) {
switch (action.type) {
case GET_ARDUINO_EXAMPLES:
return {
...state,
examples: action.payload
};
default:
return state;
}
}
+1 -3
View File
@@ -8,7 +8,6 @@ import messageReducer from './messageReducer';
import authReducer from './authReducer'; import authReducer from './authReducer';
import boardReducer from './boardReducer'; import boardReducer from './boardReducer';
import sensorwikiReducer from './sensorwikiReducer'; import sensorwikiReducer from './sensorwikiReducer';
import arduinoReducer from './arduinoReducer';
export default combineReducers({ export default combineReducers({
auth: authReducer, auth: authReducer,
@@ -19,6 +18,5 @@ export default combineReducers({
project: projectReducer, project: projectReducer,
general: generalReducer, general: generalReducer,
message: messageReducer, message: messageReducer,
sensorwiki: sensorwikiReducer, sensorwiki: sensorwikiReducer
arduino: arduinoReducer
}); });