Skip to content

Commit 775fb3c

Browse files
authored
chore: cleanup warnings from components during compilation (#228)
1 parent 9af9ae4 commit 775fb3c

File tree

6 files changed

+25
-16
lines changed

6 files changed

+25
-16
lines changed

components/cli/include/cli.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,17 @@ class Cli : private cli::CliSession {
119119

120120
// Configure UART. Note that REF_TICK is used so that the baud rate remains
121121
// correct while APB frequency is changing in light sleep mode.
122-
const uart_config_t uart_config = {
123-
.baud_rate = baud_rate,
124-
.data_bits = UART_DATA_8_BITS,
125-
.parity = UART_PARITY_DISABLE,
126-
.stop_bits = UART_STOP_BITS_1,
122+
uart_config_t uart_config;
123+
memset(&uart_config, 0, sizeof(uart_config));
124+
uart_config.baud_rate = baud_rate;
125+
uart_config.data_bits = UART_DATA_8_BITS;
126+
uart_config.parity = UART_PARITY_DISABLE;
127+
uart_config.stop_bits = UART_STOP_BITS_1;
127128
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
128-
.source_clk = UART_SCLK_REF_TICK,
129+
uart_config.source_clk = UART_SCLK_REF_TICK;
129130
#else
130-
.source_clk = UART_SCLK_XTAL,
131+
uart_config.source_clk = UART_SCLK_XTAL;
131132
#endif
132-
};
133133
/* Install UART driver for interrupt-driven reads and writes */
134134
ESP_ERROR_CHECK(uart_driver_install(port, 256, 0, 0, NULL, 0));
135135
ESP_ERROR_CHECK(uart_param_config(port, &uart_config));
@@ -214,7 +214,7 @@ class Cli : private cli::CliSession {
214214
setvbuf(stdin, nullptr, _IONBF, 0);
215215

216216
// Register the USB CDC interface
217-
auto err = esp_vfs_register(dev_name.data(), &vfs, NULL);
217+
[[maybe_unused]] auto err = esp_vfs_register(dev_name.data(), &vfs, NULL);
218218

219219
// TODO: this function is mostly untested, so we should probably add some
220220
// error handling here and store the resultant pointers for later use

components/event_manager/src/event_manager.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ bool EventManager::add_publisher(const std::string &topic, const std::string &co
2020
bool EventManager::add_subscriber(const std::string &topic, const std::string &component,
2121
const event_callback_fn &callback,
2222
const size_t stack_size_bytes) {
23-
return add_subscriber(topic, component, callback, {.stack_size_bytes = stack_size_bytes});
23+
return add_subscriber(topic, component, callback,
24+
{.name = "", .stack_size_bytes = stack_size_bytes});
2425
}
2526

2627
bool EventManager::add_subscriber(const std::string &topic, const std::string &component,

components/gfps_service/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ add_definitions(-DNEARBY_FP_RETROACTIVE_PAIRING=1) # not sure what this is...
1818
add_definitions(-DNEARBY_FP_BLE_ONLY=1)
1919
add_definitions(-DNEARBY_FP_PREFER_BLE_BONDING=1)
2020
add_definitions(-DNEARBY_FP_PREFER_LE_TRANSPORT=1)
21+
22+
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-type-limits -Wno-write-strings)

components/gfps_service/include/gfps_service.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ class GfpsService : public espp::BaseComponent {
195195

196196
protected:
197197
static constexpr uint16_t SERVICE_UUID = 0xFE2C;
198-
static constexpr char *MODEL_ID_UUID = "fe2c1233-8366-4814-8eb0-01de32100bea";
199-
static constexpr char *KB_PAIRING_UUID = "fe2c1234-8366-4814-8eb0-01de32100bea";
200-
static constexpr char *PASSKEY_UUID = "fe2c1235-8366-4814-8eb0-01de32100bea";
201-
static constexpr char *ACCOUNT_KEY_UUID = "fe2c1236-8366-4814-8eb0-01de32100bea";
198+
static const std::string MODEL_ID_UUID;
199+
static const std::string KB_PAIRING_UUID;
200+
static const std::string PASSKEY_UUID;
201+
static const std::string ACCOUNT_KEY_UUID;
202202

203203
void make_service(NimBLEServer *server) {
204204
if (service_) {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "gfps_service.hpp"
2+
3+
const std::string espp::GfpsService::MODEL_ID_UUID = "fe2c1233-8366-4814-8eb0-01de32100bea";
4+
const std::string espp::GfpsService::KB_PAIRING_UUID = "fe2c1234-8366-4814-8eb0-01de32100bea";
5+
const std::string espp::GfpsService::PASSKEY_UUID = "fe2c1235-8366-4814-8eb0-01de32100bea";
6+
const std::string espp::GfpsService::ACCOUNT_KEY_UUID = "fe2c1236-8366-4814-8eb0-01de32100bea";

components/led/include/led.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Led : public BaseComponent {
6060
* @brief Initialize the LEDC subsystem according to the configuration.
6161
* @param config The configuration structure for the LEDC subsystem.
6262
*/
63-
explicit Led(const Config &config)
63+
explicit Led(const Config &config) noexcept
6464
: BaseComponent("Led", config.log_level)
6565
, duty_resolution_(config.duty_resolution)
6666
, max_raw_duty_((uint32_t)(std::pow(2, (int)duty_resolution_) - 1))
@@ -77,7 +77,7 @@ class Led : public BaseComponent {
7777
ledc_timer_config(&ledc_timer);
7878

7979
logger_.info("Initializing channels");
80-
for (auto conf : channels_) {
80+
for (const auto &conf : channels_) {
8181
uint32_t actual_duty = std::clamp(conf.duty, 0.0f, 100.0f) * max_raw_duty_ / 100.0f;
8282
ledc_channel_config_t channel_conf;
8383
memset(&channel_conf, 0, sizeof(channel_conf));

0 commit comments

Comments
 (0)