sync up test project

This commit is contained in:
Morgan Allen 2018-09-03 15:35:55 -07:00
parent 7ae44b0083
commit 1641bd2be4
2 changed files with 20 additions and 2 deletions

View file

@ -4,5 +4,6 @@
# #
PROJECT_NAME := wm-test-project PROJECT_NAME := wm-test-project
COMPONENT_ADD_INCLUDEDIRS := main include
include $(IDF_PATH)/make/project.mk include $(IDF_PATH)/make/project.mk

View file

@ -10,6 +10,8 @@
#include "nvs_flash.h" #include "nvs_flash.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp32-wifi-manager.h"
#define TAG "WM-TEST" #define TAG "WM-TEST"
#define BUF_SIZE (1024) #define BUF_SIZE (1024)
#define RD_BUF_SIZE (BUF_SIZE) #define RD_BUF_SIZE (BUF_SIZE)
@ -65,9 +67,13 @@ void loop(void *p) {
ESP_LOGI(TAG, "starting main loop"); ESP_LOGI(TAG, "starting main loop");
while(true) { while(true) {
vTaskDelay(1000 / portTICK_PERIOD_MS); vTaskDelay(5000 / portTICK_PERIOD_MS);
ESP_LOGI(TAG, "main loop"); ESP_LOGI(TAG, "resetting store");
wifi_manager_reset_store();
while(true) {};
} }
} }
@ -77,6 +83,7 @@ void app_main() {
// Initialize NVS. // Initialize NVS.
ret = nvs_flash_init(); ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES) { if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_LOGI(TAG, "Erasing flash memory");
ESP_ERROR_CHECK(nvs_flash_erase()); ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init(); ret = nvs_flash_init();
} }
@ -105,5 +112,15 @@ void app_main() {
ESP_LOGI(TAG, "MAC: %X:%X:%X:%X:%X:%X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); ESP_LOGI(TAG, "MAC: %X:%X:%X:%X:%X:%X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
wifi_manager_load_config();
if(wifi_manager_ap_count() == 0) {
ESP_LOGI(TAG, "Adding new AP");
wifi_manager_add_ap(CONFIG_WIFI_MANAGER_TEST_AP, CONFIG_WIFI_MANAGER_TEST_PWD);
} else {
ESP_LOGI(TAG, "Got AP from store, waiting for connection");
}
xTaskCreate(&loop, "loop", 2048, NULL, 6, NULL); xTaskCreate(&loop, "loop", 2048, NULL, 6, NULL);
}; };