I have multiple ESP8266 units programmed using Arduino SDK and I would like each one of them to adjust the transmission power to lower the power requirements.
Arduino allows setting the TX power of the ESP8266 using the function WiFi.setOutputPower(), however it is not clear to me how to choose that value.
I know that RFM69 using the LowPower library has automatic gain control using the ACK packet sent by another RFM69 module. However, with ESP8266 there is a standard AP and a similar approach would not be obvious.
How can I perform optimal gain control?
This question is independent from the choice of the WiFi mode b/g/n using WiFi.setPhyMode().
Edit
An idea could be to detect AP station signal strength and transmit at a power level offset by a fixed amount, decreasing that delta by one tick at every wake up, until no connection is achievable. At that point the delta should be increased by an amount corresponding to a sort of hysteresis, to jump above the no-connection threshold, and kept.
After a predefined amount of successful wake ups, for example 100, the process of decreasing the calculated delta would be tried again.
For example: AP strength -60 dB, transmission +12 dB: success -> delta 48 dB is good.
Next wake up, delta 48.25 dB: is AP is at -55 dB, transmission would be 55-48.25 dB = 6.75 dB. If success, delta increased to 48.50 dB.