From de990c21d57b56851081ecaab35e4256f0285af5 Mon Sep 17 00:00:00 2001 From: lewishe Date: Wed, 18 Oct 2023 18:51:39 +0800 Subject: [PATCH] Fix Arduinio IDE 2.0.14 compilation error --- examples/factory/app_controller.cpp | 4 ++-- examples/factory/app_fft.cpp | 2 +- examples/factory/app_music.cpp | 1 - examples/factory/app_nfc.cpp | 10 +++++----- examples/factory/app_radio.cpp | 8 +------- examples/factory/app_radio.h | 2 +- examples/factory/build_opt.h | 1 - examples/factory/es7210.cpp | 4 +--- examples/factory/factory.ino | 18 ++++++++++-------- examples/factory/self_test.cpp | 5 ++--- examples/factory/src/alibaba_font.c | 2 +- examples/factory/src/image_lilygo_fcc.c | 2 +- examples/factory/src/img_card.c | 2 +- examples/factory/src/img_configuration.c | 2 +- examples/factory/src/img_controller.c | 2 +- examples/factory/src/img_knob.c | 2 +- examples/factory/src/img_led.c | 2 +- examples/factory/src/img_mic.c | 2 +- examples/factory/src/img_music.c | 2 +- examples/factory/src/img_nfc.c | 2 +- examples/factory/src/img_radio.c | 2 +- examples/factory/src/img_wifi.c | 2 +- examples/factory/ui.cpp | 2 +- lib/{lvgl => }/lv_conf.h | 0 platformio.ini | 3 +-- 25 files changed, 37 insertions(+), 47 deletions(-) delete mode 100644 examples/factory/build_opt.h rename lib/{lvgl => }/lv_conf.h (100%) diff --git a/examples/factory/app_controller.cpp b/examples/factory/app_controller.cpp index 148b8bd..090004d 100644 --- a/examples/factory/app_controller.cpp +++ b/examples/factory/app_controller.cpp @@ -232,12 +232,12 @@ static void get_ble_data_event_cb(lv_event_t *e) { if (controller_param.need_to_update) { /* get instance */ lv_obj_t *instance = lv_event_get_target(e); - lv_event_code_t c = lv_event_get_code(e); + // lv_event_code_t c = lv_event_get_code(e); lv_msg_t *m = lv_event_get_msg(e); meter_config_t *u = (meter_config_t *)lv_event_get_user_data(e); const float *fv = (const float *)lv_msg_get_payload(m); // Get the data passed by BLE. int32_t v = *fv; // Convert float to int. - if (v >= INDIC_1_MIN & v <= INDIC_1_MAX) { + if (v >= INDIC_1_MIN && v <= INDIC_1_MAX) { *u->value = v; // Update global parameters lv_meter_set_indicator_end_value(instance, u->indic, v); // Update the pointer in the gauge 1. lv_meter_set_indicator_value(instance, u->knob_indic, v); // Update the pointer in the gauge 2. diff --git a/examples/factory/app_fft.cpp b/examples/factory/app_fft.cpp index 792f751..0aa3be4 100644 --- a/examples/factory/app_fft.cpp +++ b/examples/factory/app_fft.cpp @@ -31,7 +31,7 @@ static void change_fft_event_cb(lv_event_t *e) { lv_msg_t *m = lv_event_get_msg(e); uint16_t *fft = (uint16_t *)lv_msg_get_payload(m); - lv_coord_t *ser_array = lv_chart_get_y_array(chart, ser); + // lv_coord_t *ser_array = lv_chart_get_y_array(chart, ser); for (int i = 0; i < SAMPLES / 2; i++) { ser->y_points[i] = (uint16_t)fft[i]; diff --git a/examples/factory/app_music.cpp b/examples/factory/app_music.cpp index da06b28..d216c43 100644 --- a/examples/factory/app_music.cpp +++ b/examples/factory/app_music.cpp @@ -16,7 +16,6 @@ extern QueueHandle_t play_music_queue; extern QueueHandle_t play_time_queue; extern EventGroupHandle_t global_event_group; -static void select_song_event_cb(lv_event_t *e); static lv_obj_t *create_music_btn(lv_obj_t *parent, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs,const char *symbol); static void find_file(fs::FS &fs, const char *dirname, uint8_t levels, String &output,const char *file_type); diff --git a/examples/factory/app_nfc.cpp b/examples/factory/app_nfc.cpp index 24bec56..cdecc41 100644 --- a/examples/factory/app_nfc.cpp +++ b/examples/factory/app_nfc.cpp @@ -88,11 +88,11 @@ void app_nfc_load(lv_obj_t *cont) { resume_nfcTaskHandler(); } -static void sleep_event_cb(lv_event_t *e) { - digitalWrite(PIN_POWER_ON, 0); - esp_sleep_enable_ext0_wakeup((gpio_num_t)PIN_ENCODE_BTN, 0); - esp_deep_sleep_start(); -} +// static void sleep_event_cb(lv_event_t *e) { +// digitalWrite(PIN_POWER_ON, 0); +// esp_sleep_enable_ext0_wakeup((gpio_num_t)PIN_ENCODE_BTN, 0); +// esp_deep_sleep_start(); +// } extern void suspend_nfcTaskHandler(void); void app_nfc_exit(lv_obj_t *cont) diff --git a/examples/factory/app_radio.cpp b/examples/factory/app_radio.cpp index 433dab2..72295e4 100644 --- a/examples/factory/app_radio.cpp +++ b/examples/factory/app_radio.cpp @@ -17,18 +17,12 @@ static uint32_t configTransmitInterval = 0; lv_timer_t *transmitTask; static lv_obj_t *radio_ta = NULL; -static struct { - uint8_t brightness; - uint8_t mode; - lv_obj_t *slider; - lv_obj_t *roller; -} radio_param; char set_text_radio_data[250] = {0}; static int new_data = 0; -void set_text_radio_ta(char * txt, int cmd) +void set_text_radio_ta(const char * txt, int cmd) { if(cmd && new_data) { diff --git a/examples/factory/app_radio.h b/examples/factory/app_radio.h index e20f3c2..bcfbe7a 100644 --- a/examples/factory/app_radio.h +++ b/examples/factory/app_radio.h @@ -6,4 +6,4 @@ extern app_t app_radio; void app_radio_load(lv_obj_t *cont); -void set_text_radio_ta(char * txt, int cmd); +void set_text_radio_ta(const char * txt, int cmd); diff --git a/examples/factory/build_opt.h b/examples/factory/build_opt.h deleted file mode 100644 index 3d74dd3..0000000 --- a/examples/factory/build_opt.h +++ /dev/null @@ -1 +0,0 @@ --DLV_CONF_INCLUDE_SIMPLE=1 -I. \ No newline at end of file diff --git a/examples/factory/es7210.cpp b/examples/factory/es7210.cpp index e87f667..dda9a74 100644 --- a/examples/factory/es7210.cpp +++ b/examples/factory/es7210.cpp @@ -210,9 +210,7 @@ void ES7210::adc_set_gain(es7210_input_mics_t mic_mask, es7210_gain_value_t gain void ES7210::adc_set_gain_all(es7210_gain_value_t gain) { uint32_t max_gain_vaule = 14; uint32_t _gain = gain; - if (_gain < 0) { - _gain = 0; - } else if (_gain > max_gain_vaule) { + if (_gain > max_gain_vaule) { _gain = max_gain_vaule; } log_d("SET: gain:%d", gain); diff --git a/examples/factory/factory.ino b/examples/factory/factory.ino index e58a6ac..25d8497 100644 --- a/examples/factory/factory.ino +++ b/examples/factory/factory.ino @@ -26,7 +26,6 @@ #include // https://github.com/lvgl/lvgl #include #include - typedef struct { uint8_t cmd; uint8_t data[14]; @@ -89,6 +88,8 @@ Adafruit_PN532 nfc(NFC_CS, &radioBus); extern int nfc_init_succeed; extern int radio_init_succeed; extern lv_timer_t *transmitTask; +extern void lv_msg_send(uint32_t msg_id, const void * payload); + void ui_task(void *param); void wav_task(void *param); @@ -172,8 +173,8 @@ void wav_task(void *param) { String music_path; bool is_pause = false; - uint32_t time_pos, Millis; - static uint32_t music_time, end_time; + uint32_t time_pos = 0, Millis = 0; + static uint32_t music_time = 0, end_time = 0; audio = new Audio(0, 3, 1); audio->setPinout(PIN_IIS_BCLK, PIN_IIS_WCLK, PIN_IIS_DOUT); audio->setVolume(21); // 0...21 @@ -241,7 +242,7 @@ void ui_task(void *param) // Update Embed initialization parameters for (uint8_t i = 0; i < (sizeof(lcd_st7789v) / sizeof(lcd_cmd_t)); i++) { tft.writecommand(lcd_st7789v[i].cmd); - for (int j = 0; j < lcd_st7789v[i].len & 0x7f; j++) { + for (int j = 0; j < (lcd_st7789v[i].len & 0x7f); j++) { tft.writedata(lcd_st7789v[i].data[j]); } @@ -633,7 +634,7 @@ void led_task(void *param) uint8_t brightness = 1; uint16_t temp, mode = 0; - int8_t last_led; + int8_t last_led = 0; EventBits_t bit; while (1) { @@ -732,7 +733,9 @@ void spk_init(void) .mclk_multiple = I2S_MCLK_MULTIPLE_256, .bits_per_chan = I2S_BITS_PER_CHAN_16BIT, }; - i2s_pin_config_t pin_config = {0}; + i2s_pin_config_t pin_config; + pin_config.data_in_num = -1; + pin_config.mck_io_num = -1; pin_config.bck_io_num = PIN_IIS_BCLK; pin_config.ws_io_num = PIN_IIS_WCLK; pin_config.data_out_num = PIN_IIS_DOUT; @@ -832,7 +835,7 @@ void timeavailable(struct timeval *t) void mic_spk_task(void *param) { static uint16_t buffer[3200] = {0}; - uint32_t temp = 0; + // uint32_t temp = 0; spk_init(); // FFT_Install(); mic_init(); @@ -868,7 +871,6 @@ void mic_spk_task(void *param) void mic_fft_task(void *param) { - size_t bytes_read; uint16_t buffer[SAMPLES] = {0}; bool start_fft = false; FFT_Install(); diff --git a/examples/factory/self_test.cpp b/examples/factory/self_test.cpp index a795f39..598b487 100644 --- a/examples/factory/self_test.cpp +++ b/examples/factory/self_test.cpp @@ -8,7 +8,7 @@ #include #ifndef LV_DELAY -#define LV_DELAY(x) {uint32_t t = x; do { lv_timer_handler();delay(1);} while (0);} +#define LV_DELAY(x) {uint32_t t = x; do { lv_timer_handler();delay(1);} while (t--);} #endif LV_IMG_DECLARE(lilygo2_gif); @@ -97,7 +97,6 @@ void self_test(void) { Serial.print(WIFI_SSID); WiFi.begin(WIFI_SSID, WIFI_PASSWORD); uint32_t last_tick = millis(); - uint32_t i = 0; bool is_smartconfig_connect = false; lv_label_set_long_mode(log_label, LV_LABEL_LONG_WRAP); while (WiFi.status() != WL_CONNECTED) { @@ -246,7 +245,7 @@ static void ui_begin() { lv_obj_add_event_cb(bat_label, update_text_subscriber_cb, LV_EVENT_MSG_RECEIVED, NULL); lv_msg_subsribe_obj(MSG_NEW_VOLT, bat_label, (void *)"VOLT : %d mV"); - lv_timer_t *timer = lv_timer_create(timer_task, 500, seg_text); + lv_timer_create(timer_task, 500, seg_text); } bool is_self_check_completed(void) { return _is_self_check_completed; } \ No newline at end of file diff --git a/examples/factory/src/alibaba_font.c b/examples/factory/src/alibaba_font.c index 3c2605d..1a6d23a 100644 --- a/examples/factory/src/alibaba_font.c +++ b/examples/factory/src/alibaba_font.c @@ -7,7 +7,7 @@ #ifdef LV_CONF_INCLUDE_SIMPLE #include "lvgl.h" #else -#include "lvgl/lvgl.h" + #include "lvgl.h" #endif #ifndef ALIBABA_FONT diff --git a/examples/factory/src/image_lilygo_fcc.c b/examples/factory/src/image_lilygo_fcc.c index 11b5d13..2fd020e 100644 --- a/examples/factory/src/image_lilygo_fcc.c +++ b/examples/factory/src/image_lilygo_fcc.c @@ -9,7 +9,7 @@ #if defined(LV_LVGL_H_INCLUDE_SIMPLE) #include "lvgl.h" #else - #include "lvgl/lvgl.h" + #include "lvgl.h" #endif diff --git a/examples/factory/src/img_card.c b/examples/factory/src/img_card.c index 11be5ce..bd14704 100644 --- a/examples/factory/src/img_card.c +++ b/examples/factory/src/img_card.c @@ -9,7 +9,7 @@ #if defined(LV_LVGL_H_INCLUDE_SIMPLE) #include "lvgl.h" #else - #include "lvgl/lvgl.h" + #include "lvgl.h" #endif diff --git a/examples/factory/src/img_configuration.c b/examples/factory/src/img_configuration.c index a67ac0c..ae43c9f 100644 --- a/examples/factory/src/img_configuration.c +++ b/examples/factory/src/img_configuration.c @@ -1,7 +1,7 @@ #if defined(LV_CONF_INCLUDE_SIMPLE) #include "lvgl.h" #else -#include "lvgl/lvgl.h" + #include "lvgl.h" #endif diff --git a/examples/factory/src/img_controller.c b/examples/factory/src/img_controller.c index c56db93..96cae2a 100644 --- a/examples/factory/src/img_controller.c +++ b/examples/factory/src/img_controller.c @@ -1,7 +1,7 @@ #if defined(LV_CONF_INCLUDE_SIMPLE) #include "lvgl.h" #else -#include "lvgl/lvgl.h" + #include "lvgl.h" #endif diff --git a/examples/factory/src/img_knob.c b/examples/factory/src/img_knob.c index 3b67828..cf10884 100644 --- a/examples/factory/src/img_knob.c +++ b/examples/factory/src/img_knob.c @@ -1,7 +1,7 @@ #if defined(LV_CONF_INCLUDE_SIMPLE) #include "lvgl.h" #else -#include "lvgl/lvgl.h" + #include "lvgl.h" #endif diff --git a/examples/factory/src/img_led.c b/examples/factory/src/img_led.c index a39e6ba..2ef25de 100644 --- a/examples/factory/src/img_led.c +++ b/examples/factory/src/img_led.c @@ -1,7 +1,7 @@ #if defined(LV_CONF_INCLUDE_SIMPLE) #include "lvgl.h" #else -#include "lvgl/lvgl.h" + #include "lvgl.h" #endif diff --git a/examples/factory/src/img_mic.c b/examples/factory/src/img_mic.c index dc9533b..368fde3 100644 --- a/examples/factory/src/img_mic.c +++ b/examples/factory/src/img_mic.c @@ -1,7 +1,7 @@ #if defined(LV_CONF_INCLUDE_SIMPLE) #include "lvgl.h" #else -#include "lvgl/lvgl.h" + #include "lvgl.h" #endif diff --git a/examples/factory/src/img_music.c b/examples/factory/src/img_music.c index ad1a761..fd96629 100644 --- a/examples/factory/src/img_music.c +++ b/examples/factory/src/img_music.c @@ -1,7 +1,7 @@ #if defined(LV_CONF_INCLUDE_SIMPLE) #include "lvgl.h" #else -#include "lvgl/lvgl.h" + #include "lvgl.h" #endif diff --git a/examples/factory/src/img_nfc.c b/examples/factory/src/img_nfc.c index 3c89408..85fab6b 100644 --- a/examples/factory/src/img_nfc.c +++ b/examples/factory/src/img_nfc.c @@ -9,7 +9,7 @@ #if defined(LV_LVGL_H_INCLUDE_SIMPLE) #include "lvgl.h" #else - #include "lvgl/lvgl.h" + #include "lvgl.h" #endif diff --git a/examples/factory/src/img_radio.c b/examples/factory/src/img_radio.c index de5b391..63581f1 100644 --- a/examples/factory/src/img_radio.c +++ b/examples/factory/src/img_radio.c @@ -9,7 +9,7 @@ #if defined(LV_LVGL_H_INCLUDE_SIMPLE) #include "lvgl.h" #else - #include "lvgl/lvgl.h" + #include "lvgl.h" #endif diff --git a/examples/factory/src/img_wifi.c b/examples/factory/src/img_wifi.c index 9ca0c37..74ef9d6 100644 --- a/examples/factory/src/img_wifi.c +++ b/examples/factory/src/img_wifi.c @@ -1,7 +1,7 @@ #if defined(LV_CONF_INCLUDE_SIMPLE) #include "lvgl.h" #else -#include "lvgl/lvgl.h" + #include "lvgl.h" #endif diff --git a/examples/factory/ui.cpp b/examples/factory/ui.cpp index fb3164a..715e898 100644 --- a/examples/factory/ui.cpp +++ b/examples/factory/ui.cpp @@ -121,7 +121,7 @@ void ui_init(void) { /* Create two views for switching menus and app UI */ lv_obj_t *menu_panel = lv_tileview_add_tile(main_screen, 0, 0, LV_DIR_HOR); - lv_obj_t *app_panel = lv_tileview_add_tile(main_screen, 0, 1, LV_DIR_HOR); + lv_tileview_add_tile(main_screen, 0, 1, LV_DIR_HOR); lv_obj_clear_flag(menu_panel, LV_OBJ_FLAG_SCROLLABLE); diff --git a/lib/lvgl/lv_conf.h b/lib/lv_conf.h similarity index 100% rename from lib/lvgl/lv_conf.h rename to lib/lv_conf.h diff --git a/platformio.ini b/platformio.ini index 3b87dfa..a30cded 100644 --- a/platformio.ini +++ b/platformio.ini @@ -18,7 +18,7 @@ default_envs = factory ; default_envs = TFT_Rainbow src_dir = examples/${platformio.default_envs} - +data_dir = examples/${platformio.default_envs}/data [env] platform = espressif32@6.3.0 board = lilygo-t-display-s3 @@ -27,7 +27,6 @@ framework = arduino build_flags = -DARDUINO_USB_CDC_ON_BOOT=1 -DDISABLE_ALL_LIBRARY_WARNINGS - -DLV_CONF_INCLUDE_SIMPLE -DBOARD_HAS_PSRAM board_build.partitions=huge_app.csv