diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-06 15:14:18 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-06 15:14:18 +0300 |
| commit | 6acb47f0ee5f80884056fa0243d1ce22213b1911 (patch) | |
| tree | 555e468c3fc70902f1acd38b971364abe91bd885 | |
| parent | 61b5b70c8cb96908309ba2299b7335966d54e420 (diff) | |
add justfile
| -rw-r--r-- | Justfile | 92 | ||||
| -rw-r--r-- | src/c/fastforge.c | 68 |
2 files changed, 129 insertions, 31 deletions
diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..2f5365e --- /dev/null +++ b/Justfile @@ -0,0 +1,92 @@ +# ============================================= +# FastForge – Pebble Intermittent Fasting App +# Justfile for Fedora Linux + Pebble SDK 4.9+ (2026) +# ============================================= + +# Default: show all available commands +default: + @just --list + +# Aliases (shortcuts) +alias b := build +alias i := install +alias d := dev +alias l := logs +alias s := screenshot +alias c := clean +alias k := kill + +# ───────────────────────────────────────────── +# Core development commands +# ───────────────────────────────────────────── + +# Build the app +build: + pebble build + +# Install to the basalt emulator (this also starts the emulator if it's not running) +install: + pebble install --emulator basalt + +# Build + Install (the command you will use most often) +dev: + pebble build && pebble install --emulator basalt + +# Show live logs (run this in a **second** terminal) +logs: + pebble logs + +# Take a screenshot of the emulator +screenshot: + pebble screenshot + +# ───────────────────────────────────────────── +# Emulator control +# ───────────────────────────────────────────── + +# Kill / stop the running emulator (this is the fixed command) +kill: + pebble kill + +# ───────────────────────────────────────────── +# Maintenance commands +# ───────────────────────────────────────────── + +# Clean all build artifacts +clean: + rm -rf build/ *.pbw *.elf *.bin *.map *.o config.log .lock-waf* .wafpickle* + +# Full clean + rebuild + install +rebuild: + just clean + just dev + +# Quick rebuild + install +quick: + just build && just install + +# ───────────────────────────────────────────── +# Debug / Testing helpers +# ───────────────────────────────────────────── + +# Build, install, and remind you to open logs +dev-with-logs: + @echo "✅ Building and installing..." + just dev + @echo "" + @echo "🚀 Now open a second terminal and run: just logs" + +# Show current SDK version +sdk-version: + pebble --version + +# Help / reminder +help: + @echo "FastForge development commands:" + @echo " just dev → build + install (most used)" + @echo " just logs → live logs (second terminal)" + @echo " just kill → stop the emulator" + @echo " just clean → remove build files" + @echo " just rebuild → clean + dev" + @echo "" + @echo "Run 'just' to see all available commands." diff --git a/src/c/fastforge.c b/src/c/fastforge.c index 8db0492..5ffb912 100644 --- a/src/c/fastforge.c +++ b/src/c/fastforge.c @@ -1,60 +1,66 @@ #include <pebble.h> -static Window *s_window; +static Window *s_main_window; static TextLayer *s_text_layer; -static void prv_select_click_handler(ClickRecognizerRef recognizer, void *context) { - text_layer_set_text(s_text_layer, "Select"); -} +// ==================== BUTTON HANDLERS ==================== -static void prv_up_click_handler(ClickRecognizerRef recognizer, void *context) { - text_layer_set_text(s_text_layer, "Up"); +static void select_click_handler(ClickRecognizerRef recognizer, void *context) { + text_layer_set_text(s_text_layer, "Hello!"); + APP_LOG(APP_LOG_LEVEL_INFO, "SELECT pressed - Hello!"); } -static void prv_down_click_handler(ClickRecognizerRef recognizer, void *context) { - text_layer_set_text(s_text_layer, "Down"); +static void down_click_handler(ClickRecognizerRef recognizer, void *context) { + APP_LOG(APP_LOG_LEVEL_INFO, "DOWN pressed - Quitting app..."); + window_stack_pop_all(false); // Cleanly quit the app } -static void prv_click_config_provider(void *context) { - window_single_click_subscribe(BUTTON_ID_SELECT, prv_select_click_handler); - window_single_click_subscribe(BUTTON_ID_UP, prv_up_click_handler); - window_single_click_subscribe(BUTTON_ID_DOWN, prv_down_click_handler); +// ==================== CLICK CONFIG ==================== + +static void click_config_provider(void *context) { + window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler); + window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler); } -static void prv_window_load(Window *window) { +// ==================== WINDOW LOAD / UNLOAD ==================== + +static void window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); GRect bounds = layer_get_bounds(window_layer); - s_text_layer = text_layer_create(GRect(0, 72, bounds.size.w, 20)); - text_layer_set_text(s_text_layer, "Press a button"); + s_text_layer = text_layer_create(GRect(0, 20, bounds.size.w, bounds.size.h - 40)); + text_layer_set_background_color(s_text_layer, GColorClear); + text_layer_set_text_color(s_text_layer, GColorBlack); text_layer_set_text_alignment(s_text_layer, GTextAlignmentCenter); + text_layer_set_font(s_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); + text_layer_set_text(s_text_layer, "Press SELECT\nfor Hello\n\nDOWN to quit"); + layer_add_child(window_layer, text_layer_get_layer(s_text_layer)); } -static void prv_window_unload(Window *window) { +static void window_unload(Window *window) { text_layer_destroy(s_text_layer); } -static void prv_init(void) { - s_window = window_create(); - window_set_click_config_provider(s_window, prv_click_config_provider); - window_set_window_handlers(s_window, (WindowHandlers) { - .load = prv_window_load, - .unload = prv_window_unload, +// ==================== APP INIT / DEINIT ==================== + +static void init(void) { + s_main_window = window_create(); + window_set_click_config_provider(s_main_window, click_config_provider); + window_set_window_handlers(s_main_window, (WindowHandlers) { + .load = window_load, + .unload = window_unload, }); - const bool animated = true; - window_stack_push(s_window, animated); + + window_stack_push(s_main_window, true); } -static void prv_deinit(void) { - window_destroy(s_window); +static void deinit(void) { + window_destroy(s_main_window); } int main(void) { - prv_init(); - - APP_LOG(APP_LOG_LEVEL_DEBUG, "Done initializing, pushed window: %p", s_window); - + init(); app_event_loop(); - prv_deinit(); + deinit(); } |
