Skip to content

Conversation

@tehmaze
Copy link

@tehmaze tehmaze commented Dec 31, 2025

Fixed some formatting specifier issues, also in Configuration.h an include for <string> appears to be missing.

@coderabbitai
Copy link

coderabbitai bot commented Dec 31, 2025

📝 Walkthrough

Walkthrough

Header Configuration.h now includes the C++ header. UI formatting specifiers were adjusted: GPS changed a baudRate specifier to %u; I2C and power code use fixed-width macros (PRIu32/PRId32) for frequency, voltage, and current formatting. URL utilities replaced sprintf with snprintf for hex-encoding and changed sscanf's format to scan into size_t ("%zx") during decoding. Control flow and public APIs were not modified; changes are limited to format specifiers and a buffer-safety call.

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fixed complier warnings and errors' is related to the changeset, which addresses compiler warnings through formatting specifier corrections and missing includes.
Description check ✅ Passed The description accurately describes the main changes: fixing formatting specifier issues and adding a missing include in Configuration.h.

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65c9049 and b880933.

📒 Files selected for processing (2)
  • Tactility/Source/app/i2csettings/I2cSettings.cpp
  • Tactility/Source/app/power/Power.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • Tactility/Source/app/power/Power.cpp
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: KenVanHoeylandt
Repo: ByteWelder/Tactility PR: 406
File: Buildscripts/CDN/devices.properties:0-0
Timestamp: 2025-11-02T15:49:07.895Z
Learning: In the ByteWelder/Tactility repository, alphabetical ordering issues (such as entries in Buildscripts/CDN/devices.properties) and similar organizational/formatting concerns should be marked as "minor" severity rather than "major" severity.
Learnt from: KenVanHoeylandt
Repo: ByteWelder/Tactility PR: 391
File: Boards/CYD-2432S028RV3/Source/devices/Display.h:11-19
Timestamp: 2025-10-26T12:44:21.858Z
Learning: In the Tactility codebase, prefer `constexpr auto` for constant declarations (such as LCD pin configurations, resolutions, and buffer sizes) rather than explicit type annotations like `gpio_num_t`, `spi_host_device_t`, `uint16_t`, or `size_t`.
📚 Learning: 2025-10-26T12:44:21.858Z
Learnt from: KenVanHoeylandt
Repo: ByteWelder/Tactility PR: 391
File: Boards/CYD-2432S028RV3/Source/devices/Display.h:11-19
Timestamp: 2025-10-26T12:44:21.858Z
Learning: In the Tactility codebase, prefer `constexpr auto` for constant declarations (such as LCD pin configurations, resolutions, and buffer sizes) rather than explicit type annotations like `gpio_num_t`, `spi_host_device_t`, `uint16_t`, or `size_t`.

Applied to files:

  • Tactility/Source/app/i2csettings/I2cSettings.cpp
🔇 Additional comments (1)
Tactility/Source/app/i2csettings/I2cSettings.cpp (1)

69-69: Format specifier correctly updated for platform portability.

The change from %lu to PRIu32 is correct: clk_speed is defined as uint32_t in the I2C configuration structure, and PRIu32 is the appropriate portable format macro. This addresses compiler warnings that could occur on platforms where uint32_t differs from unsigned long.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
Tactility/Source/app/gpssettings/GpsSettings.cpp (1)

126-126: Format specifier fix looks correct.

The change from %lu to %u correctly addresses the format specifier mismatch for baudRate. On ESP32 (32-bit platform), this is the appropriate specifier.

For maximum portability across platforms, consider using PRIu32 from <inttypes.h> if baudRate is uint32_t:

lv_label_set_text_fmt(baud_label, "Baud: %" PRIu32, configuration.baudRate);
Tactility/Source/app/i2csettings/I2cSettings.cpp (1)

69-69: Format specifier fix looks correct.

The change from %lu to %u addresses the format specifier mismatch for clk_speed. This aligns with the ESP32 platform's type definitions.

For maximum portability, if clk_speed is uint32_t, consider using PRIu32 from <inttypes.h>:

lv_label_set_text_fmt(frequency_label, "Frequency: %" PRIu32 " Hz", configuration.config.master.clk_speed);
Tactility/Source/app/power/Power.cpp (2)

