Skip to content

Added compiler.warning_flags to platform.txt; fixing #6118 #6596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
299cdad
Added compiler.warning_flags to platform.txt
PilnyTomas Apr 20, 2022
f309f16
Removed unused variables
PilnyTomas Apr 20, 2022
69f4113
Moved uart_dev_t *hw definitions to satisfy compiler warning
PilnyTomas Apr 21, 2022
885016c
Removed unused function in WiFiScan.cpp
PilnyTomas Apr 21, 2022
e6bdde4
Wrapped auth_mode_str in #if...
PilnyTomas Apr 21, 2022
5c3076f
Moved tinyusb_interface_names definition inside function
PilnyTomas Apr 21, 2022
1951652
Removed unused variables from USBHIDKeyboard.cpp
PilnyTomas Apr 21, 2022
a642825
Removed unused variables + vars used only in logs are wrapped
PilnyTomas Apr 21, 2022
1aaa72b
Wrapped tinyusb_interface_names in #if
PilnyTomas Apr 21, 2022
4b1f7ee
Wrapped variable which is used only in log into #if
PilnyTomas Apr 22, 2022
7916004
Removed unused static function
PilnyTomas Apr 22, 2022
06fdaa1
Fixed return variable init and expected value
PilnyTomas Apr 22, 2022
5c67334
Pointer dereference fix in example
PilnyTomas Apr 22, 2022
ec3f189
Enumeration fix
PilnyTomas Apr 22, 2022
80c7621
Added err log messages
PilnyTomas Apr 22, 2022
17763bd
Revert "Enumeration fix"
PilnyTomas Apr 22, 2022
188fef7
Changed data type in example
PilnyTomas Apr 22, 2022
5f2f2e9
Removed unused variable from TouchButtonV2 example
PilnyTomas Apr 22, 2022
e228fb4
Wraped variables in #if; commented unused function
PilnyTomas Apr 22, 2022
fe91b7b
Merge branch 'master' into compiler_flags_fix
PilnyTomas Apr 25, 2022
8808b9d
Wraped variables in #if; commented unused function
PilnyTomas Apr 25, 2022
c7155cf
Fixed issues detected as warnings but treated as errors by CI
PilnyTomas Apr 25, 2022
f3c39a6
Added empty default statement in switch
PilnyTomas Apr 25, 2022
821ee33
Wrapped conditionally used variables
PilnyTomas Apr 25, 2022
a156a47
More wrapping of conditionally used variables
PilnyTomas Apr 25, 2022
c04e00d
Added forgotten colon after default statement
PilnyTomas Apr 25, 2022
a6ae2b8
Fixed RainMaker
PilnyTomas Apr 26, 2022
a2315bf
Conditional variable fix
PilnyTomas Apr 26, 2022
85de184
Conditional variable fix 2
PilnyTomas Apr 26, 2022
59fb92f
Removed unused variable
PilnyTomas Apr 26, 2022
d8865ba
Added defaults in switches
PilnyTomas Apr 26, 2022
23421a6
Merge branch 'master' into compiler_flags_fix
PilnyTomas May 4, 2022
552795f
Added #if around variable used only by log_i
PilnyTomas May 4, 2022
d68c66f
Commented unused functions
PilnyTomas May 4, 2022
95fefe7
Merge branch 'master' into compiler_flags_fix
PilnyTomas May 5, 2022
0115174
Merge branch 'master' into compiler_flags_fix
me-no-dev May 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion cores/esp32/esp32-hal-i2c-slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions cores/esp32/esp32-hal-tinyusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions cores/esp32/esp32-hal-uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions libraries/BluetoothSerial/src/BluetoothSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
76 changes: 61 additions & 15 deletions libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
Expand Down Expand Up @@ -377,26 +385,36 @@ 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
{
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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -592,23 +620,29 @@ 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<dl::detect::result_t> &candidates = s1.infer((uint16_t *)fb->buf, {(int)fb->height, (int)fb->width, 3});
std::list<dl::detect::result_t> &results = s2.infer((uint16_t *)fb->buf, {(int)fb->height, (int)fb->width, 3}, candidates);
#else
std::list<dl::detect::result_t> &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;
rfb.height = fb->height;
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);
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -653,15 +691,21 @@ static esp_err_t stream_handler(httpd_req_t *req)
std::list<dl::detect::result_t> &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);
Expand All @@ -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
}
}
}
Expand Down Expand Up @@ -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;
Expand All @@ -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"
Expand All @@ -743,7 +790,6 @@ static esp_err_t stream_handler(httpd_req_t *req)
enable_led(false);
#endif

last_frame = 0;
return res;
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/ESP32/examples/ResetReason/ResetReason.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ void setup() {
}

void loop() {
static uint32_t count = 0;

if (touch1detected) {
touch1detected = false;
if (touchInterruptGetLastStatus(T1)) {
Expand Down
Loading