Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce CPU usage at boot time #4233

Merged
merged 2 commits into from
Oct 31, 2018
Merged

Conversation

ascillato
Copy link
Contributor

@ascillato ascillato commented Oct 31, 2018

If many drivers and sensors have been enabled, there is a peak of CPU usage at boot time that it is translated as a peak in power consumption. This address to a wifi connection issue in poor power regulated devices like Sonoff Basic R2. This fix reduces cpu usage making the wifi connection to establish. This don't degrate the actual performance due it is used only at boot time.

Also, it is noticed a faster wifi connection in other devices too.

This POC cames from an idea discussion with @andrethomas of delaying drivers at startup. Thanks for that! 👍

If many drivers has been enabled, there is a peak of CPU usage at boot time that it is translated as a peak in power consumption. This address to a wifi connection issue in poor power regulated devices like Sonoff Basic R2. This fix reduces cpu usage making the wifi connection to establish faster.
@andrethomas
Copy link
Contributor

Interesting, but just to mention - I picked up some wemos boards from banggood which turned out to have either fake or rebranded esp8266 chips on them... marked as Eco Plug on the chip itself. These did not work with the 2.5.0 core due to overheating... with this PR even core 2.5.0 (previously did not work at all) connects to wifi so I think giving the delay(1) is providing more yield() time to the cpu to handle SDK issues in the background resulting in a smoother and faster wifi connect.

@arendst arendst merged commit 5298469 into arendst:development Oct 31, 2018
@ascillato ascillato deleted the patch-1 branch October 31, 2018 19:06
@reloxx13
Copy link
Contributor

reloxx13 commented Nov 4, 2018

maybe this will also help to reduce power/cpu on boot

grafik
(image from pi-hole dns)
tasmota requested ntp time three times at boot at the same second

@arendst
Copy link
Owner

arendst commented Nov 4, 2018

Interesting!

If wifi is connected Tasmota uses the SDK function sntp_get_current_timestamp() once every minute. This function seems to do three requests which is fine if it is only three requests ...

arendst added a commit that referenced this pull request Nov 18, 2018
6.3.0.9 20181118
 * Moved command SetSensorXX to debugging driver freeing user code space
 * Add dynamic delay to main loop providing time for wifi background tasks
 * Remove delays introduced in 6.3.0.1 (#4233)
arendst added a commit that referenced this pull request Nov 20, 2018
6.3.0.11 20181120
 * Add delays removed in 6.3.0.9 (#4233)
 * Allow user definition of defines WIFI_RSSI_THRESHOLD (default 10) and WIFI_RESCAN_MINUTES (default 44)
 * Add support for Fujitsu HVac and IrRemote (#4387)
arendst added a commit that referenced this pull request Nov 22, 2018
6.3.0.12 20181122
 * Remove delays introduced in 6.3.0.11 (#4233)
 * Add additional start-up delay during initial wifi connection
 * Add support for I2C MGC3130 Electric Field Effect sensor by Christian Baars (#3774, #4404)
 * Add initial support for Hass sensor discovery (#4380)
gemu2015 pushed a commit to gemu2015/Sonoff-Tasmota that referenced this pull request Jan 27, 2019
6.3.0.9 20181118
 * Moved command SetSensorXX to debugging driver freeing user code space
 * Add dynamic delay to main loop providing time for wifi background tasks
 * Remove delays introduced in 6.3.0.1 (arendst#4233)
gemu2015 pushed a commit to gemu2015/Sonoff-Tasmota that referenced this pull request Jan 27, 2019
6.3.0.11 20181120
 * Add delays removed in 6.3.0.9 (arendst#4233)
 * Allow user definition of defines WIFI_RSSI_THRESHOLD (default 10) and WIFI_RESCAN_MINUTES (default 44)
 * Add support for Fujitsu HVac and IrRemote (arendst#4387)
gemu2015 pushed a commit to gemu2015/Sonoff-Tasmota that referenced this pull request Jan 27, 2019
6.3.0.12 20181122
 * Remove delays introduced in 6.3.0.11 (arendst#4233)
 * Add additional start-up delay during initial wifi connection
 * Add support for I2C MGC3130 Electric Field Effect sensor by Christian Baars (arendst#3774, arendst#4404)
 * Add initial support for Hass sensor discovery (arendst#4380)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants