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

⬆️ Upgrade LVGL to 5.3 #144

Merged
merged 12 commits into from
Aug 19, 2019
Merged

⬆️ Upgrade LVGL to 5.3 #144

merged 12 commits into from
Aug 19, 2019

Conversation

HotelCalifornia
Copy link
Contributor

@HotelCalifornia HotelCalifornia commented May 14, 2019

Summary:

Upgrades LVGL to 5.3 release

Motivation:

everyone reeeealllly wants this

References (optional):

Should unblock #110 and by extension purduesigbots/liblvgl#13
Closes #92

Test Plan:

  • let people play with it i guess

- still need to test for some regressions
- still need to test some 5.3 features
@HotelCalifornia HotelCalifornia added p: normal Normal priority enhancement This builds on top of an existing feature in progress This is currently being worked on labels May 14, 2019
@HotelCalifornia HotelCalifornia added this to the 3.1.7 milestone May 14, 2019
@HotelCalifornia HotelCalifornia self-assigned this May 14, 2019
@HotelCalifornia HotelCalifornia added this to In Progress in PROS Non-Versioned Kernel Development via automation May 14, 2019
@HotelCalifornia
Copy link
Contributor Author

everything compiles right now, but important things (namely LLEMU) appear to be broken.

@HotelCalifornia
Copy link
Contributor Author

example of breakage:

2019-03-28-151855_480x272_pros_capture

@HotelCalifornia
Copy link
Contributor Author

attached is a kernel template built on commit bd6bb46 for anyone who's interested in helping debug (e.g. @Jerrylum)
kernel@3.1.7-commit.13.bd6bb46.zip

@Jerrylum

This comment has been minimized.

@HotelCalifornia
Copy link
Contributor Author

