Skip to content

Commit 34f9c22

Browse files
andyp1perpeterbarker
authored andcommitted
AP_Notify: add AP_NOTIFY_NEOPIXEL_MASK define support
Allow boards to specify a default LED channel mask via AP_NOTIFY_NEOPIXEL_MASK define, enabling NeoPixel output without requiring explicit servo function assignment.
1 parent 34e3dc4 commit 34f9c22

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

libraries/AP_Notify/AP_Notify_config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@
128128
#define AP_NOTIFY_NEOPIXEL_ENABLED AP_NOTIFY_SERIALLED_ENABLED
129129
#endif
130130

131+
#ifndef AP_NOTIFY_NEOPIXEL_MASK
132+
#define AP_NOTIFY_NEOPIXEL_MASK 0
133+
#endif
134+
131135
#ifndef AP_NOTIFY_TONEALARM_ENABLED
132136
#define AP_NOTIFY_TONEALARM_ENABLED 0
133137
#endif

libraries/AP_Notify/NeoPixel.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ uint16_t NeoPixel::init_ports()
5050
mask |= SRV_Channels::get_output_channel_mask(fn);
5151
}
5252

53+
#if AP_NOTIFY_NEOPIXEL_MASK
54+
// Use board-defined default mask if no servo functions assigned
55+
if (mask == 0) {
56+
mask = AP_NOTIFY_NEOPIXEL_MASK;
57+
}
58+
#endif
59+
5360
if (mask == 0) {
5461
return 0;
5562
}

0 commit comments

Comments
 (0)