Commit Graph

48 Commits (935bb175b104ac2e3f20fd69747c2a496a96cb72)
 

Author SHA1 Message Date
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 +07: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 +07:00
Reinhold Gschweicher ae9a020126 Update InfiniTime submodule to current develop 2022-06-18 08:26:40 +07: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 +07:00
Reinhold Gschweicher 53d765bbd8 Update LittleVgl with upstream changes 2022-06-13 23:48:30 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07:00
NeroBurner de8d0d6b6f SpiNorFlash: code style fix 2022-04-24 19:13:56 +07: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 +07:00
Reinhold Gschweicher 7110fa0034 cmake: create QCBOR target and link to InfiniSim 2022-04-08 11:26:30 +07: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 +07: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 +07:00
Wivik 8507c601fb doc: add fedora required packages 2022-04-02 23:12:02 +07:00
Reinhold Gschweicher 80ef18cce0 Update InfiniTime to 1.9.0 development branch 2022-04-02 17:56:09 +07:00
Reinhold Gschweicher 6567a67aef cmake: add a status message which MONITOR_ZOOM is used 2022-03-30 22:15:02 +07:00
Reinhold Gschweicher 726f759ca4 fix compile error by removing static_assert 2022-03-30 22:13:58 +07: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 +07:00
Reinhold Gschweicher 84195fa44b Update InfiniTime submodule to current `develop` 2022-03-29 22:57:50 +07: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 +07:00
Reinhold Gschweicher d6cc748ea1 InfiniTime: update submodule for analog watchface warning fixes 2022-03-19 01:01:43 +07:00
Reinhold Gschweicher 00ccde99e9 Add install target to create system packages 2022-03-19 00:57:53 +07:00
Reinhold Gschweicher eb7b589826 cmake: use main lv_conf.h, use file globs for fonts and icons
To make the simulator work without modification for more PRs use the
original `lv_conf.h` file and modify the needed parts for the simulator.

Furthermore use globbing expressions to add all available fonts and
icons in case a PR adds new fonts or icons.
2022-03-09 23:17:57 +07:00
Reinhold Gschweicher 0b12245c08 Use relative path for libpng submodule, don't force ssh/http 2022-03-08 21:48:55 +07:00
NeroBurner 2e81595abf
Merge pull request #10 from InfiniTimeOrg/screenshots
main: implement saveScreenshot() writing bmp/png from SDL window buffer
2022-03-08 21:45:11 +07:00
Reinhold Gschweicher dfbc345511 main: implement saveScreenshot() writing bmp/png from SDL window buffer
When pressing `i` create a screenshot of the current InfiniTime screen
by dumping it to a timestamped png or bmp file like
`InfiniSim_2022-03-08_203421.png`.

Add a new configure option `WITH_PNG` with default `ON`. When switched
to `OFF` the screenshots will be created in `bmp` format.

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/5
2022-03-08 21:39:16 +07:00
NeroBurner 819d9cbdcb
Merge pull request #7 from InfiniTimeOrg/systemmonitor_add_cpp_file
add SystemMonitor.cpp and switch to official InfiniTime repo
2022-03-08 20:57:09 +07:00
Reinhold Gschweicher e5ce07cb75 Use official InfiniTime project with latest `develop` branch 2022-03-08 20:47:46 +07:00
Reinhold Gschweicher 1728317544 cmake: add SystemMonitor.cpp
https://github.com/InfiniTimeOrg/InfiniTime/pull/967 splits
SystemMonitor.h into a h and cpp file. Add the cpp file to the infinisim
target.
2022-03-07 22:20:22 +07:00
Reinhold Gschweicher abed693a44 main: remove residual Apps::Missing instantiation
During development the Apps::Missing screen was used to indicate a
Screeen, that wasn't ported yet to the Simulator.
2022-03-07 22:19:49 +07:00
NeroBurner 816210023f
Merge pull request #9 from InfiniTimeOrg/fix_screen_off_double_free
main: fix double free of screen_off_bg lv_obj
2022-03-02 07:40:26 +07:00
Reinhold Gschweicher 8bc308b4e1 main: fix double free of screen_off_bg lv_obj
If the Alarm is set, then switch away from the Alarm Screen and turn off
display to get the "Screen is OFF" overlay. When the alarm rings the
Screen is switched to the Alarm Screen, which triggers the current
screen (for example the Clock/WatchFace) to issue an `lv_obj_clean()`
call. This call removes the `screen_off_bg` object, before the main
`refresh_sceen()` of the simulator can do it. Later the simulator tries
to remove the `screen_off_bg` object again, which is a double-free of
memory resulting in a segfault.

To prevent this segfault add a callback to the `screen_off_bg` callback
which informs the simulator, that the object has already been removed.

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/8
2022-03-01 22:49:08 +07:00
Reinhold Gschweicher 2b8b4edba3 sim: NimbleController: add stubs for new En/DisableRadio() functions
New functions added in
ef44b763d9
for the airplane-mode
2022-02-26 21:37:21 +07:00
Reinhold Gschweicher cdd66256ce lv_drv_conf: disable linux frame buffer socket 2022-02-26 21:37:21 +07:00
Reinhold Gschweicher 999888eaf8 add missing <string> and <cmath> includes 2022-02-26 21:37:21 +07:00
Reinhold Gschweicher a79f75285f cmake: improve InfiniTime_DIR default
With the old default of just "InfiniTime" you have to have the working
directory in the `InfiniSim` directory. The new default makes the
default independent of the current working directory.
2022-02-20 22:27:10 +07:00
Reinhold Gschweicher 1b797211f1 main: fix segfault because of lv_task_handler() concurrently called
Both InfiniSim/main.cpp and SystemTask.cpp periodically called
`lv_task_handler()`. This introduces a race condition, which leads to a
segmentation fault in either the main or the SystemTasks call of
`lv_task_handler()`.

Now `main` only calls the `lv_task_handler()` if the `SystemTask` does
not (while the screen is turned off). We need this for the Simulator,
otherwise the "Screen is OFF" message won't appear, and the right mouse
button won't be recognized to wake up the simulated screen.

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/3
2022-02-20 16:27:06 +07:00
Reinhold Gschweicher db3144c4f9 main: one notification per notification category
Notifications store the title and the message in the same array,
separated by a `\0`. Add the notification category as title to the
notifications.

Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Vitae aliquet nec ullamcorper sit amet.
Id aliquet risus feugiat in ante metus dictum at.
Ut porttitor leo a diam sollicitudin.
Ultrices tincidunt arcu non sodales neque sodales ut etiam sit.
Pellentesque dignissim enim sit amet.
Urna nec tincidunt praesent semper feugiat nibh sed pulvinar proin.
Tellus id interdum velit laoreet id donec ultrices tincidunt.
Viverra maecenas accumsan lacus vel facilisis volutpat est velit egestas.
Volutpat consequat mauris nunc congue.
2022-02-20 13:22:11 +07:00
Arthur Lutz d548c711be [README] fix apt command 2022-02-18 22:52:06 +07:00
Reinhold Gschweicher f19355949b Initial InfiniSim project 2022-02-17 22:57:08 +07:00
Reinhold Gschweicher cea006b049 init 2022-02-16 21:19:37 +07:00