Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lvgl v8.0 #734

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7622964
Update submodule to lvgl v8.0
Quantum-cross Oct 8, 2021
4070292
First pass update to lvgl v8.0
Quantum-cross Oct 8, 2021
df7a417
This variable goes out of scope after the init, but its reference is …
Quantum-cross Oct 8, 2021
c679ab3
Merge branch 'indev_drv_scope_fix' into nrf52833-DK
Quantum-cross Oct 8, 2021
12d985a
Found the same issue with fs_drv.
Quantum-cross Oct 8, 2021
ee58e82
Merge branch 'indev_drv_scope_fix' into nrf52833-DK
Quantum-cross Oct 8, 2021
15bd632
Fixes for List and Tile screen event handlers
Quantum-cross Oct 8, 2021
5c01d12
Merge branch 'lvgl-v8.0' into nrf52833-DK
Quantum-cross Oct 8, 2021
23d8b2c
Port pinetime theme
Quantum-cross Oct 9, 2021
36311c5
Merge branch 'lvgl-v8.0' into nrf52833-DK
Quantum-cross Oct 9, 2021
16910e6
Implementation of LeftAnim, RightAnim, ScrollDown using public lvgl8 …
Quantum-cross Oct 10, 2021
382671f
Merge branch 'lvgl-v8.0' into nrf52833-DK
Quantum-cross Oct 11, 2021
fb632d4
stop digital watch face from constantly refreshing
Quantum-cross Oct 11, 2021
edc88e9
center icons on quicksettings
Quantum-cross Oct 11, 2021
640395e
Merge branch 'indev_drv_scope_fix' into lvgl-v8.0
Quantum-cross Oct 11, 2021
33a6be5
Fix many alignment issues
Quantum-cross Oct 11, 2021
c686d9e
Merge remote-tracking branch 'fork/lvgl-v8.0' into lvgl-v8.0
Quantum-cross Oct 11, 2021
f99b15f
Fix small glitch with the first frame of scrolldown animation.
Quantum-cross Oct 11, 2021
26e6c52
Merge branch 'develop' into lvgl-v8.0
Quantum-cross Oct 11, 2021
4602efc
Port latest PRs
Quantum-cross Oct 11, 2021
4a8049a
VERY IMPORTANT! fix twos for lvgl8
Quantum-cross Oct 11, 2021
7c7cae9
fix building of Recovery image.
Quantum-cross Oct 11, 2021
289df3f
Possible fix for reset on animation on actual pinetime
Quantum-cross Oct 11, 2021
a6dbb1b
clean pad_row/column to pad_gap
Quantum-cross Oct 11, 2021
c6b59fa
More alignment fixes
Quantum-cross Oct 12, 2021
22e3d88
Next attempt at fixing screen transitions.
Quantum-cross Oct 12, 2021
60a7229
add screen transitions for SystemInfo.
Quantum-cross Oct 12, 2021
1c06449
Fix alignments for QuickSettings and Settings (List).
Quantum-cross Oct 12, 2021
9ab44a3
Fix most other alignment issues
Quantum-cross Oct 13, 2021
dd9ba77
Port PTS fixes to SettingPTS
Quantum-cross Oct 13, 2021
ce63f51
Another attempt fixing animation issues
Quantum-cross Oct 13, 2021
ce23767
Fix screen animation errors (testing with actual ST7789)
Quantum-cross Oct 14, 2021
24c72b7
Improve lvgl8 performance for system info screen.
Quantum-cross Oct 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[submodule "src/libs/lvgl"]
path = src/libs/lvgl
url = https://github.com/joaquimorg/lvgl.git
url = https://github.com/lvgl/lvgl.git
branch = release/v8.0
[submodule "src/libs/littlefs"]
path = src/libs/littlefs
url = https://github.com/littlefs-project/littlefs.git
356 changes: 188 additions & 168 deletions src/CMakeLists.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
/* Hook function related definitions. */
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCHECK_FOR_STACK_OVERFLOW 0
#define configCHECK_FOR_STACK_OVERFLOW 1
#define configUSE_MALLOC_FAILED_HOOK 0

/* Run time and task stats gathering related definitions. */
Expand Down
31 changes: 16 additions & 15 deletions src/components/fs/FS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ int FS::FileWrite(lfs_file_t* file_p, const uint8_t* buff, uint32_t size) {
return lfs_file_write(&lfs, file_p, buff, size);
}

