From 967f3230f554cb6d0682eaf1f74878f5f1534f42 Mon Sep 17 00:00:00 2001
From: Josef Gajdusek <atx@atx.name>
Date: Sun, 17 May 2015 11:22:26 +0200
Subject: [PATCH] esp8266: Move initialization to system_init_done_cb

Initializing too early caused some of the API functions (wifi_*) to fail
when called in main.py
---
 esp8266/main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/esp8266/main.c b/esp8266/main.c
index 59b415c1d..95315dae4 100644
--- a/esp8266/main.c
+++ b/esp8266/main.c
@@ -37,6 +37,7 @@
 #include "pyexec.h"
 #include "gccollect.h"
 #include MICROPY_HAL_H
+#include "user_interface.h"
 
 STATIC char heap[16384];
 
@@ -60,13 +61,17 @@ void soft_reset(void) {
     pyexec_event_repl_init();
 }
 
-void user_init(void) {
+void init_done(void) {
     mp_reset();
     mp_hal_stdout_tx_str("\r\n");
     pyexec_event_repl_init();
     uart_task_init();
 }
 
+void user_init(void) {
+    system_init_done_cb(init_done);
+}
+
 mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
     return NULL;
 }
-- 
GitLab