From 58382f5f5376ba6ab3832e8606467881089ecf15 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 12 Apr 2026 09:59:46 +0300 Subject: h2: add day-1 fasting data model and persist keys --- src/c/fastforge.c | 8 ++++++++ src/c/fastforge.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/c/fastforge.h (limited to 'src/c') 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 +#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 + +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 -- cgit v1.2.3