int FS::FileSeek(lfs_file_t* file_p, uint32_t pos) {
return lfs_file_seek(&lfs, file_p, pos, LFS_SEEK_SET);
int FS::FileSeek(lfs_file_t* file_p, uint32_t pos, lfs_whence_flags whence) {
return lfs_file_seek(&lfs, file_p, pos, whence);
}

int FS::FileDelete(const char* fileName) {
Expand Down Expand Up @@ -140,18 +140,16 @@ int FS::SectorRead(const struct lfs_config* c, lfs_block_t block, lfs_off_t off,
*/

namespace {
lv_fs_res_t lvglOpen(lv_fs_drv_t* drv, void* file_p, const char* path, lv_fs_mode_t mode) {
void * lvglOpen(lv_fs_drv_t* drv, const char* path, lv_fs_mode_t mode) {

lfs_file_t* file = static_cast<lfs_file_t*>(file_p);
lfs_file_t* file = nullptr;
FS* filesys = static_cast<FS*>(drv->user_data);
filesys->FileOpen(file, path, LFS_O_RDONLY);

if (file->type == 0) {
return LV_FS_RES_FS_ERR;
}
else {
return LV_FS_RES_OK;
return nullptr;
}
return file;
}

lv_fs_res_t lvglClose(lv_fs_drv_t* drv, void* file_p) {
Expand All @@ -169,27 +167,30 @@ namespace {
*br = btr;
return LV_FS_RES_OK;
}

lv_fs_res_t lvglSeek(lv_fs_drv_t* drv, void* file_p, uint32_t pos) {
lv_fs_res_t lvglSeek(lv_fs_drv_t* drv, void* file_p, uint32_t pos, lv_fs_whence_t whence) {
FS* filesys = static_cast<FS*>(drv->user_data);
lfs_file_t* file = static_cast<lfs_file_t*>(file_p);
filesys->FileSeek(file, pos);
filesys->FileSeek(file, pos, static_cast<lfs_whence_flags>(whence));
return LV_FS_RES_OK;
}
}

void FS::LVGLFileSystemInit() {

lv_fs_drv_t fs_drv;
lv_fs_drv_init(&fs_drv);

fs_drv.file_size = sizeof(lfs_file_t);
fs_drv.letter = 'F';
fs_drv.ready_cb = nullptr;
fs_drv.open_cb = lvglOpen;
fs_drv.close_cb = lvglClose;
fs_drv.read_cb = lvglRead;
fs_drv.write_cb = nullptr;
fs_drv.seek_cb = lvglSeek;

fs_drv.tell_cb = nullptr;

fs_drv.dir_open_cb = nullptr;
fs_drv.dir_read_cb = nullptr;
fs_drv.dir_close_cb = nullptr;

fs_drv.user_data = this;

lv_fs_drv_register(&fs_drv);
Expand Down
7 changes: 5 additions & 2 deletions src/components/fs/FS.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <cstdint>
#include "drivers/SpiNorFlash.h"
#include <littlefs/lfs.h>
#include <lvgl/lvgl.h>

namespace Pinetime {
namespace Controllers {
Expand All @@ -17,7 +18,7 @@ namespace Pinetime {
int FileClose(lfs_file_t* file_p);
int FileRead(lfs_file_t* file_p, uint8_t* buff, uint32_t size);
int FileWrite(lfs_file_t* file_p, const uint8_t* buff, uint32_t size);
int FileSeek(lfs_file_t* file_p, uint32_t pos);
int FileSeek(lfs_file_t* file_p, uint32_t pos, lfs_whence_flags whence);

int FileDelete(const char* fileName);

Expand Down Expand Up @@ -55,7 +56,9 @@ namespace Pinetime {
static constexpr size_t startAddress = 0x0B4000;
static constexpr size_t size = 0x34C000;
static constexpr size_t blockSize = 4096;


lv_fs_drv_t fs_drv;

bool resourcesValid = false;
const struct lfs_config lfsConfig;

Expand Down
2 changes: 1 addition & 1 deletion src/components/gfx/Gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void Gfx::NotifyEndOfTransfer(TaskHandle_t task) {
}

void Gfx::WaitTransferFinished() const {
ulTaskNotifyTake(pdTRUE, 500);
// ulTaskNotifyTake(pdTRUE, 500);
}

void Gfx::SetScrollArea(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines) {
Expand Down
36 changes: 18 additions & 18 deletions src/displayapp/Colors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ using namespace Pinetime::Controllers;

lv_color_t Pinetime::Applications::Convert(Pinetime::Controllers::Settings::Colors color) {
switch (color) {
case Pinetime::Controllers::Settings::Colors::White: return LV_COLOR_WHITE;
case Pinetime::Controllers::Settings::Colors::Silver: return LV_COLOR_SILVER;
case Pinetime::Controllers::Settings::Colors::Gray: return LV_COLOR_GRAY;
case Pinetime::Controllers::Settings::Colors::Black: return LV_COLOR_BLACK;
case Pinetime::Controllers::Settings::Colors::Red: return LV_COLOR_RED;
case Pinetime::Controllers::Settings::Colors::Maroon: return LV_COLOR_MAROON;
case Pinetime::Controllers::Settings::Colors::Yellow: return LV_COLOR_YELLOW;
case Pinetime::Controllers::Settings::Colors::Olive: return LV_COLOR_OLIVE;
case Pinetime::Controllers::Settings::Colors::Lime: return LV_COLOR_LIME;
case Pinetime::Controllers::Settings::Colors::Green: return LV_COLOR_GREEN;
case Pinetime::Controllers::Settings::Colors::Cyan: return LV_COLOR_CYAN;
case Pinetime::Controllers::Settings::Colors::Teal: return LV_COLOR_TEAL;
case Pinetime::Controllers::Settings::Colors::Blue: return LV_COLOR_BLUE;
case Pinetime::Controllers::Settings::Colors::Navy: return LV_COLOR_NAVY;
case Pinetime::Controllers::Settings::Colors::Magenta: return LV_COLOR_MAGENTA;
case Pinetime::Controllers::Settings::Colors::Purple: return LV_COLOR_PURPLE;
case Pinetime::Controllers::Settings::Colors::Orange: return LV_COLOR_ORANGE;
default: return LV_COLOR_WHITE;
case Pinetime::Controllers::Settings::Colors::White: return lv_color_white();
case Pinetime::Controllers::Settings::Colors::Silver: return lv_color_hex(0xC0C0C0);
case Pinetime::Controllers::Settings::Colors::Gray: return lv_palette_main(LV_PALETTE_GREY);
case Pinetime::Controllers::Settings::Colors::Black: return lv_color_black();
case Pinetime::Controllers::Settings::Colors::Red: return lv_palette_main(LV_PALETTE_RED);
case Pinetime::Controllers::Settings::Colors::Maroon: return lv_color_hex(0x800000);
case Pinetime::Controllers::Settings::Colors::Yellow: return lv_palette_main(LV_PALETTE_YELLOW);
case Pinetime::Controllers::Settings::Colors::Olive: return lv_color_hex(0x808000);
case Pinetime::Controllers::Settings::Colors::Lime: return lv_color_hex(0x00FF00);
case Pinetime::Controllers::Settings::Colors::Green: return lv_palette_main(LV_PALETTE_GREEN);
case Pinetime::Controllers::Settings::Colors::Cyan: return lv_color_hex(0x00FFFF);
case Pinetime::Controllers::Settings::Colors::Teal: return lv_color_hex(0x008080);
case Pinetime::Controllers::Settings::Colors::Blue: return lv_palette_main(LV_PALETTE_BLUE);
case Pinetime::Controllers::Settings::Colors::Navy: return lv_color_hex(0x000080);
case Pinetime::Controllers::Settings::Colors::Magenta: return lv_color_hex(0xFF00FF);
case Pinetime::Controllers::Settings::Colors::Purple: return lv_color_hex(0x800080);
case Pinetime::Controllers::Settings::Colors::Orange: return lv_palette_main(LV_PALETTE_ORANGE);
default: return lv_color_white();
}
}
2 changes: 1 addition & 1 deletion src/displayapp/Colors.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <lvgl/src/lv_misc/lv_color.h>
#include <lvgl/src/misc/lv_color.h>
#include <components/settings/Settings.h>

namespace Pinetime {
Expand Down
5 changes: 4 additions & 1 deletion src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void DisplayApp::Process(void* instance) {
app->InitHw();

// Send a dummy notification to unlock the lvgl display driver for the first iteration
xTaskNotifyGive(xTaskGetCurrentTaskHandle());
// xTaskNotifyGive(xTaskGetCurrentTaskHandle());

while (true) {
app->Refresh();
Expand All @@ -149,6 +149,9 @@ void DisplayApp::InitHw() {

void DisplayApp::Refresh() {
TickType_t queueTimeout;
if (currentScreen->IsNew()){
doScreenTransition();
}
switch (state) {
case States::Idle:
queueTimeout = portMAX_DELAY;
Expand Down
1 change: 1 addition & 0 deletions src/displayapp/DisplayApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ namespace Pinetime {
void SetFullRefresh(FullRefreshDirections direction);

void Register(Pinetime::System::SystemTask* systemTask);
void doScreenTransition(){lvgl.StartTransitionAnimation();}

private:
Pinetime::Drivers::St7789& lcd;
Expand Down
6 changes: 3 additions & 3 deletions src/displayapp/DisplayAppRecovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void DisplayApp::Process(void* instance) {
NRF_LOG_INFO("displayapp task started!");

// Send a dummy notification to unlock the lvgl display driver for the first iteration
xTaskNotifyGive(xTaskGetCurrentTaskHandle());
// xTaskNotifyGive(xTaskGetCurrentTaskHandle());

app->InitHw();
while (true) {
Expand Down Expand Up @@ -94,7 +94,7 @@ void DisplayApp::DisplayLogo(uint16_t color) {
Pinetime::Tools::RleDecoder rleDecoder(infinitime_nb, sizeof(infinitime_nb), color, colorBlack);
for (int i = 0; i < displayWidth; i++) {
rleDecoder.DecodeNext(displayBuffer, displayWidth * bytesPerPixel);
ulTaskNotifyTake(pdTRUE, 500);
// ulTaskNotifyTake(pdTRUE, 500);
lcd.DrawBuffer(0, i, displayWidth, 1, reinterpret_cast<const uint8_t*>(displayBuffer), displayWidth * bytesPerPixel);
}
}
Expand All @@ -103,7 +103,7 @@ void DisplayApp::DisplayOtaProgress(uint8_t percent, uint16_t color) {
const uint8_t barHeight = 20;
std::fill(displayBuffer, displayBuffer + (displayWidth * bytesPerPixel), color);
for (int i = 0; i < barHeight; i++) {
ulTaskNotifyTake(pdTRUE, 500);
// ulTaskNotifyTake(pdTRUE, 500);
uint16_t barWidth = std::min(static_cast<float>(percent) * 2.4f, static_cast<float>(displayWidth));
lcd.DrawBuffer(0, displayWidth - barHeight + i, barWidth, 1, reinterpret_cast<const uint8_t*>(displayBuffer), barWidth * bytesPerPixel);
}
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/DisplayAppRecovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <date/date.h>
#include <drivers/Watchdog.h>
#include <components/motor/MotorController.h>
#include <BootErrors.h>
#include "TouchEvents.h"
#include "Apps.h"
#include "Messages.h"
Expand Down Expand Up @@ -58,6 +59,7 @@ namespace Pinetime {
Pinetime::Controllers::AlarmController& alarmController,
Pinetime::Controllers::TouchHandler& touchHandler);
void Start();
void Start(Pinetime::System::BootErrors){ Start(); };
void PushMessage(Pinetime::Applications::Display::Messages msg);
void Register(Pinetime::System::SystemTask* systemTask);

Expand Down
6 changes: 3 additions & 3 deletions src/displayapp/DummyLittleVgl.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include <libs/lvgl/src/lv_core/lv_style.h>
#include <libs/lvgl/src/lv_themes/lv_theme.h>
#include <libs/lvgl/src/lv_hal/lv_hal.h>
#include <libs/lvgl/src/misc/lv_style.h>
#include <libs/lvgl/src/core/lv_theme.h>
#include <libs/lvgl/src/hal/lv_hal.h>
#include <drivers/St7789.h>
#include <drivers/Cst816s.h>

Expand Down
Loading