A simple CardputerZero calculator built with LVGL.
- iOS-style display: the gray source formula appears above the active result/input line.
- Direct numeric keys;
symcombinations provide. + - * / ^ ( ). OK/=evaluates, Backspace deletes one character.- Unsupported printable symbols are ignored.
- Division by zero and malformed expressions show
error. - After an evaluation, operators append to the result; digits start a new calculation.
- Black background, right-aligned white main line, gray source line, slow scrolling when long.
- JetBrains Mono at 24 px for the main line and 20 px for the source line.
| Input | Result |
|---|---|
![]() |
![]() |
| Continued calculation | Help |
![]() |
![]() |
Run scons in this directory. The host defaults to the LVGL SDL backend; the
device build enables the Linux framebuffer/evdev backends.
Select a configuration with CONFIG_DEFAULT_FILE:
| Configuration | Build host | Output target |
|---|---|---|
linux_x86_sdl2_config_defaults.mk |
Linux x86_64 | Linux x86_64 SDL2 application |
linux_x86_cross_cp0_config_defaults.mk |
Linux x86_64 | CardputerZero Linux ARM64 application |
mac_cross_cp0_config_defaults.mk |
macOS | CardputerZero Linux ARM64 application |
For a Linux SDL2 build (requires SDL2 development headers and libraries):
export CONFIG_DEFAULT_FILE=linux_x86_sdl2_config_defaults.mk
scons -QFor a macOS cross-build, install the toolchain and ensure its binaries are on PATH:
brew tap messense/macos-cross-toolchains
brew install aarch64-unknown-linux-gnu
export CONFIG_DEFAULT_FILE=mac_cross_cp0_config_defaults.mk
scons -Qexport CONFIG_DEFAULT_FILE=linux_x86_cross_cp0_config_defaults.mk
CONFIG_REPO_AUTOMATION=1 scons -Q
./scripts/deploy.sh pi@192.168.199.179The deploy script backs up any existing target files under a timestamped
directory in /usr/share/APPLaunch/backups, installs the binary, desktop
entry, and icon, restarts APPLaunch, and verifies service state plus checksum.
- Confirm the Calculator entry and icon in APPLaunch.
- Start it and type
1+2; pressOK, then continue with*2. - Check
1/0displayserror, and Backspace removes one character. - Enter a sufficiently long expression and verify both display rows scroll slowly.
c++ -std=c++17 -I tests/include -I main/include \
tests/calculator_ui_state_test.cpp main/src/calculator_engine.cpp \
-o /tmp/calculator_ui_state_test
/tmp/calculator_ui_state_testtests/calculator_engine_test.cpp covers parser precedence and error handling.



