These are chat archives for esp8266/Arduino

14th
Mar 2016
Lars Englund
@larsenglund
Mar 14 2016 07:57
How do I just build a SPIFFS image (on windows) for uploading OTA?
It doesn't show me the command it runs in the IDE..
Lars Englund
@larsenglund
Mar 14 2016 08:02
If I just run mkspiffs -c data data.bin it creates a much smaller image than the IDE does...
Why would I not want it as small as possible?
Lars Englund
@larsenglund
Mar 14 2016 08:26
Another question :) Why does the examples sometimes use webServer.on("/update", HTTP_POST, [](){ and other times webServer.on("/update", HTTP_POST, [&](){?
The WebUpdate example of the ESP8266WebServer which is essentially the same as the ESP8266HTTPUpdateServer library uses only [] while the latter uses [&]..
Lars Englund
@larsenglund
Mar 14 2016 09:01

And more questions... how do I access POST variables in the upload function? I have this

 webServer.on("/update", HTTP_POST, [](){ 
      webServer.sendHeader("Connection", "close");
      webServer.sendHeader("Access-Control-Allow-Origin", "*");
      webServer.send(200, "text/plain", (Update.hasError())?"FAIL":"OK");
      ESP.restart();
    }, onFileUpload);

and in the beginning of onFileUpload I want to access a user selectable POST argument that describes what kind of file was uploaded but using this webServer.args() returns 0..

The page I send to the user is this
const char* updatePage =
R"(<html><body><form method='POST' action='/update' enctype='multipart/form-data'>
                  <input type='file' name='update'>
                  <input type='checkbox' name='spiffs' value='spiffs'> SPIFFS?
                  <input type='submit' value='Update'>
               </form>
         </body></html>)";
Ivan Grokhotkov
@igrr
Mar 14 2016 09:33
@larsenglund SPIFFS image size must match the flash size configuration selected in the IDE
when you are running mkspiffs -c data data.bin without supplying other arguments, it defaults to 64k flash size
IDE, on the other hand, gets the arguments from boards.txt for the given flash size
Ivan Grokhotkov
@igrr
Mar 14 2016 09:43
Regarding POST arguments, may I suggest you to set Debug Level to WebServer and check out the logs?
I think this may be a limitation, need to check the code in Parsing.cpp
Me No Dev
@me-no-dev
Mar 14 2016 09:45
no need
the file is sent first
so the other post aariables would not be parsed yet
Ivan Grokhotkov
@igrr
Mar 14 2016 09:46
ah okay, that's what i thought.
@larsenglund regarding lambda captures, http://en.cppreference.com/w/cpp/language/lambda is your friend
Lars Englund
@larsenglund
Mar 14 2016 10:13
@igrr @me-no-dev thanks alot!
guess I will have to use different URL:s for fw & spiffs updates then so I can call Update with the right command
Me No Dev
@me-no-dev
Mar 14 2016 10:14
try putting the file at the end of the form
or after the checkbox in your case
another way is to use get param
Lars Englund
@larsenglund
Mar 14 2016 10:18
putting it first didn't help so I'll probably put it in the url one way or the other :)
Me No Dev
@me-no-dev
Mar 14 2016 10:18
that should be done in Parsing then
do not remember how params are added in the core server but the async adds them as it gets them
bidyutper
@bidyutper
Mar 14 2016 11:46
how to wrk with MCP23008 I/O Port Expander or any other I/O expander
Ivan Grokhotkov
@igrr
Mar 14 2016 11:53
Did you try using some library, like https://github.com/adafruit/Adafruit-MCP23008-library ?
bidyutper
@bidyutper
Mar 14 2016 12:00
not yet... just want to learn about it how it works programming & all...
using esp 01
Matteo Lampugnani
@t30
Mar 14 2016 16:05
hi all
marksev1
@marksev1
Mar 14 2016 16:16
anyone of you guys used neopixels with esp8266?
Aditya Tannu
@AdySan
Mar 14 2016 16:19
@marksev1 yes
marksev1
@marksev1
Mar 14 2016 16:23
do you have some links to your code :)
using @Makuna's NeoPixelBus library, I beleive hte interface has changed a bit since I used it
marksev1
@marksev1
Mar 14 2016 16:35
cool