jasoncoon / esp32-fastled-webserver

Work in progress ESP32 port of https://github.com/jasoncoon/esp8266-fastled-webserver
GNU General Public License v3.0
197 stars 66 forks source link

Still facing issues with static files #9

Open chrisla23 opened 5 years ago

chrisla23 commented 5 years ago

Hello,

I am still facing issues with the problem mentioned here:

https://github.com/jasoncoon/esp32-fastled-webserver/issues/1

I have tried with both the stock SPIFFS lib and jar file and the modified ones called out in the README.

I'm using Arduino 1.87.

I am able to retrieve the /all as mentioned.

Are there any updates to the steps to make it work?

Thanks,

-Chris

jasoncoon commented 5 years ago

Make sure you're downloading the raw data files for libspiffs.a and esp32fs.jar. GitHub makes it easy to download a web page representing the files, instead of the actual files. I think I've fixed the links in the README so that's less likely now.

Also, I've had some ESP32 boards where I had to upload to SPIFFS multiple times before it finally worked.

chrisla23 commented 5 years ago

I had downloaded them via the zipball.

$ shasum ~/Documents/Arduino/hardware/espressif/esp32/tools/sdk/lib/libspiffs.a

f35d0918a5eda1914054d16bcb08246d0df8008a /Users/chris/Documents/Arduino/hardware/espressif/esp32/tools/sdk/lib/libspiffs.a

$ file ~/Documents/Arduino/hardware/espressif/esp32/tools/sdk/lib/libspiffs.a

/Users/chris/Documents/Arduino/hardware/espressif/esp32/tools/sdk/lib/libspiffs.a: current ar archive

$ shasum ~/Documents/Arduino/tools/ESP32FS/tool/esp32fs.jar

efb55039581b458df6e85c1ba30f67095c15bd29 /Users/chris/Documents/Arduino/tools/ESP32FS/tool/esp32fs.jar

$ file /Users/chris/Documents/Arduino/tools/ESP32FS/tool/esp32fs.jar

/Users/chris/Documents/Arduino/tools/ESP32FS/tool/esp32fs.jar: Zip archive data, at least v1.0 to extract

I've tried several times at this point and tried erasing the board with the espressif windows tool and reflashing it. Writing the spiffs data goes very quickly. I read in one thread that if it were working correctly it should be slower.

Thanks,

-Chris

On Fri, Nov 16, 2018 at 6:28 AM Jason Coon notifications@github.com wrote:

Make sure you're downloading the raw data files for libspiffs.a and esp32fs.jar. GitHub makes it easy to download a web page representing the files, instead of the actual files. I think I've fixed the links in the README so that's less likely now.

Also, I've had some ESP32 boards where I had to upload to SPIFFS multiple times before it finally worked.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jasoncoon/esp32-fastled-webserver/issues/9#issuecomment-439409735, or mute the thread https://github.com/notifications/unsubscribe-auth/ArABagJKZUTPIBbML0TiucfL8kmsovUuks5uvsuDgaJpZM4Yleih .

jasoncoon commented 5 years ago

Huh, the checksum for my libspiffs.a doesn't match that of yours:

shasum ~/Documents/Arduino/hardware/espressif/esp32/tools/sdk/lib/libspiffs.a
c27f3ac780f9dfb86c2f09f6155cde44ecb27d34
jasoncoon commented 5 years ago

Sorry, disregard. I had been testing with another version of that file.

So you don't get any errors while uploading to SPIFFS, but it goes very quickly? Do you see any serial output from the sketch setup mentioning SPIFFS? It should list the contents.

paulmneves commented 5 years ago

Hello,

Confirming that I have this issue as well. By all appearances, it looks like the web server cannot access or serve up the files for whatever reason. I've tried using the libspiffs.a from the 'arduino-esp32' master repo as well as the 'fixed' libspiffs.a and esp32fs.jar files you recommended, neither with any success.

As I am a novice, I have not been terribly successful in debugging this further or resolving it. I would be most pleased if we could come up with a fix soon; I am trying to put some WS2811 strands on my xmas tree.

jasoncoon commented 5 years ago

@paulmneves, I'm copying this here from the email I sent you earlier, for public posterity. :)

Can you compare the SHA1 checksum of the SPIFFS fix files to these?

f35d0918a5eda1914054d16bcb08246d0df8008a  libspiffs.a
efb55039581b458df6e85c1ba30f67095c15bd29  esp32fs.jar

