mongoose-os-apps / demo-js

A JS-enabled demo Mongoose OS firmware
https://mongoose-os.com
Other
32 stars 24 forks source link

Demo not working with Wemos D1 #1

Closed Hotaman closed 6 years ago

Hotaman commented 6 years ago

I'm using Wemos D1 esp8266-2M w/18650 Lipo module. This is my first attempt to use MongooseOS so I'm going through the quick start. Just installed mos tool v2.2 so everything should be fresh on the release tag (OSX). I had micropython installed and working fine on this module. I did use esptool to do a full erase of the flash before trying out MongooseOS

After flashing the demo-js app to the module I get the following two issues:

Error during boot: [May 25 10:36:20.512] mgos_init Init done, RAM: 51736 total, 41216 free, 40568 min free [May 25 10:36:21.397] LED GPIO: 2 button GPIO: 0 [May 25 10:36:21.408] at init.js:24 [May 25 10:36:21.410] MJS error: [Timer] is not defined [May 25 10:36:21.413] mgos_aws_shadow_init AWS Device Shadow requires MQTT [May 25 10:36:21.430] mongoose_poll New heap free LWM: 27496

No Timer defined so no flashing LED

Second error occurs when setting up WIFI: [May 25 10:37:10.916] Getting configuration... [May 25 10:37:11.490] Setting new configuration... [May 25 10:37:11.775] Saving and rebooting... [May 25 10:37:12.109] mgos_conf_emit_f Error opening file for writing [May 25 10:37:12.115] [May 25 10:37:12.142] Saving and rebooting... [May 25 10:37:12.479] mgos_conf_emit_f Error opening file for writing [May 25 10:37:12.484] [May 25 10:37:12.511] Saving and rebooting... [May 25 10:37:12.845] mgos_conf_emit_f Error opening file for writing [May 25 10:37:12.851] Server Error: {"error":"(-1) error saving config: failed to write file"}

I also tried to edit the init.js file and save it to the device which also gives an error.

File fs/init.js saved. Server Error: {"error":"(400) failed to open file \"init.js\""}

rojer commented 6 years ago

probably runs our of space... we use smalle FS on the Wemos D (128K instead of 256). can you post full boot log?

Hotaman commented 6 years ago

this is what I get after the flash process:

[May 25 10:36:18.776] Booting firmware... [May 25 10:36:18.956] All done! [May 25 10:36:20.465] bcn 0 [May 25 10:36:20.466] del if1 [May 25 10:36:20.467] usl [May 25 10:36:20.467] add if1 [May 25 10:36:20.468] dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1) [May 25 10:36:20.474] bcn 100 [May 25 10:36:20.475] mgos_wifi_dev_ap_set WiFi AP IP: 192.168.4.1/255.255.255.0 gw 192.168.4.1, DHCP range 192.168.4.2 - 192.168.4.100 [May 25 10:36:20.486] mgos_http_server_ini HTTP server started on [80] [May 25 10:36:20.492] mgos_ota_http_client Init done, ota_lib=(null), ota handler 1 [May 25 10:36:20.499] mg_rpc_channel_mqtt 0x3fff1544 esp8266_6E26B5/rpc [May 25 10:36:20.506] mg_rpc_channel_uart 0x3fff18c4 UART0 [May 25 10:36:20.512] mgos_init Init done, RAM: 51736 total, 41216 free, 40568 min free [May 25 10:36:21.397] LED GPIO: 2 button GPIO: 0 [May 25 10:36:21.408] at init.js:24 [May 25 10:36:21.410] MJS error: [Timer] is not defined [May 25 10:36:21.413] mgos_aws_shadow_init AWS Device Shadow requires MQTT [May 25 10:36:21.430] mongoose_poll New heap free LWM: 27496

How do I set it to use small FS with the demo?

Hotaman commented 6 years ago

the results from calling Sys.GetInfo:

{ "app": "demo-js", "fw_version": "1.0", "fw_id": "20180514-130059/???", "mac": "5ECF7F6E26B5", "arch": "esp8266", "uptime": 3666, "ram_size": 51736, "ram_free": 35692, "ram_min_free": 24592, "fs_size": 113201, "fs_free": 1255, "wifi": { "sta_ip": "", "ap_ip": "192.168.4.1", "status": "disconnected", "ssid": "" } }

seems to indicate a 128K FS with 1.2K free

rojer commented 6 years ago

you need to remove stuff from fs. i believe UI has a file manager in it, try removing unused JS APIs.

Hotaman commented 6 years ago

OK, I've had some time to do a little testing on this one. Here are the results so far:

ESP8266-07 module Raw module, custom PCB (1 MB flash): Works as expected!

ESP8266-12 module Huzzah, NodeMCU, etc. (4MB flash): Works as expected!

ESP8266-12 WEMOS D1 MINI with LiPo (2MB flash): Does not work reliably. Mixed results depending on unit used (I have tried 4 different units) Some work once or twice, some don't work at all. I have compiled the Demo-JS project with fewer files on the local FS, this has no effect on behavior. Reflashing after initial device setup (and flash) rarely works (serial port closes). Sometimes I can save an updated file ONCE, then never again. If the demo ran before the file update, it won't after the update. It looks like the local FS gets corrupted. I'm running MicroPython on these modules until I can figure out how to get MongooseOS to run on them. I'm closing this issue since it appears to be specific to this module so perhaps I just got a flaky batch of ESPs.

Arruelah commented 6 years ago

Many people are having this problem, including me, with Windows and Linux, and different boards.

harshitc commented 5 years ago

I am also facing the same issue on nodeMCU v0.9 but it's working like a charm on ESP32 devkit c v2. @rojer