Fix build warnings: guard syncword macros & fix narrowing conversions#221
Merged
Bei-Ji-Quan merged 2 commits intoHelTecAutomation:masterfrom Feb 3, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: Fix build warnings: guard syncword macros & fix narrowing conversions
Summary
This patch fixes compiler warnings observed when building projects that use the Heltec ESP32 Dev-Boards library together with other radio/driver code. The changes are minimal and backwards-compatible:
Guard LORA_MAC_PRIVATE_SYNCWORD and LORA_MAC_PUBLIC_SYNCWORD macros with #ifndef to avoid macro redefinition warnings when different values are defined in other headers (e.g., driver headers). This reduces spurious warnings when the library is included in larger projects.
Add explicit casts to
uint8_tin several spots inHT_st7735.cppto avoid narrowing-conversion warnings on modern compilers with-Wnarrowing.Why
These warnings were seen during builds and are noisy. They come from two sources:
Where
src/loramac/LoRaMac.h- wrap macro definitions in#ifndefguardssrc/driver/sx126x.h- same guard updatessrc/HT_st7735.cpp- add(uint8_t)casts where appropriateTesting
Notes
Suggested commit message
Fix build warnings: guard syncword macros & fix narrowing conversions
Commands to apply the patch locally and create a PR
1) Create a branch
git checkout -b fix/heltec-build-warnings
2) Apply patch (if you saved the patch file as heltec-fixes.patch in the repo root)
git apply heltec-fixes.patch
3) Commit
git add src/loramac/LoRaMac.h src/driver/sx126x.h src/HT_st7735.cpp
git commit -m "Fix build warnings: guard syncword macros & fix narrowing conversions"
4) Push to your fork and open a PR
(Assuming your fork remote is 'origin')
git push -u origin fix/heltec-build-warnings
Then open a PR on GitHub comparing fix/heltec-build-warnings to heltec master/main and paste the PR description above.
If you want, I can prepare a Git branch and push to your fork (requires your fork remote or GitHub token). Otherwise, you're ready to paste the patch and PR text in your fork's PR.