If you're on Windows, here's how you can get them: https://support.microsoft.com/en-us/help/889768/how-to-compute-the-md5-or-sha-1-cryptographic-hash-values-for-a-file

The files should be in the following locations:

\Documents\Arduino\hardware\espressif\esp32\tools\sdk\lib\libspiffs.a
\Documents\Arduino\tools\ESP32FS\tool\esp32fs.jar

If you're on Mac, you can just run:

shasum ~/Documents/Arduino/hardware/espressif/esp32/tools/sdk/lib/libspiffs.a
shasum ~/Documents/Arduino/tools/ESP32FS/tool/esp32fs.jar
paulmneves commented 5 years ago

@jasoncoon, thanks for the quick reply! I am indeed running these versions of these files, as verified with checksum.

This is my hardware: NodeMCU 'ESP-WROOM-32' ESP-32s development board and it is version (1.1) My Arduino IDE is v 1.8.7 on Windows 10 x64

I get no errors or even warnings when uploading the files to SPIFFS, and it takes all of 3-4 seconds to upload the files:

[SPIFFS] address: 2691072
[SPIFFS] port   : COM6
[SPIFFS] speed  : 115200
[SPIFFS] mode   : dio
[SPIFFS] freq   : 40m

esptool.py v2.5.0

Serial port COM6

Connecting........____

Chip is ESP32D0WDQ6 (revision 1)

Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse

MAC: <REDACTED>

Uploading stub...

Running stub...

Stub running...

Configuring flash size...

Auto-detected Flash size: 4MB

Compressed 1503232 bytes to 19179...

Writing at 0x00291000... (50 %)
Writing at 0x00295000... (100 %)
Wrote 1503232 bytes (19179 compressed) at 0x00291000 in 3.7 seconds (effective 3262.6 kbit/s)...

Hash of data verified.

Leaving...

Hard resetting via RTS pin...

and here's the boot up log:

10:02:55.598 -> 
10:02:55.598 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
10:02:55.598 -> configsip: 0, SPIWP:0xee
10:02:55.598 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
10:02:55.632 -> mode:DIO, clock div:2
10:02:55.632 -> load:0x3fff0018,len:4
10:02:55.632 -> load:0x3fff001c,len:928
10:02:55.632 -> ho 0 tail 12 room 4
10:02:55.632 -> load:0x40078000,len:8412
10:02:55.632 -> load:0x40080400,len:5780
10:02:55.632 -> entry 0x40080698
Listing directory: /
  FILE: /css/styles.css  SIZE: 31
10:02:56.180 ->   FILE: /favicon.ico  SIZE: 4286
10:02:56.180 ->   FILE: /images/atom196.png  SIZE: 5469
10:02:56.215 ->   FILE: /index.htm  SIZE: 10733
10:02:56.215 ->   FILE: /js/app.js  SIZE: 13101
Connecting to <REDACTED>
HTTP server started
10:02:57.287 -> Main code running on core 1

10:02:57.426 -> WiFi connected
10:02:57.426 -> IP address: 192.168.1.30
HTTP server started

http:///all - does function, as does controlling FastLED via HTTP_POST calls to http:///fieldValue?name=power&value=0 - as one example.

If I try to pull one of the files directly via URL, I get a HTTP '200' but it immediately closes the connection. I would sure love to see a realtime debug log for the web server...

As a somewhat related aside... I was having MASSIVE and deal-breaking issues driving strands of 50-pixel WS2811 LEDs in parallel or in series (worse this way...) with glitching and flickering and ultimately crashing/freezing of the FastLED animations, requiring a reboot. Changing delays and FPS and IC type had varying effects, but never fixed it completely.

What did fix it was commenting out the code to initialize the web server and wifi. ROCK SOLID STABLE animations after that...

jonnypage-d3 commented 5 years ago

Where do I place these files on a windows install? I can't seem to find the folders referenced anywhere. It seems the install location for the arduino ide and it's associated files is C:\Users\<user>\AppData\Local\Arduino15 but I can't see the subfolders there.

Edit: Found the libspiffs.a folder at

C:\Users\<user>\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\tools\sdk\lib

and the esp32fs.jar folder at

C:\Program Files (x86)\Arduino\tools\ESP32FS\tool

Wonder if it has something to do with the new-ish Arduino IDE Boards Manager?

jasoncoon commented 5 years ago

I think on Windows, they'll go here:

C:\Users\<user>\Documents\Arduino\hardware\espressif\esp32\tools\sdk\lib\libspiffs.a
C:\Users\<user>\Documents\Arduino\tools\ESP32FS\tool\esp32fs.jar

