From 1e04762e3ad316b53618987d2815256c65fb67f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Tue, 10 Sep 2024 15:25:18 +0200 Subject: [PATCH] fix(example): Fix compilation warnings in examples (#10311) * fix(example): Fix compilation warnings in examples * ci(pre-commit): Apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- .../FreeRTOS/BasicMultiThreading/BasicMultiThreading.ino | 6 +++--- libraries/ESP32/examples/HWCDC_Events/ci.json | 5 +++++ .../Legacy_RMT_Driver_Compatible.ino | 2 +- libraries/ESP_SR/examples/Basic/ci.json | 5 +++++ .../examples/DiagnosticsSmokeTest/DiagnosticsSmokeTest.ino | 2 +- libraries/USB/examples/MIDI/MidiInterface/MidiInterface.ino | 2 +- libraries/USB/examples/MIDI/ReceiveMidi/ReceiveMidi.ino | 2 +- .../Update/examples/AWS_S3_OTA_Update/AWS_S3_OTA_Update.ino | 4 ++-- .../HttpAuthCallbackInline/HttpAuthCallbackInline.ino | 4 ++-- 9 files changed, 21 insertions(+), 11 deletions(-) diff --git a/libraries/ESP32/examples/FreeRTOS/BasicMultiThreading/BasicMultiThreading.ino b/libraries/ESP32/examples/FreeRTOS/BasicMultiThreading/BasicMultiThreading.ino index 9e26ca69416..8704568dbeb 100644 --- a/libraries/ESP32/examples/FreeRTOS/BasicMultiThreading/BasicMultiThreading.ino +++ b/libraries/ESP32/examples/FreeRTOS/BasicMultiThreading/BasicMultiThreading.ino @@ -7,9 +7,9 @@ // Please read file README.md in the folder containing this example. #if CONFIG_FREERTOS_UNICORE -#define ARDUINO_RUNNING_CORE 0 +#define TASK_RUNNING_CORE 0 #else -#define ARDUINO_RUNNING_CORE 1 +#define TASK_RUNNING_CORE 1 #endif #define ANALOG_INPUT_PIN A0 @@ -51,7 +51,7 @@ void setup() { , &analog_read_task_handle // With task handle we will be able to manipulate with this task. , - ARDUINO_RUNNING_CORE // Core on which the task will run + TASK_RUNNING_CORE // Core on which the task will run ); Serial.printf("Basic Multi Threading Arduino Example\n"); diff --git a/libraries/ESP32/examples/HWCDC_Events/ci.json b/libraries/ESP32/examples/HWCDC_Events/ci.json index edef5051e09..dbc4c35cbd5 100644 --- a/libraries/ESP32/examples/HWCDC_Events/ci.json +++ b/libraries/ESP32/examples/HWCDC_Events/ci.json @@ -2,5 +2,10 @@ "targets": { "esp32": false, "esp32s2": false + }, + "fqbn": { + "esp32s3": [ + "espressif:esp32:esp32s3:USBMode=hwcdc,PartitionScheme=huge_app,FlashMode=dio" + ] } } diff --git a/libraries/ESP32/examples/RMT/Legacy_RMT_Driver_Compatible/Legacy_RMT_Driver_Compatible.ino b/libraries/ESP32/examples/RMT/Legacy_RMT_Driver_Compatible/Legacy_RMT_Driver_Compatible.ino index f00e1dce92e..5744cf884a7 100644 --- a/libraries/ESP32/examples/RMT/Legacy_RMT_Driver_Compatible/Legacy_RMT_Driver_Compatible.ino +++ b/libraries/ESP32/examples/RMT/Legacy_RMT_Driver_Compatible/Legacy_RMT_Driver_Compatible.ino @@ -10,7 +10,7 @@ #ifndef ESP32_ARDUINO_NO_RGB_BUILTIN // add the file "build_opt.h" to your Arduino project folder with "-DESP32_ARDUINO_NO_RGB_BUILTIN" to use the RMT Legacy driver -#error "ESP32_ARDUINO_NO_RGB_BUILTIN is not defined, this example is intended to demonstrate the RMT Legacy driver. +#error "ESP32_ARDUINO_NO_RGB_BUILTIN is not defined, this example is intended to demonstrate the RMT Legacy driver." #error "Please add the file 'build_opt.h' with '-DESP32_ARDUINO_NO_RGB_BUILTIN' to your Arduino project folder." #error "Another way to disable the RGB_BUILTIN is to define it in the platformio.ini file, for instance: '-D ESP32_ARDUINO_NO_RGB_BUILTIN'" diff --git a/libraries/ESP_SR/examples/Basic/ci.json b/libraries/ESP_SR/examples/Basic/ci.json index 97ae5ee5616..90425f61c02 100644 --- a/libraries/ESP_SR/examples/Basic/ci.json +++ b/libraries/ESP_SR/examples/Basic/ci.json @@ -5,5 +5,10 @@ "esp32c6": false, "esp32h2": false, "esp32s2": false + }, + "fqbn": { + "esp32s3": [ + "espressif:esp32:esp32s3:USBMode=default,PartitionScheme=esp_sr_16,FlashSize=16M,FlashMode=dio" + ] } } diff --git a/libraries/Insights/examples/DiagnosticsSmokeTest/DiagnosticsSmokeTest.ino b/libraries/Insights/examples/DiagnosticsSmokeTest/DiagnosticsSmokeTest.ino index 2178c9bcd17..52019a703b7 100644 --- a/libraries/Insights/examples/DiagnosticsSmokeTest/DiagnosticsSmokeTest.ino +++ b/libraries/Insights/examples/DiagnosticsSmokeTest/DiagnosticsSmokeTest.ino @@ -36,7 +36,7 @@ static void smoke_test() { Insights.event(TAG, "[count][%d]", count); } else { log_e("[count][%d] [crash_count][%" PRIu32 "] [excvaddr][0x0f] Crashing...", count, s_reset_count); - *(int *)0x0F = 0x10; + abort(); } } diff --git a/libraries/USB/examples/MIDI/MidiInterface/MidiInterface.ino b/libraries/USB/examples/MIDI/MidiInterface/MidiInterface.ino index 7088e9b03f0..e3ad1c4e028 100644 --- a/libraries/USB/examples/MIDI/MidiInterface/MidiInterface.ino +++ b/libraries/USB/examples/MIDI/MidiInterface/MidiInterface.ino @@ -50,7 +50,7 @@ void loop() { } // USB MIDI 1.0 to MIDI Serial 1.0 - midiEventPacket_t midi_packet_in = {0}; + midiEventPacket_t midi_packet_in = {0, 0, 0, 0}; // See Chapter 4: USB-MIDI Event Packets (page 16) of the spec. int8_t cin_to_midix_size[16] = {-1, -1, 2, 3, 3, 1, 2, 3, 3, 3, 3, 3, 2, 2, 3, 1}; diff --git a/libraries/USB/examples/MIDI/ReceiveMidi/ReceiveMidi.ino b/libraries/USB/examples/MIDI/ReceiveMidi/ReceiveMidi.ino index 75078d163c8..09a3e2a7b5c 100644 --- a/libraries/USB/examples/MIDI/ReceiveMidi/ReceiveMidi.ino +++ b/libraries/USB/examples/MIDI/ReceiveMidi/ReceiveMidi.ino @@ -28,7 +28,7 @@ void setup() { } void loop() { - midiEventPacket_t midi_packet_in = {0}; + midiEventPacket_t midi_packet_in = {0, 0, 0, 0}; if (MIDI.readPacket(&midi_packet_in)) { printDetails(midi_packet_in); diff --git a/libraries/Update/examples/AWS_S3_OTA_Update/AWS_S3_OTA_Update.ino b/libraries/Update/examples/AWS_S3_OTA_Update/AWS_S3_OTA_Update.ino index c51fcf478bf..08c0a5a9ff0 100644 --- a/libraries/Update/examples/AWS_S3_OTA_Update/AWS_S3_OTA_Update.ino +++ b/libraries/Update/examples/AWS_S3_OTA_Update/AWS_S3_OTA_Update.ino @@ -178,11 +178,11 @@ void execOTA() { // Understand the partitions and // space availability Serial.println("Not enough space to begin OTA"); - client.flush(); + client.clear(); } } else { Serial.println("There was no content in the response"); - client.flush(); + client.clear(); } } diff --git a/libraries/WebServer/examples/HttpAuthCallbackInline/HttpAuthCallbackInline.ino b/libraries/WebServer/examples/HttpAuthCallbackInline/HttpAuthCallbackInline.ino index 48cbaa93dac..3a69f1db413 100644 --- a/libraries/WebServer/examples/HttpAuthCallbackInline/HttpAuthCallbackInline.ino +++ b/libraries/WebServer/examples/HttpAuthCallbackInline/HttpAuthCallbackInline.ino @@ -9,8 +9,8 @@ const char *password = "........"; WebServer server(80); typedef struct credentials_t { - char *username; - char *password; + const char *username; + const char *password; } credentials_t; credentials_t passwdfile[] = {{"admin", "esp32"}, {"fred", "41234123"}, {"charlie", "sdfsd"}, {"alice", "vambdnkuhj"}, {"bob", "svcdbjhws12"}, {NULL, NULL}};