Skip to content

Conversation

@jp-bennett
Copy link
Collaborator

Rename PIN_LED2 to LED_NOTIFICATION for the devices using it for that purpose.
Drop dead and unused defines
General cleanup

@github-actions github-actions bot added the needs-review Needs human review label Jan 29, 2026
@jp-bennett jp-bennett requested a review from thebentern January 29, 2026 18:26
@jp-bennett jp-bennett added the cleanup Code cleanup or refactor label Jan 29, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR continues the variant.h cleanup effort by standardizing LED naming conventions and removing dead code across multiple hardware variants. The main focus is renaming PIN_LED2 to LED_NOTIFICATION for devices using it for notification purposes, and simplifying conditional compilation in core files.

Changes:

  • Renamed PIN_LED2 to LED_NOTIFICATION across 20+ nRF52840 and ESP32S3 variants
  • Removed unused LED definitions and initialization code from variant files
  • Simplified external notification configuration in NodeDB.cpp to use LED_NOTIFICATION macro instead of device-specific conditionals
  • Updated main.cpp to use LED_NOTIFICATION instead of USER_LED
  • Improved LED_STATE_OFF definition in configuration.h to automatically derive from LED_STATE_ON
  • Added variant.cpp files for two variants with early LED initialization

Reviewed changes

Copilot reviewed 59 out of 59 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
variants/stm32/milesight_gs301/variant.cpp Added early init for USER_LED (should use LED_NOTIFICATION)
variants/stm32/milesight_gs301/platformio.ini Added build_src_filter to include variant.cpp
variants/rp2040/rak11310/pins_arduino.h Renamed PIN_LED2 to LED_NOTIFICATION
variants/nrf52840/*/variant.h (20+ files) Renamed PIN_LED2 to LED_BLUE, added LED_NOTIFICATION defines, removed dead LED defines
variants/nrf52840/*/variant.cpp (15 files) Removed PIN_LED2 initialization code
variants/esp32s3/*/variant.h (3 files) Renamed PIN_LED2 to LED_NOTIFICATION
variants/esp32/diy/9m2ibr_aprs_lora_tracker/variant.cpp Added early init for USER_LED (should use LED_NOTIFICATION)
variants/esp32/diy/9m2ibr_aprs_lora_tracker/platformio.ini Added build_src_filter to include variant.cpp
variants/nrf52840/nrf52.ini Updated Adafruit nRF52 framework commit hash
src/mesh/NodeDB.cpp Simplified external notification defaults using LED_NOTIFICATION macro
src/main.cpp Changed USER_LED to LED_NOTIFICATION
src/configuration.h Made LED_STATE_OFF automatically derive from LED_STATE_ON
src/Power.cpp Added LED_NOTIFICATION to shutdown sequence

Comment on lines +6 to +7
pinMode(USER_LED, OUTPUT);
digitalWrite(USER_LED, HIGH ^ LED_STATE_ON);
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The variant.cpp file references USER_LED, but according to the PR changes in main.cpp (line 357-359), USER_LED has been renamed to LED_NOTIFICATION. This variant.cpp should use LED_NOTIFICATION instead for consistency with the rest of the codebase.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These defines were not being used for notifications. I don't know these devices at all, so don't know if they should be or not. May want to keep the name or pick another one. Open to suggestions.

Comment on lines +6 to +7
pinMode(USER_LED, OUTPUT);
digitalWrite(USER_LED, HIGH ^ LED_STATE_ON);
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The variant.cpp file references USER_LED, but according to the PR changes in main.cpp (line 357-359), USER_LED has been renamed to LED_NOTIFICATION. This variant.cpp should use LED_NOTIFICATION instead for consistency with the rest of the codebase.

Suggested change
pinMode(USER_LED, OUTPUT);
digitalWrite(USER_LED, HIGH ^ LED_STATE_ON);
pinMode(LED_NOTIFICATION, OUTPUT);
digitalWrite(LED_NOTIFICATION, HIGH ^ LED_STATE_ON);

Copilot uses AI. Check for mistakes.
@jp-bennett jp-bennett merged commit dbded86 into develop Jan 29, 2026
85 of 86 checks passed
@jp-bennett jp-bennett deleted the LED-cleanup branch January 29, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code cleanup or refactor needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants