Browse Source

maybe finish

master
pomin-163 4 months ago
parent
commit
cd5e504276
  1. 4
      Proj.code-workspace
  2. 1
      components/esp32-DHT11
  3. 366
      components/myui/guider/ESP32_GUI.guiguider
  4. 4
      components/myui/guider/generated/gui_guider.h
  5. 131
      components/myui/guider/generated/gui_guider.py
  6. 3
      components/myui/guider/generated/guider_fonts/guider_fonts.h
  7. 3732
      components/myui/guider/generated/guider_fonts/lv_font_digifaw_24.c
  8. 125
      components/myui/guider/generated/setup_scr_screen.c
  9. 4
      components/myui/guider/sdk/Core/source/lv_conf.h
  10. 1
      main/CMakeLists.txt
  11. 10
      main/init/app_init.h
  12. 4
      main/init/btns_init.c
  13. 164
      main/init/https_init.c
  14. 14
      main/init/led_init.c
  15. 26
      main/init/mqtt_init.c
  16. 73
      main/init/ntp_init.c
  17. 26
      main/main.c
  18. 31
      main/server_root_cert.pem
  19. 2
      sdkconfig
  20. 2
      sdkconfig.old

4
Proj.code-workspace

@ -113,7 +113,9 @@
"stdint.h": "c",
"esp_log.h": "c",
"thread": "c",
"lvgl_helpers.h": "c"
"lvgl_helpers.h": "c",
"mqtt_client.h": "c",
"events_init.h": "c"
},
},
}

1
components/esp32-DHT11

@ -0,0 +1 @@
Subproject commit 572cdc341d00a1644cbcd6f8554c31c1234f898b

366
components/myui/guider/ESP32_GUI.guiguider

