Skip to content

Commit 57667f1

Browse files
authored
ADD: Configurable UPLINK_ENABLED and DOWNLINK_ENABLED in userPrefs.h (#5120)
1 parent 3f1c86f commit 57667f1

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

src/mesh/Channels.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,41 +117,56 @@ void Channels::initDefaultChannel(ChannelIndex chIndex)
117117
static const uint8_t defaultpsk0[] = USERPREFS_CHANNEL_0_PSK;
118118
memcpy(channelSettings.psk.bytes, defaultpsk0, sizeof(defaultpsk0));
119119
channelSettings.psk.size = sizeof(defaultpsk0);
120-
121120
#endif
122121
#ifdef USERPREFS_CHANNEL_0_NAME
123122
strcpy(channelSettings.name, USERPREFS_CHANNEL_0_NAME);
124123
#endif
125124
#ifdef USERPREFS_CHANNEL_0_PRECISION
126125
channelSettings.module_settings.position_precision = USERPREFS_CHANNEL_0_PRECISION;
126+
#endif
127+
#ifdef USERPREFS_CHANNEL_0_UPLINK_ENABLED
128+
channelSettings.uplink_enabled = USERPREFS_CHANNEL_0_UPLINK_ENABLED;
129+
#endif
130+
#ifdef USERPREFS_CHANNEL_0_DOWNLINK_ENABLED
131+
channelSettings.downlink_enabled = USERPREFS_CHANNEL_0_DOWNLINK_ENABLED;
127132
#endif
128133
break;
129134
case 1:
130135
#ifdef USERPREFS_CHANNEL_1_PSK
131136
static const uint8_t defaultpsk1[] = USERPREFS_CHANNEL_1_PSK;
132137
memcpy(channelSettings.psk.bytes, defaultpsk1, sizeof(defaultpsk1));
133138
channelSettings.psk.size = sizeof(defaultpsk1);
134-
135139
#endif
136140
#ifdef USERPREFS_CHANNEL_1_NAME
137141
strcpy(channelSettings.name, USERPREFS_CHANNEL_1_NAME);
138142
#endif
139143
#ifdef USERPREFS_CHANNEL_1_PRECISION
140144
channelSettings.module_settings.position_precision = USERPREFS_CHANNEL_1_PRECISION;
145+
#endif
146+
#ifdef USERPREFS_CHANNEL_1_UPLINK_ENABLED
147+
channelSettings.uplink_enabled = USERPREFS_CHANNEL_1_UPLINK_ENABLED;
148+
#endif
149+
#ifdef USERPREFS_CHANNEL_1_DOWNLINK_ENABLED
150+
channelSettings.downlink_enabled = USERPREFS_CHANNEL_1_DOWNLINK_ENABLED;
141151
#endif
142152
break;
143153
case 2:
144154
#ifdef USERPREFS_CHANNEL_2_PSK
145155
static const uint8_t defaultpsk2[] = USERPREFS_CHANNEL_2_PSK;
146156
memcpy(channelSettings.psk.bytes, defaultpsk2, sizeof(defaultpsk2));
147157
channelSettings.psk.size = sizeof(defaultpsk2);
148-
149158
#endif
150159
#ifdef USERPREFS_CHANNEL_2_NAME
151160
strcpy(channelSettings.name, USERPREFS_CHANNEL_2_NAME);
152161
#endif
153162
#ifdef USERPREFS_CHANNEL_2_PRECISION
154163
channelSettings.module_settings.position_precision = USERPREFS_CHANNEL_2_PRECISION;
164+
#endif
165+
#ifdef USERPREFS_CHANNEL_2_UPLINK_ENABLED
166+
channelSettings.uplink_enabled = USERPREFS_CHANNEL_2_UPLINK_ENABLED;
167+
#endif
168+
#ifdef USERPREFS_CHANNEL_2_DOWNLINK_ENABLED
169+
channelSettings.downlink_enabled = USERPREFS_CHANNEL_2_DOWNLINK_ENABLED;
155170
#endif
156171
break;
157172
default:

userPrefs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
*/
2727
// #define USERPREFS_CHANNEL_0_NAME "DEFCONnect"
2828
// #define USERPREFS_CHANNEL_0_PRECISION 14
29+
// #define USERPREFS_CHANNEL_0_UPLINK_ENABLED true
30+
// #define USERPREFS_CHANNEL_0_DOWNLINK_ENABLED true
2931
/*
3032
#define USERPREFS_CHANNEL_1_PSK \
3133
{ \
@@ -35,6 +37,8 @@
3537
*/
3638
// #define USERPREFS_CHANNEL_1_NAME "REPLACEME"
3739
// #define USERPREFS_CHANNEL_1_PRECISION 14
40+
// #define USERPREFS_CHANNEL_1_UPLINK_ENABLED true
41+
// #define USERPREFS_CHANNEL_1_DOWNLINK_ENABLED true
3842
/*
3943
#define USERPREFS_CHANNEL_2_PSK \
4044
{ \
@@ -44,6 +48,8 @@
4448
*/
4549
// #define USERPREFS_CHANNEL_2_NAME "REPLACEME"
4650
// #define USERPREFS_CHANNEL_2_PRECISION 14
51+
// #define USERPREFS_CHANNEL_2_UPLINK_ENABLED true
52+
// #define USERPREFS_CHANNEL_2_DOWNLINK_ENABLED true
4753

4854
// #define USERPREFS_CONFIG_OWNER_LONG_NAME "My Long Name"
4955
// #define USERPREFS_CONFIG_OWNER_SHORT_NAME "MLN"

0 commit comments

Comments
 (0)