Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3cac65b97 | ||
|
|
a969727a48 | ||
|
|
a1167b436b |
@@ -1,5 +1,4 @@
|
|||||||
#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
|
||||||
|
|
||||||
|
|||||||
@@ -582,47 +582,4 @@ Blockly.Blocks["sensebox_sensor_dps310"] = {
|
|||||||
this.setTooltip(Blockly.Msg.senseBox_sps30_tooltip);
|
this.setTooltip(Blockly.Msg.senseBox_sps30_tooltip);
|
||||||
this.setHelpUrl(Blockly.Msg.senseBox_sps30_helpurl);
|
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);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -7,6 +7,7 @@ import * as Blockly from "blockly/core";
|
|||||||
* @return {string} Completed code.
|
* @return {string} Completed code.
|
||||||
*/
|
*/
|
||||||
Blockly.Arduino["arduino_functions"] = function (block) {
|
Blockly.Arduino["arduino_functions"] = function (block) {
|
||||||
|
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
|
||||||
// Edited version of Blockly.Generator.prototype.statementToCode
|
// Edited version of Blockly.Generator.prototype.statementToCode
|
||||||
function statementToCodeNoTab(block, name) {
|
function statementToCodeNoTab(block, name) {
|
||||||
var targetBlock = block.getInputTargetBlock(name);
|
var targetBlock = block.getInputTargetBlock(name);
|
||||||
|
|||||||
@@ -753,58 +753,3 @@ if (time_startsps > time_actualsps + intervalsps) {
|
|||||||
var code = `m.mc_${dropdown_name}`;
|
var code = `m.mc_${dropdown_name}`;
|
||||||
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
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];
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -104,4 +104,4 @@ export const getCompatibleTypes = (type) => {
|
|||||||
return compatibleTypes[type];
|
return compatibleTypes[type];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const VARIABLE_TYPES = [['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']];
|
||||||
|
|||||||
@@ -640,8 +640,6 @@ 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>
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class ProjectHome extends Component {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</Link>
|
</Link>
|
||||||
{this.props.user &&
|
{this.props.user &&
|
||||||
this.props.user.email === project.creator ? (
|
(this.props.user.email === project.creator || this.props.user.role === 'admin') ? (
|
||||||
<div>
|
<div>
|
||||||
<Divider
|
<Divider
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class SaveProject extends Component {
|
|||||||
<Tooltip title={this.state.projectType === 'project' ? Blockly.Msg.tooltip_update_project : Blockly.Msg.tooltip_save_project} arrow>
|
<Tooltip title={this.state.projectType === 'project' ? Blockly.Msg.tooltip_update_project : Blockly.Msg.tooltip_save_project} arrow>
|
||||||
<IconButton
|
<IconButton
|
||||||
className={this.props.classes.button}
|
className={this.props.classes.button}
|
||||||
onClick={this.props.user.blocklyRole !== 'user' && (!this.props.project || this.props.user.email === this.props.project.creator) ? (e) => this.toggleMenu(e) : this.state.projectType === 'project' ? () => this.props.updateProject(this.state.projectType, this.props.project._id) : () => { this.setState({ projectType: 'project' }, () => this.saveProject()) }}
|
onClick={this.props.user.blocklyRole === 'admin' && (!this.props.project || this.props.user.email === this.props.project.creator) ? (e) => this.toggleMenu(e) : this.state.projectType === 'project' ? () => this.props.updateProject(this.state.projectType, this.props.project._id) : () => { this.setState({ projectType: 'project' }, () => this.saveProject()) }}
|
||||||
size="large">
|
size="large">
|
||||||
<FontAwesomeIcon icon={faSave} size="xs" />
|
<FontAwesomeIcon icon={faSave} size="xs" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class WorkspaceFunc extends Component {
|
|||||||
(this.props.projectType === "project" ||
|
(this.props.projectType === "project" ||
|
||||||
this.props.projectType === "gallery") &&
|
this.props.projectType === "gallery") &&
|
||||||
this.props.user &&
|
this.props.user &&
|
||||||
this.props.user.email === this.props.project.creator ? (
|
(this.props.user.email === this.props.project.creator || this.props.user.role === 'admin' ) ? (
|
||||||
<DeleteProject
|
<DeleteProject
|
||||||
project={this.props.project}
|
project={this.props.project}
|
||||||
projectType={this.props.projectType}
|
projectType={this.props.projectType}
|
||||||
|
|||||||
Reference in New Issue
Block a user