From 9e6350a42f0a1c345c2cc75ce76a26e53d0a2a8c Mon Sep 17 00:00:00 2001
From: Irene-Maxine <114802521+Irene-Maxine@users.noreply.github.com>
Date: Fri, 21 Feb 2025 15:11:07 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E5=85=83=E7=BB=84?=
=?UTF-8?q?=E8=BD=AC=E6=97=B6=E9=97=B4=E5=AD=97=E7=AC=A6=E4=B8=B2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../micropython/blocks/sensor_onboard.js | 14 ++++++++++++++
.../micropython/generators/sensor_onboard.js | 7 +++++++
.../default_src/micropython_educore/template.xml | 7 +++++++
boards/default_src/micropython_esp32/template.xml | 7 +++++++
.../default_src/micropython_esp32c2/template.xml | 7 +++++++
.../default_src/micropython_esp32c3/template.xml | 7 +++++++
.../default_src/micropython_esp32s2/template.xml | 7 +++++++
.../default_src/micropython_esp32s3/template.xml | 7 +++++++
8 files changed, 63 insertions(+)
diff --git a/boards/default_src/micropython/blocks/sensor_onboard.js b/boards/default_src/micropython/blocks/sensor_onboard.js
index 40b78759..53dcec9d 100644
--- a/boards/default_src/micropython/blocks/sensor_onboard.js
+++ b/boards/default_src/micropython/blocks/sensor_onboard.js
@@ -612,6 +612,20 @@ export const onboard_RTC_get_time_str = {
}
};
+export const onboard_RTC_get_timetuple_to_str = {
+ init: function () {
+ this.setColour(SENSOR_ONBOARD_HUE);
+ this.appendValueInput('CONTENT')
+ .appendField('RTC '+Blockly.Msg.blockpy_USE_TUPLE)
+ .setCheck()
+ this.appendDummyInput()
+ .appendField( Blockly.Msg.MATH_ZHW + Blockly.Msg.MIXLY_GPS_TIME+Blockly.Msg.LANG_MATH_STRING)
+ this.setOutput(true, String);
+ this.setInputsInline(true);
+ this.setTooltip(Blockly.Msg.MIXLY_ESP32_RTC_GET_TIME_TOOLTIP);
+ }
+};
+
export const sensor_LTR308 = {
init: function () {
this.setColour(SENSOR_ONBOARD_HUE);
diff --git a/boards/default_src/micropython/generators/sensor_onboard.js b/boards/default_src/micropython/generators/sensor_onboard.js
index 500a2d1f..ae9790f6 100644
--- a/boards/default_src/micropython/generators/sensor_onboard.js
+++ b/boards/default_src/micropython/generators/sensor_onboard.js
@@ -584,6 +584,13 @@ export const onboard_RTC_get_time_str = function(_,generator){
return [code, generator.ORDER_ATOMIC];
}
+export const onboard_RTC_get_timetuple_to_str = function(_,generator){
+ generator.definitions_['import_rtctime'] = 'import rtctime';
+ var ct = generator.valueToCode(this, 'CONTENT', generator.ORDER_ATOMIC);
+ var code = 'rtctime.strtime(('+ ct +'))';
+ return [code, generator.ORDER_ATOMIC];
+}
+
//mixgo_cc onboard_sensor generators:
export const sensor_mixgo_cc_mmc5603_get_magnetic = function (_, generator) {
diff --git a/boards/default_src/micropython_educore/template.xml b/boards/default_src/micropython_educore/template.xml
index cdb0014a..260dc1e4 100644
--- a/boards/default_src/micropython_educore/template.xml
+++ b/boards/default_src/micropython_educore/template.xml
@@ -1587,6 +1587,13 @@
+
+
+
+ 2023,1,1,12,0,0
+
+
+
diff --git a/boards/default_src/micropython_esp32/template.xml b/boards/default_src/micropython_esp32/template.xml
index bc9a0947..4c196a1e 100644
--- a/boards/default_src/micropython_esp32/template.xml
+++ b/boards/default_src/micropython_esp32/template.xml
@@ -1491,6 +1491,13 @@
+
+
+
+ 2023,1,1,12,0,0
+
+
+
diff --git a/boards/default_src/micropython_esp32c2/template.xml b/boards/default_src/micropython_esp32c2/template.xml
index e133d9be..77dba2b0 100644
--- a/boards/default_src/micropython_esp32c2/template.xml
+++ b/boards/default_src/micropython_esp32c2/template.xml
@@ -1510,6 +1510,13 @@
+
+
+
+ 2023,1,1,12,0,0
+
+
+
diff --git a/boards/default_src/micropython_esp32c3/template.xml b/boards/default_src/micropython_esp32c3/template.xml
index 3bc72b4c..a59519bd 100644
--- a/boards/default_src/micropython_esp32c3/template.xml
+++ b/boards/default_src/micropython_esp32c3/template.xml
@@ -1500,6 +1500,13 @@
+
+
+
+ 2023,1,1,12,0,0
+
+
+
diff --git a/boards/default_src/micropython_esp32s2/template.xml b/boards/default_src/micropython_esp32s2/template.xml
index b4aec6eb..33f8b368 100644
--- a/boards/default_src/micropython_esp32s2/template.xml
+++ b/boards/default_src/micropython_esp32s2/template.xml
@@ -1466,6 +1466,13 @@
+
+
+
+ 2023,1,1,12,0,0
+
+
+
diff --git a/boards/default_src/micropython_esp32s3/template.xml b/boards/default_src/micropython_esp32s3/template.xml
index 10c4ebe8..da023b8b 100644
--- a/boards/default_src/micropython_esp32s3/template.xml
+++ b/boards/default_src/micropython_esp32s3/template.xml
@@ -1520,6 +1520,13 @@
+
+
+
+ 2023,1,1,12,0,0
+
+
+