diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-12 09:59:46 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-12 09:59:46 +0300 |
| commit | 58382f5f5376ba6ab3832e8606467881089ecf15 (patch) | |
| tree | 839625640c1cd885a19fedb310b7285aa9cd209d | |
| parent | 860b9c1f1d97eec46d42a90dc9bf887233e7218e (diff) | |
h2: add day-1 fasting data model and persist keys
| -rw-r--r-- | src/c/fastforge.c | 8 | ||||
| -rw-r--r-- | src/c/fastforge.h | 30 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/c/fastforge.c b/src/c/fastforge.c index 5ffb912..d248ab8 100644 --- a/src/c/fastforge.c +++ b/src/c/fastforge.c @@ -1,4 +1,12 @@ #include <pebble.h> +#include "fastforge.h" + +FastEntry history[MAX_FASTS]; +int history_count = 0; +FastEntry current_fast = {0}; +uint16_t global_target_minutes = DEFAULT_TARGET_MINUTES; +AppTimer *alarm_timer = NULL; +time_t target_time = 0; static Window *s_main_window; static TextLayer *s_text_layer; diff --git a/src/c/fastforge.h b/src/c/fastforge.h new file mode 100644 index 0000000..1ab5339 --- /dev/null +++ b/src/c/fastforge.h @@ -0,0 +1,30 @@ +#ifndef FASTFORGE_H +#define FASTFORGE_H + +#include <pebble.h> + +typedef struct { + time_t start_time; + time_t end_time; // 0 = currently running + uint16_t target_minutes; + char note[32]; + uint8_t max_stage_reached; // 0=none, 1=12h, 2=18h, 3=24h+ +} FastEntry; + +#define MAX_FASTS 64 +#define DEFAULT_TARGET_MINUTES (16 * 60) + +#define KEY_HISTORY_COUNT 1 +#define KEY_HISTORY_DATA 2 +#define KEY_CURRENT_FAST 3 +#define KEY_TARGET_MIN 4 +#define KEY_STREAK_DATA 5 + +extern FastEntry history[MAX_FASTS]; +extern int history_count; +extern FastEntry current_fast; +extern uint16_t global_target_minutes; +extern AppTimer *alarm_timer; +extern time_t target_time; + +#endif |
