InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

Lvgl v8.0

Open Quantum-cross opened this issue 4 years ago • 20 comments
trafficstars

Here's my first pass at upgrading pinetime to lvgl 8.

Still to do:

  • [x] Port pinetime theme (I just copied the default lvgl theme for now)
  • [x] Test on an actual PineTIme
  • [x] Go through with fine tooth comb fixing layout/padding/alignment differences
  • [ ] Cleaning event handlers (using event filters) (this could be deferred to another PR)
  • [x] fix Twos (very important)
  • [x] change pad_row+pad_col -> pad_gap
  • [x] implemented custom lvgl screen transitions
  • [ ] improve screen transition performance

This is a WIP, I'm creating it as a draft. I'll keep yall updated here, but early feedback and testing is appreciated.

2021-10-08-174412_238x241_scrot 2021-10-08-174704_234x238_scrot 2021-10-08-174810_236x241_scrot 2021-10-08-174826_238x239_scrot 2021-10-08-174850_238x240_scrot


Ported theme!

2021-10-09-135757_240x240_scrot 2021-10-09-135953_240x240_scrot 2021-10-09-135959_240x240_scrot 2021-10-09-140005_240x240_scrot


Many fixes:

2021-10-11-104334_240x240_scrot 2021-10-11-104312_240x240_scrot 2021-10-11-104231_240x240_scrot 2021-10-11-104209_240x240_scrot 2021-10-11-104159_240x240_scrot 2021-10-11-104141_240x240_scrot


More fixes!!!

2021-10-12-215652_240x240_scrot 2021-10-12-215645_240x240_scrot 2021-10-12-215525_240x240_scrot 2021-10-12-215823_240x240_scrot 2021-10-12-215634_240x240_scrot 2021-10-12-215721_240x240_scrot 2021-10-12-215702_240x240_scrot

Resolves #616

Quantum-cross avatar Oct 08 '21 21:10 Quantum-cross

can't compile your branch locally getting error

[build] /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.cpp: In member function 'void Pinetime::System::SystemTask::Work()':
[build] /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.cpp:159:29: error: no matching function for call to 'Pinetime::Applications::DisplayApp::Start(Pinetime::System::BootErrors&)'
[build]   159 |   displayApp.Start(bootError);
[build]       |                             ^
[build] In file included from /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.h:25,
[build]                  from /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.cpp:1:
[build] /home/nero/repos/pinetime/InfiniTime/src/displayapp/DisplayAppRecovery.h:60:12: note: candidate: 'void Pinetime::Applications::DisplayApp::Start()'
[build]    60 |       void Start();
[build]       |            ^~~~~
[build] /home/nero/repos/pinetime/InfiniTime/src/displayapp/DisplayAppRecovery.h:60:12: note:   candidate expects 0 arguments, 1 provided
[build] make[2]: *** [src/CMakeFiles/pinetime-mcuboot-recovery.dir/build.make:664: src/CMakeFiles/pinetime-mcuboot-recovery.dir/systemtask/SystemTask.cpp.o] Error 1

do I maybe need to update a dependency (other than the lvgl submodule)?

NeroBurner avatar Oct 11 '21 20:10 NeroBurner

can't compile your branch locally getting error

[build] /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.cpp: In member function 'void Pinetime::System::SystemTask::Work()':
[build] /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.cpp:159:29: error: no matching function for call to 'Pinetime::Applications::DisplayApp::Start(Pinetime::System::BootErrors&)'
[build]   159 |   displayApp.Start(bootError);
[build]       |                             ^
[build] In file included from /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.h:25,
[build]                  from /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.cpp:1:
[build] /home/nero/repos/pinetime/InfiniTime/src/displayapp/DisplayAppRecovery.h:60:12: note: candidate: 'void Pinetime::Applications::DisplayApp::Start()'
[build]    60 |       void Start();
[build]       |            ^~~~~
[build] /home/nero/repos/pinetime/InfiniTime/src/displayapp/DisplayAppRecovery.h:60:12: note:   candidate expects 0 arguments, 1 provided
[build] make[2]: *** [src/CMakeFiles/pinetime-mcuboot-recovery.dir/build.make:664: src/CMakeFiles/pinetime-mcuboot-recovery.dir/systemtask/SystemTask.cpp.o] Error 1

