georgerobotics / cyw43-driver

Other
79 stars 42 forks source link

src/cyw43: Improve power-save constants so their names match behaviour. #126

Closed dpgeorge closed 1 day ago

dpgeorge commented 1 month ago

Doing some testing with various power saving modes gives the following:

For all three of the pre-defined constants CYW43_DEFAULT_PM, CYW43_AGGRESSIVE_PM and CYW43_PERFORMANCE_PM, doing a fast ping -i 0.1 <ip> to the cyw43, there's pretty much no difference (they all have low latency). That's because they all use CYW43_PM2_POWERSAVE_MODE and the fast ping is supplying constant traffic over the air and keeping the cyw43 awake.

Doing a standard 1-second interval ping its possible to see the difference between these three pre-defined constants: CYW43_AGGRESSIVE_PM still has low latency, but the other two have very varied ping latency, up to about 200ms (because the cyw43 has gone to sleep and takes time to wake up).

So the names of these three pre-defined constants don't match their behaviour very well, and they aren't very different in their behaviour.

This is fixed in this commit by adjusting the power-save settings so the names of the constants match their behaviour.

Also a new CYW43_NONE_PM has been added.

Note that CYW43_DEFAULT_PM still has exactly the same behaviour as it did prior to this commit.

Fixes issue #122.

peterharperuk commented 1 month ago

Looks good. So this matches with Micropython which I think is a good thing.