Skip to content

Commit 521bae5

Browse files
committed
Fixed GenericModuleMaster command line parsing
1 parent 5f18681 commit 521bae5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

examples/WebPage/WINDOWS_LINUX_DUDP/GenericModuleMaster/GenericModuleMaster/GenericModuleMaster.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
*/
1212

1313
#define MI_USE_SYSTEMTIME
14-
#define DEBUG_PRINT_TIMES
15-
//#define MI_USE_MQTT
1614
#define MASTER_MULTI_TRANSFER
15+
//#define MIMQTT_USE_JSON
16+
17+
#define DEBUG_PRINT_TIMES
18+
//#define DEBUG_PRINT_SETTINGUPDATE_MQTT
1719
//#define DEBUG_PRINT_SETTINGSYNC
1820
//#define MQTT_DEBUGPRINT
19-
//#define MIMQTT_USE_JSON
2021

2122
// We have memory enough, so allow the maximum amount of nodes
2223
#define DUDP_MAX_REMOTE_NODES 255
@@ -71,15 +72,15 @@ void parse_ip_string(const char *ip_string, in_addr &ip) {
7172

7273
int get_ip_and_port(int argc, const char * const argv[], int ix, in_addr &ip, uint16_t &port) {
7374
int start_ix = ix;
74-
if (argc > ix + 1 && !is_switch(argv[ix])) {
75+
if (argc > ix && !is_switch(argv[ix])) {
7576
parse_ip_string(argv[ix], ip);
7677
ix++;
7778
} else {
7879
printf("ERROR: Missing IP address in command line.\n\n");
7980
print_instructions();
8081
exit(3);
8182
}
82-
if (argc > ix + 1 && !is_switch(argv[ix])) {
83+
if (argc > ix && !is_switch(argv[ix])) {
8384
uint16_t p = (uint16_t) atoi(argv[ix]);
8485
if (p > 0 && p < (1 << 16) - 1) port = p; // Valid port specified
8586
else {

0 commit comments

Comments
 (0)