JohnySeven / TWatchSK

TTGO T-Watch 2020 v1 supporting Signal K features for displaying boat data and controlling devices on board.
MIT License
9 stars 1 forks source link

Wifi auto reconnect #57

Closed ba58smith closed 3 years ago

ba58smith commented 3 years ago

See the comments for each commit.

It's ready for some testing if you want to. See the array of retry intervals in wifi.h: float wifi_retry_minutes[WIFI_RETRY_ARRAY_SIZE] = {0.5, 0.6, 0.7, 0.8, 0.7, 0.6, 0.5, 0.4};

I've tested it with 0.1 minute intervals and it works. (But I can't think of a situation in which that short of an interval makes sense.)

Now I will work on reducing the power draw from all the retries - eliminating some of the vibrates and some of the message displays.

JohnySeven commented 3 years ago

Good work @ba58smith like the code and new comments.

What's your next plan? Reduce number of wakeups? Maybe show wifi loss every attempt ÷ 3 == 0 attempt?

Also I was thinking about that we could add disable button in first shown message. The scenario is that I turn off my Wifi when leaving the boat and it would try to reconnect until I disable WiFi. This way I could just click on Disable and it's done.

Maybe we could make Wifi icon in status bar red? As it's in failed state?

These are just things that I see as possible enhancements. No need to implement them.

Thanks!

ba58smith commented 3 years ago

Yes, as you've probably already seen (on Slack), I spent way too much time trying to make some of the messages not vibrate / display. I got it working, but it was way too complicated, I fear. I have already come up with a simpler plan, which I will implement tomorrow.

I love the idea of the Disable Wifi button on the message. I will try to work on that soon. I think it should be on the the "Wifi Can't Connect" message as well as the "Lost connection to wifi" message. In either case, you might want to disable wifi.

If it's easy to turn the wifi icon red when not connected (but supposed to be connected), we should do that. But right now, if wifi is not connected, that icon doesn't show at all. I suppose that's on purpose, and is easy to change.

I was also thinking of changing the top message to "Wifi reconnected after X tries" if in fact it does reconnect. What do you think of that?

ba58smith commented 3 years ago

The basic wifi reconnect is working, and does not eat up the battery. There are still some enhancements to make, which I will put in a new Issue and tackle one at a time. @JohnySeven , please review, and merge if you think it's ready.

JohnySeven commented 3 years ago

Looking good, if you want just merge it. If not I'll do it tomorrow. Thanks for this last piece into puzzle.