do I maybe need to update a dependency (other than the lvgl submodule)?

Fixed that, I never tried building the recovery image.

Quantum-cross avatar Oct 11 '21 21:10 Quantum-cross

I will enabled Checks for this so it will build DFUs for testing as I see you make pushes. Good luck with this its on my to review list!

geekbozu avatar Oct 13 '21 14:10 geekbozu

My pinetime DK is arriving tomorrow so I can finally start testing on the actual hardware soon.

Quantum-cross avatar Oct 14 '21 11:10 Quantum-cross

screen blanking errors should be fixed on real hardware!

The ST7789 driver is a bit of a mess right now. I'd like to refactor it some time.

Quantum-cross avatar Oct 14 '21 22:10 Quantum-cross

This might be ready for a daily driver test.

I'm going to work on cleaning up the event handlers over the weekend but those changes shouldn't change any function.

Quantum-cross avatar Oct 15 '21 00:10 Quantum-cross

@Quantum-cross Thanks for your work on this PR! It looks like the port to LVGL8 is not as straightforward as for previous versions!

Have you already had the opportunity to check the memory usage (RAM and FLASH) since you've integrated LVGL8? We are already tight on memory, and I wouldn't want this updater to use too much of the remaining memory.

JF002 avatar Oct 16 '21 12:10 JF002

@Quantum-cross got a build error again

[build] Memory region         Used Size  Region Size  %age Used
[build]            FLASH:      391208 B       480 KB     79.59%
[build]              RAM:       53368 B        64 KB     81.43%
[build] /home/nero/repos/pinetime/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/pinetime-mcuboot-app.dir/drivers/SpiNorFlash.cpp.o: in function `Pinetime::Drivers::SpiNorFlash::Sleep()':
[build] /home/nero/repos/pinetime/InfiniTime/src/drivers/SpiNorFlash.cpp:23: undefined reference to `Pinetime::Drivers::Spi::Write(unsigned char const*, unsigned int)'
[build] collect2: error: ld returned 1 exit status
[build] make[2]: *** [src/CMakeFiles/pinetime-mcuboot-app.dir/build.make:1781: src/pinetime-mcuboot-app-1.6.0.out] Error 1

broke with commit ce2376750df305a79be07f7d60039b5fb50ceeb0

NeroBurner avatar Oct 16 '21 17:10 NeroBurner

@JF002 I don't know if that is what you're asking for, but the build output for ce63f51e83a5117cf176044428e845c2d33e36e5 shows the following memory usages

[build] [ 61%] Linking CXX executable pinetime-mcuboot-recovery-loader-1.6.0.out
[build] Memory region         Used Size  Region Size  %age Used
[build]            FLASH:      165172 B       480 KB     33.60%
[build]              RAM:       19116 B        64 KB     29.17%
[build] Memory region         Used Size  Region Size  %age Used
[build]            FLASH:      391064 B       480 KB     79.56%
[build]              RAM:       53368 B        64 KB     81.43%
[build] post build steps for pinetime-mcuboot-recovery-loader-1.6.0
[build] post build steps for pinetime-app-1.6.0
[build]    text	   data	    bss	    dec	    hex	filename
[build]  165172	    120	  18996	 184288	  2cfe0	pinetime-mcuboot-recovery-loader-1.6.0.out
[build]    text	   data	    bss	    dec	    hex	filename
[build]  391064	    592	  52772	 444428	  6c80c	pinetime-app-1.6.0.out
[build] [ 78%] Built target pinetime-app
[build] Memory region         Used Size  Region Size  %age Used
[build]            FLASH:      391064 B       480 KB     79.56%
[build]              RAM:       53368 B        64 KB     81.43%
[build] post build steps for pinetime-mcuboot-app-1.6.0
[build]    text	   data	    bss	    dec	    hex	filename
[build]  391064	    592	  52772	 444428	  6c80c	pinetime-mcuboot-app-1.6.0.out
[build] [ 79%] Linking CXX executable pinetime-recovery-loader-1.6.0.out
[build] [ 81%] Built target pinetime-mcuboot-recovery-loader
[build] [ 98%] Built target pinetime-mcuboot-app
[build] Memory region         Used Size  Region Size  %age Used
[build]            FLASH:      165172 B       480 KB     33.60%
[build]              RAM:       19116 B        64 KB     29.17%
[build] post build steps for pinetime-recovery-loader-1.6.0
[build]    text	   data	    bss	    dec	    hex	filename
[build]  165172	    120	  18996	 184288	  2cfe0	pinetime-recovery-loader-1.6.0.out
[build] [100%] Built target pinetime-recovery-loader