@ -87,52 +87,93 @@
"type": "tab",
"child": [
{
"name": "img_1",
"id": "k319snlu",
"type": "img",
"left": 84,
"top": 19,
"name": "label_6",
"type": "label",
"left": 161,
"top": 136,
"is_move_animation": false,
"desX": 0,
"desY": 0,
"path_type": "linear",
"duration": 100,
"width": 100,
"height": 100,
"width": 63,
"height": 25,
"default_style": false,
"scrollbar_mode": "OFF",
"img_path": "_m.png",
"rotate": 0,
"x": 0,
"y": 0,
"color_format": "true-color-alpha",
"text": ".",
"long_mode": "LV_LABEL_LONG_WRAP",
"style": [
{
"part": "LV_PART_MAIN",
"state": "LV_STATE_DEFAULT",
"disable": false,
"image_recolor": "#ffffff",
"image_recolor_opa": 0,
"image_opa": 255
"radius": 0,
"text_color": "#242eb2",
"font": 24,
"text_align": "LV_TEXT_ALIGN_CENTER",
"font_family": "digifaw",
"letter_space": 2,
"line_space": 0,
"bg_color": "#2195f6",
"bg_grad_color": "#2195f6",
"bg_opa": 0,
"bg_grad_dir": "LV_GRAD_DIR_NONE",
"padding_top": 0,
"padding_right": 0,
"padding_bottom": 0,
"padding_left": 0,
"shadow_color": "#2195f6",
"shadow_opa": 255,
"shadow_width": 0,
"shadow_spread": 0,
"shadow_ofs_x": 0,
"shadow_ofs_y": 0
},
{
"part": "LV_PART_MAIN",
"state": "LV_STATE_DISABLED",
"disable": true,
"radius": 0,
"text_color": "#000000",
"font": 12,
"font_family": "simsun",
"text_align": "LV_TEXT_ALIGN_CENTER",
"letter_space": 2,
"line_space": 0,
"bg_color": "#2195f6",
"bg_grad_color": "#2195f6",
"bg_opa": 0,
"bg_grad_dir": "LV_GRAD_DIR_NONE",
"padding_top": 0,
"padding_right": 0,
"padding_bottom": 0,
"padding_left": 0,
"shadow_color": "#2195f6",
"shadow_opa": 255,
"shadow_width": 0,
"shadow_spread": 0,
"shadow_ofs_x": 0,
"shadow_ofs_y": 0
}
]
],
"id": "89wp6z2s"
},
{
"name": "label_1",
"id": "o89pxhvs",
"name": "label_5",
"id": "5ne0mffk",
"type": "label",
"left": 64,
"top": 134,
"left": 37,
"top": 138,
"is_move_animation": false,
"desX": 0,
"desY": 0,
"path_type": "linear",
"duration": 100,
"width": 136,
"height": 39,
"width": 117,
"height": 20,
"default_style": false,
"scrollbar_mode": "OFF",
"text": "pomin",
"text": ".",
"long_mode": "LV_LABEL_LONG_WRAP",
"style": [
{
@ -140,7 +181,7 @@
"state": "LV_STATE_DEFAULT",
"disable": false,
"radius": 0,
"text_color": "#000000",
"text_color": "#28aae2",
"font": 20,
"text_align": "LV_TEXT_ALIGN_CENTER",
"font_family": "digifaw",
@ -149,7 +190,7 @@
"bg_color": "#2195f6",
"bg_grad_color": "#2195f6",
"bg_opa": 0,
"bg_grad_dir": "LV_GRAD_DIR_VER",
"bg_grad_dir": "LV_GRAD_DIR_NONE",
"padding_top": 0,
"padding_right": 0,
"padding_bottom": 0,
@ -175,7 +216,7 @@
"bg_color": "#2195f6",
"bg_grad_color": "#2195f6",
"bg_opa": 0,
"bg_grad_dir": "LV_GRAD_DIR_VER",
"bg_grad_dir": "LV_GRAD_DIR_NONE",
"padding_top": 0,
"padding_right": 0,
"padding_bottom": 0,
@ -188,6 +229,37 @@
"shadow_ofs_y": 0
}
]
},
{
"name": "img_1",
"id": "k319snlu",
"type": "img",
"left": 82,
"top": 14,
"is_move_animation": false,
"desX": 0,
"desY": 0,
"path_type": "linear",
"duration": 100,
"width": 100,
"height": 100,
"default_style": false,
"scrollbar_mode": "OFF",
"img_path": "_m.png",
"rotate": 0,
"x": 0,
"y": 0,
"color_format": "true-color-alpha",
"style": [
{
"part": "LV_PART_MAIN",
"state": "LV_STATE_DEFAULT",
"disable": false,
"image_recolor": "#ffffff",
"image_recolor_opa": 0,
"image_opa": 255
}
]
}
],
"title_text": ""
@ -507,6 +579,7 @@
"child": [
{
"name": "cb_2",
"id": "0hkpfc7o",
"type": "cb",
"left": 3,
"top": 31,
@ -657,11 +730,11 @@
"radius": 6,
"bg_opa": 255
}
],
"id": "0hkpfc7o"
]
},
{
"name": "cb_1",
"id": "1h6o3bhy",
"type": "cb",
"left": 3,
"top": 0,
@ -812,8 +885,7 @@
"radius": 6,
"bg_opa": 255
}
],
"id": "1h6o3bhy"
]
}
],
"title_text": ""
@ -1534,6 +1606,54 @@
}
}
]
},
{
"name": "spinner_1",
"type": "spinner",
"left": 75,
"top": 40,
"is_move_animation": false,
"desX": 0,
"desY": 0,
"path_type": "linear",
"duration": 100,
"width": 150,
"height": 150,
"default_style": false,
"scrollbar_mode": "OFF",
"arc_length": 60,
"spin_time": 1000,
"style": [
{
"part": "LV_PART_MAIN",
"state": "LV_STATE_DEFAULT",
"disable": false,
"padding_top": 5,
"padding_bottom": 5,
"padding_left": 5,
"padding_right": 5,
"bg_color": "#eeeef6",
"bg_grad_color": "#eeeef6",
"bg_opa": 3,
"bg_grad_dir": "LV_GRAD_DIR_NONE",
"arc_color": "#d5d6de",
"arc_width": 12,
"shadow_color": "#2195f6",
"shadow_opa": 255,
"shadow_width": 0,
"shadow_spread": 0,
"shadow_ofs_x": 0,
"shadow_ofs_y": 0
},
{
"part": "LV_PART_INDICATOR",
"state": "LV_STATE_DEFAULT",
"disable": false,
"arc_color": "#2195f6",
"arc_width": 12
}
],
"id": "xap8jgjq"
}
],
"style": [
@ -1605,17 +1725,17 @@
"type": "tab",
"child": [
{
"name": "screen_img_1",
"id": "k319snlu",
"type": "img",
"name": "screen_label_6",
"id": "89wp6z2s",
"type": "label",
"scrollbar_mode": "OFF",
"pos": [
84,
19
161,
136
],
"size": [
100,
100
63,
25
],
"is_move_animation": false,
"path_type": "linear",
@ -1627,33 +1747,75 @@
"duration": 100
},
"default_style": false,
"img_path": "F:\\MyEnv\\esp_code\\esp32-s2-kaluga-1\\components\\myui\\guider\\import\\_m.png",
"color_format": "true-color-alpha",
"rotate": 0,
"pivot": "0,0",
"text": ".",
"long_mode": "LV_LABEL_LONG_WRAP",
"style": [
{
"part": "LV_PART_MAIN",
"state": "LV_STATE_DEFAULT",
"disable": false,
"image_recolor": "#ffffff",
"image_recolor_opa": 0,
"image_opa": 255
"radius": 0,
"text_color": "#242eb2",
"font": 24,
"text_align": "LV_TEXT_ALIGN_CENTER",
"font_family": "digifaw",
"letter_space": 2,
"line_space": 0,
"bg_color": "#2195f6",
"bg_grad_color": "#2195f6",
"bg_opa": 0,
"bg_grad_dir": "LV_GRAD_DIR_NONE",
"padding_top": 0,
"padding_right": 0,
"padding_bottom": 0,
"padding_left": 0,
"shadow_color": "#2195f6",
"shadow_opa": 255,
"shadow_width": 0,
"shadow_spread": 0,
"shadow_ofs_x": 0,
"shadow_ofs_y": 0
},
{
"part": "LV_PART_MAIN",
"state": "LV_STATE_DISABLED",
"disable": true,
"radius": 0,
"text_color": "#000000",
"font": 12,
"font_family": "simsun",
"text_align": "LV_TEXT_ALIGN_CENTER",
"letter_space": 2,
"line_space": 0,
"bg_color": "#2195f6",
"bg_grad_color": "#2195f6",
"bg_opa": 0,
"bg_grad_dir": "LV_GRAD_DIR_NONE",
"padding_top": 0,
"padding_right": 0,
"padding_bottom": 0,
"padding_left": 0,
"shadow_color": "#2195f6",
"shadow_opa": 255,
"shadow_width": 0,
"shadow_spread": 0,
"shadow_ofs_x": 0,
"shadow_ofs_y": 0
}
]
},
{
"name": "screen_label_1",
"id": "o89pxhvs",
"name": "screen_label_5",
"id": "5ne0mffk",
"type": "label",
"scrollbar_mode": "OFF",
"pos": [
64,
134
37,
138
],
"size": [
136,
39
117,
20
],
"is_move_animation": false,
"path_type": "linear",
@ -1665,7 +1827,7 @@
"duration": 100
},
"default_style": false,
"text": "pomin",
"text": ".",
"long_mode": "LV_LABEL_LONG_WRAP",
"style": [
{
@ -1673,7 +1835,7 @@
"state": "LV_STATE_DEFAULT",
"disable": false,
"radius": 0,
"text_color": "#000000",
"text_color": "#28aae2",
"font": 20,
"text_align": "LV_TEXT_ALIGN_CENTER",
"font_family": "digifaw",
@ -1682,7 +1844,7 @@
"bg_color": "#2195f6",
"bg_grad_color": "#2195f6",
"bg_opa": 0,
"bg_grad_dir": "LV_GRAD_DIR_VER",
"bg_grad_dir": "LV_GRAD_DIR_NONE",
"padding_top": 0,
"padding_right": 0,
"padding_bottom": 0,
@ -1708,7 +1870,7 @@
"bg_color": "#2195f6",
"bg_grad_color": "#2195f6",
"bg_opa": 0,
"bg_grad_dir": "LV_GRAD_DIR_VER",
"bg_grad_dir": "LV_GRAD_DIR_NONE",
"padding_top": 0,
"padding_right": 0,
"padding_bottom": 0,
@ -1721,6 +1883,44 @@
"shadow_ofs_y": 0
}
]
},
{
"name": "screen_img_1",
"id": "k319snlu",
"type": "img",
"scrollbar_mode": "OFF",
"pos": [
82,
14
],
"size": [
100,
100
],
"is_move_animation": false,
"path_type": "linear",
"move_animation": {
"des_pos": [
0,
0
],
"duration": 100
},
"default_style": false,
"img_path": "F:\\MyEnv\\esp_code\\esp32-s2-kaluga-1\\components\\myui\\guider\\import\\_m.png",
"color_format": "true-color-alpha",
"rotate": 0,
"pivot": "0,0",
"style": [
{
"part": "LV_PART_MAIN",
"state": "LV_STATE_DEFAULT",
"disable": false,
"image_recolor": "#ffffff",
"image_recolor_opa": 0,
"image_opa": 255
}
]
}
],
"title_text": "",
@ -2794,6 +2994,64 @@
],
"text": "",
"toggle": true
},
{
"name": "screen_spinner_1",
"id": "xap8jgjq",
"type": "spinner",
"scrollbar_mode": "OFF",
"pos": [
75,
40
],
"size": [
150,
150
],
"is_move_animation": false,
"path_type": "linear",
"move_animation": {
"des_pos": [
0,
0
],
"duration": 100
},
"default_style": false,
"width": 150,
"height": 150,
"arc_length": 60,
"spin_time": 1000,
"style": [
{
"part": "LV_PART_MAIN",
"state": "LV_STATE_DEFAULT",
"disable": false,
"padding_top": 5,
"padding_bottom": 5,
"padding_left": 5,
"padding_right": 5,
"bg_color": "#eeeef6",
"bg_grad_color": "#eeeef6",
"bg_opa": 3,
"bg_grad_dir": "LV_GRAD_DIR_NONE",
"arc_color": "#d5d6de",
"arc_width": 12,
"shadow_color": "#2195f6",
"shadow_opa": 255,
"shadow_width": 0,
"shadow_spread": 0,
"shadow_ofs_x": 0,
"shadow_ofs_y": 0
},
{
"part": "LV_PART_INDICATOR",
"state": "LV_STATE_DEFAULT",
"disable": false,
"arc_color": "#2195f6",
"arc_width": 12
}
]
}
]
}

