Where is this battery draining code from? #5977
Replies: 1 comment
-
Posted at 2023-04-15 by user140377 Can you add a list of apps you have installed? Posted at 2023-04-15 by rigrigrig Looks like it's from the Posted at 2023-04-15 by @thyttan Thanks! That certainly looks like it. Posted at 2023-04-17 by @gfwilliams That's interesting - maybe something is trying to repeatedly buzz but with an empty pattern so you don't see it. You could try connecting with the IDE and doing Also, Is it possible you have this option enabled in the App Loader:
If so, it might be worth unchecking that and doing The Minification option seems to have caused a huge amount of issues so far and it wouldn't surprise me if it ended up causing some Posted at 2023-04-17 by @thyttan
When you mention it, I think I did enable minification for one or two app installs. I'm reinstalling now with it disabled to see how that works. Thanks!
I forgot to test this now, I might get to it later if the issue persists. Also, yesterday I removed 'Activity Reminder', and maybe that lessened the number of calls. I also reset the 'Power Manager' log. The new log is attached if it's interesting. Attachments: Posted at 2023-04-25 by @thyttan
That sounds at least somewhat similar to my experience. Could you copy/paste installed apps from the app loader's 'More...' tab? Maybe we can see what apps we have in common to narrow down suspect apps. Posted at 2023-05-08 by @thyttan I uninstalled 'Sleep Log' the other day and so far the battery seem to drop ca 10 % per day - back within reasonable bounds I say. If that continues I will be satisfied. I am under the impression Sleep Log mostly looks at data that the watch provides already, regarding movement, and so shouldn't cause sensors to be used more often then they would otherwise. But I guess the app does many writes to the storage, so that could be what's caused the increased battery consumption? Have anyone else noticed if Sleep Log very noticably impacts battery use? Posted at 2023-05-09 by @gfwilliams
It definitely used to have a massive effect, but at some point I thought there were some changes to improve the situation. The Posted at 2023-05-09 by @thyttan From Sleep Log's README:
So maybe that the hr sensor is used during deep sleep state could cause the app to sip a lot of juice? Posted at 2023-05-10 by @thyttan Over the course of about 7 hours the night to today the battery level dropped from ca 75% to ca 10%. During this time the app 'Podcast Addict Remote' was open.
Posted at 2023-05-11 by @thyttan Tonight the battery dropped from 100 to ca 20%. Podcast Addict Remote was open during this time. When I woke up and I exited the app I received a lot of messages. I haven't looked at the log from Power Manager yet. I'll add an edit here when I do. EDIT: Attached screenshot shows the buzz module seems to be part of the problem again... I didn't notice/wake up from my wrist buzzing though. But I didn't the first time I brought this up in the opening post either. I have tried avoiding minification on upload but the buzz module seems to be minified anyway. Here is the complete deferred log as JSON:
Attachments: Posted at 2023-05-11 by @halemmerich I've had similar problems (empty in a day) and have seen something in the trace logs. Do you have GPS via Gadgetbridge activated on your watch? Your problem with the buzzing code is a bit strange, but even if the CPU ran full tilt for the 6h it would consume under 30mAh or around 15% of the battery charge. Actual buzzing would probably need more power, but you said it wasn't actually buzzing a lot. Posted at 2023-05-12 by @thyttan
Yes, I've enabled that in 'Bangle.js Gadgetbridge' (I think I'm still running my version with some changes that are still waiting to be merged over at GB's repo on codeberg, with bumped android api version and some changes to permission handling).
Would this show up in Power Managers HW log? I didn't see an entry for gps in my log.
I don't believe so at least since it didn't wake me up. Posted at 2023-05-12 by @thyttan A night with the clock face active and, just a little bit of the battery drained and nothing I think is weird in Power Manager logs. Posted at 2023-05-13 by @thyttan Last night I tried with Podcast addict remote open again. The battery dropped from around 70% to around 20%. EDIT: I had disabled "Use phone gps data" option in Gadgetbridge. I had not changed anything with how agpsdata app runs. Attached deferred function calls log and Gadgetbridge battery history graph. Deferred log as JSON:
Attachments: Posted at 2023-05-13 by @thyttan And here I attach the last weeks Gadgetbridge battery log. EDIT: Attachments: Posted at 2023-05-15 by @gfwilliams @halemmerich am I right in thinking that 2 hours solid function execution in 10 hours seems like a lot? I mean the @thyttan Any chance you could connect with the IDE and paste this on the left hand side:
And then maybe leave it connected to the Web IDE? Hopefully any app that calls the buzz module will then not buzz but instead get an exception thrown with a stack trace and what the pattern was. And do you think it's particularly the podcast remote that's doing it? I guess maybe it's forcing hundreds of redraws of the messages widget, and that in turn is calling the Posted at 2023-05-15 by @gfwilliams Looking again at what you have installed, I think this could be Please can you uninstall that and see if it helps matters? Posted at 2023-05-15 by @thyttan
Will do! Posted at 2023-05-15 by @thyttan
I did this the night to today (Fastload Utils was still installed). The battery lost 10% charge from 89% to 79% over about 6.5 hours. Attached is the deferred functions log and battery stats from Gadgetbridge for the last day. Here is deferred functions log as JSON:
Attachments: Posted at 2023-05-15 by @thyttan
Since I didn't have a big battery draw and the logs looked ok when I let the watch sit with the clock face during the night, it seems to me that Podcast Addict Remote does something to trigger this buzz code. But that's of course not a super robust test, maybe it was just a one off and another night the buzz module might show up in the logs even if I let the watch sit with the clock face showing. The app can adjust the volume on the android device and buzzes the bangle as indication with this code:
Does Posted at 2023-05-17 by @gfwilliams
It shouldn't, no - however if gadgetbridge sent something in response, that could potentially cause a buzz. So maybe it's sending updates every second when the music is playing showing the current play position, and then somewhere along the line something responds to that when it shouldn't. It's one of the reasons I gave you that code to run - it would have shown you when and where the buzzing was coming from But please remove Fastload utils. By making apps fast load that were never designed for it, it's likely leaving all kinds of stuff running in the background, which might cause all kinds of problems, which will only show themselves when you've launched certain apps at some point in the past Posted at 2023-05-17 by @halemmerich Slightly off-topic, so I will keep it short:
Apps do not need to be designed for being loaded without a reset, they need to be able to clean up if another app is loaded without reset. Fastload Utils just enables loading every app after one that is able to clean up. There is no (intended) way to fastload with the current version if the currently running app can not clean up. There should not be any stuff accumulating except for bugs in apps regarding clean up. Real reset is still done for leaving nearly every app but clocks and launchers. Edit: Nevertheless removing it as a possible source for errors is what I would do as well. Posted at 2023-05-17 by @thyttan
I did this:
After that I had this setup on my watch:
I then let 'Podcast Addict Remote' be active during the night again and got the following deferred function log (as JSON):
I lost the Gadgetbridge battery logs and don't remember how much the battery had dropped. Attachments: Posted at 2023-05-17 by @thyttan
I ran that and tried some behaviour that buzzes on Podcast Addict Remote (up/down swipes to change volume) to see if it triggered it. But now I look at it a little closer I don't think that is what it would catch. I have now uploaded the buzz module to a file on the watch, named it "buzz". Going to start logging on the watch via 'Settings'->'Utils'->'Debug'. You said earlier:
Which I can do, but that way there's no way to track if the problem stems from the communication with gadgetbridge? But I think that is solved if I enable logging on the bangle and connect to gadgetbridge instead, right? Posted at 2023-05-18 by @gfwilliams
Well, hopefully you'll get a stack trace which will point straight to the You could definitely try and enable logging and see what happens - there is even logging in Gadgetbridge itself (or you obviously have Android Studio set up so you could look at logcat to see what's being sent). I think if you're looking at the Gadgetbridge logcat while using Podcast Addict and you're seeing a bunch of data transferred to the Bangle, that could be a good step to see what's going wrong. If you can isolate the Posted at 2023-05-18 by @thyttan Ok, thanks for all help! I shall see what I can find out 🙂 Posted at 2023-05-18 by @thyttan Attached is output from to the Web IDE after having had it connected to my bangle for a couple of hours today. Podcast Addict Remote was open on the watch during that time. The error message from EDIT:
I'll do that next. Attachments: Posted at 2023-05-29 by @thyttan
I tried this once, but for some reason somewhere along the way the watch was disconnected from the web ide where I was checking for the error message. So that time it didn't yield to much. Tonight I had the battery fall of a cliff once again when Podcast Addict was active (Fastload utils not installed). Unfortunately I only have the gadgetbridge battery graph and nothing else. But I'll try connecting it to the web ide as suggested again. Attachments: Posted at 2023-05-29 by @halemmerich I think battery falling like that can only be either a horribly wrong value for the battery calibration (and relatively low charge being shown as full) or GPS being active. There is just no hardware taking that much power besides full power backlight, but I suspect you would have seen that at some point. Do you have Posted at 2023-05-29 by @thyttan
I don't have it installed now. I did have it installed before I removed it as part of this process some time ago: https://forum.espruino.com/conversations/385629/#16983079 Posted at 2023-06-03 by @thyttan
Now I've tried twice with this setup:
But the connection between App Loader and Web IDE is soon lost. I'll try this once more I think, or I'll try adding in Android Studios logcat in the mix as suggested as well. Posted at 2023-06-04 by @thyttan
I did this again and this time closer to my wifi router, the connection held much better. Also connected the Android Studio logcat. During the ca 2 hours I had it running now the bug didn't occur though. The buzz module code doesn't show in the Deferred Function Calls table either. Will try again at a later time. Posted at 2023-06-05 by @gfwilliams I had some odd issue a week or so ago where my Bangle lost a bunch of charge very quickly (I woke up and found it almost flat and on the messages list screen) and I was pretty sure that in that case the backlight had got stuck on. So it's definitely worth checking to see if podcast addict keeps the screen on - if it's constantly getting notifications from Gadgetbridge I guess it may well be keeping it on? Posted at 2023-06-07 by @thyttan During waking hours the other day I noticed the messagesgui was open and didn't time out to the clock face. The screen was locked and lcd backlight off - could be unlocked and backlight turned on with hw button press. My experience was that this state had a high draw of the batter for some reason - even though it feels unwarranted (the watch was just sitting on one of the messages - shouldn't be very battery intensive..). Posted at 2023-06-08 by @gfwilliams Hmm, that's an odd one. I just tried here on a power meter, and the power draw when displaying a message was 2.5mA, where normally you'd expect 0.25mA And actually opening a message then going back to the messages list raised it slightly - by 2.5mA each time! I've just had a look at timers and it would appear to be something related to the buzz pattern, which we have seen in logs before. I'll try and have a look at it later tonight - it's good I can reproduce Posted at 2023-06-08 by @gfwilliams Fixed it! espruino/BangleApps@2b6f776 If you update messages now it should pull in the new buzz, which will fix the power draw at least for the messages app. I'm not sure if it'll help with podcast remote, but it may Posted at 2023-06-08 by @thyttan Nice, will do - thanks! Actually I don't think podcast addict remote utilizes the buzz module. I suspect it has been messagesgui all along, if that makes sense. But I'll see. Posted at 2023-06-08 by @gfwilliams If you're fastloading apps it would have made the problem miles worse as well - just because the timeouts would keep piling up. ... and all because I forgot a Posted at 2023-06-08 by @thyttan I haven't used fastload utils in a while now. I think I remember messages will buzz 'under' podcast addict remote, but not display messagesgui (I haven't disabled auto-open). And I think this happens whether I have fastload utils installed or not. But don't read too much into this, it's not fresh in my mind. Edit: But I get the feeling this might be the expected behaviour and auto-open should only happen on a clock face. Posted at 2023-06-09 by @gfwilliams
Yes, I think that's right |
Beta Was this translation helpful? Give feedback.
-
Posted at 2023-04-15 by @thyttan
Hi,
I've had my Bangle 2 draining it's battery in about 1-2 days the last couple of weeks.
With the help of the logging feature in Power Manager (thanks @halemmerich!) I've identified a "deferred function call" that's likely to blame, in my understanding. Power Manager says the function in question is responsible for 99% of deferred function calls.
Now, I've tried to identify where the code is located, but haven't found it. I've searched the Espruino organization on github. I've downloaded a backup of my watch and used neovim + telescope "live_grep" feature to locate. Both without success.
Here's the log entry from
powermanager.def.json
:If anyone recognize the function snippet from the log above it would be a huge help. Since it seems minimized it's proven tricky to me...
A screenshot from Power Manager's "download data from app" app loader screen is attached.
Steps I've not yet taken:
EDIT, installed apps:
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions