Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Ivan Grokhotkov
@igrr
actually, if you don't want to be bothered with flashRead and getting all alignments right, you can simply use memcpy_P to copy stuff from flash to RAM
it will be a bit slower (around 35% slower), but not a deal breaker.
turned out, writing a test case for getSketchSize and getSketchMD5 is not exactly trivial...
Me No Dev
@me-no-dev
:D
how long does it take to calculate the md5?
Ivan Grokhotkov
@igrr
~100ms with flashRead, ~135ms with memcpy_P
that is for a 230k sized sketch
flash read methods are blocking, so you can not actually do calculations while you wait for data to be pulled from flash.
but meh, it's caching result anyway, so it's just 100ms once, not a big deal
Me No Dev
@me-no-dev
maybe not a bad idea to use the code to check the md5 of the new uploaded sketch (instead of checking what came through the network)
currently we do not know if the sketch was written properly
Ivan Grokhotkov
@igrr
yeah, possible entirely, just read stuff back in UpdaterClass::_writeBuffer...
Ivan Grokhotkov
@igrr
i have no idea how to test this though
i.e. how to simulate a case when flash is not written correctly
Me No Dev
@me-no-dev
pick a random address and write something else to it?
how are you testing the flashing now?
write to a file?
Ivan Grokhotkov
@igrr
no i mean i wanted to write a test case for this feature — checking that md5 catches bad flash writes
we don't have one at the moment, so would be good to add it
Me No Dev
@me-no-dev
since it's a test, it does not involve a real ESP right?
Ivan Grokhotkov
@igrr
it does
Me No Dev
@me-no-dev
hmm... then...
Ivan Grokhotkov
@igrr
i think i'm going to take my FPGA board and create a flash chip emulator with a "bad block"
should be fun
Me No Dev
@me-no-dev
:D
so if you OTA a sketch, the md5 is once checked for the incomming data
if you write some random stuff to a random place after that
the following md5 will fail
that only if md5 is checked once the new sketch is written to the flash and not while writing it
or am I getting the totally werong idea of how tests work
Ivan Grokhotkov
@igrr
actually i added flash read back thingie into the Updater, so MD5 is calculated by Updater based on data read from flash.
esp8266/Arduino@0c58dc1
Me No Dev
@me-no-dev
why not use both and know which one failed?
I mean network or write
Ivan Grokhotkov
@igrr
does it matter?
like, does it matter which one failed?
Me No Dev
@me-no-dev
it could... but more for debugging
if you get fails, you will need to add it so you can figure out where to look for issues
it can hint on failing flash blocks also
Ivan Grokhotkov
@igrr
yeah, that can be done basically by comparing the contents of _buffer written and read in _writeBuffer, that will give you info on exact location in flash where this happens
Me No Dev
@me-no-dev
maybe even retry write?
Ivan Grokhotkov
@igrr
if the flash is borked i wouldn't like software to sweep the issue under the rug by doing some retries.
just fail hard and fast
Me No Dev
@me-no-dev
is that the only reason why write would fail?
Ivan Grokhotkov
@igrr
It may also fail due to EMI or bad power supply, but those issues should, IMO, be made as obvious as possible.
Me No Dev
@me-no-dev
ok, hard fail it is :)
Mehrdad K
@mkeyno
hi every one , so sorry for any interrupt, can anyone tell how to catch ip address of client connected to webserver in AP and Station mode ,? is following code correct
ESP8266WebServer server(80);

void handleRoot() {
  Serial.print("this request if from=");Serial.println(server.client().remoteIP());

  server.send(200, "text/html", "<h1>You are connected to slave node</h1>");
}
Hagai Shatz
@hagai-shatz
@everslick and @me-no-dev, why do we have to send 'Content-Disposition: inline; filename='...' with every file that we serve? This is an overhead TMOH and also expose the actual file location in the file system. Sorry I was not following the full discussion on it, but as far as I can read this is not HTTP standard and has some security risks: stackoverflow
Me No Dev
@me-no-dev
@hagai-shatz so it was better before?
@mkeyno if(server.client().localIP() != WiFi. localIP()){ server.send(200, "text/html", "<h1>You are connected to my AP</h1>"); }