4
components/myui/guider/generated/gui_guider.h

@ -19,8 +19,9 @@ typedef struct
bool screen_del;
lv_obj_t *screen_tabview_1;
lv_obj_t *screen_tabview_1_Home;
lv_obj_t *screen_label_6;
lv_obj_t *screen_label_5;
lv_obj_t *screen_img_1;
lv_obj_t *screen_label_1;
lv_obj_t *screen_tabview_1_Sensor;
lv_obj_t *screen_bar_2;
lv_obj_t *screen_bar_1;
@ -34,6 +35,7 @@ typedef struct
lv_obj_t *screen_btnm_1;
lv_obj_t *screen_btn_1;
lv_obj_t *screen_btn_1_label;
lv_obj_t *screen_spinner_1;
}lv_ui;
void init_scr_del_flag(lv_ui *ui);

131
components/myui/guider/generated/gui_guider.py

@ -205,8 +205,74 @@ except AttributeError:
screen_tabview_1_tab_btns.add_style(style_screen_tabview_1_extra_btnm_items_checked, lv.PART.ITEMS|lv.STATE.CHECKED)
screen_tabview_1_Home = screen_tabview_1.add_tab("Home")
screen_label_6 = lv.label(screen_tabview_1_Home)
screen_label_6.set_pos(int(161),int(136))
screen_label_6.set_size(63,25)
screen_label_6.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
screen_label_6.set_text(".")
screen_label_6.set_long_mode(lv.label.LONG.WRAP)
# create style style_screen_label_6_main_main_default
style_screen_label_6_main_main_default = lv.style_t()
style_screen_label_6_main_main_default.init()
style_screen_label_6_main_main_default.set_radius(0)
style_screen_label_6_main_main_default.set_bg_color(lv.color_make(0x21,0x95,0xf6))
style_screen_label_6_main_main_default.set_bg_grad_color(lv.color_make(0x21,0x95,0xf6))
style_screen_label_6_main_main_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
style_screen_label_6_main_main_default.set_bg_opa(0)
style_screen_label_6_main_main_default.set_text_color(lv.color_make(0x24,0x2e,0xb2))
try:
style_screen_label_6_main_main_default.set_text_font(lv.font_digifaw_24)
except AttributeError:
try:
style_screen_label_6_main_main_default.set_text_font(lv.font_montserrat_24)
except AttributeError:
style_screen_label_6_main_main_default.set_text_font(lv.font_montserrat_16)
style_screen_label_6_main_main_default.set_text_letter_space(2)
style_screen_label_6_main_main_default.set_text_line_space(0)
style_screen_label_6_main_main_default.set_text_align(lv.TEXT_ALIGN.CENTER)
style_screen_label_6_main_main_default.set_pad_left(0)
style_screen_label_6_main_main_default.set_pad_right(0)
style_screen_label_6_main_main_default.set_pad_top(0)
style_screen_label_6_main_main_default.set_pad_bottom(0)
# add style for screen_label_6
screen_label_6.add_style(style_screen_label_6_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_label_5 = lv.label(screen_tabview_1_Home)
screen_label_5.set_pos(int(37),int(138))
screen_label_5.set_size(117,20)
screen_label_5.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
screen_label_5.set_text(".")
screen_label_5.set_long_mode(lv.label.LONG.WRAP)
# create style style_screen_label_5_main_main_default
style_screen_label_5_main_main_default = lv.style_t()
style_screen_label_5_main_main_default.init()
style_screen_label_5_main_main_default.set_radius(0)
style_screen_label_5_main_main_default.set_bg_color(lv.color_make(0x21,0x95,0xf6))
style_screen_label_5_main_main_default.set_bg_grad_color(lv.color_make(0x21,0x95,0xf6))
style_screen_label_5_main_main_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
style_screen_label_5_main_main_default.set_bg_opa(0)
style_screen_label_5_main_main_default.set_text_color(lv.color_make(0x28,0xaa,0xe2))
try:
style_screen_label_5_main_main_default.set_text_font(lv.font_digifaw_20)
except AttributeError:
try:
style_screen_label_5_main_main_default.set_text_font(lv.font_montserrat_20)
except AttributeError:
style_screen_label_5_main_main_default.set_text_font(lv.font_montserrat_16)
style_screen_label_5_main_main_default.set_text_letter_space(2)
style_screen_label_5_main_main_default.set_text_line_space(0)
style_screen_label_5_main_main_default.set_text_align(lv.TEXT_ALIGN.CENTER)
style_screen_label_5_main_main_default.set_pad_left(0)
style_screen_label_5_main_main_default.set_pad_right(0)
style_screen_label_5_main_main_default.set_pad_top(0)
style_screen_label_5_main_main_default.set_pad_bottom(0)
# add style for screen_label_5
screen_label_5.add_style(style_screen_label_5_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_img_1 = lv.img(screen_tabview_1_Home)
screen_img_1.set_pos(int(84),int(19))
screen_img_1.set_pos(int(82),int(14))
screen_img_1.set_size(100,100)
screen_img_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
screen_img_1.add_flag(lv.obj.FLAG.CLICKABLE)
@ -236,39 +302,6 @@ style_screen_img_1_main_main_default.set_img_opa(255)
# add style for screen_img_1
screen_img_1.add_style(style_screen_img_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_label_1 = lv.label(screen_tabview_1_Home)
screen_label_1.set_pos(int(64),int(134))
screen_label_1.set_size(136,39)
screen_label_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
screen_label_1.set_text("pomin")
screen_label_1.set_long_mode(lv.label.LONG.WRAP)
# create style style_screen_label_1_main_main_default
style_screen_label_1_main_main_default = lv.style_t()
style_screen_label_1_main_main_default.init()
style_screen_label_1_main_main_default.set_radius(0)
style_screen_label_1_main_main_default.set_bg_color(lv.color_make(0x21,0x95,0xf6))
style_screen_label_1_main_main_default.set_bg_grad_color(lv.color_make(0x21,0x95,0xf6))
style_screen_label_1_main_main_default.set_bg_grad_dir(lv.GRAD_DIR.VER)
style_screen_label_1_main_main_default.set_bg_opa(0)
style_screen_label_1_main_main_default.set_text_color(lv.color_make(0x00,0x00,0x00))
try:
style_screen_label_1_main_main_default.set_text_font(lv.font_digifaw_20)
except AttributeError:
try:
style_screen_label_1_main_main_default.set_text_font(lv.font_montserrat_20)
except AttributeError:
style_screen_label_1_main_main_default.set_text_font(lv.font_montserrat_16)
style_screen_label_1_main_main_default.set_text_letter_space(2)
style_screen_label_1_main_main_default.set_text_line_space(0)
style_screen_label_1_main_main_default.set_text_align(lv.TEXT_ALIGN.CENTER)
style_screen_label_1_main_main_default.set_pad_left(0)
style_screen_label_1_main_main_default.set_pad_right(0)
style_screen_label_1_main_main_default.set_pad_top(0)
style_screen_label_1_main_main_default.set_pad_bottom(0)
# add style for screen_label_1
screen_label_1.add_style(style_screen_label_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_tabview_1_Sensor = screen_tabview_1.add_tab("Sensor")
screen_bar_2 = lv.bar(screen_tabview_1_Sensor)
screen_bar_2.set_pos(int(80),int(100))
@ -699,6 +732,36 @@ style_screen_btn_1_main_main_default.set_text_align(lv.TEXT_ALIGN.CENTER)
# add style for screen_btn_1
screen_btn_1.add_style(style_screen_btn_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_spinner_1 = lv.spinner(screen, 1000, 60)
screen_spinner_1.set_pos(int(75),int(40))
screen_spinner_1.set_size(150,150)
screen_spinner_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# create style style_screen_spinner_1_main_main_default
style_screen_spinner_1_main_main_default = lv.style_t()
style_screen_spinner_1_main_main_default.init()
style_screen_spinner_1_main_main_default.set_bg_color(lv.color_make(0xee,0xee,0xf6))
style_screen_spinner_1_main_main_default.set_bg_grad_color(lv.color_make(0xee,0xee,0xf6))
style_screen_spinner_1_main_main_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
style_screen_spinner_1_main_main_default.set_bg_opa(3)
style_screen_spinner_1_main_main_default.set_pad_left(5)
style_screen_spinner_1_main_main_default.set_pad_right(5)
style_screen_spinner_1_main_main_default.set_pad_top(5)
style_screen_spinner_1_main_main_default.set_pad_bottom(5)
style_screen_spinner_1_main_main_default.set_arc_color(lv.color_make(0xd5,0xd6,0xde))
style_screen_spinner_1_main_main_default.set_arc_width(12)
# add style for screen_spinner_1
screen_spinner_1.add_style(style_screen_spinner_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
# create style style_screen_spinner_1_main_indicator_default
style_screen_spinner_1_main_indicator_default = lv.style_t()
style_screen_spinner_1_main_indicator_default.init()
style_screen_spinner_1_main_indicator_default.set_arc_color(lv.color_make(0x21,0x95,0xf6))
style_screen_spinner_1_main_indicator_default.set_arc_width(12)
# add style for screen_spinner_1
screen_spinner_1.add_style(style_screen_spinner_1_main_indicator_default, lv.PART.INDICATOR|lv.STATE.DEFAULT)
def screen_btnm_1_clicked_1_event_cb(e,screen_btn_1):

3
components/myui/guider/generated/guider_fonts/guider_fonts.h

@ -7,8 +7,9 @@
#include "lv_font.h"
LV_FONT_DECLARE(lv_font_digifaw_20)
LV_FONT_DECLARE(lv_font_digifaw_24)
LV_FONT_DECLARE(lv_font_simsun_12)
LV_FONT_DECLARE(lv_font_digifaw_20)
LV_FONT_DECLARE(lv_font_digifaw_12)
LV_FONT_DECLARE(lv_font_arial_12)

3732
components/myui/guider/generated/guider_fonts/lv_font_digifaw_24.c

File diff suppressed because it is too large

125
components/myui/guider/generated/setup_scr_screen.c

@ -114,9 +114,69 @@ void setup_scr_screen(lv_ui *ui){
//Update pos for widget screen_tabview_1
lv_obj_update_layout(ui->screen_tabview_1);
//Write codes screen_label_6
ui->screen_label_6 = lv_label_create(ui->screen_tabview_1_Home);
lv_obj_set_pos(ui->screen_label_6, 161, 136);
lv_obj_set_size(ui->screen_label_6, 63, 25);
lv_obj_set_scrollbar_mode(ui->screen_label_6, LV_SCROLLBAR_MODE_OFF);
lv_label_set_text(ui->screen_label_6, ".");
lv_label_set_long_mode(ui->screen_label_6, LV_LABEL_LONG_WRAP);
//Write style state: LV_STATE_DEFAULT for style_screen_label_6_main_main_default
static lv_style_t style_screen_label_6_main_main_default;
if (style_screen_label_6_main_main_default.prop_cnt > 1)
lv_style_reset(&style_screen_label_6_main_main_default);
else
lv_style_init(&style_screen_label_6_main_main_default);
lv_style_set_radius(&style_screen_label_6_main_main_default, 0);
lv_style_set_bg_color(&style_screen_label_6_main_main_default, lv_color_make(0x21, 0x95, 0xf6));
lv_style_set_bg_grad_color(&style_screen_label_6_main_main_default, lv_color_make(0x21, 0x95, 0xf6));
lv_style_set_bg_grad_dir(&style_screen_label_6_main_main_default, LV_GRAD_DIR_NONE);
lv_style_set_bg_opa(&style_screen_label_6_main_main_default, 0);
lv_style_set_text_color(&style_screen_label_6_main_main_default, lv_color_make(0x24, 0x2e, 0xb2));
lv_style_set_text_font(&style_screen_label_6_main_main_default, &lv_font_digifaw_24);
lv_style_set_text_letter_space(&style_screen_label_6_main_main_default, 2);
lv_style_set_text_line_space(&style_screen_label_6_main_main_default, 0);
lv_style_set_text_align(&style_screen_label_6_main_main_default, LV_TEXT_ALIGN_CENTER);
lv_style_set_pad_left(&style_screen_label_6_main_main_default, 0);
lv_style_set_pad_right(&style_screen_label_6_main_main_default, 0);
lv_style_set_pad_top(&style_screen_label_6_main_main_default, 0);
lv_style_set_pad_bottom(&style_screen_label_6_main_main_default, 0);
lv_obj_add_style(ui->screen_label_6, &style_screen_label_6_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_label_5
ui->screen_label_5 = lv_label_create(ui->screen_tabview_1_Home);
lv_obj_set_pos(ui->screen_label_5, 37, 138);
lv_obj_set_size(ui->screen_label_5, 117, 20);
lv_obj_set_scrollbar_mode(ui->screen_label_5, LV_SCROLLBAR_MODE_OFF);
lv_label_set_text(ui->screen_label_5, ".");
lv_label_set_long_mode(ui->screen_label_5, LV_LABEL_LONG_WRAP);
//Write style state: LV_STATE_DEFAULT for style_screen_label_5_main_main_default
static lv_style_t style_screen_label_5_main_main_default;
if (style_screen_label_5_main_main_default.prop_cnt > 1)
lv_style_reset(&style_screen_label_5_main_main_default);
else
lv_style_init(&style_screen_label_5_main_main_default);
lv_style_set_radius(&style_screen_label_5_main_main_default, 0);
lv_style_set_bg_color(&style_screen_label_5_main_main_default, lv_color_make(0x21, 0x95, 0xf6));
lv_style_set_bg_grad_color(&style_screen_label_5_main_main_default, lv_color_make(0x21, 0x95, 0xf6));
lv_style_set_bg_grad_dir(&style_screen_label_5_main_main_default, LV_GRAD_DIR_NONE);
lv_style_set_bg_opa(&style_screen_label_5_main_main_default, 0);
lv_style_set_text_color(&style_screen_label_5_main_main_default, lv_color_make(0x28, 0xaa, 0xe2));
lv_style_set_text_font(&style_screen_label_5_main_main_default, &lv_font_digifaw_20);
lv_style_set_text_letter_space(&style_screen_label_5_main_main_default, 2);
lv_style_set_text_line_space(&style_screen_label_5_main_main_default, 0);
lv_style_set_text_align(&style_screen_label_5_main_main_default, LV_TEXT_ALIGN_CENTER);
lv_style_set_pad_left(&style_screen_label_5_main_main_default, 0);
lv_style_set_pad_right(&style_screen_label_5_main_main_default, 0);
lv_style_set_pad_top(&style_screen_label_5_main_main_default, 0);
lv_style_set_pad_bottom(&style_screen_label_5_main_main_default, 0);
lv_obj_add_style(ui->screen_label_5, &style_screen_label_5_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_img_1
ui->screen_img_1 = lv_img_create(ui->screen_tabview_1_Home);
lv_obj_set_pos(ui->screen_img_1, 84, 19);
lv_obj_set_pos(ui->screen_img_1, 82, 14);
lv_obj_set_size(ui->screen_img_1, 100, 100);
lv_obj_set_scrollbar_mode(ui->screen_img_1, LV_SCROLLBAR_MODE_OFF);
@ -135,36 +195,6 @@ void setup_scr_screen(lv_ui *ui){
lv_img_set_pivot(ui->screen_img_1, 0,0);
lv_img_set_angle(ui->screen_img_1, 0);
//Write codes screen_label_1
ui->screen_label_1 = lv_label_create(ui->screen_tabview_1_Home);
lv_obj_set_pos(ui->screen_label_1, 64, 134);
lv_obj_set_size(ui->screen_label_1, 136, 39);
lv_obj_set_scrollbar_mode(ui->screen_label_1, LV_SCROLLBAR_MODE_OFF);
lv_label_set_text(ui->screen_label_1, "pomin");
lv_label_set_long_mode(ui->screen_label_1, LV_LABEL_LONG_WRAP);
//Write style state: LV_STATE_DEFAULT for style_screen_label_1_main_main_default
static lv_style_t style_screen_label_1_main_main_default;
if (style_screen_label_1_main_main_default.prop_cnt > 1)
lv_style_reset(&style_screen_label_1_main_main_default);
else
lv_style_init(&style_screen_label_1_main_main_default);
lv_style_set_radius(&style_screen_label_1_main_main_default, 0);
lv_style_set_bg_color(&style_screen_label_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6));
lv_style_set_bg_grad_color(&style_screen_label_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6));
lv_style_set_bg_grad_dir(&style_screen_label_1_main_main_default, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_1_main_main_default, 0);
lv_style_set_text_color(&style_screen_label_1_main_main_default, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_1_main_main_default, &lv_font_digifaw_20);
lv_style_set_text_letter_space(&style_screen_label_1_main_main_default, 2);
lv_style_set_text_line_space(&style_screen_label_1_main_main_default, 0);
lv_style_set_text_align(&style_screen_label_1_main_main_default, LV_TEXT_ALIGN_CENTER);
lv_style_set_pad_left(&style_screen_label_1_main_main_default, 0);
lv_style_set_pad_right(&style_screen_label_1_main_main_default, 0);
lv_style_set_pad_top(&style_screen_label_1_main_main_default, 0);
lv_style_set_pad_bottom(&style_screen_label_1_main_main_default, 0);
lv_obj_add_style(ui->screen_label_1, &style_screen_label_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_bar_2
ui->screen_bar_2 = lv_bar_create(ui->screen_tabview_1_Sensor);
lv_obj_set_pos(ui->screen_bar_2, 80, 100);
@ -507,6 +537,39 @@ void setup_scr_screen(lv_ui *ui){
lv_obj_set_style_pad_all(ui->screen_btn_1, 0, LV_STATE_DEFAULT);
lv_obj_align(ui->screen_btn_1_label, LV_ALIGN_CENTER, 0, 0);
//Write codes screen_spinner_1
ui->screen_spinner_1 = lv_spinner_create(ui->screen, 1000, 60);
lv_obj_set_pos(ui->screen_spinner_1, 70, 35);
lv_obj_set_size(ui->screen_spinner_1, 150, 150);
//Write style state: LV_STATE_DEFAULT for style_screen_spinner_1_main_main_default
static lv_style_t style_screen_spinner_1_main_main_default;
if (style_screen_spinner_1_main_main_default.prop_cnt > 1)
lv_style_reset(&style_screen_spinner_1_main_main_default);
else
lv_style_init(&style_screen_spinner_1_main_main_default);
lv_style_set_bg_color(&style_screen_spinner_1_main_main_default, lv_color_make(0xee, 0xee, 0xf6));
lv_style_set_bg_grad_color(&style_screen_spinner_1_main_main_default, lv_color_make(0xee, 0xee, 0xf6));
lv_style_set_bg_grad_dir(&style_screen_spinner_1_main_main_default, LV_GRAD_DIR_NONE);
lv_style_set_bg_opa(&style_screen_spinner_1_main_main_default, 3);
lv_style_set_pad_left(&style_screen_spinner_1_main_main_default, 5);
lv_style_set_pad_right(&style_screen_spinner_1_main_main_default, 5);
lv_style_set_pad_top(&style_screen_spinner_1_main_main_default, 5);
lv_style_set_pad_bottom(&style_screen_spinner_1_main_main_default, 5);
lv_style_set_arc_color(&style_screen_spinner_1_main_main_default, lv_color_make(0xd5, 0xd6, 0xde));
lv_style_set_arc_width(&style_screen_spinner_1_main_main_default, 12);
lv_obj_add_style(ui->screen_spinner_1, &style_screen_spinner_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write style state: LV_STATE_DEFAULT for style_screen_spinner_1_main_indicator_default
static lv_style_t style_screen_spinner_1_main_indicator_default;
if (style_screen_spinner_1_main_indicator_default.prop_cnt > 1)
lv_style_reset(&style_screen_spinner_1_main_indicator_default);
else
lv_style_init(&style_screen_spinner_1_main_indicator_default);
lv_style_set_arc_color(&style_screen_spinner_1_main_indicator_default, lv_color_make(0x21, 0x95, 0xf6));
lv_style_set_arc_width(&style_screen_spinner_1_main_indicator_default, 12);
lv_obj_add_style(ui->screen_spinner_1, &style_screen_spinner_1_main_indicator_default, LV_PART_INDICATOR|LV_STATE_DEFAULT);
//Init events for screen
events_init_screen(ui);
}

4
components/myui/guider/sdk/Core/source/lv_conf.h

@ -215,7 +215,7 @@ typedef void * lv_font_user_data_t;
#define LV_USE_OBJ_REALIGN 1
#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY
#define LV_USE_ARC 0
#define LV_USE_ARC 1
#define LV_USE_BAR 1
#define LV_USE_BTN 1
#define LV_USE_BTNMATRIX 1
@ -282,7 +282,7 @@ typedef void * lv_font_user_data_t;
#define LV_SPAN_SNIPPET_STACK_SIZE 64
#endif /* LV_USE_SPAN */
#define LV_USE_SPINNER 0
#define LV_USE_SPINNER 1
#if LV_USE_SPINNER != 0
#define LV_SPINNER_DEF_ARC_LENGTH 60

1
main/CMakeLists.txt

@ -1,4 +1,5 @@
file(GLOB_RECURSE SOURCES ./*.c ./*.cpp ./init/*.c ./init/*.cpp)
set(COMPONENT_SRCS ${SOURCES})
set(COMPONENT_EMBED_TXTFILES server_root_cert.pem)
register_component()

10
main/init/app_init.h

@ -2,7 +2,7 @@
* @author: Pomin
* @date: 2022-08-27 22:34:01
* @github: https://github.com/POMIN-163
* @lastedit: 2022-10-15 15:11:09
* @lastedit: 2022-10-20 22:43:10
* @description:
**/
#ifndef _APP_INIT_H
@ -31,6 +31,14 @@ void btns_init(void);
void fd_register(void);
void fd_init(void);
void mqtt_init(void);
void ntp_init(void);
void https_init(void);
struct app_status
{
uint8_t led_running;
} apps_status;
#ifdef __cplusplus
}

4
main/init/btns_init.c

@ -2,7 +2,7 @@
* @author: Pomin
* @date: 2022-08-27 22:33:46
* @github: https://github.com/POMIN-163
* @lastedit: 2022-10-15 16:09:10
* @lastedit: 2022-10-16 14:33:14
* @description: ADC
**/
#include "app_init.h"
@ -12,7 +12,7 @@
#include "lvgl_helpers.h"
#define NO_OF_SAMPLES 64
#define SAMPLE_TIME 200
#define SAMPLE_TIME 150
static const adc_channel_t channel = ADC_CHANNEL_5;
static const adc_bits_width_t width = ADC_WIDTH_BIT_13;

164
main/init/https_init.c

@ -0,0 +1,164 @@
/**
* @author: Pomin
* @date: 2022-10-20 00:41:56
* @github: https://github.com/POMIN-163
* @lastedit: 2022-10-20 01:01:28
* @description:
**/
#include "app_init.h"
#include "esp_tls.h"
#include "esp_crt_bundle.h"
#define CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS
/* Constants that aren't configurable in menuconfig */
#define WEB_SERVER "devapi.qweather.com"
#define WEB_URL "https://devapi.qweather.com/v7/weather/now?location=101200101&key=4eca11d06d914d56bf41c202b14c7d3e"
static const char *TAG = "example";
static const char REQUEST[] = "GET " WEB_URL " HTTP/1.1\r\n"
"Host: "WEB_SERVER"\r\n"
"User-Agent: esp-idf/1.0 esp32\r\n"
"\r\n";
extern const uint8_t server_root_cert_pem_start[] asm("_binary_server_root_cert_pem_start");
extern const uint8_t server_root_cert_pem_end[] asm("_binary_server_root_cert_pem_end");
#ifdef CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS
esp_tls_client_session_t *tls_client_session = NULL;
#endif
static void https_get_request(esp_tls_cfg_t cfg)
{
char buf[512];
int ret, len;
struct esp_tls *tls = esp_tls_conn_http_new(WEB_URL, &cfg);
if (tls != NULL) {
ESP_LOGI(TAG, "Connection established...");
} else {
ESP_LOGE(TAG, "Connection failed...");
goto exit;
}
#ifdef CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS
/* The TLS session is successfully established, now saving the session ctx for reuse */
if (tls_client_session == NULL) {
tls_client_session = esp_tls_get_client_session(tls);
}
#endif
size_t written_bytes = 0;
do {
ret = esp_tls_conn_write(tls,
REQUEST + written_bytes,
sizeof(REQUEST) - written_bytes);
if (ret >= 0) {
ESP_LOGI(TAG, "%d bytes written", ret);
written_bytes += ret;
} else if (ret != ESP_TLS_ERR_SSL_WANT_READ && ret != ESP_TLS_ERR_SSL_WANT_WRITE) {
ESP_LOGE(TAG, "esp_tls_conn_write returned: [0x%02X](%s)", ret, esp_err_to_name(ret));
goto exit;
}
} while (written_bytes < sizeof(REQUEST));
ESP_LOGI(TAG, "Reading HTTP response...");
do {
len = sizeof(buf) - 1;
bzero(buf, sizeof(buf));
ret = esp_tls_conn_read(tls, (char *)buf, len);
if (ret == ESP_TLS_ERR_SSL_WANT_WRITE || ret == ESP_TLS_ERR_SSL_WANT_READ) {
continue;
}
if (ret < 0) {
ESP_LOGE(TAG, "esp_tls_conn_read returned [-0x%02X](%s)", -ret, esp_err_to_name(ret));
break;
}
if (ret == 0) {
ESP_LOGI(TAG, "connection closed");
break;
}
len = ret;
ESP_LOGD(TAG, "%d bytes read", len);
/* Print response directly to stdout as it is read */
for (int i = 0; i < len; i++) {
putchar(buf[i]);
}
putchar('\n'); // JSON output doesn't have a newline at end
} while (1);
exit:
esp_tls_conn_delete(tls);
for (int countdown = 10; countdown >= 0; countdown--) {
ESP_LOGI(TAG, "%d...", countdown);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
static void https_get_request_using_crt_bundle(void)
{
ESP_LOGI(TAG, "https_request using crt bundle");
esp_tls_cfg_t cfg = {
.crt_bundle_attach = esp_crt_bundle_attach,
};
https_get_request(cfg);
}
static void https_get_request_using_cacert_buf(void)
{
ESP_LOGI(TAG, "https_request using cacert_buf");
esp_tls_cfg_t cfg = {
.cacert_buf = (const unsigned char *) server_root_cert_pem_start,
.cacert_bytes = server_root_cert_pem_end - server_root_cert_pem_start,
};
https_get_request(cfg);
}
static void https_get_request_using_global_ca_store(void)
{
esp_err_t esp_ret = ESP_FAIL;
ESP_LOGI(TAG, "https_request using global ca_store");
esp_ret = esp_tls_set_global_ca_store(server_root_cert_pem_start, server_root_cert_pem_end - server_root_cert_pem_start);
if (esp_ret != ESP_OK) {
ESP_LOGE(TAG, "Error in setting the global ca store: [%02X] (%s),could not complete the https_request using global_ca_store", esp_ret, esp_err_to_name(esp_ret));
return;
}
esp_tls_cfg_t cfg = {
.use_global_ca_store = true,
};
https_get_request(cfg);
esp_tls_free_global_ca_store();
}
#ifdef CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS
static void https_get_request_using_already_saved_session(void)
{
ESP_LOGI(TAG, "https_request using saved client session");
esp_tls_cfg_t cfg = {
.client_session = tls_client_session,
};
https_get_request(cfg);
free(tls_client_session);
tls_client_session = NULL;
}
#endif
void https_init(void)
{
ESP_LOGI(TAG, "Start https_request example");
https_get_request_using_crt_bundle();
https_get_request_using_cacert_buf();
https_get_request_using_global_ca_store();
#ifdef CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS
https_get_request_using_already_saved_session();
#endif
ESP_LOGI(TAG, "Finish https_request example");
}

14
main/init/led_init.c

@ -2,7 +2,7 @@
* @author: Pomin
* @date: 2022-08-27 22:33:39
* @github: https://github.com/POMIN-163
* @lastedit: 2022-10-15 20:32:14
* @lastedit: 2022-10-20 22:44:06
* @description: led
**/
#include "app_init.h"
@ -139,8 +139,14 @@ static void led_task(void *arg) {
while (1) {
vTaskDelay(10);
rgb = rgb_brilliant();
strip->set_pixel(strip, 0, rgb->r, rgb->g, rgb->b);
strip->refresh(strip, 0);
for (size_t i = 0; i < 19; i++) {
if (apps_status.led_running) {
strip->set_pixel(strip, i, rgb->r, rgb->g, rgb->b);
} else {
strip->set_pixel(strip, i, 0, 0, 0);
}
strip->refresh(strip, 0);
}
}
vTaskDelete(NULL);
}
@ -150,7 +156,7 @@ static void led_task(void *arg) {
*
**/
void led_init(void) {
rmt_init(CONFIG_RMT_TX_GPIO, CONFIG_STRIP_LED_NUMBER, RMT_CHANNEL_0);
rmt_init(CONFIG_RMT_TX_GPIO, /* CONFIG_STRIP_LED_NUMBER */ 19, RMT_CHANNEL_0);
BaseType_t res = xTaskCreatePinnedToCore(&led_task, "led_task", 1 * 1024, NULL, 5, NULL, 0);
if (res == pdPASS) {
ESP_LOGI(TAG, "successed init.");

26
main/init/mqtt_init.c

@ -2,7 +2,7 @@
* @author: Pomin
* @date: 2022-10-15 08:51:11
* @github: https://github.com/POMIN-163
* @lastedit: 2022-10-16 13:07:59
* @lastedit: 2022-10-20 22:45:16
* @description:
**/
#include "app_init.h"
@ -10,6 +10,7 @@
#include "esp_wifi.h"
#include "esp_event.h"
#include "freertos/event_groups.h"
#include "cJSON.h"
#include "lwip/dns.h"
#include "lwip/netdb.h"
@ -78,6 +79,17 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
ESP_LOGI(TAG, "MQTT_EVENT_DATA");
printf("TOPIC=%.*s\r\n", event->topic_len, event->topic);
printf("DATA=%.*s\r\n", event->data_len, event->data);
cJSON *root = cJSON_Parse(event->data);
cJSON *led = cJSON_GetObjectItem(root, "led");
if (led) {
if (strcmp("on", cJSON_GetStringValue(led)) == 0) {
ESP_LOGI(" ", "on");
apps_status.led_running = 1;
} else if (strcmp("off", cJSON_GetStringValue(led)) == 0) {
ESP_LOGI(" ", "off");
apps_status.led_running = 0;
}
}
// esp_mqtt_client_publish(client, "/pomin/mqtt", "rec !!", 0, 0, 0);
break;
case MQTT_EVENT_ERROR:
@ -136,14 +148,14 @@ static void wifi_init(void) {
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
wifi_config_t wifi_config = {
.sta =
{
.ssid = "landianb62",
.password = "landianb62",
},
// {
// .ssid = "CMCC-WEB",
// .password = "88888888",
// .ssid = "landianb62",
// .password = "landianb62",
// },
{
.ssid = "CMCC-WEB",
.password = "88888888",
},
// {
// .ssid = CONFIG_ESP_WIFI_SSID,
// .password = CONFIG_ESP_WIFI_PASSWORD,

73
main/init/ntp_init.c

@ -0,0 +1,73 @@
/**
* @author: Pomin
* @date: 2022-10-20 00:24:34
* @github: https://github.com/POMIN-163
* @lastedit: 2022-10-20 00:52:15
* @description:
**/
#include "app_init.h"
#include "esp_sntp.h"
static const char *TAG = "ntp";
static void obtain_time(void);
static void initialize_sntp(void);
void time_sync_notification_cb(struct timeval *tv)
{
ESP_LOGI(TAG, "Notification of a time synchronization event");
}
/**
* @brief ntp
*
**/
void ntp_init(void) {
time_t now;
struct tm timeinfo;
time(&now);
localtime_r(&now, &timeinfo);
// Is time set? If not, tm_year will be (1970 - 1900).
if (timeinfo.tm_year < (2016 - 1900)) {
ESP_LOGI(TAG, "Time is not set yet. Connecting to WiFi and getting time over NTP.");
obtain_time();
// update 'now' variable with current time
time(&now);
}
// Set timezone to China Standard Time
setenv("TZ", "CST-8", 1);
tzset();
}
static void obtain_time(void)
{
#ifdef LWIP_DHCP_GET_NTP_SRV
sntp_servermode_dhcp(1);
#endif
initialize_sntp();
// wait for time to be set
time_t now = 0;
struct tm timeinfo = { 0 };
int retry = 0;
const int retry_count = 10;
while (sntp_get_sync_status() == SNTP_SYNC_STATUS_RESET && ++retry < retry_count) {
ESP_LOGI(TAG, "Waiting for system time to be set... (%d/%d)", retry, retry_count);
vTaskDelay(2000 / portTICK_PERIOD_MS);
}
time(&now);
localtime_r(&now, &timeinfo);
// Set timezone to China Standard Time
setenv("TZ", "CST-8", 1);
tzset();
}
static void initialize_sntp(void)
{
ESP_LOGI(TAG, "Initializing SNTP");
sntp_setoperatingmode(SNTP_OPMODE_POLL);
sntp_setservername(0, "pool.ntp.org");
sntp_set_time_sync_notification_cb(time_sync_notification_cb);
sntp_init();
}

26
main/main.c

@ -2,7 +2,7 @@
* @author: Pomin
* @date: 2022-08-27 22:33:49
* @github: https://github.com/POMIN-163
* @lastedit: 2022-10-16 13:06:20
* @lastedit: 2022-10-20 23:22:14
* @description:
**/
#include "app.h"
@ -25,6 +25,8 @@ int app_init(void) {
btns_init();
lvgl_init();
mqtt_init();
ntp_init();
// https_init();
// fd_init();
return 0;
}
@ -38,8 +40,13 @@ void app_main() {
ESP_LOGI(TAG, "[APP] Free memory (IRAM): %d KB", esp_get_free_internal_heap_size() / 1024);
ESP_LOGI(TAG, "[APP] Free memory (EX-RAM): %d KB", esp_get_free_heap_size() / 1024);
ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version());
lv_obj_set_height(guider_ui.screen_spinner_1, 0);
struct dht11_reading bak = {-1, -1, -1};
time_t now;
struct tm timeinfo;
char strftime_buf[64];
while (1) {
struct dht11_reading res = DHT11_read();
// ESP_LOGI("--", "......");
@ -67,13 +74,26 @@ void app_main() {
root = cJSON_CreateObject();
hum = cJSON_CreateNumber((double) bak.humidity);
tem = cJSON_CreateNumber((double) bak.temperature);
tem = cJSON_CreateString((double) apps_status.led_running ? "on" : "off");
cJSON_AddItemToObject(root, "hum", hum);
cJSON_AddItemToObject(root, "tem", tem);
esp_mqtt_client_publish(mqtt_client, "/pomin/mqtt", cJSON_Print(root), 0, 0, 0);
ESP_LOGI(" ", "%s", cJSON_Print(root));
cJSON_Delete(root);
time(&now);
localtime_r(&now, &timeinfo);
strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
// ESP_LOGI(TAG, "The current date/time in Shanghai is: %s", strftime_buf);
strftime_buf[20] = '\0';
strftime_buf[3] = '\0';
lv_label_set_text(guider_ui.screen_label_5, strftime_buf + 11);
lv_label_set_text(guider_ui.screen_label_6, strftime_buf);
tick_div = 0;
}
}
}

31
main/server_root_cert.pem

@ -0,0 +1,31 @@
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn
OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn
jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE-----

2
sdkconfig

@ -305,7 +305,7 @@ CONFIG_EFUSE_MAX_BLK_LEN=256
CONFIG_ESP_TLS_USING_MBEDTLS=y
CONFIG_ESP_TLS_USE_DS_PERIPHERAL=y
# CONFIG_ESP_TLS_SERVER is not set
# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set
CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS=y
# CONFIG_ESP_TLS_PSK_VERIFICATION is not set
# CONFIG_ESP_TLS_INSECURE is not set
# end of ESP-TLS

2
sdkconfig.old

@ -363,7 +363,7 @@ CONFIG_SPIRAM_BOOT_INIT=y
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
CONFIG_SPIRAM_USE_MALLOC=y
CONFIG_SPIRAM_MEMTEST=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=256
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=64
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y

Loading…
Cancel
Save