Ah, yes. One of the things we get in this upgrade is support for monospaced fonts, which I believe I set as the default. You should be able to switch back to the old (not monospaced) font with a call to lv_set_font or whatever it is (can't remember off the top of my head)

@HotelCalifornia
Copy link
Contributor Author

HotelCalifornia commented May 14, 2019

the symbol should be lv_font_dejavu_20 (changing the number for the size you'd like). Monosapced fonts can be used with pros_font_dejavu_mono_20 and friends.

@Jerrylum
Copy link
Contributor

@Jerrylum
Copy link
Contributor

Jerrylum commented May 14, 2019

image

I fixed the problem. That's fine right now.

@HotelCalifornia
Copy link
Contributor Author

per @edjubuh:

For sake of backwards compatibility, I think the monospace should be turned on by default only when you initialize LLEMU

That's a good point. What I'll probably end up doing is just keeping the default font the same as it is, and changing LLEMU styles to explicitly use the monospaced version

@Jerrylum
Copy link
Contributor

Jerrylum commented May 29, 2019

You can solve the problem by adding a delay at the first line of initialize function.
image
According Lines 43 - 45 in main.c file:
https://github.com/purduesigbots/pros/blob/develop/src/system/main.c#L43-L45
It is because the user 'initialize' function runs before the LVGL init and causes the problem. LVGL will display an empty screen (no object) in the init function, and it is grey. This keeps working in the old version, and I don't know why it is malfunctioning now.

I think we should be initializing LVGL before the system daemon, and the problem should be resolved.

@HotelCalifornia
Copy link
Contributor Author

Thanks for the investigation, I'll give it a try at some point in the next few days or so.

You're right that we should probably be initializing LVGL before running the competition tasks... I'm not entirely sure why it was working before but it seems to have been a fluke.

@HotelCalifornia
Copy link
Contributor Author

@Jerrylum thanks again for the help, changing the order of initialization does seem to have fixed it

2019-05-31-132534_480x272_pros_capture

@HotelCalifornia
Copy link
Contributor Author

incidentally, now that we actually have a monospace font, we can finally impose a hard limit on the number of characters that can be printed on the LLEMU screen (33). this also means that we can get rid of the call to vasprintf (lol).

before:
2019-05-31-133123_480x272_pros_capture

after:
2019-05-31-133457_480x272_pros_capture

@HotelCalifornia HotelCalifornia marked this pull request as ready for review May 31, 2019 04:39
@HotelCalifornia
Copy link
Contributor Author

I'm attaching a copy of the kernel from this PR (as of 890739f) so people can play around with it and tell me what's broken

kernel@3.1.7-pr144.629.zip

@HotelCalifornia
Copy link
Contributor Author

well this is... uh... progress?

lv_obj_t* canvas;
static void* canvas_buf;
void initialize() {
	canvas = lv_canvas_create(lv_scr_act(), NULL);
	canvas_buf = malloc((lv_img_color_format_get_px_size(LV_IMG_CF_TRUE_COLOR) * 480 * 240)/ 8);
	lv_canvas_set_buffer(canvas, canvas_buf, 480, 240, LV_IMG_CF_TRUE_COLOR);
	lv_canvas_draw_circle(canvas, 240, 120, 60, lv_color_t{{0xFF,0xFF,0x00}}); // yellow
}

2019-05-31-140044_480x272_pros_capture

@jm-spencer
Copy link
Contributor

I tested my screenlib on this, pretty much everything was the same.
The only exception is with text, which is printing slightly differently.

The text is printing a single 5x7 character on a 10x10 obj. If I remove everything except for aligning the label to the center of the cube, I get this branch printing 4 pixels right of the existing kernel.
Of course, it is possible this is a change with how aligning works or something with lvgl itself, I'll have to investigate more.

Existing kernel
Existing kernel

This branch
This branch

@HotelCalifornia
Copy link
Contributor Author

The only exception is with text, which is printing slightly differently.

What font were you using?

@jm-spencer
Copy link
Contributor

This one here
If you’re planning on testing with it, know it only has the characters for numbers.

@HotelCalifornia
Copy link
Contributor Author

HotelCalifornia commented Jun 1, 2019

Hm ok yeah. I'm pretty sure there were some changes made to the way that fonts are rendered (judging by the addition of support for monospace fonts). I wonder what would happen if you explicitly configured that font as such? See

.monospace = 5, /*Fix width (0: if not used)*/

@theol0403
Copy link
Contributor

First thing I noticed when I upgraded - my splashscreen image broke. Probably because the image was generated using the old convertor.

Before:
2019-05-31-225035_480x272_pros_capture
2019-05-31-225127_480x272_pros_capture
After:
2019-05-31-225931_480x272_pros_capture
2019-05-31-225949_480x272_pros_capture

Not much changed, it looks good. The only difference I noticed was under the angler page, in the button matrix on the left, the bottom button was expanded to fill the container. Most likely a bug fix.

I will get the image working, but apart from that the upgrade looks successful.

@HotelCalifornia
Copy link
Contributor Author

Hmmm... The image thing alone might warrant bumping to 3.2.0

@theol0403
Copy link
Contributor

I managed to get the image to work. However, it seems only True Color with Alpha gave me the results I needed, and it was a massive download.
Raw gave a "no data" error, and all the chroma-keyed ones had transparency problems.
Probably not a bug though, but it might be a good idea to suggest the best format in the docs.

@theol0403
Copy link
Contributor

Working splashscreen with transparency.
2019-05-31-232029_480x272_pros_capture

I don't think I have anything else to test, aside from upgrading the image format, everything else worked properly.

@HotelCalifornia do you want me to try to use the canvas?

@HotelCalifornia
Copy link
Contributor Author

I was also getting the "no data" thing when setting raw color format on a canvas. I think I saw something about needing a custom decoder for that.

That said, I had some ok results when using the indexed 8-bit format-- did you try that? Also I think @Jerrylum had some success with writing a bmp decoder that used 32-bit RGBA (which may actually be the same thing now I think about it)

@theol0403
Copy link
Contributor

I did not try any indexed formats, but does it provide the transparency I need? My image is white, and the container background is orange, which is why the transparency is needed.

When I have time I will test the reading from SD card. Last time I tried I couldn't get it to work (it just gave no data no matter the path), and I needed to be able to compile LVGL on my own to enable the debugging options.

I know you have thought about it already, but I really think it is a good idea to provide LVGL as a template, which people can build on their own, and people can uninstall it and opt to install another template which contains the vexos screen wrappers.

@HotelCalifornia
Copy link
Contributor Author

I did not try any indexed formats, but does it provide the transparency I need? My image is white, and the container background is orange, which is why the transparency is needed.

Ah, ok. Assuming that the 8-bit indexed format is actually RGBA, then yes, the "A" refers to an alpha (read: transparency) channel.

I know you have thought about it already, but I really think it is a good idea to provide LVGL as a template, which people can build on their own, and people can uninstall it and opt to install another template which contains the vexos screen wrappers.

Yeah I have thought about it. There are a couple problems:

  • it's arguably better to have LVGL compiled in with the kernel:
    • so that it has a bit lower-level access (kernel heap, etc)
    • and requires basically zero configuration on the part of the user
  • at this point removing LVGL from the kernel would be a really big breaking change

I suppose I could build a copy of the kernel with LVGL debugging turned on, if you think that would help

@Jerrylum
Copy link
Contributor

Jerrylum commented Jun 1, 2019

I tested the LVGL Canvas feature and made a BMP image display function.
The function can display RGB (24 bit) .bmp and RGBA (32 bit) .bmp file.

This is the code:
https://gist.github.com/Jerrylum/5d4f3168a596dfbcd87e8d5f81236fcc

The result:
2019-06-01-145200_480x272_pros_capture
Showing "pros-icon-rgba.bmp", the picture is bigger then the screen

The image I used in the code:

  • pros-icon.bmp (with white background, R8:G8:B8)
  • pros-icon-rgba.bmp (with transparent background, A8:R8:G8:B8)

Size: 280px X 280px

Download:
images.zip

Tools to made image: Pixelformer

@HotelCalifornia HotelCalifornia changed the title Upgrade LVGL to 5.2 ⬆️ Upgrade LVGL to 5.3 Jun 3, 2019
Copy link
Contributor

@baylessj baylessj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of minor polishing changes that I'd like to see, otherwise it seems ready to get merged.

include/api.h Outdated Show resolved Hide resolved
version Outdated Show resolved Hide resolved
src/system/startup.c Show resolved Hide resolved
PROS Non-Versioned Kernel Development automation moved this from In Progress to In Review Aug 19, 2019
PROS Non-Versioned Kernel Development automation moved this from In Review to Reviewer Approved Aug 19, 2019
@HotelCalifornia HotelCalifornia merged commit 330469c into develop Aug 19, 2019
PROS Non-Versioned Kernel Development automation moved this from Reviewer Approved to Done Aug 19, 2019
@HotelCalifornia HotelCalifornia deleted the feature/upgrade-lvgl branch August 19, 2019 22:21
@HotelCalifornia HotelCalifornia mentioned this pull request Sep 3, 2019
1 task
HotelCalifornia added a commit that referenced this pull request Sep 15, 2019
* Better errno for registry validation failure, update vision sensor errnos

Summary:
  - Changed port number validation to return ENXIO when outside the domain of port numbers
  - Changed port validation to return ENODEV when the requested device doesn't match the actual device
  - Vision Sensor read/get functions consistently use EAGAIN when the libv5rts tells us it couldn't get data
  - Remove docstrings for EACCES since it is practically impossible to get that errno (we wait for mutex indefinitely)

Test Plan:
TBD

* ✨ Add Makefile-variable for excluding libraries from cold image (#121)

#### Summary:
Someone want to enable 🔥/❄ function but he doesn't want to include all libraries in the cold image. So he adds this feature here. you can edit `EXCLUDE_COLD_LIBRARIES` to exclude the library. The library will be compiled every time you use `make` command. (🔥🔥🔥)

#### Motivation:
Add it.

##### References (optional):
lazy to make an issue. 404 not found.

#### Test Plan:
- [x] Make a library for testing
- [x] Make a new project and apply the testing library
- [x] Compile with  🔥/❄ function (use `make all`)
- [x] Upload and test if the library is running?
- [x] Exclude the library
- [x] Compile with  🔥/❄ function (use `make all`)
- [x] Upload and test if the library is running?
- [x] Change something in the project
- [x] Compile with  🔥/❄ function  (use `make`)
- [x] Upload and test if the library is running?
- [x] delete variable `EXCLUDE_COLD_LIBRARIES`
- [x] Compile with  🔥/❄ function (use `make all`)
- [x] Upload and test if the library is running?

* Update vdml_vision.c

* Update vdml_vision.c

* Update vdml_vision.c

* Update Copyright info to current year

* 🐛 Fix cold libraries variable assignment (#129)

* Apply suggestions from code review

Co-Authored-By: edjubuh <edjubuh@elliotjb.com>

* Fix whitespace

* Fix up errno when mismatch/not connected

* Fix up errno when mismatch/not connected for ADI

* Fix up errno when mismatched/not connected for ADI round 2

* Fix up errno when mismatched/not connected for ADI round 3

* ✨ Improve Makefile compile speed (#123)

#### Summary:
Someone doesn't want to waste his time. So he adds this code to make compile-job faster. The compiler now doesn't need to remove and create `temp.log` every time it compiles a file. 

#### Motivation:
Add it.

##### References (optional):
close #103 

#### Test Plan:
- [x] Call `make all`
- [x] Call `make`
- [x] Try to compile with no error
- [x] Try to compile with warning
- [x] Try to compile with error

#### Commits:

* ✨ Improve Makefile compile speed

* Use only variables; use printf

* Keep changes from #119

* Do not treat strings as escaped

* Migate kernel makefile to test_output_2 (#130)

#### Summary:
Migrate kernel makefile to `test_output_2` and make make make again.

#### Motivation:
It's broken because `@cd` isn't a command. `@` was supposed to suppress echoing the whole command, but `test_output` has changed.

##### References (optional):
#123 

#### Test Plan:
- [X] It build

* Fix incorrect port type (#139)

#### Summary:
Fix incorrect port type in some motor functions

#### Motivation:
They were different from everywhere else with seemingly no reason.

#### Test Plan:

- [x] Still compiles

* Add alternate generic serial API and fix generic serial filesystem driver (#141)

* Add alternate serial API

* Fix generic serial files

* Add serial tests

* Fix dev_read_r and dev_write_r starving tasks

* Revert DEVCTL_SET_BAUDRATE to maintain compatibility

* Update generic serial test

* Modify blocking serial sleep time

* Move serial include

* Change serial telemetry function names

* 🐛 Update vision_read_by_sig to be less funky (#124)

* Update vision_read_by_sig to properly transform all coordinates and
respect array boundaries

Summary:
- We weren't properly respecting array boundaries on read_by_sig, now we
are

Test Plan:
- [x] @kdcrafter tested in T659 and throughout Worlds

* Update vdml_vision.c

* 🚨 Make things work with GCC 8.3 (#155)

* add __sync_synchronize stub

* catch exception by reference to suppress new warning

* move mlock functions to their own file to fix newlib

* 🔧 Enable hot/cold by default (#154)

* 🏗 Combine template source files (#152)

* Rename main.c to startup.c

* Combine initialize, autonomous, and opcontrol into main

* Patch Makefile

* Patch template-Makefile

* Don't change USE_PACKAGE in this PR

* 🐛 Fix multiple ADI bugs and inconsistencies (#151)

* Fix IntelliSense error

* Note possible hack with registry pad

* Note possible issue with claim_port

* Cleanup ADI C API

* Remove config clear from ADI destructor

* Move ADI config to initilizer list

* Fix double normalization of ultrasonic port

* Partially Revert "Remove config clear from ADI destructor"

This partially reverts commit 6a562ef.

* Declare ADIPort destructor as default

* Revert "Note possible hack with registry pad"

This reverts commit 866067b.

* Change claim_port note

* ⬆️ Upgrade LVGL to 5.3 (#144)

* [wip] rollback point

* finish upgrade\? doubt it

* update lv_conf

* make everything compile

- still need to test for some regressions
- still need to test some 5.3 features

* initialize LVGL before system daemon

* make non-monospaced font the default again

* limit LLEMU screen to 33 monospace chars

* clean versions

* add comment about system_daemon_initialize

* 🤫 Suppress ignored qualifiers when including lvgl (#147)

* 🔧 Add default `.gitignore` to template (#156)

* 🚸 Add alternate constructor for pros::Task (#158)

* Alternate Task contructor: ommission of prio and stack_depth while still allowing access to name

* Delegation of truncated constructor to the normal constructor

* 💚 Update toolchain installation for azure (#163)

* update toolchain installation for azure

the PPA was hanging, and it installs an old version anyway

* Update azure-pipelines.yml

Co-Authored-By: Elliot Berman <berman5@purdue.edu>

* 🚨🔊 Add a better Data Abort Handler (#112)

* Add WIP of a better DataAbortHandler

* More WIP

* Cleanup

* refactor some things

* Refactor, clean up, and documentation

* More comments

* Update unwind.c

* Tweak printfs

* Add custom build of newlib

* Include libc/libm in template

* Exclude libc/libm from being included in cold image

* check whether pc is in the hot zone

* test unwind with hot/cold linking

* Add support for unwinding through hot code

* Clean up for PR

* Undo USE_PACKAGE:=1

* remove leftover include

* move __env_lock/__env_unlock to src/system/envlock.c

missed this in #155, but these two functions are moved to their own file for the same reason as __malloc_lock/__malloc_unlock were-- to follow the override scheme that newlib expects. found the right filename from here: https://newlib.sourceware.narkive.com/aXWplROp/queries-concerning-rtos-protection-in-newllib

* lint files

* Update .arclint whitespace

* 🐛 Add default LLEMU init code back to main.cpp (#165)

* 🐛 adddefault LLEMU init code back to main.cpp

* add documentation comment for callback function

* Bump to 3.2.0

* 🔧 Recompile on header change (#167)

* implemented header dependency tracking

* Added dependency folder to the makefile

* fix bug in making c folders

* Renamed POSTCOMPILE

* Undo unwanted changes

* Modify template gitignore

* Ignore clean errors

* 🐛 Return proper error code for VDML functions that return floating point numbers (#160)

* 🐛 Fix problem of return PROS_ERR_F error code

* 🐛 Improve condition statement and comment VDML function


🤫 forgot to change

* 🐛 Undo claim_port_try code to avoid warning




🐛 Undo claim_port_try code to avoid warning

* 🐛 Fix motor PID functions bug (#162)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This builds on top of an existing feature in progress This is currently being worked on p: normal Normal priority
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Upgrade to LVGL 5.3
5 participants