2020-02-03 10:01:04 +00:00
|
|
|
/* Wi-Fi iperf Example
|
2017-03-30 15:12:25 +00:00
|
|
|
|
|
|
|
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, this
|
|
|
|
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
|
|
CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "esp_wifi.h"
|
|
|
|
#include "esp_log.h"
|
|
|
|
#include "esp_err.h"
|
2017-10-20 01:52:58 +00:00
|
|
|
#include "nvs_flash.h"
|
2017-03-30 15:12:25 +00:00
|
|
|
#include "esp_console.h"
|
|
|
|
#include "cmd_decl.h"
|
|
|
|
|
|
|
|
void app_main(void)
|
|
|
|
{
|
2017-10-20 01:52:58 +00:00
|
|
|
esp_err_t ret = nvs_flash_init();
|
2018-07-25 15:11:09 +00:00
|
|
|
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
2017-10-20 01:52:58 +00:00
|
|
|
ESP_ERROR_CHECK(nvs_flash_erase());
|
|
|
|
ret = nvs_flash_init();
|
|
|
|
}
|
|
|
|
ESP_ERROR_CHECK( ret );
|
2018-09-20 11:26:14 +00:00
|
|
|
|
2017-03-30 15:12:25 +00:00
|
|
|
initialise_wifi();
|
|
|
|
|
2020-02-03 10:01:04 +00:00
|
|
|
esp_console_repl_config_t repl_config = ESP_CONSOLE_REPL_CONFIG_DEFAULT();
|
|
|
|
repl_config.prompt = "iperf>";
|
|
|
|
// init console REPL
|
|
|
|
ESP_ERROR_CHECK(esp_console_repl_init(&repl_config));
|
2017-03-30 15:12:25 +00:00
|
|
|
/* Register commands */
|
2018-09-20 11:26:14 +00:00
|
|
|
register_system();
|
2017-03-30 15:12:25 +00:00
|
|
|
register_wifi();
|
|
|
|
|
|
|
|
printf("\n ==================================================\n");
|
|
|
|
printf(" | Steps to test WiFi throughput |\n");
|
|
|
|
printf(" | |\n");
|
|
|
|
printf(" | 1. Print 'help' to gain overview of commands |\n");
|
|
|
|
printf(" | 2. Configure device to station or soft-AP |\n");
|
|
|
|
printf(" | 3. Setup WiFi connection |\n");
|
|
|
|
printf(" | 4. Run iperf to test UDP/TCP RX/TX throughput |\n");
|
|
|
|
printf(" | |\n");
|
|
|
|
printf(" =================================================\n\n");
|
|
|
|
|
2020-02-03 10:01:04 +00:00
|
|
|
// start console REPL
|
|
|
|
ESP_ERROR_CHECK(esp_console_repl_start());
|
2017-03-30 15:12:25 +00:00
|
|
|
}
|
|
|
|
|