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
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-h3d2657b9ad
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
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.
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.
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.
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>
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
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`.
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
`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
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.
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
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.
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
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
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.
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
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.