Close

Timing

A project log for Tide Clock in MicroPython

Showing times of upcoming high/low tides using a WiPy and an E-Paper Display to try MicroPython in a project

Stephen BStephen B 03/27/2016 at 21:430 Comments

The WiPy has an RTC, but it needs initialising on boot (and wakeup from deep sleep too) even without power loss, don't know if that's a limitation of the micro or the RTC or Python or what. So we need a time. I put this problem on the TODO pile and started writing the network code, more specifically parsing HTTP headers

HTTP/1.1 200 OK
Date: Sun, 27 Mar 2016 21:36:31 GMT
Server: Apache/2.4.7 (Ubuntu)
Last-Modified: Sun, 27 Mar 2016 21:30:01 GMT
ETag: "94b-52f0e7fb04995"
Accept-Ranges: bytes
Content-Length: 2379
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: image/png
Oh hey, a time! Let's assume it's accurate and use that!

These headers are from Chrome, I worked on HTTP 1.0 rather than take the risk I'd upgrade Apache or tinker with it in the future and find it returning chunked data for some reason which I haven't written support for. I do support keep-alives though, to save valuable milliseconds awake and sending WiFi.

Discussions