Skip to content

On app cpu #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cores/esp32/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ void initVariant() {}
void init() __attribute__((weak));
void init() {}

void bootWiFi() __attribute__((weak));
void bootWiFi() {}
void startWiFi() __attribute__((weak));
void startWiFi() {}

void initWiFi() __attribute__((weak));
void initWiFi() {}

extern void loop();
extern void setup();
Expand All @@ -18,7 +21,7 @@ void loopTask(void *pvParameters)
bool setup_done = false;
for(;;) {
if(!setup_done) {
bootWiFi();
startWiFi();
setup();
setup_done = true;
}
Expand All @@ -30,6 +33,7 @@ extern "C" void app_main()
{
init();
initVariant();
xTaskCreatePinnedToCore(loopTask, "loopTask", 4096, NULL, 1, NULL, 0);
initWiFi();
xTaskCreatePinnedToCore(loopTask, "loopTask", 4096, NULL, 1, NULL, 1);
}

28 changes: 10 additions & 18 deletions libraries/WiFi/src/WiFiGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,29 +286,21 @@ void wifi_dns_found_callback(const char *name, const ip_addr_t *ipaddr, void *ca
* */
#include "nvs_flash.h"

void bootWiFi()
void initWiFi()
{
esp_err_t err;
wifi_init_config_t cfg;
wifi_mode_t mode = WIFI_MODE_NULL;
bool auto_connect = false;

err = nvs_flash_init();
if (err != ESP_OK) {
log_e("nvs_flash_init fail %d", err);
return;
}

wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
nvs_flash_init();
system_init();
tcpip_adapter_init();
esp_event_loop_init(WiFiGenericClass::_eventCallback, NULL);
esp_wifi_init(&cfg);
}

cfg.event_handler = &esp_event_send;
err = esp_wifi_init(&cfg);
if (err != ESP_OK) {
log_e("esp_wifi_init fail %d\n", err);
return;
}
void startWiFi()
{
esp_err_t err;
wifi_mode_t mode = WIFI_MODE_NULL;
bool auto_connect = false;

err = esp_wifi_start();
if (err != ESP_OK) {
Expand Down