Files
frontend-dev/README.md
2026-03-13 00:39:06 +01:00

90 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Smaage Frontend Prototype
## Install Requirements
```bash
uv sync
```
## Run
```bash
uv run -m frontend
```
## Navigation
- L: left press
- LL: left long press
- R: right press
- RL: right long press
- LB: long left and right press
```mermaid
stateDiagram-v2
[*] --> Main
state "Main View<br>(timer + weight)" as Main
state "Menu<br>(carousel)" as Menu
state "Bluetooth Pairing<br>(waiting for connection)" as BTPairing
state "Recipe Selection<br>(carousel)" as RecipeSelection
state "Do Recipe<br>(step-by-step)" as DoRecipe
state "Edit Recipe<br>(step list)" as EditRecipe
state "Edit Recipe Move Mode<br>(reorder steps)" as MoveMode
state "Edit Step Type Selection<br>(list view)" as TypeSelect
state "Edit Step Value Entry<br>(morse input)" as ValueEntry
state "Edit Step Goal Time Entry<br>(morse input)" as GoalTime
Main --> Menu : LB
Main --> RecipeSelection : RL
Menu --> Main : LL [back]
Menu --> BTPairing : RL [BT Pair]
BTPairing --> Menu : LL [cancel]
RecipeSelection --> Main : LL
RecipeSelection --> DoRecipe : RL [on recipe → run]
RecipeSelection --> EditRecipe : LB [on recipe → edit]<br>or RL [on + → add]
DoRecipe --> Main : LL [back]<br>or R [last step → done]
EditRecipe --> RecipeSelection : LL [back]<br>or RL [on save]
EditRecipe --> TypeSelect : RL [on step]<br>or RL [on + → add step]
EditRecipe --> ValueEntry : RL [on name]
EditRecipe --> MoveMode : LB [on step]
MoveMode --> EditRecipe : LB [confirm]<br>or LL [cancel]
TypeSelect --> ValueEntry : RL [type with value]
TypeSelect --> EditRecipe : RL [type w/o value → saved]<br>or RL [delete → deleted]<br>or LL [back]
ValueEntry --> EditRecipe : LL [save]<br>or L [cancel]
ValueEntry --> GoalTime : LL [WEIGH_WITH_TIMER]
GoalTime --> EditRecipe : LL [save]<br>or L [cancel]
```
## Tools
### `export_loading_frames.py`
Renders the loading screen animation and exports every unique frame as both PNG files and a NumPy array.
**Usage**
```bash
uv run export_loading_frames.py [--out-dir <directory>]
```
| Argument | Default | Description |
|---|---|---|
| `--out-dir` | `frames/` | Directory to write output files into |
**Outputs**
| File | Description |
|---|---|
| `frames/frame_XXXX.png` | One PNG per unique frame, zero-padded index |
| `frames/frames.npy` | NumPy array of shape `(N, H, W)`, dtype `bool` |
Consecutive duplicate frames are collapsed so only visually distinct frames are exported. The script prints the total number of frames rendered and the number of unique frames kept.