Skip to content

fix all the compiler warnings - #43

Merged
miles-p merged 1 commit into
mainfrom
punch/fix_build_warnings
Aug 4, 2026
Merged

fix all the compiler warnings#43
miles-p merged 1 commit into
mainfrom
punch/fix_build_warnings

Conversation

@miles-p

@miles-p miles-p commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

the compiler warnings irritate me because they mean I have no clue whether the code i'm working on is the thing emitting all the warnings. in theory i'd love to put warnings-as-errors in the CI/CD pipeline but honestly who cares that much. may as well just keep the CI/CD as is. Thanks.

  • Remove duplicate MX_GPIO_Init stub in i2c.c (real one lives in gpio.c)
  • Wrap register-address ORs in imu.cpp with explicit uint8_t cast to
    silence narrowing conversion warnings
  • Rewrite volatile ring-buffer size updates (++/--/+=/-=) as plain
    assignments in Port.hpp/cpp and PacketHandler.hpp; these compound
    forms are deprecated on volatile in C++20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Ready to approve

The changes are narrow, consistent with the stated goal (warning cleanup), and appear behavior-preserving with no new correctness risks identified in the modified regions.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR focuses on eliminating noisy compiler warnings in the NUSense firmware so warning output is more actionable during development, without changing CI behavior or materially altering runtime logic.

Changes:

  • Removes an unused/duplicate MX_GPIO_Init stub from i2c.c (the real GPIO init lives in gpio.c).
  • Adds explicit uint8_t casts around IMU register address bitwise-OR operations to avoid narrowing warnings in brace-initialization.
  • Rewrites compound updates on volatile ring-buffer size fields as plain assignments to avoid C++20 deprecation warnings.
File summaries
File Description
NUSense/Core/Src/usb/PacketHandler.hpp Replaces volatile compound decrements with explicit assignments when consuming bytes from the USB RX ring buffer.
NUSense/Core/Src/uart/Port.hpp Rewrites volatile size++/size-- in the UART ring buffer helpers to avoid deprecated volatile compound operations.
NUSense/Core/Src/uart/Port.cpp Replaces rx_buffer.size += delta with rx_buffer.size = rx_buffer.size + delta in the DMA RX handling path.
NUSense/Core/Src/imu.cpp Wraps register-address ORs with an explicit uint8_t cast to prevent narrowing warnings when forming SPI command packets.
NUSense/Core/Src/i2c.c Deletes the redundant MX_GPIO_Init stub to remove dead code and associated warnings.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

@miles-p

miles-p commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

clanker says yes

clanka please

@ysims ysims left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm. I'd put it in CI tho.

@miles-p
miles-p merged commit 8b96edd into main Aug 4, 2026
2 checks passed
@miles-p
miles-p deleted the punch/fix_build_warnings branch August 4, 2026 04:38
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.

3 participants