InfiniTimeOrg / InfiniTime

Firmware for Pinetime smartwatch written in C++ and based on FreeRTOS
GNU General Public License v3.0
2.71k stars 928 forks source link

Activity notifications #1675

Open FintasticMan opened 1 year ago

FintasticMan commented 1 year ago

Depends on #1696.

This adds a feature that sends the user a notification if they haven't walked a certain number of steps within the past hour. It works by keeping track of the number of steps every half hour, storing them in a circular buffer. It checks whether difference between the number of steps from the last half hour and the number of steps from an hour before that is lower than the threshold.

The majority of the size increase comes from the settings screen, so if I can make that smaller, that would be good.

I'm not sure if a notification is the best way to handle alerting the user. Suggestions welcome.

github-actions[bot] commented 1 year ago
Build size and comparison to main: Section Size Difference
text 397104B 1324B
data 1020B 24B
bss 63428B 8B
Riksu9000 commented 1 year ago

Actually I was mistaken. This is not quite like a circular buffer. A class that tracks the changes made to a variable, with template parameters specifying the resolution and how much history is stored would be more appropriate for this use case. You would access the value an hour ago through a function that you pass a time point or duration to.