cleanup code and add translations
This commit is contained in:
parent
c1eff07b7e
commit
d65948fca7
@ -1,6 +1,5 @@
|
||||
import * as Blockly from "blockly";
|
||||
import { getColour } from "../helpers/colour";
|
||||
import { selectedBoard } from "../helpers/board";
|
||||
import * as Types from "../helpers/types";
|
||||
|
||||
Blockly.Blocks["sensebox_rtc_init"] = {
|
||||
@ -54,12 +53,12 @@ Blockly.Blocks["sensebox_rtc_get"] = {
|
||||
.appendField(Blockly.Msg.sensebox_rtc_get)
|
||||
.appendField(
|
||||
new Blockly.FieldDropdown([
|
||||
["hour", "hour"],
|
||||
["min", "minutes"],
|
||||
["sec", "seconds"],
|
||||
["day", "day"],
|
||||
["month", "month"],
|
||||
["year", "year"],
|
||||
[Blockly.Msg.sensebox_rtc_hour, "hour"],
|
||||
[Blockly.Msg.sensebox_rtc_minutes, "minutes"],
|
||||
[Blockly.Msg.sensebox_rtc_second, "seconds"],
|
||||
[Blockly.Msg.sensebox_rtc_day, "day"],
|
||||
[Blockly.Msg.sensebox_rtc_month, "month"],
|
||||
[Blockly.Msg.sensebox_rtc_year, "year"],
|
||||
]),
|
||||
"dropdown"
|
||||
);
|
||||
|
@ -3,6 +3,9 @@ import Blockly from "blockly";
|
||||
Blockly.Arduino.sensebox_rtc_init = function () {
|
||||
Blockly.Arduino.libraries_["RV8523"] = `#include <RV8523.h>`;
|
||||
Blockly.Arduino.definitions_["RTC"] = `RV8523 rtc;`;
|
||||
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
|
||||
'#include "SenseBoxMCU.h"';
|
||||
Blockly.Arduino.setupCode_["rtc.begin"] = `rtc.begin();`;
|
||||
var code = ``;
|
||||
return code;
|
||||
};
|
||||
@ -86,7 +89,7 @@ Blockly.Arduino.sensebox_rtc_get_timestamp = function () {
|
||||
|
||||
Blockly.Arduino.loopCodeOnce_[
|
||||
""
|
||||
] = `sprintf(timestamp, "20%02d-%02d-%02dT%02d:%02d:%02dZ", year, month, day, hour, min, sec);`;
|
||||
] = `sprintf(timestamp, "%02d-%02d-%02dT%02d:%02d:%02dZ", year, month, day, hour, min, sec);`;
|
||||
|
||||
var code = `timestamp`;
|
||||
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||
|
@ -1,6 +1,19 @@
|
||||
export const RTC = {
|
||||
sensebox_rtc_init: "Initialisiere RTC",
|
||||
sensebox_rtc_set: "Set Time",
|
||||
sensebox_rtc_get_timestamp: "Get Timestamp",
|
||||
sensebox_rtc_get: "Get: ",
|
||||
sensebox_rtc_init_tooltip:
|
||||
"Initialisiere die RTC. Schließe diese an einen der 5 I2C/Wire Anschlüsse an und lege die Batterie ein. Bevor du die Uhrzeit auslesen kannst muss diese zunächst einmal gesetzt werden. Dieser Schritt muss normalerweise nur einmalig durchgeführt werden.",
|
||||
sensebox_rtc_set: "Setze Uhrzeit/Datum der RTC",
|
||||
sensebox_rtc_set_tooltip:
|
||||
"Stellt die Uhrzeit der RTC ein. Beachte, dass du diesen Block im Setup ausführst.",
|
||||
sensebox_rtc_get_timestamp: "Zeitstempel",
|
||||
sensebox_rtc_get_timestamp_tooltip:
|
||||
"Gibt dir einen in ISO 8601 formatierten Zeitstempel zurück. Bsp: 2021-12-24T18:21Z",
|
||||
sensebox_rtc_get: "Wert: ",
|
||||
sensebox_rtc_get_tooltip: "Gibt dir den ausgewählten Wert zurück.",
|
||||
sensebox_rtc_second: "Sekunden",
|
||||
sensebox_rtc_minutes: "Minuten",
|
||||
sensebox_rtc_hour: "Stunden",
|
||||
sensebox_rtc_day: "Tag",
|
||||
sensebox_rtc_month: "Monat",
|
||||
sensebox_rtc_year: "Jahr",
|
||||
};
|
||||
|
@ -1,8 +1,15 @@
|
||||
export const RTC = {
|
||||
sensebox_rtc_init: "Initialisiere RTC",
|
||||
sensebox_rtc_set: "Set Time manually",
|
||||
sensebox_rtc_init: "Initialise RTC",
|
||||
sensebox_rtc_init_tooltip:
|
||||
"Initialise the RTC. Connect it to one of the 5 I2C/Wire connections and insert the battery. Before you can read out the time, it must first be set. This step usually only needs to be done once.",
|
||||
sensebox_rtc_set: "Set RTC time/date:",
|
||||
sensebox_rtc_set_tooltip:
|
||||
"Sets the time of the RTC. Note that you execute this block in the setup.",
|
||||
sensebox_rtc_get_timestamp: "Get timestamp",
|
||||
sensebox_rtc_get_timestamp_tooltip:
|
||||
"Returns a timestamp formatted in ISO 8601. Ex: 2021-12-24T18:21Z",
|
||||
sensebox_rtc_get_tooltip: "Returns the selected value",
|
||||
sensebox_rtc_set_ntp: "Set time via NTP-Server",
|
||||
sensebox_rtc_get_timestamp: "Get Timestamp",
|
||||
sensebox_rtc_get: "Get: ",
|
||||
sensebox_rtc_second: "seconds",
|
||||
sensebox_rtc_minutes: "minutes",
|
||||
|
@ -502,7 +502,7 @@ class Toolbox extends React.Component {
|
||||
</Block>
|
||||
</Value>
|
||||
</Block>
|
||||
<Block type="sensebox_rtc_set_ntp"></Block>
|
||||
{/* <Block type="sensebox_rtc_set_ntp"></Block> */}
|
||||
<Block type="sensebox_rtc_get"></Block>
|
||||
<Block type="sensebox_rtc_get_timestamp"></Block>
|
||||
</Category>
|
||||
|
Loading…
x
Reference in New Issue
Block a user