Skip to content

Commit e5e68a9

Browse files
committed
removed cmd line init
1 parent eae96cc commit e5e68a9

File tree

4 files changed

+22
-27
lines changed

4 files changed

+22
-27
lines changed

.vscode/c_cpp_properties.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Win32",
5+
"includePath": [
6+
"${workspaceFolder}/**",
7+
"${workspaceFolder}/mqtt/build/inlcude/**",
8+
"D:\\Projects\\ESP32\\esp-idf\\**"
9+
],
10+
"defines": [
11+
"_DEBUG",
12+
"UNICODE",
13+
"_UNICODE"
14+
],
15+
"compilerPath": "/usr/bin/gcc",
16+
"cStandard": "c11",
17+
"cppStandard": "c++17",
18+
"intelliSenseMode": "clang-x64"
19+
}
20+
],
21+
"version": 4
22+
}

mqtt/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
(See the README.md file in the upper level 'examples' directory for more information about examples.)
33

44
This example connects to the broker URI selected using `make menuconfig` (using mqtt tcp transport) and as a demonstration subscribes/unsubscribes and send a message on certain topic.
5-
Note: If the URI equals `FROM_STDIN` then the broker address is read from stdin upon application startup (used for testing)
65

76
It uses ESP-MQTT library which implements mqtt client to connect to mqtt broker.
87

mqtt/main/app_main.c

-25
Original file line numberDiff line numberDiff line change
@@ -123,31 +123,6 @@ static void mqtt_app_start(void)
123123
// .user_context = (void *)your_context
124124
};
125125

126-
#if CONFIG_BROKER_URL_FROM_STDIN
127-
char line[128];
128-
129-
if (strcmp(mqtt_cfg.uri, "FROM_STDIN") == 0) {
130-
int count = 0;
131-
printf("Please enter url of mqtt broker\n");
132-
while (count < 128) {
133-
int c = fgetc(stdin);
134-
if (c == '\n') {
135-
line[count] = '\0';
136-
break;
137-
} else if (c > 0 && c < 127) {
138-
line[count] = c;
139-
++count;
140-
}
141-
vTaskDelay(10 / portTICK_PERIOD_MS);
142-
}
143-
mqtt_cfg.uri = line;
144-
printf("Broker url: %s\n", line);
145-
} else {
146-
ESP_LOGE(TAG, "Configuration mismatch: wrong broker url");
147-
abort();
148-
}
149-
#endif /* CONFIG_BROKER_URL_FROM_STDIN */
150-
151126
esp_mqtt_client_handle_t client = esp_mqtt_client_init(&mqtt_cfg);
152127
esp_mqtt_client_start(client);
153128
}

mqtt/sdkconfig.defaults

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
CONFIG_BROKER_URL="FROM_STDIN"
21
CONFIG_LOG_DEFAULT_LEVEL_NONE=
32
CONFIG_LOG_DEFAULT_LEVEL_ERROR=
43
CONFIG_LOG_DEFAULT_LEVEL_WARN=

0 commit comments

Comments
 (0)