Commit Graph

32 Commits

Author SHA1 Message Date
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
2e746ea560 use drivers/Hrs3300.h from InfiniTime
The Hrs3300.h driver can now be used directly from InfiniTime. Some
other improvement made that possible. One less simulator file, one less
file to keep updated. Win-Win (for me at least).
2023-05-03 21:16:30 +02:00
Reinhold Gschweicher
4b0c2dc3eb Use InfiniTime Watchdog.h by providing mdk/nrf.h and others 2023-05-03 20:59:58 +02:00
Reinhold Gschweicher
7613571f96 sim: support upstream Watchdog driver improvement
Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/101
2023-05-01 21:44:29 +02:00
Finlay Davidson
2f37837c77 motioncontroller: Fix changes in InfiniTime#1659 2023-03-10 10:18:16 +01:00
Riku Isokoski
6c0488da74 timers: Fix restarting timer from a timer
Running xTimerChangePeriod and xTimerStart on the expired timer from a
callback function returns successfully, but doesn't actually set the
timer.
2023-02-27 19:03:18 +01: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
f457925952 sim: WeatherService: add missing algorithm include 2023-02-26 21:46:42 +01:00
Riku Isokoski
322092e2ef Remove unused app_timer library
This is no longer used in InfiniTime, and I can't see any reason it
would ever be used again.
2023-02-25 19:49:58 +02:00
Riku Isokoski
3be951690c Remove unused Missing screen
This class causes builds to fail every time screens are changed in
InfiniTime.
2023-02-25 19:49:58 +02:00
Riku Isokoski
48afc495ab Apply InfiniTime LittleVgl changes 2023-02-24 18:11:26 +02:00
Riku Isokoski
1aaf2c3890 Fix build after InfiniTime change
Update InfiniTime
2023-01-29 20:15:40 +01:00
Elements6007
4fe058c652 combine 2023-01-15 22:38:25 +01:00
minacode
81c060874f added threshold 2022-10-12 21:17:22 +02:00
minacode
3381d68baa add dummy function 2022-10-12 20:29:33 +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
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
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
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
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
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
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
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
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 +01:00
Reinhold Gschweicher
999888eaf8 add missing <string> and <cmath> includes 2022-02-26 21:37:21 +01:00
Reinhold Gschweicher
f19355949b Initial InfiniSim project 2022-02-17 22:57:08 +01:00