You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/12/03 21:20:04 UTC

[GitHub] ccollins476ad closed pull request #1545: adding battery polling rate 0 to stop polling

ccollins476ad closed pull request #1545: adding battery polling rate 0 to stop polling
URL: https://github.com/apache/mynewt-core/pull/1545
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/hw/battery/src/battery.c b/hw/battery/src/battery.c
index c8d4fc0a70..e3f2ac306b 100644
--- a/hw/battery/src/battery.c
+++ b/hw/battery/src/battery.c
@@ -487,10 +487,16 @@ battery_set_poll_rate_ms(struct os_dev *battery, uint32_t poll_rate)
 {
     struct battery *bat = (struct battery *)battery;
 
-    if ((poll_rate == 0) || (bat == NULL)) {
+    if (bat == NULL) {
         return -1;
     }
 
+    if (poll_rate == 0) {
+        bat->b_poll_rate = 0;
+        os_callout_stop(&battery_manager.bm_poll_callout);
+        return 0;
+    }
+
     bat->b_poll_rate = poll_rate;
     bat->b_next_run = os_time_get();
     os_callout_reset(&battery_manager.bm_poll_callout, 0);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services