Xerxes3rd / Wifiibo

Application and supporting library to manage amiibos using an ESP8266
67 stars 12 forks source link

Extra files? #8

Closed Cabalist closed 6 years ago

Cabalist commented 6 years ago

Are theses files in data/ used for anything?

mode-css.js.gz mode-html.js.gz mode-javascript.js.gz worker-html.js.gz

Xerxes3rd commented 6 years ago

They're part of the default ESPAsyncWebServer application, and you can use them for generic file management on the device. I think they also provide HTTP firmware flashing capability. It'd be nice to have a file manager that's more integrated into the main page, but these are functional. Everything should work fine without them, though, so they're not required per se (aside from possibly the HTTP firmware update functionality). It might be worthwhile to migrate the HTTP firmware update feature into the main Wifiibo.

Bottom line- they're not required, I'd lean toward keeping them, but not opposed to removing them (and just using the files from the ESPAsyncWebServer if I need them for development/testing).

Cabalist commented 6 years ago

I'll have to do some more looking into ESPAsyncWebServer.

I'll admit I don't see how those files are pulled in. They seemed to be bundled in the examples/ directory of ESPAsyncWebServer which makes me think they are not part of the core. They seem to be part of a code editor example (with file management like you say).

Are they currently being used? I feel dumb even asking that but I am trying to wrap my head around the flow/structure of this implementation.

Xerxes3rd commented 6 years ago

You're pretty much correct- my starting point for Wifiibo was the ESPAsyncWebServer example you mentioned. It's confusing because the main source file (wifiibo.ino) doesn't actually reference the files in the data directory; instead, there's a handler that will attempt to serve you any arbitrary file you request from the SPI flash filesystem (SPIFFS) via HTTP.

By default, the ESP8266 flash is set to 1MB for the firmware and 3MB for flash file system data (I assume PlatformIO partitions the flash the same way?). The typical procedure I use for setting up a new device is to compile & flash from the Arduino IDE, then use the "ESP8266 Sketch Data Upload" feature, which copies everything from the sketch's "data" directory into the flash filesystem portion of the ESP.

So, I guess the answer is "kinda." The files are useful for debugging if you want to see what's actually getting copied to your filesystem; however, I haven't had to pull up the file browser since I've gotten the uploads working reasonably well.

In reality, it's probably fine to remove everything from the data directory, and move amiitool.htm elsewhere (since it gets compiled into the firmware). Any more, when I'm debugging the Javascript frontend, I work from a local copy of amiitool.htm which then connects to the websocket server on the ESP.

Xerxes3rd commented 6 years ago

I went ahead and removed those files, since I couldn't figure out how to use them anymore anyway. I also moved & renamed amiitool.htm and favicon.ico out of the data folder, since they're included via bin2c.