Add a new simulation key handler for weather data:
- 'w' will generate new weather, cycling through the various conditions
- 'W' will clear the weather data
* Integration of Simple Weather Service
Replace the old WeatherService by the new Simple Weather Service.=
* Update InfiniTime to after SimpleWeatherService got merged
---------
Co-authored-by: Reinhold Gschweicher <pyro4hell@gmail.com>
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.
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
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).
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
InfiniTime removed the `Pinetime::Drivers::Cst816S& touchPanel`
reference from the LittleVGL constructor. Update that in the simulator
to stay compatible
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>
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
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.
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>
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