add blocks for internal RTC and NTP
This commit is contained in:
parent
9bf17aed67
commit
9526b154bf
@ -10,6 +10,7 @@ import "./sensebox-motors";
|
||||
import "./sensebox-lora";
|
||||
import "./sensebox-led";
|
||||
import "./sensebox-rtc";
|
||||
import "./sensebox-ntp";
|
||||
import "./sensebox-ble";
|
||||
import "./sensebox-sd";
|
||||
import "./mqtt";
|
||||
|
42
src/components/Blockly/blocks/sensebox-ntp.js
Normal file
42
src/components/Blockly/blocks/sensebox-ntp.js
Normal file
@ -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,56 @@ Blockly.Blocks["sensebox_rtc_get_timestamp"] = {
|
||||
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.appendDummyInput().appendField(Blockly.Msg.sensebox_internal_rtc_set);
|
||||
this.appendValueInput("time").appendField(
|
||||
Blockly.Msg.sensebox_internal_rtc_epoch
|
||||
);
|
||||
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, "Hour"],
|
||||
[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);
|
||||
},
|
||||
};
|
||||
|
@ -10,6 +10,7 @@ import "./sensebox-lora";
|
||||
import "./sensebox-led";
|
||||
import "./sensebox";
|
||||
import "./sensebox-rtc";
|
||||
import "./sensebox-ntp";
|
||||
import "./sensebox-ble";
|
||||
import "./sensebox-sd";
|
||||
import "./mqtt";
|
||||
|
19
src/components/Blockly/generator/sensebox-ntp.js
Normal file
19
src/components/Blockly/generator/sensebox-ntp.js
Normal file
@ -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,26 @@ uint8_t sec, min, hour, day, month;
|
||||
var code = `getTimeStamp()`;
|
||||
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;
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @license
|
||||
*
|
||||
*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -21,39 +21,51 @@
|
||||
* @author samelh@google.com (Sam El-Husseini)
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import BlocklyComponent from './BlocklyComponent';
|
||||
import React from "react";
|
||||
import BlocklyComponent from "./BlocklyComponent";
|
||||
|
||||
export default BlocklyComponent;
|
||||
|
||||
const Block = (p) => {
|
||||
const { children, ...props } = p;
|
||||
props.is = "blockly";
|
||||
return React.createElement("block", props, children);
|
||||
const { children, ...props } = p;
|
||||
props.is = "blockly";
|
||||
return React.createElement("block", props, children);
|
||||
};
|
||||
|
||||
const Category = (p) => {
|
||||
const { children, ...props } = p;
|
||||
props.is = "blockly";
|
||||
return React.createElement("category", props, children);
|
||||
const { children, ...props } = p;
|
||||
props.is = "blockly";
|
||||
return React.createElement("category", props, children);
|
||||
};
|
||||
|
||||
const Value = (p) => {
|
||||
const { children, ...props } = p;
|
||||
props.is = "blockly";
|
||||
return React.createElement("value", props, children);
|
||||
const { children, ...props } = p;
|
||||
props.is = "blockly";
|
||||
return React.createElement("value", props, children);
|
||||
};
|
||||
|
||||
const Field = (p) => {
|
||||
const { children, ...props } = p;
|
||||
props.is = "blockly";
|
||||
return React.createElement("field", props, children);
|
||||
const { children, ...props } = p;
|
||||
props.is = "blockly";
|
||||
return React.createElement("field", props, children);
|
||||
};
|
||||
|
||||
const Shadow = (p) => {
|
||||
const { children, ...props } = p;
|
||||
props.is = "blockly";
|
||||
return React.createElement("shadow", props, children);
|
||||
const { children, ...props } = p;
|
||||
props.is = "blockly";
|
||||
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 };
|
||||
|
@ -12,6 +12,7 @@ import { LED } from "./de/sensebox-led";
|
||||
import { LORA } from "./de/sensebox-lora";
|
||||
import { OSEM } from "./de/sensebox-osem";
|
||||
import { RTC } from "./de/sensebox-rtc";
|
||||
import { NTP } from "./de/sensebox-ntp";
|
||||
import { SD } from "./de/sensebox-sd";
|
||||
import { SENSORS } from "./de/sensebox-sensors";
|
||||
import { SENSEBOX } from "./de/sensebox";
|
||||
@ -40,6 +41,7 @@ export const De = {
|
||||
...LORA,
|
||||
...OSEM,
|
||||
...RTC,
|
||||
...NTP,
|
||||
...SD,
|
||||
...SENSORS,
|
||||
...SENSEBOX,
|
||||
|
14
src/components/Blockly/msg/de/sensebox-ntp.js
Normal file
14
src/components/Blockly/msg/de/sensebox-ntp.js
Normal file
@ -0,0 +1,14 @@
|
||||
export const NTP = {
|
||||
sensebox_ntp_init: "Initialisiere 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_set_tooltip:
|
||||
"Stellt die Uhrzeit der RTC ein. Beachte, dass du diesen Block im Setup ausführst.",
|
||||
sensebox_ntp_get: "Zeitstempel (RFC 3339)",
|
||||
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",
|
||||
};
|
@ -1,14 +1,14 @@
|
||||
export const RTC = {
|
||||
sensebox_rtc_init: "Initialisiere RTC",
|
||||
sensebox_rtc_init: "Initialisiere externe RTC",
|
||||
sensebox_rtc_init_tooltip:
|
||||
"Initialisiere die RTC. Schließe diese an einen der 5 I2C/Wire Anschlüsse an und lege die Batterie ein. Bevor du die Uhrzeit auslesen kannst muss diese zunächst einmal gesetzt werden. Dieser Schritt muss normalerweise nur einmalig durchgeführt werden.",
|
||||
sensebox_rtc_set: "Setze Uhrzeit/Datum der RTC",
|
||||
sensebox_rtc_set: "Setze Uhrzeit/Datum der externen RTC",
|
||||
sensebox_rtc_set_tooltip:
|
||||
"Stellt die Uhrzeit der RTC ein. Beachte, dass du diesen Block im Setup ausführst.",
|
||||
sensebox_rtc_get_timestamp: "Zeitstempel (RFC 3339)",
|
||||
sensebox_rtc_get_timestamp_tooltip:
|
||||
"Gibt dir einen in ISO 8601 formatierten Zeitstempel zurück. Bsp: 2021-12-24T18:21Z",
|
||||
sensebox_rtc_get: "Wert: ",
|
||||
sensebox_rtc_get: "Wert (externe RTC): ",
|
||||
sensebox_rtc_get_tooltip: "Gibt dir den ausgewählten Wert zurück.",
|
||||
sensebox_rtc_second: "Sekunden",
|
||||
sensebox_rtc_minutes: "Minuten",
|
||||
@ -16,4 +16,22 @@ export const RTC = {
|
||||
sensebox_rtc_day: "Tag",
|
||||
sensebox_rtc_month: "Monat",
|
||||
sensebox_rtc_year: "Jahr",
|
||||
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: "Wert (interne RTC): ",
|
||||
sensebox_internal_rtc_get_timestamp: "Get internal RTC timestamp",
|
||||
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: "epoch",
|
||||
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",
|
||||
};
|
||||
|
@ -8,11 +8,15 @@ export const UI = {
|
||||
toolbox_math: "Mathematik",
|
||||
toolbox_io: "Eingang/Ausgang",
|
||||
toolbox_time: "Zeit",
|
||||
toolbox_rtc: "RTC",
|
||||
toolbox_ntp: "NTP",
|
||||
toolbox_functions: "Funktionen",
|
||||
toolbox_variables: "Variablen",
|
||||
toolbox_serial: "Seriell",
|
||||
toolbox_advanced: "Erweitert",
|
||||
toolbox_motors: "Motoren",
|
||||
toolbox_label_externalRTC: "Externe RTC",
|
||||
toolbox_label_internalRTC: "Interne RTC",
|
||||
variable_NUMBER: "Zahl (int)",
|
||||
variable_SHORT_NUMBER: "char",
|
||||
variable_LONG: "große Zahl (long)",
|
||||
@ -309,7 +313,8 @@ export const UI = {
|
||||
* Device Selction
|
||||
* */
|
||||
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_02: "oder die"
|
||||
deviceselection_footnote_02: "oder die",
|
||||
};
|
||||
|
@ -13,6 +13,7 @@ import { LED } from "./en/sensebox-led";
|
||||
import { LORA } from "./en/sensebox-lora";
|
||||
import { OSEM } from "./en/sensebox-osem";
|
||||
import { RTC } from "./en/sensebox-rtc";
|
||||
import { NTP } from "./en/sensebox-ntp";
|
||||
import { SD } from "./en/sensebox-sd";
|
||||
import { SENSORS } from "./en/sensebox-sensors";
|
||||
import { TELEGRAM } from "./en/sensebox-telegram";
|
||||
@ -40,6 +41,7 @@ export const En = {
|
||||
...LORA,
|
||||
...OSEM,
|
||||
...RTC,
|
||||
...NTP,
|
||||
...SD,
|
||||
...SENSORS,
|
||||
...SENSEBOX,
|
||||
|
10
src/components/Blockly/msg/en/sensebox-ntp.js
Normal file
10
src/components/Blockly/msg/en/sensebox-ntp.js
Normal file
@ -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: "Hole Zeit von 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)",
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
export const RTC = {
|
||||
sensebox_rtc_init: "Initialise RTC",
|
||||
sensebox_rtc_init: "Initialise external RTC",
|
||||
sensebox_rtc_init_tooltip:
|
||||
"Initialise the RTC. Connect it to one of the 5 I2C/Wire connections and insert the battery. Before you can read out the time, it must first be set. This step usually only needs to be done once.",
|
||||
sensebox_rtc_set: "Set RTC time/date:",
|
||||
@ -17,4 +17,22 @@ export const RTC = {
|
||||
sensebox_rtc_day: "day",
|
||||
sensebox_rtc_month: "month",
|
||||
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: "Get internal RTC timestamp",
|
||||
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: "epoch",
|
||||
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",
|
||||
};
|
||||
|
@ -8,11 +8,15 @@ export const UI = {
|
||||
toolbox_math: "Math",
|
||||
toolbox_io: "Input/Output",
|
||||
toolbox_time: "Time",
|
||||
toolbox_rtc: "RTC",
|
||||
toolbox_ntp: "NTP",
|
||||
toolbox_functions: "Functions",
|
||||
toolbox_variables: "Variables",
|
||||
toolbox_serial: "Serial",
|
||||
toolbox_advanced: "Erweitert",
|
||||
toolbox_motors: "Motors",
|
||||
toolbox_label_externalRTC: "External RTC",
|
||||
toolbox_label_internalRTC: "Internal RTC",
|
||||
variable_NUMBER: "Number (int)",
|
||||
variable_SHORT_NUMBER: "char",
|
||||
variable_LONG: " Zahl (long)",
|
||||
@ -300,13 +304,13 @@ export const UI = {
|
||||
codeeditor_compile_progress:
|
||||
"Your code will now be compiled and then downloaded to your computer",
|
||||
|
||||
/**
|
||||
/**
|
||||
* Device Selction
|
||||
* */
|
||||
deviceselection_head: "Which board are you using?",
|
||||
deviceselection_keep_selection: "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_keep_selection:
|
||||
"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",
|
||||
|
||||
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
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 "@blockly/block-plus-minus";
|
||||
import { TypedVariableModal } from "@blockly/plugin-typed-variable-modal";
|
||||
@ -295,7 +295,7 @@ class Toolbox extends React.Component {
|
||||
</Value>
|
||||
</Block>
|
||||
</Category>
|
||||
|
||||
|
||||
{/* <Category name="Telegram" colour={getColour().sensebox}>
|
||||
<Block type="sensebox_telegram" />
|
||||
<Block type="sensebox_telegram_do" />
|
||||
@ -502,42 +502,62 @@ class Toolbox extends React.Component {
|
||||
<Block type="time_micros"></Block>
|
||||
<Block type="infinite_loop"></Block>
|
||||
<Block type="sensebox_interval_timer"></Block>
|
||||
<Block type="sensebox_rtc_init"></Block>
|
||||
<Block type="sensebox_rtc_set">
|
||||
<Value name="second">
|
||||
<Block type="math_number">
|
||||
<Field name="NUM">00</Field>
|
||||
</Block>
|
||||
</Value>
|
||||
<Value name="minutes">
|
||||
<Block type="math_number">
|
||||
<Field name="NUM">00</Field>
|
||||
</Block>
|
||||
</Value>
|
||||
<Value name="hour">
|
||||
<Block type="math_number">
|
||||
<Field name="NUM">00</Field>
|
||||
</Block>
|
||||
</Value>
|
||||
<Value name="day">
|
||||
<Block type="math_number">
|
||||
<Field name="NUM">01</Field>
|
||||
</Block>
|
||||
</Value>
|
||||
<Value name="month">
|
||||
<Block type="math_number">
|
||||
<Field name="NUM">01</Field>
|
||||
</Block>
|
||||
</Value>
|
||||
<Value name="year">
|
||||
<Block type="math_number">
|
||||
<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>
|
||||
<Category
|
||||
id="time"
|
||||
name={Blockly.Msg.toolbox_rtc}
|
||||
colour={getColour().time}
|
||||
>
|
||||
<Label text={Blockly.Msg.toolbox_label_externalRTC}></Label>
|
||||
<Block type="sensebox_rtc_init"></Block>
|
||||
<Block type="sensebox_rtc_set">
|
||||
<Value name="second">
|
||||
<Block type="math_number">
|
||||
<Field name="NUM">00</Field>
|
||||
</Block>
|
||||
</Value>
|
||||
<Value name="minutes">
|
||||
<Block type="math_number">
|
||||
<Field name="NUM">00</Field>
|
||||
</Block>
|
||||
</Value>
|
||||
<Value name="hour">
|
||||
<Block type="math_number">
|
||||
<Field name="NUM">00</Field>
|
||||
</Block>
|
||||
</Value>
|
||||
<Value name="day">
|
||||
<Block type="math_number">
|
||||
<Field name="NUM">01</Field>
|
||||
</Block>
|
||||
</Value>
|
||||
<Value name="month">
|
||||
<Block type="math_number">
|
||||
<Field name="NUM">01</Field>
|
||||
</Block>
|
||||
</Value>
|
||||
<Value name="year">
|
||||
<Block type="math_number">
|
||||
<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>
|
||||
</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
|
||||
id="math"
|
||||
@ -643,16 +663,19 @@ class Toolbox extends React.Component {
|
||||
</Value>
|
||||
</Block>
|
||||
</Category>
|
||||
<Category name={Blockly.Msg.toolbox_motors} colour={getColour().motors}>
|
||||
<Block type="sensebox_motors_beginServoMotor" />
|
||||
<Block type="sensebox_motors_moveServoMotor">
|
||||
<Value name="degrees">
|
||||
<Block type="math_number">
|
||||
<Field name="NUM">90</Field>
|
||||
</Block>
|
||||
</Value>
|
||||
</Block>
|
||||
{/* <Block type="sensebox_motors_I2CMotorBoard_begin" />
|
||||
<Category
|
||||
name={Blockly.Msg.toolbox_motors}
|
||||
colour={getColour().motors}
|
||||
>
|
||||
<Block type="sensebox_motors_beginServoMotor" />
|
||||
<Block type="sensebox_motors_moveServoMotor">
|
||||
<Value name="degrees">
|
||||
<Block type="math_number">
|
||||
<Field name="NUM">90</Field>
|
||||
</Block>
|
||||
</Value>
|
||||
</Block>
|
||||
{/* <Block type="sensebox_motors_I2CMotorBoard_begin" />
|
||||
<Block type="sensebox_motors_I2CMotorBoard_moveDCMotor">
|
||||
<Value name="speed">
|
||||
<Block type="math_number">
|
||||
@ -669,7 +692,7 @@ class Toolbox extends React.Component {
|
||||
</Block>
|
||||
</Value>
|
||||
</Block> */}
|
||||
</Category>
|
||||
</Category>
|
||||
<Category name="Watchdog" colour={getColour().io}>
|
||||
<Block type="watchdog_enable"></Block>
|
||||
<Block type="watchdog_reset"></Block>
|
||||
|
Loading…
x
Reference in New Issue
Block a user