From 2a4d82f4b69ab4f91ba2be1c3d4a3bb8983f5c08 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 8 Nov 2018 14:21:45 +0100 Subject: [PATCH] Add RF calibration on next restart Add RF calibration on next restart --- sonoff/sonoff.ino | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index c4b0cbb20..e8bd64542 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -2176,6 +2176,21 @@ void Every250mSeconds() restart_flag--; if (restart_flag <= 0) { AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING)); + + /* + Function: + Set whether the chip will do RF calibration or not when power up. The option is 0 by default. + Prototype: + void system_phy_set_powerup_option(uint8 option) + Parameter: + uint8 option : RF initialization when power up. + 0 : RF initialization when power up depends on esp_init_data_default.bin(0〜~127byte) byte 114. + 1 : RF initialization only calibrate VDD33 and TX power which will take about 18 ms; this reduces the current consumption. + 2 : RF initialization only calibrate VDD33 which will take about 2 ms; this has the least current consumption. + 3 : RF initialization will do the whole RF calibration which will take about 200 ms; this increases the current consumption. + */ + system_phy_set_powerup_option(3); + EspRestart(); } }