InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

Disable heart rate tracking while charging

Open Andersama opened this issue 1 month ago • 11 comments

Verification

  • [x] I searched for similar issues (including closed issues) and found none was relevant.

Introduce the issue

The watch faces appear to be able to indicate when the watch is charging, use that information to disable background and foreground heart rate tracking.

Preferred solution

No response

Version

No response

Andersama avatar Nov 10 '25 00:11 Andersama

I'm not 100% clear on the state machine as of yet, but I'm imagining something like:

    case States::BackgroundMeasuring:
    case States::ForegroundMeasuring:
      if (batteryController.IsCharging()) {
        return portMAX_DELAY;
      }
     return CalculateSleepTicks();

here: https://github.com/InfiniTimeOrg/InfiniTime/blob/99ae2f368bd3f9ca5521d2d04a426addbb00b04b/src/heartratetask/HeartRateTask.cpp#L68

Might be what we're after.

Andersama avatar Nov 11 '25 04:11 Andersama

Alternatively modifying HeartRateTask::Work() would probably make more sense.

Andersama avatar Nov 11 '25 04:11 Andersama

May also make sense to modify the condition inside of HandleSensorData():

if (ambient > 0 || batteryController.IsCharging()) {

Andersama avatar Nov 11 '25 04:11 Andersama

On second look, probably should use IsPowerPresent()

Andersama avatar Nov 11 '25 05:11 Andersama

I've made the changes above, but I'm clearly missing something, the sensor remains active.

Andersama avatar Nov 11 '25 19:11 Andersama

Can this please be optional? 🥺 It would render the watch temporarily inoperable when charging it on the arm (without removing it from the wrist) and create gaps in health statistics. Then there's notifications, alarms, timers etc.

Saarsk avatar Dec 08 '25 22:12 Saarsk

How on earth do you charge the watch on your wrist? Wouldn't you be blocking the heart rate sensor with the charger anyway? 🤔

marigoldfish avatar Dec 08 '25 22:12 marigoldfish

That's only if you use the original unmodified charging puck. 😊 It's just some pogo-pins (or anything conductive, really) that need to make contact.

The watch will be fitted with USB-C when I get the time (I'm between houses for the time being). I'm USB-C-ing everything. No more dongle life.

Everyone has a battery bank in their pocket at all times that that can charge other devices. A battery bank will also sit surprisingly comfortable in my elastic watch strap enabling a 100 % untethered arm operation. 😁 There are also these tiny USB-C batttery banks that could attach right into a USB-C on the side of the watch when that time comes.

Saarsk avatar Dec 08 '25 22:12 Saarsk

If you need modified hardware for the setting to make sense I'm not sure they'd put it in for literally one person to use...

https://xkcd.com/1172/

marigoldfish avatar Dec 08 '25 22:12 marigoldfish

Just the charging puck needs to be modified or swapped.

It's a legitimate use-case, in my opinion. More people should consider it. 🙂 And who knows, suddenly there'll be 3D-printed pucks available or even housing upgrades that integrates a USB-C and a flashlight etc.

If it also affects notifications, timers and such - then it affects 100 % unmodified hardware. Personally, I have my phone on silent and rely on my watch for notification vibration.

Saarsk avatar Dec 08 '25 22:12 Saarsk

@Saarsk I was going to make it optional since I figured someone would have worked out something like that, first I need to figure out how to get it to work properly without bugs. Or rather, I was going to do some smart detection to see if the sensor still kept reading a heart rate...but I've found the data isn't exactly reliable so when I get the thing working, I'll be adding a toggle somewhere.

Andersama avatar Dec 10 '25 07:12 Andersama