1
0
Fork 0
Commit graph

40 commits

Author SHA1 Message Date
baltevl
1e00e73cff main: add missing argument in lcd driver constructor call.
As of InfiniTimeOrg/InfiniTime#1758 ST7789 driver constructor has a
pinReset argument.

Update the InfiniTime submodule to the state after the update of the
ST7789 driver.

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/107
2023-06-12 23:39:44 +02:00
NeroBurner
e6dcf3f743
Merge pull request #97 from InfiniTimeOrg/heap-unification
Integrate the new heap implementation from InfiniTime
2023-05-18 20:32:33 +02:00
Reinhold Gschweicher
aa34f93161 sim: embedd background bmp and load from memory
Loading the file from disk introduces a slight dependency on the working
directory for the simulator. Prevent that by loading the bmp from
memory.

Use a python script to convert the backround bmp image to a C header
file. Include this header in `main.cpp` and load the bmp from memory.
2023-05-08 18:32:50 +02:00
Brod8362
1c479a2875 Add sim status window background and make it pretty
Instead of drawing just circles use a background image to show status
symbols what the respective status means (not just the color of the
dots).

Furthermore draw a rectangle for the battery status instead of bubbles.
2023-05-08 18:30:41 +02:00
Reinhold Gschweicher
310dc029a0 main: access minimumEverFreeHeap only when needed 2023-05-03 22:39:40 +02:00
Jean-François Milants
8ae5ba7c0a Integrate the new heap implementation from InfiniTime (https://github.com/InfiniTimeOrg/InfiniTime/pull/1709).
Since FreeRTOS.h, portmacro_cmsis.h and task.h are now built in C (by lv_mem.c), I had to change some includes and declarations to make them compatible with a C compiler.

Integrating the new memory management from InfiniTime in InfiniSim is not easy because InfiniSim does not include the whole FreeRTOS. Which means that, for example, pvPortMalloc() and vPortFree() are not accessible from InfiniSim.
As a first step, I provided custom implementations for pvPortMalloc(), vPortFree() which are based on ... malloc(). These function keep track of the memory that is currently allocated so that xPortGetFreeHeapSize(), xPortGetMinimumEverFreeHeapSize() return something.

Not that this implementation do not keep track of all the memory allocations done in InfiniTime. It can only "see" those done via pvPortMalloc(). It means that the available memory displayed by InfiniSim will probably be very optimistic.
2023-05-03 22:39:40 +02:00
Reinhold Gschweicher
8753661845 Handle MONITOR_ZOOM for screen transitions and captures
Something must have changed, but now the MONITOR_ZOOM factor must be
considered when calling `SDL_RenderReadPixels`. Always calling with a
monitor width and height of 240 results in a segmentation fault in said
function.

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/95
2023-05-03 22:36:25 +02:00
Reinhold Gschweicher
4f54e7bb7f main: add swipe direction keys to make debugging easier
For me with vscode triggering a breakpoint during a mouse swipe event
handler freezes all interaction with the IDE.

As a workaround (and a nice way to play `Twos.h` :D ) map the direction
keys to the corresponding swipe events.
2023-05-03 22:33:39 +02:00
Reinhold Gschweicher
4b0c2dc3eb Use InfiniTime Watchdog.h by providing mdk/nrf.h and others 2023-05-03 20:59:58 +02:00
minacode
4f4f446517 Support refactor watch face to enum
Support for PR: https://github.com/InfiniTimeOrg/InfiniTime/pull/1339
2023-05-01 21:07:55 +02:00
Reinhold Gschweicher
32fada34f4 Support rename of TimerController to FreeRTOS::Timer 2023-03-02 22:33:05 +01:00
Riku Isokoski
1278132840 Remove LVGL instance in main
This has been moved to DisplayApp in InfiniTime, so there were two
instances in InfiniSim.
2023-02-27 08:45:53 +02:00
Reinhold Gschweicher
02f980f278 sim: LittleVgl: update s.t. LVGL-FS driver is initialized by LittleVgl
InfiniTime moved the LVGL-FS driver initialization to the LittleVgl
constructor and passed the FS member to do that.

Update the simulator copy of LittleVgl to do just that.

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/89
2023-02-26 23:42:03 +01:00
Reinhold Gschweicher
44452ccdf6 sim: LittleVgl: remove touchPanel from constructor as done upstream
InfiniTime removed the `Pinetime::Drivers::Cst816S& touchPanel`
reference from the LittleVGL constructor. Update that in the simulator
to stay compatible
2023-02-26 23:11:00 +01:00
Reinhold Gschweicher
3a0ee34be5 main: updated to changed DisplayApp and SystemTask constructors
The constructors got cleaned up and the WatchdogView got replaced by a
const reference to the Watchdog object.

Update develop branch to the `infineat: Create colors at compile time`
commit, where those changes are needed
2023-02-26 23:00:52 +01:00
Reinhold Gschweicher
36c69bbc2e main: use ctime put_time to replace date/date.h include
Implementation referenced from:
https://stackoverflow.com/questions/17223096/outputting-date-and-time-in-c-using-stdchrono

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/88
2023-02-26 22:44:15 +01:00
Riku Isokoski
df768e2030 Remove motorController from SystemTask
InfiniTime change
2023-02-25 12:35:16 +02:00
Riku Isokoski
c6bccf5225 Apply InfiniTime TouchHandler changes 2023-02-24 18:10:17 +02:00
blatzfab
db77a2cf52 Infinisim: GifExporter: Disable dithering
This patch disables dithering since it causes artifacts within the
generated gif files.
2022-11-21 19:55:32 +01:00
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
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
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
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
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
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
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
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
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
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
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