Skip to content

Commit 51fb8b0

Browse files
authored
Merge pull request #31 from rzeldent/develop
Added QR code
2 parents 97a1ce2 + 37ca3a1 commit 51fb8b0

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

include/lv_conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@
642642
#define LV_USE_GIF 0
643643

644644
/*QR code library*/
645-
#define LV_USE_QRCODE 0
645+
#define LV_USE_QRCODE 1
646646

647647
/*FreeType library*/
648648
#define LV_USE_FREETYPE 0

platformio.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ monitor_filters = esp32_exception_decoder
5353
build_flags =
5454
-Ofast
5555
-Wall
56-
-D 'BOARD_NAME="${this.board}"'
57-
-D 'CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_INFO'
58-
#-D 'CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG'
59-
#-D 'CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE'
60-
-D'LV_CONF_PATH=${platformio.include_dir}/lv_conf.h'
56+
'-D BOARD_NAME="${this.board}"'
57+
'-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_INFO'
58+
#'-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG'
59+
#'-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE'
60+
'-D LV_CONF_PATH=${platformio.include_dir}/lv_conf.h'
6161

6262
lib_deps =
6363
https://github.com/rzeldent/esp32-smartdisplay

src/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <esp32_smartdisplay.h>
44
#include <ui/ui.h>
55

6+
#include <src/extra/libs/qrcode/lv_qrcode.h>
7+
68
void OnAddOneClicked(lv_event_t *e)
79
{
810
static uint8_t cnt = 0;
@@ -38,6 +40,12 @@ void setup()
3840
// lv_disp_set_rotation(disp, LV_DISP_ROT_270);
3941

4042
ui_init();
43+
44+
// To use third party libraries, enable the define in lv_conf.h: #define LV_USE_QRCODE 1
45+
auto ui_qrcode = lv_qrcode_create(ui_scrMain, 100, lv_color_black(), lv_color_white());
46+
const char *qr_data = "https://github.com/rzeldent/esp32-smartdisplay";
47+
lv_qrcode_update(ui_qrcode, qr_data, strlen(qr_data));
48+
lv_obj_center(ui_qrcode);
4149
}
4250

4351
ulong next_millis;

0 commit comments

Comments
 (0)