The directories may not already exist, and may need to be created.

jonnypage-d3 commented 5 years ago

I put the files in those locations, but anything after C:\Users\<user>\Documents\Arduino did not exist, so I had to make all the sub directories, telling me that was probably not the correct location. Didn't work regardless, still getting ERR_CONTENT_LENGTH_MISMATCH I'll investigate further.

chrisla23 commented 5 years ago

BTW, still following this although my problems all went away when switched from the HiLetgo Amazon special ESP32 board to the Adafruit version. It would be preferable to have the cheaper generic board work as well, but that seemed to be a factor for me. The cost is always a bit higher, but it sure is worth it often to have LadyAda work through all this BS for you. :)

Thanks,

-Chris

On Thu, Dec 6, 2018 at 9:48 AM Jonathan Page notifications@github.com wrote:

I put the files in those locations, but anything after C:\Users\\Documents\Arduino did not exist, so I had to make all the sub directories, telling me that was probably not the correct location. Didn't work regardless, still getting ERR_CONTENT_LENGTH_MISMATCH I'll investigate further.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jasoncoon/esp32-fastled-webserver/issues/9#issuecomment-444964260, or mute the thread https://github.com/notifications/unsubscribe-auth/ArABamtNS7eRIextRJJa8Sr_kRMrDhGHks5u2VhfgaJpZM4Yleih .

jonnypage-d3 commented 5 years ago

I was able to get it to work by uninstalling the ESP32 board from the board manager and reinstalling it. I've been able to confirm that the correct path for libspiffs.a should be

C:\Users\<user>\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\tools\sdk\lib\

I'm pretty sure the correct location for esp32fs.jar is

<My Documents>\Arduino\tools\ESP32FS\tool\

Strangely, I also have that file in

C:\Program Files (x86)\Arduino\tools\ESP32FS\tool

The Arduino IDE seems to have locked both of them when active, so I'm not sure which location it is actually using for the build.

jonnypage-d3 commented 5 years ago

@chrisla23 I have an aliexpress ESP32 board, specifically this one - Seems to work great within the Arduino ide as a "MH ET LIVE ESP32DevKIT" board (after installing the ESP32 in the board manager)

timbudtwo commented 5 years ago

Also having the same issue. The site cannot be reached. On Macos Mojave, running arduino 1.8.8 Using esp32_devkitc_v4, official silicon, from gridconnect. Also tried using both the espressif webserver.h and ESP8266WebServer.h Also using the samguyer fastled

Tried building with the ESP boards manually installed, and also tried it installing via boards manager. Replaced libspliffs and esp32fs, hashes " efb55039581b458df6e85c1ba30f67095c15bd29 and f35d0918a5eda1914054d16bcb08246d0df8008a.

I'm getting this in the serial output:

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:10088
load:0x40080400,len:6380
entry 0x400806a4
Listing directory: /
  FILE: /favicon.ico  SIZE: 4286
  FILE: /css/styles.css  SIZE: 31
  FILE: /images/atom196.png  SIZE: 5469
  FILE: /js/app.js  SIZE: 13101
  FILE: /index.htm  SIZE: 10733
Hostname: ESP32-d3a4ae30
Connecting to <redacted>
HTTP server started
Main code running on core 1
...........
WiFi connected
IP address: 10.0.1.111
HTTP server started

Using Angry IP Scanner 10.0.1.111 is alive but hostname does not resolve

jasoncoon commented 5 years ago

Does it work via IP instead of hostname? http://10.0.1.111?

Can you post a screenshot of the network tab in Chrome dev tools when trying to load the page?

timbudtwo commented 5 years ago
screen shot 2019-01-22 at 10 11 20 am
jasoncoon commented 5 years ago

Does this return any data? http://10.0.1.111/all

You should see a JSON response like this:

