1
0
Fork 0
Commit graph

121 commits

Author SHA1 Message Date
Reinhold Gschweicher
c6b1f0f74b sim: wake up screen (delete label) when screen off on new Notification
Get the system into the running state again, when the `n` button is
pressed for a new notification. Otherwise the simulation freezes
2022-09-27 23:37:45 +02:00
Tomas Groth
ac5a04ee9d Send a NewNotification message when a new notification has been created. 2022-09-27 23:16:27 +02:00
NeroBurner
2cfd22c856
Merge pull request #69 from InfiniTimeOrg/displayapp-needs-fs
DisplayApp now takes the filesystem as ctor arguments
2022-09-27 23:10:39 +02:00
Reinhold Gschweicher
17abf385f6 Update InfiniTime submodule with InfiNeat watchface PR
Update the submodule to the version just after
https://github.com/InfiniTimeOrg/InfiniTime/pull/1024 is merged.
2022-09-27 23:05:07 +02:00
Jean-François Milants
4e60d77270 Since #1324 (https://github.com/InfiniTimeOrg/InfiniTime/pull/1324) / #1024 (https://github.com/InfiniTimeOrg/InfiniTime/pull/1024) DisplayApp needs the FileSystem as parameter to the constructor. 2022-09-27 21:08:08 +02:00
NeroBurner
8460a5207a
sim: change brightness only when screen is on (#66)
Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/45
2022-09-18 21:46:49 +02:00
NeroBurner
3d52e4a826
Update libpng to v1.6.38 with libm cmake fix (#65) 2022-09-17 16:08:33 +02:00
Aaron Honeycutt
c89e9701af
REAdme: Add npm package for Fedora (#64) 2022-09-16 17:41:06 +02:00
Aaron Honeycutt
07aa97bca3
README: Add zlib-devel package as Fedora dependency (#63)
This package is needed to run this command on Fedora:

```sh
cmake -S . -B build
```
2022-09-16 08:27:50 +02:00
Dyllan Kobal
0fe5b87bc6
Add changes for music fast forward PR (#61)
This pull request allows my pull request InfiniTimeOrg/InfiniTime#1323 in the
InfiniTime project to build the simulator that's in this project. Both pull requests
add the feature that I requested here: InfiniTimeOrg/InfiniTime#1320

Co-authored-by: Dyllan Kobal <dddk500@gmail.com>
2022-09-12 08:31:36 +02:00
Galdor
7ca0e50f1b
Print memory usage (p/P) only on change (#56)
* print memory usage (p/P): Only print when changed, max-memory

No longer spam the memory usage constantly. This makes the output much
more useful by allowing to observe each change in memory usage, since
the values now no longer get pushed up and scroll out of view rapidly.

Changes:
- Add `max_used` peak memory usage
- Add labels in the output (slightly more verbose, but much clearer)
- Remove unnecessary `int64_t` cast
- Change "free" to "budget left" to clarify it shows mem that would be
  free on the real hardware, making situations where it goes negative
  less confusing
- Change field widths so 5 digit values no longer jump out of alignment

Example output:
```
Mem:  6720 used (change:  -248, peak:  7928) 7616 budget left
Mem:  6832 used (change:  +112, peak:  7928) 7504 budget left
Mem:  6584 used (change:  -248, peak:  7928) 7752 budget left
Mem: 10856 used (change: +4272, peak: 10848) 3480 budget left
Mem: 10888 used (change:   +32, peak: 10880) 3448 budget left
Mem: 10616 used (change:  -272, peak: 10880) 3720 budget left
Mem:  6704 used (change: -3912, peak: 10880) 7632 budget left
Mem:  6808 used (change:  +104, peak: 10880) 7528 budget left
```
2022-09-11 19:38:37 +02:00
NeroBurner
23bf37995c
Merge pull request #60 from InfiniTimeOrg/littlefs-do_install_ressource
littlefs-do: unzip in memory and copy listed resources to SPI raw file
2022-09-08 20:14:15 +02:00
Reinhold Gschweicher
2306807a73 littlefs-do: unzip in memory and copy listed resources to SPI raw file
Add a new command `littlefs-do res load resource.zip` which loads
resources from a zip file to the SPI raw file.

Below an example `resource.zip` is loaded:

```sh
$ ./littlefs-do res load infinitime-resources-1.10.0.zip --verbose
Calling FS::Init()
running 'res'
running 'res load'
loading resource file: "infinitime-resources-1.10.0.zip"
zip: num of files in zip: 8
copy file teko.bin                  from zip to SPI path '/teko.bin'
copy file lv_font_dots_40.bin       from zip to SPI path '/lv_font_dots_40.bin'
copy file 7segments_40.bin          from zip to SPI path '/7segments_40.bin'
copy file bebas.bin                 from zip to SPI path '/bebas.bin'
copy file 7segments_115.bin         from zip to SPI path '/7segments_115.bin'
copy file matrix.bin                from zip to SPI path '/matrix.bin'
copy file infineat-1.bin            from zip to SPI path '/infineat-1.bin'
finished: zip file fully loaded into SPI memory: infinitime-resources-1.10.0.zip
```

Afterwards the files are listed in the SPI raw file:

```sh
$ ./littlefs-do ls
type: DIR
name: /
type: DIR name: .
type: DIR name: ..
type: REG size: 4928 name: 7segments\_115.bin
type: REG size: 760 name: 7segments\_40.bin
type: REG size: 4420 name: bebas.bin
type: REG size: 1430 name: infineat-1.bin
type: REG size: 1840 name: lv\_font\_dots\_40.bin
type: REG size: 115204 name: matrix.bin
type: REG size: 440 name: teko.bin
```

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/55
2022-09-08 20:02:48 +02:00
Reinhold Gschweicher
4dea63843e external: add nlohmann_json v3.11.2
Single header downloaded from https://github.com/nlohmann/json/releases/tag/v3.11.2

Add a custom CMakeLists.txt to have a `nlohmann_json::nlohmann_json`
target to link against (just like the full project)
2022-09-06 21:34:55 +02:00
Reinhold Gschweicher
9841601106 external: add miniz v2.2.0 with self written CMakeLists.txt
Sources downloaded from https://github.com/richgel999/miniz/releases/tag/2.2.0
2022-09-06 21:34:44 +02:00
NeroBurner
6e423c9a48
Update Notification::On/Off enum rename (#59)
In https://github.com/InfiniTimeOrg/InfiniTime/pull/1261 the enums for
Notification ON/OFF were renamed to On/Off and the additional entry
`Sleep` was added.

Update `littlefs-do` to this change.
2022-09-05 22:54:25 +02:00
Reinhold Gschweicher
25ce4b20a3 README: get sources before lv_font_conv install
The build dependencies section says to install `lv_font_conv` to the
source directory. But the instructions to download the InfiniSim sources
was after the build dependencies.

Move the "get sources" section before the "build dependencies" to
clairify the instructions.

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/53
2022-09-05 21:12:41 +02:00
NeroBurner
9e15182af2
littlefs-do binary to work with spi raw file (#52)
Add helper to modify spi raw file, to make experimenting with it easier.

```sh
$ ./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'
```

In the process restructure the CMake file for less duplicate
includes/defines for both executables (`infinisim` and `littlefs-do`).

Upload the `littlefs-do` binary built by the CI additionally to the `infinisim` binary.
Use the updated upload-artifact@v3 template to do that.
2022-08-29 12:05:21 +02:00
Reinhold Gschweicher
741db4ea32 main: add index to notification message 2022-08-21 18:36:35 +02:00
NeroBurner
b00dceb8c6
Support "Centralize most color definitions" (#50)
Support changes in InfiniTimeOrg/InfiniTime#1258

The file `lv_pinetime_theme.c` is renamed to `InfiniTimeTheme.cpp`.
Need to pick up that change in the simulator to compile with the new cpp
file if it exists.

Furthermore use the new `InfiniTimeTheme.h` header in simulator files.

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/49
2022-08-15 13:46:42 +02:00
Thomas Gourley
fc96e5df31
Updated README with required node.js version (#48) 2022-08-07 20:22:51 +02:00
Reinhold Gschweicher
8861b98d04 Update InfiniTime to current develop v1.10.0 branch 2022-08-04 15:45:54 +02:00
Reinhold Gschweicher
dfe72235bf Update InfiniTime to 1.10.0 release 2022-08-04 15:45:09 +02:00
Reinhold Gschweicher
935bb175b1 cmake: support date submodule include dir
Support both the current modified `date/includes` directory and the
`date` submodules `date/include` directory.

Once https://github.com/InfiniTimeOrg/InfiniTime/pull/1183 is merged
and the InfiniTime submodule is checked in also update the GitHub Action
and the AUR package.

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/42
2022-06-26 22:15:09 +02:00
Reinhold Gschweicher
a594446ef0 Add gif-h helper to create screen capture
Press key `I` (shift+`i`) to start a screen capture creating a gif with
the captured screen. Hit `I` again to stop the screen recording.

---

Add gif-h helper header only library

Copied from https://github.com/charlietangora/gif-h

3d2657b9ad
2022-06-19 22:31:25 +02:00
Reinhold Gschweicher
ae9a020126 Update InfiniTime submodule to current develop 2022-06-18 08:26:40 +02:00
Reinhold Gschweicher
04c923bd82 LittleVgl: implement screen transitions like on PineTime
Move lvgl display init from main.cpp into LittleVgl.cpp to be closer to
InfiniTime, where display initialization is also done in LitteVgl.cpp.

Enable the original FlushDisplay code to get the screen
transition animations like on the real PineTime.

Also slow down the rendering, to actually be able to see the screen
flushing.

For the Up and Down screen transitions implement the screen movement.
When moving Down, move the the whole screen content down, and then draw
the new part of the new screen at the top of the display. Repeat until
screen transition is finished.

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/13
2022-06-13 23:48:30 +02:00
Reinhold Gschweicher
53d765bbd8 Update LittleVgl with upstream changes 2022-06-13 23:48:30 +02:00
NeroBurner
ce22ba29c9
Remove MotorController, use nrf_gpio Motor pin, apptimer repeat (#34)
Remove the custom MotorController class and use the upstream
MotorController instead.

To enable this move add custom code in nrf_gpio to handle the Motor pin
instead of the custom motor_is_running member variable.

Also implement the repeating app_timer type used in the upstream
MotorController.
2022-06-05 22:03:53 +02:00
NeroBurner
f64e1aab80
Fix notification segfault (#36)
Need to loop the notification_idx after half the notification_messages
size since the change of splitting the subject and message body into two
strings.
2022-06-05 22:00:50 +02:00
NeroBurner
6313a7498b
CI: install lv_font_conv binary (#35)
We consider in CMake if we add the font subdir, but we didn't install
the `lv_font_conv` binary.
2022-06-05 21:58:12 +02:00
Reinhold Gschweicher
068c5a823e main: Fix 'N' clear new notification flag documentation
The documentation for the 'N' key wrongly stated it clears all
notifications. But in the code we see that just the new notification
flag is reset.
2022-05-16 23:45:34 +02:00
Reinhold Gschweicher
5f1dc192ac Update submodule with fonts target fix
Update InfiniTime to contain fix from
https://github.com/InfiniTimeOrg/InfiniTime/pull/1131
2022-05-16 19:27:37 +02:00
Reinhold Gschweicher
9427d4ddb1 SpiNorFlash: check Read/Write for out of bounds
Just to be extra pedantic and to get an error while developing on
InfiniSim. Because on PC we can easily add the debugger, on the device
we can, but it is a bit more involved.
2022-05-15 22:47:41 +02:00
JF
644431cbc4
Add support for SpiNorFlash and FS (#30)
The external SPI flash is implemented as a 4MB on the local filesystem.
This allows the FS (littleFS) and settings to work properly.

Remove the simulated `FS.h` and `FS.cpp`, because we can now use
the files from InfiniTime directly as the heavy lifting is done in the simulated
`SpiNorFlash.h` and cpp files.

`SpiNorFlash.h` provides read and write functions with `uint8_t` buffer, but
`fs::fstream` expects `char` buffer. Use `reinterpret_cast` and check if by
any chance the `char` type on a platform is implemented with more
than one byte. Then the `reinterpret_cast<char *>(buffer)` would change the
meaning of the `size` parameter, which could lead to garbage data.

Co-authored-by: Reinhold Gschweicher <pyro4hell@gmail.com>
2022-05-15 22:15:19 +02:00
Riku Isokoski
b1fbae36f9
Build widgets in widgets folder (#31)
https://github.com/InfiniTimeOrg/InfiniTime/pull/1136 adds a new folder `widgets`
for source files.If it gets merged, this folder needs to be added to the build.

Add the source files to InfiniSim if the new folder exists
2022-05-15 21:13:24 +02:00
Reinhold Gschweicher
f0c6ef9cd6 Use infinitime_fonts target if fonts/CMakeLists.txt exists
Since https://github.com/InfiniTimeOrg/InfiniTime/pull/1097 the fonts
are generated. Support this new way of using fonts.

When InfiniTime isn't a subdirectory of InfiniSim we need to provide
the binary dir when using `add_subdirectory()`. Use `fonts`.

Update README with instructions to install `lv_font_conv`.
2022-05-14 21:31:26 +02:00
Reinhold Gschweicher
d9d729d40f FS: fix FS::Stat function by looking at local dir instead of /
Like in `FileOpen()` interpret filenames starting with `/` as paths
relative to the current working directory by removing the first `/` from
the path.

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/23
2022-04-24 23:23:45 +02:00
NeroBurner
de8d0d6b6f SpiNorFlash: code style fix 2022-04-24 19:13:56 +02:00
Reinhold Gschweicher
7194e3e38e SpiNorFlash: use C++ style struct in C++ only header
`SpiNorFlash.h` is a C++ header, but the `Identification` struct is
created in a C style using `typedef struct`. Clang issues a warining
about this discrepancy:

```
In file included from /home/nero/repos/pinetime/InfiniSim/InfiniTime/src/systemtask/SystemTask.cpp:13:
/home/nero/repos/pinetime/InfiniSim/sim/drivers/SpiNorFlash.h:16:21: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
      typedef struct __attribute__((packed)) {
                    ^
                     Identification
/home/nero/repos/pinetime/InfiniSim/sim/drivers/SpiNorFlash.h:17:9: note: type is not C-compatible due to this default member initializer
        uint8_t manufacturer = 0;
        ^~~~~~~~~~~~~~~~~~~~
/home/nero/repos/pinetime/InfiniSim/sim/drivers/SpiNorFlash.h:20:9: note: type is given name 'Identification' for linkage purposes by this typedef declaration
      } Identification;
        ^
1 warning generated.
```

The easy fix is to use a C++ style struct.

Same fix as in: https://github.com/InfiniTimeOrg/InfiniTime/pull/1046
2022-04-24 19:13:56 +02:00
Reinhold Gschweicher
7110fa0034 cmake: create QCBOR target and link to InfiniSim 2022-04-08 11:26:30 +02:00
Reinhold Gschweicher
9f36b7886d FS: copy lfs_info and implement FS::Stat()
Implement the subset of the functionality to be usable to check if the
file exists or not and check the size of the file.
2022-04-04 21:22:57 +02:00
Reinhold Gschweicher
d4e81ca177 Fix libpng submodule usage
The current usage used the system `png.h` header instead of the intended
submodule header. This may break if the system header isn't at
`libpng16/png.h`.

Fix the include header to get the genreated include files and the
`png.h` from the submodule as described in
https://github.com/glennrp/libpng/issues/342#issuecomment-864589614

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/19
2022-04-03 21:35:09 +02:00
Wivik
8507c601fb doc: add fedora required packages 2022-04-02 23:12:02 +02:00
Reinhold Gschweicher
80ef18cce0 Update InfiniTime to 1.9.0 development branch 2022-04-02 17:56:09 +02:00
Reinhold Gschweicher
6567a67aef cmake: add a status message which MONITOR_ZOOM is used 2022-03-30 22:15:02 +02:00
Reinhold Gschweicher
726f759ca4 fix compile error by removing static_assert 2022-03-30 22:13:58 +02:00
Reinhold Gschweicher
bf3a255ca4 Cst816s: scale down SDL mouse coordinates according to MONITOR_ZOOM
The lv_drivers provided monitor driver supports a `MONITOR_ZOOM`-factor
which scales the window by the set factor. This is 'useful when
simulating small screens'.

The zoom can be set as cmake configuration setting `-DMONITOR_ZOOM=1`.

Probably even more usefull for high-dpi screens where 240 pixels is
really tiny.
2022-03-30 20:51:41 +02:00
Reinhold Gschweicher
84195fa44b Update InfiniTime submodule to current develop 2022-03-29 22:57:50 +02:00
Reinhold Gschweicher
3cc6e74ea1 sim/timers: implement xTimerGetExpiryTime, xTimerIsActive, more accurate
Implement the missing functions `xTimerGetExpiryTime()` and `xTimerIsActive()`
for the move of `TimerController` to use FreeRTOS timers.

In the process also fix a slight inaccuracy in the ms to ticks
conversion (no conversion was done as 1000 was close enough to 1024 for
a first working implementation).

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/17
2022-03-29 22:41:09 +02:00