Skip to content

Commit 09dc07e

Browse files
converted to enum, but does not compile
1 parent c3d756e commit 09dc07e

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

RemoteIDModule/RemoteIDModule.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,19 +195,19 @@ static const char *check_parse(void)
195195
}
196196
}
197197

198-
if ((serial_number_configured == false) && ((g.region == 2) || (g.region == 3))) {
198+
if ((serial_number_configured == false) && ((g.region == JAPAN) || (g.region == EU))) {
199199
return "BasicID: no Serial Number configured";
200200
}
201201

202-
if ((serial_number_configured == false && session_ID_configured == false) && ((g.region == 0) || (g.region == 1))) {
202+
if ((serial_number_configured == false && session_ID_configured == false) && ((g.region == WORLD) || (g.region == USA))) {
203203
return "BasicID: no Serial Number/Session ID configured.";
204204
}
205205

206-
if ((CAA_registration_ID_configured == false) && (g.region == 2)) {
206+
if ((CAA_registration_ID_configured == false) && (g.region == JAPAN)) {
207207
return "BasicID: no CAA registration ID configured.";
208208
}
209209

210-
if ((strlen(UAS_data.OperatorID.OperatorId) < 1) && (g.region == 3)) { //basic check if the operator field has data. For the EU legislation an additional check could be implemented.
210+
if ((strlen(UAS_data.OperatorID.OperatorId) < USA) && (g.region == EU)) { //basic check if the operator field has data. For the EU legislation an additional check could be implemented.
211211
return "OperatorID: no operator ID configured.";
212212
}
213213

RemoteIDModule/parameters.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,16 @@ class Parameters {
3535
char wifi_ssid[21] = "";
3636
char wifi_password[21] = "ArduRemoteID";
3737
uint8_t wifi_channel = 6;
38-
uint8_t region = 0; // 0 = world, 1 = USA, 2 = Japan, 3 = EU
38+
39+
enum class Region {
40+
WORLD=0,
41+
USA=1,
42+
JAPAN=2,
43+
EU=3,
44+
};
45+
46+
Region region;
47+
3948
struct {
4049
char b64_key[64];
4150
} public_keys[MAX_PUBLIC_KEYS];

0 commit comments

Comments
 (0)