[{"name":"power","label":"Power","type":"Boolean","value":0},{"name":"brightness","label":"Brightness","type":"Number","value":255,"min":1,"max":255},{"name":"pattern","label":"Pattern","type":"Select","value":1,"options":["Pride","Color Waves","Rainbow Twinkles","Snow Twinkles","Cloud Twinkles","Incandescent Twinkles","Retro C9 Twinkles","Red & White Twinkles","Blue & White Twinkles","Red, Green & White Twinkles","Fairy Light Twinkles","Snow 2 Twinkles","Holly Twinkles","Ice Twinkles","Party Twinkles","Forest Twinkles","Lava Twinkles","Fire Twinkles","Cloud 2 Twinkles","Ocean Twinkles","Rainbow","Rainbow With Glitter","Solid Rainbow","Confetti","Sinelon","Beat","Juggle","Fire","Water","Solid Color"]},{"name":"speed","label":"Speed","type":"Number","value":30,"min":1,"max":255},{"name":"autoplay","label":"Autoplay","type":"Section"},{"name":"autoplay","label":"Autoplay","type":"Boolean","value":0},{"name":"autoplayDuration","label":"Autoplay Duration","type":"Number","value":10,"min":0,"max":255},{"name":"solidColor","label":"Solid Color","type":"Section"},{"name":"solidColor","label":"Color","type":"Color","value":"0,0,255"},{"name":"fire","label":"Fire & Water","type":"Section"},{"name":"cooling","label":"Cooling","type":"Number","value":49,"min":0,"max":255},{"name":"sparking","label":"Sparking","type":"Number","value":60,"min":0,"max":255},{"name":"twinkles","label":"Twinkles","type":"Section"},{"name":"twinkleSpeed","label":"Twinkle Speed","type":"Number","value":4,"min":0,"max":8},{"name":"twinkleDensity","label":"Twinkle Density","type":"Number","value":5,"min":0,"max":8}]

timbudtwo commented 5 years ago
This site can’t be reached 10.0.1.111 took too long to respond.
Search Google for all
ERR_CONNECTION_TIMED_OUT
jasoncoon commented 5 years ago

I think that means we're down to basic network troubleshooting then.

Can you ping 10.0.1.111 and/or traceroute 10.0.1.111 or tracert 10.0.1.111? What's the IP address of the computer from which you're trying to access the ESP8266?

timbudtwo commented 5 years ago
PING 10.0.1.111 (10.0.1.111): 56 data bytes
64 bytes from 10.0.1.111: icmp_seq=0 ttl=255 time=13.965 ms
64 bytes from 10.0.1.111: icmp_seq=1 ttl=255 time=95.142 ms
64 bytes from 10.0.1.111: icmp_seq=2 ttl=255 time=12.412 ms
64 bytes from 10.0.1.111: icmp_seq=3 ttl=255 time=366.258 ms
64 bytes from 10.0.1.111: icmp_seq=4 ttl=255 time=159.465 ms
64 bytes from 10.0.1.111: icmp_seq=5 ttl=255 time=77.372 ms
64 bytes from 10.0.1.111: icmp_seq=6 ttl=255 time=20.297 ms

traceroute to 10.0.1.111 (10.0.1.111), 64 hops max, 52 byte packets
 1  10.0.1.111 (10.0.1.111)  241.193 ms  99.743 ms  212.545 ms

Local ip is 10.0.1.125

It is on the esp32 actually, but now I am having trouble getting either working on the esp32 or 8266

I am also getting at least 3 or 4 reboot errors each time I reboot the esp32:

......Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0) Core 0 register dump: PC : 0x400d745d PS : 0x00050034 A0 : 0x40081668 A1 : 0x3ffbe2d0
A2 : 0x00000000 A3 : 0x3ff56000 A4 : 0x00000000 A5 : 0x3ffc2d04
A6 : 0x01000000 A7 : 0x00000001 A8 : 0x00000018 A9 : 0x3ff44030
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x800e865f A13 : 0x3ffbd0b0
A14 : 0x00000000 A15 : 0x3ffbd0df SAR : 0x0000001f EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
Core 0 was running in ISR context: EPC1 : 0x40154f4e EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x400d745d

Backtrace: 0x400d745d:0x3ffbe2d0 0x40081665:0x3ffbe300 0x40154f4b:0x00000000

Core 1 register dump: PC : 0x40154f4e PS : 0x00060434 A0 : 0x800e699a A1 : 0x3ffbd680
A2 : 0x00000000 A3 : 0x00000001 A4 : 0x8008ea88 A5 : 0x3ffb1a10
A6 : 0x00000000 A7 : 0x3ffbd380 A8 : 0x00060023 A9 : 0x3ffbd1f4
A10 : 0x00000000 A11 : 0x00000001 A12 : 0x8008ea88 A13 : 0x3ffb19f0
A14 : 0x00000000 A15 : 0x3ffbd380 SAR : 0x00000000 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000

Backtrace: 0x40154f4e:0x3ffbd680 0x400e6997:0x3ffbd6a0 0x4009074d:0x3ffbd6c0 0x4008e875:0x3ffbd6e0