This commit is contained in:
2026-02-24 23:53:41 +08:00
parent 2f452e694c
commit 227139355e
4 changed files with 12 additions and 12 deletions
Submodule code/esp32c3_espidf/components/lvgl added at 0a05078455
+1 -1
View File
@@ -2,7 +2,7 @@ dependencies:
idf:
source:
type: idf
version: 5.5.2
version: 5.5.1
manifest_hash: a52a8cabe7f10f1636effa39e0be0f2d62531803ed5f518e7921b728e64c8752
target: esp32c3
version: 2.0.0
+8 -8
View File
@@ -40,14 +40,14 @@
static const char *TAG = "SYS";
// 自定义 tick 获取函数
static uint32_t custom_tick_get(void)
{
// 返回从启动到现在的毫秒数
// 使用64位中间变量避免溢出,采用乘以1.024的倒数近似值
uint64_t time_us = esp_timer_get_time();
return (uint32_t)((time_us * 1073) >> 20); // 1073/2^20 ≈ 1/1000
//return (uint32_t)(esp_timer_get_time() / 1000);
}
// static uint32_t custom_tick_get(void)
// {
// // 返回从启动到现在的毫秒数
// // 使用64位中间变量避免溢出,采用乘以1.024的倒数近似值
// uint64_t time_us = esp_timer_get_time();
// return (uint32_t)((time_us * 1073) >> 20); // 1073/2^20 ≈ 1/1000
// //return (uint32_t)(esp_timer_get_time() / 1000);
// }
esp_timer_handle_t timer_handle;
@@ -9,7 +9,7 @@ LV_FONT_DECLARE(my_cn_font);
* Create styles from scratch for buttons.
*/
unsigned int t=0;
unsigned long t=0;
char str[32]={0};
lv_obj_t *label3 ; //lv_label_create(lv_screen_active()); /*Add a label to the button*/
@@ -17,7 +17,7 @@ lv_obj_t *label3 ; //lv_label_create(lv_screen_active()); /*Add a label to the b
void this_work_loop(){
t++;
lv_label_set_text_fmt(label3,"这是啥xxx:%d",t);
lv_label_set_text_fmt(label3,"时间过去了:%lu秒",t);
}
@@ -57,7 +57,6 @@ void lv_example_get_started_1(void)
label3=lv_label_create(lv_screen_active()); /*Add a label to the button*/
lv_obj_add_style(label3, &style_label, 0);
lv_label_set_text_fmt(label3,"这是xxx:%d",t);
lv_timer_create(this_work_loop, 1000, NULL);
}