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

FuelGauge waking up enhancement #2159

Merged
merged 5 commits into from
Jul 21, 2020
Merged

FuelGauge waking up enhancement #2159

merged 5 commits into from
Jul 21, 2020

Conversation

XuGuohui
Copy link
Member

By applying the changes, device can resume from sleep faster if system power manager is enabled.

Example App

#include "Particle.h"

SYSTEM_MODE(MANUAL);

Serial1LogHandler log(115200, LOG_LEVEL_ALL);

void startup() {
    SystemPowerConfiguration conf;
    // conf.feature(SystemPowerFeature::DISABLE);
    System.setPowerConfiguration(conf);
}

STARTUP( startup() );

void setup() {
    System.sleep(SystemSleepConfiguration().mode(SystemSleepMode::STOP).duration(3s));
    LOG(TRACE, "Now: %d", millis());
}

void loop() {
}

Log if system power manager is not enabled:

0000004027 [app] application.cpp:17, setup(): TRACE: Now: 4027

Log if system power manager is enabled:

0000003537 [app] application.cpp:17, setup(): TRACE: Now: 3537


Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation
  • Added to CHANGELOG.md after merging (add links to docs and issues)

HAL_Delay_Milliseconds(500);
if (isRunning()) {
Event ev = Event::Wakeup;
os_queue_put(queue_, (const void*)&ev, CONCURRENT_WAIT_FOREVER, nullptr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done before or combined with update() call. As otherwise the fuelgauge will anyway be accessed in handleUpdate().

@XuGuohui XuGuohui requested a review from avtolstoy July 21, 2020 09:08
@XuGuohui XuGuohui requested a review from avtolstoy July 21, 2020 09:29
@XuGuohui XuGuohui merged commit 3295f5a into develop Jul 21, 2020
@XuGuohui XuGuohui deleted the enhancement/fuelgauge branch July 21, 2020 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants