Commit Graph

7 Commits

Author SHA1 Message Date
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 +01: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 +01: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 +01:00
Reinhold Gschweicher
999888eaf8 add missing <string> and <cmath> includes 2022-02-26 21:37:21 +01: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 +01: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 +01:00
Reinhold Gschweicher
f19355949b Initial InfiniSim project 2022-02-17 22:57:08 +01:00