1
0
Fork 0
No description
Find a file
NeroBurner ae2cd08965
Merge pull request #119 from InfiniTimeOrg/libpng_system_lib
Remove libpng submodule and require system lib
2023-09-11 19:48:21 +02:00
.github/workflows Remove libpng submodule and require system lib 2023-09-07 19:06:56 +02:00
cmake cmake: add explicit std::filesystem linking 2023-01-18 17:26:10 +01:00
external external: add nlohmann_json v3.11.2 2022-09-06 21:34:55 +02:00
gif-h Add gif-h helper to create screen capture 2022-06-19 22:31:25 +02:00
img sim: embedd background bmp and load from memory 2023-05-08 18:32:50 +02:00
InfiniTime@2b1eae7f59 raisewake: Fix for new raise to wake impl 2023-08-20 18:29:41 +02:00
lv_drivers@8c96359f41 Initial InfiniSim project 2022-02-17 22:57:08 +01:00
sim lowersleep: Fix InfiniSim build 2023-08-30 11:48:23 +02:00
.gitignore init 2022-02-16 21:19:37 +01:00
.gitmodules Remove libpng submodule and require system lib 2023-09-07 19:06:56 +02:00
CMakeLists.txt Remove libpng submodule and require system lib 2023-09-07 19:06:56 +02:00
LICENSE Initial InfiniSim project 2022-02-17 22:57:08 +01:00
littlefs-do-main.cpp Support refactor watch face to enum 2023-05-01 21:07:55 +02:00
lv_drv_conf.h fix compile error by removing static_assert 2022-03-30 22:13:58 +02:00
main.cpp Remove libpng submodule and require system lib 2023-09-07 19:06:56 +02:00
README.md Remove libpng submodule and require system lib 2023-09-07 19:06:56 +02:00

InfiniSim

Build InfiniSim LVGL Simulator

Simulator for InfiniTime project.

Experience the InfiniTime user interface directly on your PC, to shorten the time until you get your hands on a real PineTime smartwatch. Or use it to develop new Watchfaces, new Screens, or quickly iterate on the user interface.

For a history on how this simulator started and the challenges on its way visit the original PR.

Get the Sources

Clone this repository and tell git to recursively download the submodules as well

git clone --recursive https://github.com/InfiniTimeOrg/InfiniSim.git

If you've already cloned the repository without the submodules (or you want to update them to the latest checked in version) run the following command:

git submodule update --init --recursive

Build dependencies

  • CMake
  • SDL2 (provides the simulator window, handles mouse and keyboard input)
  • Compiler (g++ or clang++)
  • lv_font_conv (for font.c generation since InfiniTime#1097)
    • Note: requires Node.js v12.0.0 or later
  • lv_img_conv (for resource.zip generation when BUILD_RESOURCES=ON, which is the default)
  • optional: libpng, see -DWITH_PNG=ON cmake setting below for more info

On Ubuntu/Debian install the following packages:

sudo apt install -y cmake libsdl2-dev g++ npm libpng-dev

On Arch Linux the following packages are needed:

sudo pacman -S cmake sdl2 gcc npm libpng

On Fedora the following packages are needed:

sudo dnf install cmake SDL2-devel g++ npm patch perl libpng-devel

Then install the lv_font_conv executable to the InfiniSim source directory (will be installed at node_modules/.bin/lv_font_conv)

npm install lv_font_conv@1.5.2

When you want to create a resource.zip file then install the lv_img_conv executable to the InfiniSim source directory (will be installed at node_modules/.bin/lv_img_conv)

npm install ts-node@10.9.1 @swc/core lv_img_conv@0.3.0

Configure and Build

In the most basic configuration tell cmake to configure the project and build it with the following two commands:

cmake -S . -B build
cmake --build build -j4

The following configuration settings can be added to the first cmake -S . -B build call

  • -DInfiniTime_DIR=InfiniTime: a full path to an existing InfiniTime repository checked out. Inside that directory the src/libs/lvgl submodule must be checked out as well. The default value points to the InfiniTime submodule in this repository.
  • -DMONITOR_ZOOM=1: scale simulator window by this factor
  • -DBUILD_RESOURCES=ON: enable/disable resource.zip creation, will be created in the <build-dir>/resources folder
  • -DWITH_PNG=ON: enable/disable the screenshot to PNG support. Per default InfiniSim tries to use libpng to create screenshots in PNG format. This requires libpng development libraries as build and runtime dependency. Can be disabled with cmake config setting -DWITH_PNG=OFF.

Run Simulator

When the build was successful the simulator binary can be started with

./build/infinisim

Running Simulator

To hide the second simulator-status-window start the binary with the --hide-status option

./build/infinisim --hide-status
  • Left mouse button: simulates your finger, just click to tap, click and drag to swipe
  • Right mouse button: simulates the hardware button (for example turn the screen off or on again)

Using the keyboard the following events can be triggered:

  • r ... enable ringing
  • R ... disable ringing
  • m ... let motor run for 100 ms
  • M ... let motor run for 255 ms
  • n ... send notification
  • N ... clear new notification flag
  • b ... connect Bluetooth
  • B ... disconnect Bluetooth
  • v ... increase battery voltage and percentage
  • V ... decrease battery voltage and percentage
  • c ... charging,
  • C ... not charging
  • l ... increase brightness level
  • L ... lower brightness level
  • p ... enable print lvgl memory usage to terminal
  • P ... disable print memory usage
  • s ... increase step count by 500 steps
  • S ... decrease step count by 500 steps
  • h ... set heartrate running, and on further presses increase by 10 bpm
  • H ... stop heartrate
  • i ... take screenshot
  • I ... start/stop Gif screen capture

Additionally using the arrow keys the respective swipe gesture can be triggered. For example pressing the UP key triggers a SwipeUp gesture.

Littlefs-do helper

To help working with the SPI-raw file the tool littlefs-do is provided. The SPI-raw file emulates the persistent 4MB storage available over the SPI bus on the PineTime.

$ ./littlefs-do --help
Usage: ./littlefs-do <command> [options]
Commands:
  -h, --help           show this help message for the selected command and exit
  -v, --verbose        print status messages to the console
  stat                 show information of specified file or directory
  ls                   list available files in 'spiNorFlash.raw' file
  mkdir                create directory
  rmdir                remove directory
  rm                   remove directory or file
  cp                   copy files into or out of flash file
  settings             list settings from 'settings.h'
  res                  resource.zip handling

Resource loading

To load resource zip files into the SPI raw file for the simulator to use the res load command can be used.

$ ./littlefs-do res --help
Usage: ./littlefs-do res <action> [options]
actions:
  load res.zip         load zip file into SPI memory
Options:
  -h, --help           show this help message for the selected command and exit

Licenses

This project is released under the GNU General Public License version 3 or, at your option, any later version. The same license as InfiniTime.

The simulator is based on lv_sim_eclipse_sdl project under the MIT license.