117-117: Format specifier fix looks correct.

The change from %lu to %u properly matches the uint32_t type of battery_voltage (line 96) on the ESP32 platform.

For maximum portability, consider using PRIu32 from <inttypes.h>:

lv_label_set_text_fmt(batteryVoltageLabel, "Battery voltage: %" PRIu32 " mV", battery_voltage);

129-129: Format specifier fix looks correct.

The change from %ld to %d properly matches the int32_t type of current (line 89) on the ESP32 platform.

For maximum portability, consider using PRId32 from <inttypes.h>:

lv_label_set_text_fmt(currentLabel, "Current: %" PRId32 " mAh", current);
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between feaeb11 and 65c9049.

📒 Files selected for processing (5)
  • Tactility/Include/Tactility/hal/uart/Configuration.h
  • Tactility/Source/app/gpssettings/GpsSettings.cpp
  • Tactility/Source/app/i2csettings/I2cSettings.cpp
  • Tactility/Source/app/power/Power.cpp
  • Tactility/Source/network/Url.cpp
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: KenVanHoeylandt
Repo: ByteWelder/Tactility PR: 406
File: Buildscripts/CDN/devices.properties:0-0
Timestamp: 2025-11-02T15:49:07.895Z
Learning: In the ByteWelder/Tactility repository, alphabetical ordering issues (such as entries in Buildscripts/CDN/devices.properties) and similar organizational/formatting concerns should be marked as "minor" severity rather than "major" severity.
Learnt from: KenVanHoeylandt
Repo: ByteWelder/Tactility PR: 391
File: Boards/CYD-2432S028RV3/Source/devices/Display.h:11-19
Timestamp: 2025-10-26T12:44:21.858Z
Learning: In the Tactility codebase, prefer `constexpr auto` for constant declarations (such as LCD pin configurations, resolutions, and buffer sizes) rather than explicit type annotations like `gpio_num_t`, `spi_host_device_t`, `uint16_t`, or `size_t`.
📚 Learning: 2025-10-26T12:44:21.858Z
Learnt from: KenVanHoeylandt
Repo: ByteWelder/Tactility PR: 391
File: Boards/CYD-2432S028RV3/Source/devices/Display.h:11-19
Timestamp: 2025-10-26T12:44:21.858Z
Learning: In the Tactility codebase, prefer `constexpr auto` for constant declarations (such as LCD pin configurations, resolutions, and buffer sizes) rather than explicit type annotations like `gpio_num_t`, `spi_host_device_t`, `uint16_t`, or `size_t`.

Applied to files:

  • Tactility/Source/app/i2csettings/I2cSettings.cpp
  • Tactility/Source/app/gpssettings/GpsSettings.cpp
📚 Learning: 2025-10-26T12:40:47.243Z
Learnt from: KenVanHoeylandt
Repo: ByteWelder/Tactility PR: 391
File: Boards/ElecrowCrowpanelAdvance28/Source/devices/Display.cpp:37-43
Timestamp: 2025-10-26T12:40:47.243Z
Learning: The Tactility project uses 80 MHz SPI pixel clock frequency for ST7789 displays, which has been tested and confirmed to work stably on all supported devices (CYD variants, Elecrow CrowPanel, LilyGo, M5Stack, Waveshare boards).

Applied to files:

  • Tactility/Source/app/i2csettings/I2cSettings.cpp
🔇 Additional comments (3)
Tactility/Source/network/Url.cpp (2)

51-51: Excellent safety improvement.

Replacing sprintf with snprintf prevents potential buffer overflow. The buffer size of 10 bytes is sufficient for the format string "%%%02X" (max 3 characters plus null terminator).


72-72: Correct format specifier for size_t.

The change from %x to %zx properly matches the size_t type of conversion_buffer (declared at line 62), fixing a format specifier mismatch that would cause warnings or incorrect behavior on 64-bit platforms.

Tactility/Include/Tactility/hal/uart/Configuration.h (1)

3-3: Necessary include added.

The #include <string> is required for the std::string name member used in both ESP_PLATFORM and non-ESP_PLATFORM configurations. This fixes a missing header compilation error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant