diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b0300fc743..8eb8f4e45ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,8 @@ set(LIBRARY_SRCS libraries/RainMaker/src/RMakerParam.cpp libraries/RainMaker/src/RMakerDevice.cpp libraries/RainMaker/src/RMakerType.cpp + libraries/RainMaker/src/RMakerQR.cpp + libraries/RainMaker/src/RMakerUtils.cpp libraries/SD_MMC/src/SD_MMC.cpp libraries/SD/src/SD.cpp libraries/SD/src/sd_diskio.cpp diff --git a/cores/esp32/esp32-hal-i2c-slave.c b/cores/esp32/esp32-hal-i2c-slave.c index 99bc2c54c9b..4d67eaff0e3 100644 --- a/cores/esp32/esp32-hal-i2c-slave.c +++ b/cores/esp32/esp32-hal-i2c-slave.c @@ -695,7 +695,6 @@ static void i2c_slave_isr_handler(void* arg) uint32_t activeInt = i2c_ll_get_intsts_mask(i2c->dev); i2c_ll_clr_intsts_mask(i2c->dev, activeInt); uint8_t rx_fifo_len = i2c_ll_get_rxfifo_cnt(i2c->dev); - uint8_t tx_fifo_len = SOC_I2C_FIFO_LEN - i2c_ll_get_txfifo_len(i2c->dev); bool slave_rw = i2c_ll_slave_rw(i2c->dev); if(activeInt & I2C_RXFIFO_WM_INT_ENA){ // RX FiFo Full diff --git a/cores/esp32/esp32-hal-tinyusb.c b/cores/esp32/esp32-hal-tinyusb.c index c34af2a9ef6..8bf9932d2e4 100644 --- a/cores/esp32/esp32-hal-tinyusb.c +++ b/cores/esp32/esp32-hal-tinyusb.c @@ -646,8 +646,9 @@ static void usb_device_task(void *param) { /* * PUBLIC API * */ -static const char *tinyusb_interface_names[USB_INTERFACE_MAX] = {"MSC", "DFU", "HID", "VENDOR", "CDC", "MIDI", "CUSTOM"}; - +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR + const char *tinyusb_interface_names[USB_INTERFACE_MAX] = {"MSC", "DFU", "HID", "VENDOR", "CDC", "MIDI", "CUSTOM"}; +#endif static bool tinyusb_is_initialized = false; esp_err_t tinyusb_enable_interface(tinyusb_interface_t interface, uint16_t descriptor_len, tinyusb_descriptor_cb_t cb) diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 80030b8fabc..a2f6ea4c918 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -538,8 +538,6 @@ void uartStartDetectBaudrate(uart_t *uart) { return; } - uart_dev_t *hw = UART_LL_GET_HW(uart->num); - #ifdef CONFIG_IDF_TARGET_ESP32C3 // ESP32-C3 requires further testing @@ -555,6 +553,7 @@ void uartStartDetectBaudrate(uart_t *uart) { //hw->conf0.autobaud_en = 1; #elif CONFIG_IDF_TARGET_ESP32S3 #else + uart_dev_t *hw = UART_LL_GET_HW(uart->num); hw->auto_baud.glitch_filt = 0x08; hw->auto_baud.en = 0; hw->auto_baud.en = 1; @@ -571,7 +570,6 @@ uartDetectBaudrate(uart_t *uart) #ifndef CONFIG_IDF_TARGET_ESP32C3 // ESP32-C3 requires further testing - Baud rate detection returns wrong values static bool uartStateDetectingBaudrate = false; - uart_dev_t *hw = UART_LL_GET_HW(uart->num); if(!uartStateDetectingBaudrate) { uartStartDetectBaudrate(uart); @@ -592,6 +590,7 @@ uartDetectBaudrate(uart_t *uart) //hw->conf0.autobaud_en = 0; #elif CONFIG_IDF_TARGET_ESP32S3 #else + uart_dev_t *hw = UART_LL_GET_HW(uart->num); hw->auto_baud.en = 0; #endif uartStateDetectingBaudrate = false; // Initialize for the next round diff --git a/libraries/BluetoothSerial/src/BluetoothSerial.cpp b/libraries/BluetoothSerial/src/BluetoothSerial.cpp index ea72f787ebf..09ef2aeb180 100644 --- a/libraries/BluetoothSerial/src/BluetoothSerial.cpp +++ b/libraries/BluetoothSerial/src/BluetoothSerial.cpp @@ -973,10 +973,12 @@ bool BluetoothSerial::connect(uint8_t remoteAddress[], int channel, esp_spp_sec_ log_i("master : remoteAddress"); xEventGroupClearBits(_spp_event_group, SPP_CLOSED); if (channel > 0) { +#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO) char bda_str[18]; log_i("spp connect to remote %s channel %d", bda2str(_peer_bd_addr, bda_str, sizeof(bda_str)), channel); +#endif if(esp_spp_connect(sec_mask, role, channel, _peer_bd_addr) != ESP_OK ) { log_e("spp connect failed"); return false; diff --git a/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp b/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp index 79ff0ba6aa1..d0a0fd59432 100644 --- a/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp +++ b/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp @@ -28,7 +28,7 @@ static const char *TAG = "camera_httpd"; #endif -// Face Detection will not work on boards without (or with disabled) PSRAM +// Face Detection will not work on boards without (or with disabled) PSRAM #ifdef BOARD_HAS_PSRAM #define CONFIG_ESP_FACE_DETECT_ENABLED 1 // Face Recognition takes upward from 15 seconds per frame on chips other than ESP32S3 @@ -148,6 +148,7 @@ static ra_filter_t *ra_filter_init(ra_filter_t *filter, size_t sample_size) return filter; } +/* unused function triggers error static int ra_filter_run(ra_filter_t *filter, int value) { if (!filter->values) @@ -165,6 +166,7 @@ static int ra_filter_run(ra_filter_t *filter, int value) } return filter->sum / filter->count; } +*/ #if CONFIG_ESP_FACE_DETECT_ENABLED #if CONFIG_ESP_FACE_RECOGNITION_ENABLED @@ -294,7 +296,9 @@ static esp_err_t bmp_handler(httpd_req_t *req) { camera_fb_t *fb = NULL; esp_err_t res = ESP_OK; +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO uint64_t fr_start = esp_timer_get_time(); +#endif fb = esp_camera_fb_get(); if (!fb) { @@ -323,7 +327,9 @@ static esp_err_t bmp_handler(httpd_req_t *req) } res = httpd_resp_send(req, (const char *)buf, buf_len); free(buf); +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO uint64_t fr_end = esp_timer_get_time(); +#endif ESP_LOGI(TAG, "BMP: %llums, %uB", (uint64_t)((fr_end - fr_start) / 1000), buf_len); return res; } @@ -347,7 +353,9 @@ static esp_err_t capture_handler(httpd_req_t *req) { camera_fb_t *fb = NULL; esp_err_t res = ESP_OK; +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO int64_t fr_start = esp_timer_get_time(); +#endif #ifdef CONFIG_LED_ILLUMINATOR_ENABLED enable_led(true); @@ -377,15 +385,21 @@ static esp_err_t capture_handler(httpd_req_t *req) size_t out_len, out_width, out_height; uint8_t *out_buf; bool s; +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO bool detected = false; +#endif int face_id = 0; if (!detection_enabled || fb->width > 400) { #endif +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO size_t fb_len = 0; +#endif if (fb->format == PIXFORMAT_JPEG) { +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO fb_len = fb->len; +#endif res = httpd_resp_send(req, (const char *)fb->buf, fb->len); } else @@ -393,10 +407,14 @@ static esp_err_t capture_handler(httpd_req_t *req) jpg_chunking_t jchunk = {req, 0}; res = frame2jpg_cb(fb, 80, jpg_encode_stream, &jchunk) ? ESP_OK : ESP_FAIL; httpd_resp_send_chunk(req, NULL, 0); +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO fb_len = jchunk.len; +#endif } esp_camera_fb_return(fb); +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO int64_t fr_end = esp_timer_get_time(); +#endif ESP_LOGI(TAG, "JPG: %uB %ums", (uint32_t)(fb_len), (uint32_t)((fr_end - fr_start) / 1000)); return res; #if CONFIG_ESP_FACE_DETECT_ENABLED @@ -425,12 +443,14 @@ static esp_err_t capture_handler(httpd_req_t *req) rfb.data = fb->buf; rfb.bytes_per_pixel = 2; rfb.format = FB_RGB565; +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO detected = true; +#endif draw_face_boxes(&rfb, &results, face_id); } s = fmt2jpg_cb(fb->buf, fb->len, fb->width, fb->height, PIXFORMAT_RGB565, 90, jpg_encode_stream, &jchunk); esp_camera_fb_return(fb); - } else + } else { out_len = fb->width * fb->height * 3; out_width = fb->width; @@ -468,7 +488,9 @@ static esp_err_t capture_handler(httpd_req_t *req) #endif if (results.size() > 0) { +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO detected = true; +#endif #if CONFIG_ESP_FACE_RECOGNITION_ENABLED if (recognition_enabled) { face_id = run_face_recognition(&rfb, &results); @@ -486,8 +508,9 @@ static esp_err_t capture_handler(httpd_req_t *req) httpd_resp_send_500(req); return ESP_FAIL; } - +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO int64_t fr_end = esp_timer_get_time(); +#endif ESP_LOGI(TAG, "FACE: %uB %ums %s%d", (uint32_t)(jchunk.len), (uint32_t)((fr_end - fr_start) / 1000), detected ? "DETECTED " : "", face_id); return res; #endif @@ -502,14 +525,15 @@ static esp_err_t stream_handler(httpd_req_t *req) uint8_t *_jpg_buf = NULL; char *part_buf[128]; #if CONFIG_ESP_FACE_DETECT_ENABLED - bool detected = false; + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO + bool detected = false; + int64_t fr_ready = 0; + int64_t fr_recognize = 0; + int64_t fr_encode = 0; + int64_t fr_face = 0; + int64_t fr_start = 0; + #endif int face_id = 0; - int64_t fr_start = 0; - int64_t fr_ready = 0; - int64_t fr_face = 0; - int64_t fr_recognize = 0; - int64_t fr_encode = 0; - size_t out_len = 0, out_width = 0, out_height = 0; uint8_t *out_buf = NULL; bool s = false; @@ -544,7 +568,9 @@ static esp_err_t stream_handler(httpd_req_t *req) while (true) { #if CONFIG_ESP_FACE_DETECT_ENABLED + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO detected = false; + #endif face_id = 0; #endif @@ -559,11 +585,13 @@ static esp_err_t stream_handler(httpd_req_t *req) _timestamp.tv_sec = fb->timestamp.tv_sec; _timestamp.tv_usec = fb->timestamp.tv_usec; #if CONFIG_ESP_FACE_DETECT_ENABLED + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO fr_start = esp_timer_get_time(); fr_ready = fr_start; - fr_face = fr_start; fr_encode = fr_start; fr_recognize = fr_start; + fr_face = fr_start; + #endif if (!detection_enabled || fb->width > 400) { #endif @@ -592,15 +620,19 @@ static esp_err_t stream_handler(httpd_req_t *req) && !recognition_enabled #endif ){ +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO fr_ready = esp_timer_get_time(); +#endif #if TWO_STAGE std::list &candidates = s1.infer((uint16_t *)fb->buf, {(int)fb->height, (int)fb->width, 3}); std::list &results = s2.infer((uint16_t *)fb->buf, {(int)fb->height, (int)fb->width, 3}, candidates); #else std::list &results = s1.infer((uint16_t *)fb->buf, {(int)fb->height, (int)fb->width, 3}); #endif +#if CONFIG_ESP_FACE_DETECT_ENABLED && ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO fr_face = esp_timer_get_time(); fr_recognize = fr_face; +#endif if (results.size() > 0) { fb_data_t rfb; rfb.width = fb->width; @@ -608,7 +640,9 @@ static esp_err_t stream_handler(httpd_req_t *req) rfb.data = fb->buf; rfb.bytes_per_pixel = 2; rfb.format = FB_RGB565; +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO detected = true; +#endif draw_face_boxes(&rfb, &results, face_id); } s = fmt2jpg(fb->buf, fb->len, fb->width, fb->height, PIXFORMAT_RGB565, 80, &_jpg_buf, &_jpg_buf_len); @@ -618,8 +652,10 @@ static esp_err_t stream_handler(httpd_req_t *req) ESP_LOGE(TAG, "fmt2jpg failed"); res = ESP_FAIL; } +#if CONFIG_ESP_FACE_DETECT_ENABLED && ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO fr_encode = esp_timer_get_time(); - } else +#endif + } else { out_len = fb->width * fb->height * 3; out_width = fb->width; @@ -637,7 +673,9 @@ static esp_err_t stream_handler(httpd_req_t *req) ESP_LOGE(TAG, "to rgb888 failed"); res = ESP_FAIL; } else { +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO fr_ready = esp_timer_get_time(); +#endif fb_data_t rfb; rfb.width = out_width; @@ -653,15 +691,21 @@ static esp_err_t stream_handler(httpd_req_t *req) std::list &results = s1.infer((uint8_t *)out_buf, {(int)out_height, (int)out_width, 3}); #endif +#if CONFIG_ESP_FACE_DETECT_ENABLED && ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO fr_face = esp_timer_get_time(); fr_recognize = fr_face; +#endif if (results.size() > 0) { +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO detected = true; +#endif #if CONFIG_ESP_FACE_RECOGNITION_ENABLED if (recognition_enabled) { face_id = run_face_recognition(&rfb, &results); + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO fr_recognize = esp_timer_get_time(); + #endif } #endif draw_face_boxes(&rfb, &results, face_id); @@ -672,7 +716,9 @@ static esp_err_t stream_handler(httpd_req_t *req) ESP_LOGE(TAG, "fmt2jpg failed"); res = ESP_FAIL; } +#if CONFIG_ESP_FACE_DETECT_ENABLED && ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO fr_encode = esp_timer_get_time(); +#endif } } } @@ -710,7 +756,7 @@ static esp_err_t stream_handler(httpd_req_t *req) } int64_t fr_end = esp_timer_get_time(); -#if CONFIG_ESP_FACE_DETECT_ENABLED +#if CONFIG_ESP_FACE_DETECT_ENABLED && ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO int64_t ready_time = (fr_ready - fr_start) / 1000; int64_t face_time = (fr_face - fr_ready) / 1000; int64_t recognize_time = (fr_recognize - fr_face) / 1000; @@ -719,9 +765,10 @@ static esp_err_t stream_handler(httpd_req_t *req) #endif int64_t frame_time = fr_end - last_frame; - last_frame = fr_end; frame_time /= 1000; +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO uint32_t avg_frame_time = ra_filter_run(&ra_filter, frame_time); +#endif ESP_LOGI(TAG, "MJPG: %uB %ums (%.1ffps), AVG: %ums (%.1ffps)" #if CONFIG_ESP_FACE_DETECT_ENABLED ", %u+%u+%u+%u=%u %s%d" @@ -743,7 +790,6 @@ static esp_err_t stream_handler(httpd_req_t *req) enable_led(false); #endif - last_frame = 0; return res; } diff --git a/libraries/ESP32/examples/ResetReason/ResetReason.ino b/libraries/ESP32/examples/ResetReason/ResetReason.ino index 608edde31e0..2ccf7107d03 100644 --- a/libraries/ESP32/examples/ResetReason/ResetReason.ino +++ b/libraries/ESP32/examples/ResetReason/ResetReason.ino @@ -30,7 +30,7 @@ #define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */ -void print_reset_reason(RESET_REASON reason) +void print_reset_reason(int reason) { switch ( reason) { @@ -53,7 +53,7 @@ void print_reset_reason(RESET_REASON reason) } } -void verbose_print_reset_reason(RESET_REASON reason) +void verbose_print_reset_reason(int reason) { switch ( reason) { diff --git a/libraries/ESP32/examples/Touch/TouchButtonV2/TouchButtonV2.ino b/libraries/ESP32/examples/Touch/TouchButtonV2/TouchButtonV2.ino index 640fd2d3b59..9c489c2597c 100644 --- a/libraries/ESP32/examples/Touch/TouchButtonV2/TouchButtonV2.ino +++ b/libraries/ESP32/examples/Touch/TouchButtonV2/TouchButtonV2.ino @@ -30,8 +30,6 @@ void setup() { } void loop() { - static uint32_t count = 0; - if (touch1detected) { touch1detected = false; if (touchInterruptGetLastStatus(T1)) { diff --git a/libraries/Ethernet/src/ETH.cpp b/libraries/Ethernet/src/ETH.cpp index 86c804fd6e5..857b204a86c 100644 --- a/libraries/Ethernet/src/ETH.cpp +++ b/libraries/Ethernet/src/ETH.cpp @@ -57,24 +57,25 @@ extern void tcpipInit(); static eth_clock_mode_t eth_clock_mode = ETH_CLK_MODE; #if CONFIG_ETH_RMII_CLK_INPUT +/* static void emac_config_apll_clock(void) { - /* apll_freq = xtal_freq * (4 + sdm2 + sdm1/256 + sdm0/65536)/((o_div + 2) * 2) */ + // apll_freq = xtal_freq * (4 + sdm2 + sdm1/256 + sdm0/65536)/((o_div + 2) * 2) rtc_xtal_freq_t rtc_xtal_freq = rtc_clk_xtal_freq_get(); switch (rtc_xtal_freq) { case RTC_XTAL_FREQ_40M: // Recommended - /* 50 MHz = 40MHz * (4 + 6) / (2 * (2 + 2) = 50.000 */ - /* sdm0 = 0, sdm1 = 0, sdm2 = 6, o_div = 2 */ + // 50 MHz = 40MHz * (4 + 6) / (2 * (2 + 2) = 50.000 + // sdm0 = 0, sdm1 = 0, sdm2 = 6, o_div = 2 rtc_clk_apll_enable(true, 0, 0, 6, 2); break; case RTC_XTAL_FREQ_26M: - /* 50 MHz = 26MHz * (4 + 15 + 118 / 256 + 39/65536) / ((3 + 2) * 2) = 49.999992 */ - /* sdm0 = 39, sdm1 = 118, sdm2 = 15, o_div = 3 */ + // 50 MHz = 26MHz * (4 + 15 + 118 / 256 + 39/65536) / ((3 + 2) * 2) = 49.999992 + // sdm0 = 39, sdm1 = 118, sdm2 = 15, o_div = 3 rtc_clk_apll_enable(true, 39, 118, 15, 3); break; case RTC_XTAL_FREQ_24M: - /* 50 MHz = 24MHz * (4 + 12 + 255 / 256 + 255/65536) / ((2 + 2) * 2) = 49.499977 */ - /* sdm0 = 255, sdm1 = 255, sdm2 = 12, o_div = 2 */ + // 50 MHz = 24MHz * (4 + 12 + 255 / 256 + 255/65536) / ((2 + 2) * 2) = 49.499977 + // sdm0 = 255, sdm1 = 255, sdm2 = 12, o_div = 2 rtc_clk_apll_enable(true, 255, 255, 12, 2); break; default: // Assume we have a 40M xtal @@ -82,8 +83,10 @@ static void emac_config_apll_clock(void) break; } } +*/ #endif +/* static esp_err_t on_lowlevel_init_done(esp_eth_handle_t eth_handle){ #if CONFIG_IDF_TARGET_ESP32 if(eth_clock_mode > ETH_CLOCK_GPIO17_OUT){ @@ -168,7 +171,7 @@ static esp_err_t on_lowlevel_init_done(esp_eth_handle_t eth_handle){ #endif return ESP_OK; } - +*/ /** diff --git a/libraries/I2S/src/I2S.cpp b/libraries/I2S/src/I2S.cpp index 393052c136f..78dc5c202df 100644 --- a/libraries/I2S/src/I2S.cpp +++ b/libraries/I2S/src/I2S.cpp @@ -988,7 +988,6 @@ void I2SClass::_post_read_data_fix(void *input, size_t *size){ // bytes_written - number of bytes used from original buffer // actual_bytes_written - number of bytes written by i2s_write after fix void I2SClass::_fix_and_write(void *output, size_t size, size_t *bytes_written, size_t *actual_bytes_written){ - long start = millis(); ulong src_ptr = 0; uint8_t* buff = NULL; size_t buff_size = size; diff --git a/libraries/RainMaker/examples/RMakerCustom/RMakerCustom.ino b/libraries/RainMaker/examples/RMakerCustom/RMakerCustom.ino index 892f285415f..f10f858cad7 100644 --- a/libraries/RainMaker/examples/RMakerCustom/RMakerCustom.ino +++ b/libraries/RainMaker/examples/RMakerCustom/RMakerCustom.ino @@ -36,6 +36,7 @@ void sysProvEvent(arduino_event_t *sys_event) printQR(service_name, pop, "ble"); #endif break; + default:; } } diff --git a/libraries/RainMaker/examples/RMakerSonoffDualR3/RMakerSonoffDualR3.ino b/libraries/RainMaker/examples/RMakerSonoffDualR3/RMakerSonoffDualR3.ino index 37eda40134b..b571f4f5dac 100644 --- a/libraries/RainMaker/examples/RMakerSonoffDualR3/RMakerSonoffDualR3.ino +++ b/libraries/RainMaker/examples/RMakerSonoffDualR3/RMakerSonoffDualR3.ino @@ -50,6 +50,7 @@ void sysProvEvent(arduino_event_t *sys_event) Serial.printf("\nConnected to Wi-Fi!\n"); digitalWrite(gpio_led, true); break; + default:; } } diff --git a/libraries/RainMaker/examples/RMakerSwitch/RMakerSwitch.ino b/libraries/RainMaker/examples/RMakerSwitch/RMakerSwitch.ino index 11f11a586bd..52afe11076e 100644 --- a/libraries/RainMaker/examples/RMakerSwitch/RMakerSwitch.ino +++ b/libraries/RainMaker/examples/RMakerSwitch/RMakerSwitch.ino @@ -35,6 +35,7 @@ void sysProvEvent(arduino_event_t *sys_event) printQR(service_name, pop, "ble"); #endif break; + default:; } } diff --git a/libraries/RainMaker/src/RMakerQR.cpp b/libraries/RainMaker/src/RMakerQR.cpp new file mode 100644 index 00000000000..7f94f70383f --- /dev/null +++ b/libraries/RainMaker/src/RMakerQR.cpp @@ -0,0 +1,21 @@ +#include "RMakerQR.h" +#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK +void printQR(const char *name, const char *pop, const char *transport) +{ + if (!name || !pop || !transport) { + log_w("Cannot generate QR code payload. Data missing."); + return; + } + char payload[150]; + snprintf(payload, sizeof(payload), "{\"ver\":\"%s\",\"name\":\"%s\"" \ + ",\"pop\":\"%s\",\"transport\":\"%s\"}", + PROV_QR_VERSION, name, pop, transport); + if(Serial){ + Serial.printf("Scan this QR code from the ESP RainMaker phone app.\n"); + } + qrcode_display(payload); + if(Serial){ + Serial.printf("If QR code is not visible, copy paste the below URL in a browser.\n%s?data=%s\n", QRCODE_BASE_URL, payload); + } +} +#endif \ No newline at end of file diff --git a/libraries/RainMaker/src/RMakerQR.h b/libraries/RainMaker/src/RMakerQR.h index 7b666557fcd..cb282a2e9d4 100644 --- a/libraries/RainMaker/src/RMakerQR.h +++ b/libraries/RainMaker/src/RMakerQR.h @@ -14,24 +14,12 @@ #pragma once #include "sdkconfig.h" #ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK +#include "RMaker.h" #include "esp_system.h" #include #define PROV_QR_VERSION "v1" #define QRCODE_BASE_URL "https://rainmaker.espressif.com/qrcode.html" -static void printQR(const char *name, const char *pop, const char *transport) -{ - if (!name || !pop || !transport) { - log_w("Cannot generate QR code payload. Data missing."); - return; - } - char payload[150]; - snprintf(payload, sizeof(payload), "{\"ver\":\"%s\",\"name\":\"%s\"" \ - ",\"pop\":\"%s\",\"transport\":\"%s\"}", - PROV_QR_VERSION, name, pop, transport); - Serial.printf("Scan this QR code from the ESP RainMaker phone app.\n"); - qrcode_display(payload); - Serial.printf("If QR code is not visible, copy paste the below URL in a browser.\n%s?data=%s\n", QRCODE_BASE_URL, payload); -} +void printQR(const char *name, const char *pop, const char *transport); #endif \ No newline at end of file diff --git a/libraries/RainMaker/src/RMakerUtils.cpp b/libraries/RainMaker/src/RMakerUtils.cpp new file mode 100644 index 00000000000..1d800b72df8 --- /dev/null +++ b/libraries/RainMaker/src/RMakerUtils.cpp @@ -0,0 +1,12 @@ +#include "RMakerUtils.h" +#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK +void RMakerFactoryReset(int seconds) +{ + esp_rmaker_factory_reset(0, seconds); +} + +void RMakerWiFiReset(int seconds) +{ + esp_rmaker_wifi_reset(0, seconds); +} +#endif \ No newline at end of file diff --git a/libraries/RainMaker/src/RMakerUtils.h b/libraries/RainMaker/src/RMakerUtils.h index 710b0e9a8a4..17b7533d6be 100644 --- a/libraries/RainMaker/src/RMakerUtils.h +++ b/libraries/RainMaker/src/RMakerUtils.h @@ -14,16 +14,10 @@ #pragma once #include "sdkconfig.h" #ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK +#include "RMaker.h" #include "esp_system.h" #include -static void RMakerFactoryReset(int seconds) -{ - esp_rmaker_factory_reset(0, seconds); -} - -static void RMakerWiFiReset(int seconds) -{ - esp_rmaker_wifi_reset(0, seconds); -} +void RMakerFactoryReset(int seconds); +void RMakerWiFiReset(int seconds); #endif \ No newline at end of file diff --git a/libraries/USB/examples/HIDVendor/HIDVendor.ino b/libraries/USB/examples/HIDVendor/HIDVendor.ino index 01b91596026..e6d413d9608 100644 --- a/libraries/USB/examples/HIDVendor/HIDVendor.ino +++ b/libraries/USB/examples/HIDVendor/HIDVendor.ino @@ -20,7 +20,7 @@ static void vendorEventCallback(void* arg, esp_event_base_t event_base, int32_t case ARDUINO_USB_HID_VENDOR_SET_FEATURE_EVENT: Serial.printf("HID VENDOR SET FEATURE: len:%u\n", data->len); for(uint16_t i=0; ilen; i++){ - Serial.printf("0x%02X ",data->buffer); + Serial.printf("0x%02X ",*(data->buffer)); } Serial.println(); break; diff --git a/libraries/USB/src/USBHID.cpp b/libraries/USB/src/USBHID.cpp index cf66d661319..a5bdb2d6739 100644 --- a/libraries/USB/src/USBHID.cpp +++ b/libraries/USB/src/USBHID.cpp @@ -42,7 +42,9 @@ static bool tinyusb_hid_is_initialized = false; static uint8_t tinyusb_loaded_hid_devices_num = 0; static uint16_t tinyusb_hid_device_descriptor_len = 0; static uint8_t * tinyusb_hid_device_descriptor = NULL; -static const char * tinyusb_hid_device_report_types[4] = {"INVALID", "INPUT", "OUTPUT", "FEATURE"}; +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG + static const char * tinyusb_hid_device_report_types[4] = {"INVALID", "INPUT", "OUTPUT", "FEATURE"}; +#endif static bool tinyusb_enable_hid_device(uint16_t descriptor_len, USBHIDDevice * device){ if(tinyusb_hid_is_initialized){ diff --git a/libraries/USB/src/USBHIDKeyboard.cpp b/libraries/USB/src/USBHIDKeyboard.cpp index d7cd5e5e2b1..3ebf47580e0 100644 --- a/libraries/USB/src/USBHIDKeyboard.cpp +++ b/libraries/USB/src/USBHIDKeyboard.cpp @@ -274,7 +274,6 @@ size_t USBHIDKeyboard::releaseRaw(uint8_t k) // call release(), releaseAll(), or otherwise clear the report and resend. size_t USBHIDKeyboard::press(uint8_t k) { - uint8_t i; if (k >= 0x88) { // it's a non-printing key (not a modifier) k = k - 0x88; } else if (k >= 0x80) { // it's a modifier key @@ -298,7 +297,6 @@ size_t USBHIDKeyboard::press(uint8_t k) // it shouldn't be repeated any more. size_t USBHIDKeyboard::release(uint8_t k) { - uint8_t i; if (k >= 0x88) { // it's a non-printing key (not a modifier) k = k - 0x88; } else if (k >= 0x80) { // it's a modifier key diff --git a/libraries/WiFi/examples/WiFiScanDualAntenna/WiFiScanDualAntenna.ino b/libraries/WiFi/examples/WiFiScanDualAntenna/WiFiScanDualAntenna.ino index 344778ff3df..029f95d2205 100644 --- a/libraries/WiFi/examples/WiFiScanDualAntenna/WiFiScanDualAntenna.ino +++ b/libraries/WiFi/examples/WiFiScanDualAntenna/WiFiScanDualAntenna.ino @@ -18,7 +18,7 @@ void setup() { - bool err = ESP_FAIL; + bool err = false; Serial.begin(115200); // Set WiFi to station mode and disconnect from an AP if it was previously connected @@ -36,7 +36,7 @@ void setup() * https://docs.espressif.com/projects/arduino-esp32/en/latest/api/wifi.html */ - if(err == ESP_FAIL) { + if(err == false) { Serial.println("Dual Antenna configuration failed!"); } else { Serial.println("Dual Antenna configuration successfuly done!"); diff --git a/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp index 5d31341481a..58a02736b27 100644 --- a/libraries/WiFi/src/WiFiGeneric.cpp +++ b/libraries/WiFi/src/WiFiGeneric.cpp @@ -195,6 +195,7 @@ esp_err_t set_esp_interface_dns(esp_interface_t interface, IPAddress main_dns=IP return ESP_OK; } +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE static const char * auth_mode_str(int authmode) { switch (authmode) { @@ -221,6 +222,7 @@ static const char * auth_mode_str(int authmode) } return ("UNKNOWN"); } +#endif static char default_hostname[32] = {0,}; static const char * get_esp_netif_hostname(){ @@ -286,24 +288,32 @@ static void _arduino_event_cb(void* arg, esp_event_base_t event_base, int32_t ev log_v("STA Stopped"); arduino_event.event_id = ARDUINO_EVENT_WIFI_STA_STOP; } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_AUTHMODE_CHANGE) { - wifi_event_sta_authmode_change_t * event = (wifi_event_sta_authmode_change_t*)event_data; - log_v("STA Auth Mode Changed: From: %s, To: %s", auth_mode_str(event->old_mode), auth_mode_str(event->new_mode)); + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE + wifi_event_sta_authmode_change_t * event = (wifi_event_sta_authmode_change_t*)event_data; + log_v("STA Auth Mode Changed: From: %s, To: %s", auth_mode_str(event->old_mode), auth_mode_str(event->new_mode)); + #endif arduino_event.event_id = ARDUINO_EVENT_WIFI_STA_AUTHMODE_CHANGE; memcpy(&arduino_event.event_info.wifi_sta_authmode_change, event_data, sizeof(wifi_event_sta_authmode_change_t)); } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_CONNECTED) { - wifi_event_sta_connected_t * event = (wifi_event_sta_connected_t*)event_data; - log_v("STA Connected: SSID: %s, BSSID: " MACSTR ", Channel: %u, Auth: %s", event->ssid, MAC2STR(event->bssid), event->channel, auth_mode_str(event->authmode)); + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE + wifi_event_sta_connected_t * event = (wifi_event_sta_connected_t*)event_data; + log_v("STA Connected: SSID: %s, BSSID: " MACSTR ", Channel: %u, Auth: %s", event->ssid, MAC2STR(event->bssid), event->channel, auth_mode_str(event->authmode)); + #endif arduino_event.event_id = ARDUINO_EVENT_WIFI_STA_CONNECTED; memcpy(&arduino_event.event_info.wifi_sta_connected, event_data, sizeof(wifi_event_sta_connected_t)); } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) { - wifi_event_sta_disconnected_t * event = (wifi_event_sta_disconnected_t*)event_data; - log_v("STA Disconnected: SSID: %s, BSSID: " MACSTR ", Reason: %u", event->ssid, MAC2STR(event->bssid), event->reason); + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE + wifi_event_sta_disconnected_t * event = (wifi_event_sta_disconnected_t*)event_data; + log_v("STA Disconnected: SSID: %s, BSSID: " MACSTR ", Reason: %u", event->ssid, MAC2STR(event->bssid), event->reason); + #endif arduino_event.event_id = ARDUINO_EVENT_WIFI_STA_DISCONNECTED; memcpy(&arduino_event.event_info.wifi_sta_disconnected, event_data, sizeof(wifi_event_sta_disconnected_t)); } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) { - ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data; - log_v("STA Got %sIP:" IPSTR, event->ip_changed?"New ":"Same ", IP2STR(&event->ip_info.ip)); - arduino_event.event_id = ARDUINO_EVENT_WIFI_STA_GOT_IP; + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE + ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data; + log_v("STA Got %sIP:" IPSTR, event->ip_changed?"New ":"Same ", IP2STR(&event->ip_info.ip)); + #endif + arduino_event.event_id = ARDUINO_EVENT_WIFI_STA_GOT_IP; memcpy(&arduino_event.event_info.got_ip, event_data, sizeof(ip_event_got_ip_t)); } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_LOST_IP) { log_v("STA IP Lost"); @@ -313,8 +323,10 @@ static void _arduino_event_cb(void* arg, esp_event_base_t event_base, int32_t ev * SCAN * */ } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_SCAN_DONE) { - wifi_event_sta_scan_done_t * event = (wifi_event_sta_scan_done_t*)event_data; - log_v("SCAN Done: ID: %u, Status: %u, Results: %u", event->scan_id, event->status, event->number); + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE + wifi_event_sta_scan_done_t * event = (wifi_event_sta_scan_done_t*)event_data; + log_v("SCAN Done: ID: %u, Status: %u, Results: %u", event->scan_id, event->status, event->number); + #endif arduino_event.event_id = ARDUINO_EVENT_WIFI_SCAN_DONE; memcpy(&arduino_event.event_info.wifi_scan_done, event_data, sizeof(wifi_event_sta_scan_done_t)); @@ -328,24 +340,32 @@ static void _arduino_event_cb(void* arg, esp_event_base_t event_base, int32_t ev log_v("AP Stopped"); arduino_event.event_id = ARDUINO_EVENT_WIFI_AP_STOP; } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_AP_PROBEREQRECVED) { - wifi_event_ap_probe_req_rx_t * event = (wifi_event_ap_probe_req_rx_t*)event_data; - log_v("AP Probe Request: RSSI: %d, MAC: " MACSTR, event->rssi, MAC2STR(event->mac)); - arduino_event.event_id = ARDUINO_EVENT_WIFI_AP_PROBEREQRECVED; + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE + wifi_event_ap_probe_req_rx_t * event = (wifi_event_ap_probe_req_rx_t*)event_data; + log_v("AP Probe Request: RSSI: %d, MAC: " MACSTR, event->rssi, MAC2STR(event->mac)); + #endif + arduino_event.event_id = ARDUINO_EVENT_WIFI_AP_PROBEREQRECVED; memcpy(&arduino_event.event_info.wifi_ap_probereqrecved, event_data, sizeof(wifi_event_ap_probe_req_rx_t)); } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_AP_STACONNECTED) { - wifi_event_ap_staconnected_t* event = (wifi_event_ap_staconnected_t*) event_data; - log_v("AP Station Connected: MAC: " MACSTR ", AID: %d", MAC2STR(event->mac), event->aid); - arduino_event.event_id = ARDUINO_EVENT_WIFI_AP_STACONNECTED; + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE + wifi_event_ap_staconnected_t* event = (wifi_event_ap_staconnected_t*) event_data; + log_v("AP Station Connected: MAC: " MACSTR ", AID: %d", MAC2STR(event->mac), event->aid); + #endif + arduino_event.event_id = ARDUINO_EVENT_WIFI_AP_STACONNECTED; memcpy(&arduino_event.event_info.wifi_ap_staconnected, event_data, sizeof(wifi_event_ap_staconnected_t)); } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_AP_STADISCONNECTED) { - wifi_event_ap_stadisconnected_t* event = (wifi_event_ap_stadisconnected_t*) event_data; - log_v("AP Station Disconnected: MAC: " MACSTR ", AID: %d", MAC2STR(event->mac), event->aid); + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE + wifi_event_ap_stadisconnected_t* event = (wifi_event_ap_stadisconnected_t*) event_data; + log_v("AP Station Disconnected: MAC: " MACSTR ", AID: %d", MAC2STR(event->mac), event->aid); + #endif arduino_event.event_id = ARDUINO_EVENT_WIFI_AP_STADISCONNECTED; memcpy(&arduino_event.event_info.wifi_ap_stadisconnected, event_data, sizeof(wifi_event_ap_stadisconnected_t)); } else if (event_base == IP_EVENT && event_id == IP_EVENT_AP_STAIPASSIGNED) { - ip_event_ap_staipassigned_t * event = (ip_event_ap_staipassigned_t*)event_data; - log_v("AP Station IP Assigned:" IPSTR, IP2STR(&event->ip)); - arduino_event.event_id = ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED; + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE + ip_event_ap_staipassigned_t * event = (ip_event_ap_staipassigned_t*)event_data; + log_v("AP Station IP Assigned:" IPSTR, IP2STR(&event->ip)); + #endif + arduino_event.event_id = ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED; memcpy(&arduino_event.event_info.wifi_ap_staipassigned, event_data, sizeof(ip_event_ap_staipassigned_t)); /* @@ -353,7 +373,6 @@ static void _arduino_event_cb(void* arg, esp_event_base_t event_base, int32_t ev * */ } else if (event_base == ETH_EVENT && event_id == ETHERNET_EVENT_CONNECTED) { log_v("Ethernet Link Up"); - esp_eth_handle_t eth_handle = *(esp_eth_handle_t *)event_data; arduino_event.event_id = ARDUINO_EVENT_ETH_CONNECTED; memcpy(&arduino_event.event_info.eth_connected, event_data, sizeof(esp_eth_handle_t)); } else if (event_base == ETH_EVENT && event_id == ETHERNET_EVENT_DISCONNECTED) { @@ -366,9 +385,11 @@ static void _arduino_event_cb(void* arg, esp_event_base_t event_base, int32_t ev log_v("Ethernet Stopped"); arduino_event.event_id = ARDUINO_EVENT_ETH_STOP; } else if (event_base == IP_EVENT && event_id == IP_EVENT_ETH_GOT_IP) { - ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data; - log_v("Ethernet got %sip:" IPSTR, event->ip_changed?"new":"", IP2STR(&event->ip_info.ip)); - arduino_event.event_id = ARDUINO_EVENT_ETH_GOT_IP; + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE + ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data; + log_v("Ethernet got %sip:" IPSTR, event->ip_changed?"new":"", IP2STR(&event->ip_info.ip)); + #endif + arduino_event.event_id = ARDUINO_EVENT_ETH_GOT_IP; memcpy(&arduino_event.event_info.got_ip, event_data, sizeof(ip_event_got_ip_t)); /* @@ -393,13 +414,11 @@ static void _arduino_event_cb(void* arg, esp_event_base_t event_base, int32_t ev } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_WPS_ER_SUCCESS) { arduino_event.event_id = ARDUINO_EVENT_WPS_ER_SUCCESS; } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_WPS_ER_FAILED) { - wifi_event_sta_wps_fail_reason_t * event = (wifi_event_sta_wps_fail_reason_t*)event_data; arduino_event.event_id = ARDUINO_EVENT_WPS_ER_FAILED; memcpy(&arduino_event.event_info.wps_fail_reason, event_data, sizeof(wifi_event_sta_wps_fail_reason_t)); } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_WPS_ER_TIMEOUT) { arduino_event.event_id = ARDUINO_EVENT_WPS_ER_TIMEOUT; } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_WPS_ER_PIN) { - wifi_event_sta_wps_er_pin_t * event = (wifi_event_sta_wps_er_pin_t*)event_data; arduino_event.event_id = ARDUINO_EVENT_WPS_ER_PIN; memcpy(&arduino_event.event_info.wps_er_pin, event_data, sizeof(wifi_event_sta_wps_er_pin_t)); } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_WPS_ER_PBC_OVERLAP) { @@ -409,7 +428,6 @@ static void _arduino_event_cb(void* arg, esp_event_base_t event_base, int32_t ev * FTM * */ } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_FTM_REPORT) { - wifi_event_ftm_report_t * event = (wifi_event_ftm_report_t*)event_data; arduino_event.event_id = ARDUINO_EVENT_WIFI_FTM_REPORT; memcpy(&arduino_event.event_info.wifi_ftm_report, event_data, sizeof(wifi_event_ftm_report_t)); @@ -424,8 +442,10 @@ static void _arduino_event_cb(void* arg, esp_event_base_t event_base, int32_t ev log_v("SC Found Channel"); arduino_event.event_id = ARDUINO_EVENT_SC_FOUND_CHANNEL; } else if (event_base == SC_EVENT && event_id == SC_EVENT_GOT_SSID_PSWD) { - smartconfig_event_got_ssid_pswd_t *event = (smartconfig_event_got_ssid_pswd_t *)event_data; - log_v("SC: SSID: %s, Password: %s", (const char *)event->ssid, (const char *)event->password); + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR + smartconfig_event_got_ssid_pswd_t *event = (smartconfig_event_got_ssid_pswd_t *)event_data; + log_v("SC: SSID: %s, Password: %s", (const char *)event->ssid, (const char *)event->password); + #endif arduino_event.event_id = ARDUINO_EVENT_SC_GOT_SSID_PSWD; memcpy(&arduino_event.event_info.sc_got_ssid_pswd, event_data, sizeof(smartconfig_event_got_ssid_pswd_t)); @@ -450,13 +470,17 @@ static void _arduino_event_cb(void* arg, esp_event_base_t event_base, int32_t ev wifi_prov_mgr_deinit(); arduino_event.event_id = ARDUINO_EVENT_PROV_END; } else if (event_base == WIFI_PROV_EVENT && event_id == WIFI_PROV_CRED_RECV) { - wifi_sta_config_t *event = (wifi_sta_config_t *)event_data; - log_v("Provisioned Credentials: SSID: %s, Password: %s", (const char *) event->ssid, (const char *) event->password); + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE + wifi_sta_config_t *event = (wifi_sta_config_t *)event_data; + log_v("Provisioned Credentials: SSID: %s, Password: %s", (const char *) event->ssid, (const char *) event->password); + #endif arduino_event.event_id = ARDUINO_EVENT_PROV_CRED_RECV; memcpy(&arduino_event.event_info.prov_cred_recv, event_data, sizeof(wifi_sta_config_t)); } else if (event_base == WIFI_PROV_EVENT && event_id == WIFI_PROV_CRED_FAIL) { - wifi_prov_sta_fail_reason_t *reason = (wifi_prov_sta_fail_reason_t *)event_data; - log_e("Provisioning Failed: Reason : %s", (*reason == WIFI_PROV_STA_AUTH_ERROR)?"Authentication Failed":"AP Not Found"); + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR + wifi_prov_sta_fail_reason_t *reason = (wifi_prov_sta_fail_reason_t *)event_data; + log_e("Provisioning Failed: Reason : %s", (*reason == WIFI_PROV_STA_AUTH_ERROR)?"Authentication Failed":"AP Not Found"); + #endif arduino_event.event_id = ARDUINO_EVENT_PROV_CRED_FAIL; memcpy(&arduino_event.event_info.prov_fail_reason, event_data, sizeof(wifi_prov_sta_fail_reason_t)); } else if (event_base == WIFI_PROV_EVENT && event_id == WIFI_PROV_CRED_SUCCESS) { diff --git a/libraries/WiFi/src/WiFiScan.cpp b/libraries/WiFi/src/WiFiScan.cpp index 5b0c6732a64..f4a32e49a6b 100644 --- a/libraries/WiFi/src/WiFiScan.cpp +++ b/libraries/WiFi/src/WiFiScan.cpp @@ -42,33 +42,6 @@ extern "C" { #include "lwip/err.h" } -static const char * cipher_str(int cipher) -{ - switch (cipher) { - case WIFI_CIPHER_TYPE_NONE: - return ("NONE"); - break; - case WIFI_CIPHER_TYPE_WEP40: - return ("WEP40"); - break; - case WIFI_CIPHER_TYPE_WEP104: - return ("WEP104"); - break; - case WIFI_CIPHER_TYPE_TKIP: - return ("TKIP"); - break; - case WIFI_CIPHER_TYPE_CCMP: - return ("CCMP"); - break; - case WIFI_CIPHER_TYPE_TKIP_CCMP: - return ("TKIP_CCMP"); - break; - default: - break; - } - return ("UNKNOWN"); -} - bool WiFiScanClass::_scanAsync = false; uint32_t WiFiScanClass::_scanStarted = 0; uint32_t WiFiScanClass::_scanTimeout = 10000; diff --git a/libraries/WiFiClientSecure/src/esp_crt_bundle.c b/libraries/WiFiClientSecure/src/esp_crt_bundle.c index 747f86239d5..9a555b218d0 100644 --- a/libraries/WiFiClientSecure/src/esp_crt_bundle.c +++ b/libraries/WiFiClientSecure/src/esp_crt_bundle.c @@ -22,8 +22,6 @@ #define BUNDLE_HEADER_OFFSET 2 #define CRT_HEADER_OFFSET 4 -static const char *TAG = "esp-x509-crt-bundle"; - /* a dummy certificate so that * cacert_ptr passes non-NULL check during handshake */ static mbedtls_x509_crt s_dummy_crt; diff --git a/libraries/WiFiProv/src/WiFiProv.cpp b/libraries/WiFiProv/src/WiFiProv.cpp index e5a7dc21eec..d5a2cb0e4c3 100644 --- a/libraries/WiFiProv/src/WiFiProv.cpp +++ b/libraries/WiFiProv/src/WiFiProv.cpp @@ -66,15 +66,6 @@ static void get_device_service_name(prov_scheme_t prov_scheme, char *service_nam #endif } -static esp_err_t custom_prov_data_handler(uint32_t session_id, const uint8_t *inbuf, ssize_t inlen, uint8_t **outbuf, ssize_t *outlen, void *priv_data){ - if (inbuf) { - log_d("Received data: %.*s", inlen, (char *)inbuf); - } - *outbuf = NULL; - *outlen = 0; - return ESP_OK; -} - void WiFiProvClass :: beginProvision(prov_scheme_t prov_scheme, scheme_handler_t scheme_handler, wifi_prov_security_t security, const char * pop, const char *service_name, const char *service_key, uint8_t * uuid) { bool provisioned = false; diff --git a/libraries/Wire/src/Wire.cpp b/libraries/Wire/src/Wire.cpp index bc06ba5483a..686a3903ee0 100644 --- a/libraries/Wire/src/Wire.cpp +++ b/libraries/Wire/src/Wire.cpp @@ -374,6 +374,9 @@ size_t TwoWire::requestFrom(uint16_t address, size_t size, bool sendStop) rxIndex = 0; rxLength = 0; err = i2cWriteReadNonStop(num, address, txBuffer, txLength, rxBuffer, size, _timeOutMillis, &rxLength); + if(err){ + log_e("i2cWriteReadNonStop returned Error %d", err); + } } else { #if !CONFIG_DISABLE_HAL_LOCKS //acquire lock @@ -385,6 +388,9 @@ size_t TwoWire::requestFrom(uint16_t address, size_t size, bool sendStop) rxIndex = 0; rxLength = 0; err = i2cRead(num, address, rxBuffer, size, _timeOutMillis, &rxLength); + if(err){ + log_e("i2cRead returned Error %d", err); + } } #if !CONFIG_DISABLE_HAL_LOCKS //release lock diff --git a/platform.txt b/platform.txt index 9aec793fb65..239710c135d 100644 --- a/platform.txt +++ b/platform.txt @@ -86,9 +86,9 @@ build.extra_flags.esp32c3=-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT={build. # Compile Flags compiler.cpreprocessor.flags={compiler.cpreprocessor.flags.{build.mcu}} "-I{compiler.sdk.path}/{build.memory_type}/include" -compiler.c.flags={compiler.c.flags.{build.mcu}} -compiler.cpp.flags={compiler.cpp.flags.{build.mcu}} -compiler.S.flags={compiler.S.flags.{build.mcu}} +compiler.c.flags={compiler.c.flags.{build.mcu}} {compiler.warning_flags} +compiler.cpp.flags={compiler.cpp.flags.{build.mcu}} {compiler.warning_flags} +compiler.S.flags={compiler.S.flags.{build.mcu}} {compiler.warning_flags} compiler.c.elf.flags={compiler.c.elf.flags.{build.mcu}} compiler.c.elf.libs={compiler.c.elf.libs.{build.mcu}} compiler.ar.flags={compiler.ar.flags.{build.mcu}}