From 960536975064047ce6f11abc3b82ef3a636adfa9 Mon Sep 17 00:00:00 2001 From: John Malone Date: Wed, 27 May 2026 05:00:20 -0500 Subject: [PATCH 01/24] feat: add ship receipts app shell --- .../main/apps/app_ship_receipts/README.md | 39 ++++++++ .../app_ship_receipts/app_ship_receipts.cpp | 92 +++++++++++++++++++ .../app_ship_receipts/app_ship_receipts.h | 39 ++++++++ firmware/main/apps/apps.h | 1 + firmware/main/main.cpp | 1 + 5 files changed, 172 insertions(+) create mode 100644 firmware/main/apps/app_ship_receipts/README.md create mode 100644 firmware/main/apps/app_ship_receipts/app_ship_receipts.cpp create mode 100644 firmware/main/apps/app_ship_receipts/app_ship_receipts.h diff --git a/firmware/main/apps/app_ship_receipts/README.md b/firmware/main/apps/app_ship_receipts/README.md new file mode 100644 index 00000000..54cce64c --- /dev/null +++ b/firmware/main/apps/app_ship_receipts/README.md @@ -0,0 +1,39 @@ +# Ship Receipts app shell + +This directory is the first explicit app boundary for integrating `ship-receipts` +with StackChan. + +## Intent + +`ship-receipts` should be an **app on top of StackChan core**, not logic wired +into generic firmware subsystems. + +That means: + +- keep **transport**, **motion**, **audio**, **diagnostics**, and **renderer + primitives** in StackChan core +- keep **mode/content logic**, **copy**, **scene sequencing**, and + `ship-receipts` semantics in this app layer + +## Why this matters + +This split gives us: + +- a clean place to build host-driven game modes +- better odds of upstreaming generic capabilities later +- less pressure to turn StackChan core into a `ship-receipts`-specific product + +## What belongs here later + +- host scene packet consumers for Ship Receipts modes +- Odyssey / Heike / future mode selection +- app-local diagnostics relevant to Ship Receipts mode +- branding and copy specific to this app + +## What should stay out + +- generic servo transport code +- generic audio plumbing +- generic small-screen layout helpers +- generic packet logging / debugging + diff --git a/firmware/main/apps/app_ship_receipts/app_ship_receipts.cpp b/firmware/main/apps/app_ship_receipts/app_ship_receipts.cpp new file mode 100644 index 00000000..f6093f35 --- /dev/null +++ b/firmware/main/apps/app_ship_receipts/app_ship_receipts.cpp @@ -0,0 +1,92 @@ +/* + * SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD + * + * SPDX-License-Identifier: MIT + */ +#include "app_ship_receipts.h" +#include +#include +#include + +using namespace mooncake; +using namespace smooth_ui_toolkit::lvgl_cpp; + +AppShipReceipts::AppShipReceipts() +{ + setAppInfo().name = "SHIP.RECEIPTS"; + + static uint32_t theme_color = 0x4A79E8; + setAppInfo().userData = (void*)&theme_color; +} + +void AppShipReceipts::onCreate() +{ + mclog::tagInfo(getAppInfo().name, "on create"); +} + +void AppShipReceipts::onOpen() +{ + mclog::tagInfo(getAppInfo().name, "on open"); + + LvglLockGuard lock; + + _panel = std::make_unique(lv_screen_active()); + _panel->setSize(320, 240); + _panel->setAlign(LV_ALIGN_CENTER); + _panel->setBorderWidth(0); + _panel->setRadius(0); + _panel->setPaddingAll(0); + _panel->setBgColor(lv_color_hex(0x0F172A)); + _panel->setBgOpa(LV_OPA_100); + + _title = std::make_unique