NeroBurner avatar Oct 16 '21 17:10 NeroBurner

@Quantum-cross you might want to cherry-pick https://github.com/InfiniTimeOrg/InfiniTime/pull/743/commits/b13aec2b0ec82f2c2cf424dea16b3eb0d08b9047 to fix the Game "Twos". On my simulator the initialization of the cell-objects ran out of memory, resulting in a segmentation fault. So I reverted to use lv_table

NeroBurner avatar Oct 16 '21 21:10 NeroBurner

@Quantum-cross you might want to cherry-pick b13aec2 to fix the Game "Twos". On my simulator the initialization of the cell-objects ran out of memory, resulting in a segmentation fault. So I reverted to use lv_table

I'm going to worry about performance optimization first right now, I'm messing with the ST driver and such.

If I can't increase the speed of scrolling then I think lvgl8 is dead in the water.

If I can fix the speed issues then I'll look into memory.

I'm mostly just testing the pinetime-app cmake target right now.

Quantum-cross avatar Oct 17 '21 16:10 Quantum-cross

I finally got round to testing this - I'm impressed with how much works! Yes the scrolling is a bit slow and the colors look washed out somehow? But it's huge progress!

kieranc avatar Oct 21 '21 18:10 kieranc

If I can't increase the speed of scrolling then I think lvgl8 is dead in the water.

If I can fix the speed issues then I'll look into memory.

i think you should look in the memory first and it may allow more speed improvement because , when my pc have very little memory free it become very slow so i think it's the same for an os like infintime @Quantum-cross

lman0 avatar Oct 23 '21 12:10 lman0

I finally got round to testing this - I'm impressed with how much works! Yes the scrolling is a bit slow and the colors look washed out somehow? But it's huge progress!

Good to hear!!! Still working on the scrolling, colors may be washed out because I may not have copied the themes exactly. I'll have to go through and double check that later.

Thanks for testing!

If I can't increase the speed of scrolling then I think lvgl8 is dead in the water. If I can fix the speed issues then I'll look into memory.

i think you should look in the memory first and it may allow more speed improvement because , when my pc have very little memory free it become very slow so i think it's the same for an os like infintime @Quantum-cross

Sure, also there was talk about maybe combining the heaps of FreeRTOS and lvgl.


Overall I have not had much time to work on this the past week. It's still near the top of my list though!

Quantum-cross avatar Oct 23 '21 15:10 Quantum-cross

I think this is a PR which is going to need extensive testing so there's no rush, and initial progress looks very promising. I did just run a DFU to the LVGL8 build though, and the DFU screen is very broken! It completed just fine, but if you want something easier to tackle than scrolling speed, there's that :-) I guess you've tried lv_page_set_anim_time ? Apparently the default is 400ms which is fairly slow.

kieranc avatar Oct 23 '21 16:10 kieranc

@Quantum-cross Do you think there's any hope in updating this or is it easier to start over? As you've put a lot of effort into this and are more familiar with the changes required, do you know if there are things we could do in preparation for upgrading to make the process easier, like making some preliminary changes for example?

Riksu9000 avatar Jul 29 '22 17:07 Riksu9000

Any updates on this?

pipe01 avatar Oct 14 '23 22:10 pipe01

While creating InfiniSim I've based my development on this lvgl8 port. I think I got to a working state, but the memory consumption of lvgl8 was higher than lvgl7. Crashing the PineTimeStyle watch face with then new settings menu. Maybe that was a bug in lvgl8 and it is fixed now, but I don't know, as I've not tested it since then

Anyways my work sprinkled with simulator based commits can be found here: https://github.com/NeroBurner/InfiniTime/commits/lv_simulation_lvgl8

maybe someone finds it useful

NeroBurner avatar Oct 28 '23 20:10 NeroBurner