Git Product home page Git Product logo

liblvgl's People

Contributors

hotelcalifornia avatar jerrylum avatar noam987 avatar r11g avatar richard-stump avatar ryan-doan avatar unwieldycat avatar willxucodes avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

liblvgl's Issues

Update LVGL to version 8.3

The latest version of LVGL is version 8.3: https://github.com/lvgl/lvgl

We need to update the template to match this version. We only need to worry about the files under the src/ folder in the above repo, and these are transplanted to our src/ and include/ folders.

When updating the LVGL version, be sure to carry over the necessary settings in /include/display/lv_conf.h

Script to automatically pull LVGL updates

Overview

Although updating liblvgl is less cumbersome now that it is removed from the kernel, we still need to do the following to update liblvgl:

  • Copy all the header files from LVLG's repo to include/liblvgl
  • Copy all the source files from LVLG's repo to src/liblvgl
  • Update all the includes in the LVGL files to match the PROS project structure
  • Update include/liblvgl/fonts/lv_font.h to include our custom fonts that llemu depends on

My Proposal

Fixing the font issue:

  1. Store the fonts that llemu depends on in a vector graphics file
  2. On build, the makefile creates the lvgl font.c files
  3. The fonts are declared in a new pros_line.h file so we don't have to add then to lv_font.h

Automated update script:

The script should not run automatically when LVGL updates, since we want to force someone to make sure everything works and builds properly

These are the things I think the script needs to do:

  1. Check the latest release tag on LVGL's repo. If we are up to date, do nothing
  2. Otherwise, clone the repo as a submodule
  3. Copy all the headers to include/libvgl
  4. Copy all the c files to src/liblvgl
  5. Run through all the copied files and update the includes to be absolute and follow the PROS project structure.

Replace vex_display_flush and vex_read_touch with simplified screen API's structs/calls.

In the kernel repo, our LVGL hooks make calls to VexOs directly. These need replaced since the template cannot use the VexOs API. The functions liblvgl_display_flush() and liblvgl_read_touch() need to be updated to use the pros screen API rather than the VexOs api:

static void liblvgl_display_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color) {
	screen_copy_area(area->x1, area->y1, area->x2, area->y2, (uint32_t*)color, area->x2 - area->x1 + 1);
	lv_flush_ready();
}

static bool liblvgl_read_touch(lv_indev_drv_t* _, lv_indev_data_t* data) {
	screen_touch_status_s_t touch_data = screen_touch_status();

	switch (touch_data.touch_status) {
		case E_TOUCH_PRESSED:
		case E_TOUCH_HELD:
			data->state = LV_INDEV_STATE_PR;
			break;
		case E_TOUCH_RELEASED:
			data->state = LV_INDEV_STATE_REL;
			break;
	}
	// return last (x,y) pos in all cases https://doc.littlevgl.com/#Porting and
	// purduesigbots/pros#79
	data->point.x = touch_data.x;
	data->point.y = touch_data.y;
	return false;
}

PROS 4 Implementation Details

Steps to do this:

  • Upgrade Kernel to some version of PROS 4 Kernel without LVGL
  • Re-add LVGL files (Probably will be LVGL >7)
  • Replace vex_display_flush and vex_read_touch with simplified screen API's structs/calls.
  • Verify that LVGL still works, release a version of this for beta testing. Also make sure that this works in template form as well.
static void liblvgl_display_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color) {
	screen_copy_area(area->x1, area->y1, area->x2, area->y2, (uint32_t*)color, area->x2 - area->x1 + 1);
	lv_flush_ready();
}

static bool liblvgl_read_touch(lv_indev_drv_t* _, lv_indev_data_t* data) {
	screen_touch_status_s_t touch_data = screen_touch_status();

	switch (touch_data.touch_status) {
		case E_TOUCH_PRESSED:
		case E_TOUCH_HELD:
			data->state = LV_INDEV_STATE_PR;
			break;
		case E_TOUCH_RELEASED:
			data->state = LV_INDEV_STATE_REL;
			break;
	}
	// return last (x,y) pos in all cases https://doc.littlevgl.com/#Porting and
	// purduesigbots/pros#79
	data->point.x = touch_data.x;
	data->point.y = touch_data.y;
	return false;
}

LVGL 5.3: lcd::print() is broken

Task:

The lcd::print function for llemu.cpp/hpp is not printing anything. An example of this can be seen with the default main.cpp:

...
while (true) {
        pros::lcd::print(0, "%d %d %d", (pros::lcd::read_buttons() & LCD_BTN_LEFT) >> 2,
		               (pros::lcd::read_buttons() & LCD_BTN_CENTER) >> 1,
		               (pros::lcd::read_buttons() & LCD_BTN_RIGHT) >> 0);
...

This should print the states of the 3 buttons as 0 or 1 on the first line, but currently seems to print nothing. It should look like:
image

Beta Server Link:

https://discordapp.com/channels/1025259843763847229/1029666535553384498/1071536722996887602

Testing:

This can be tested using the default main.cpp. The button states should be printed at the top, and change when the buttons are pressed.

LVGL Filesystem

May be worth looking into creating stub filesystem functions to allow for the use of the filesystem module from LVGL 8.

Verify that LVGL still works

Test the LVGL template to verify that it works. Try various features, especially things such as buttons to ensure they work properly. Also test LVGL 8 specific features to ensure that it was upgraded properly

Make LVGL thread-safe

Expected Behavior:

LVGL functions should be thread-safe.

Actual Behavior:

Per lvgl/lvgl#544, we need to mutex guard the call to lv_task_handler, and then make the same mutex available to guard the calls to the lv_* API.

Steps to reproduce:

This hasn't yet been the obvious cause of any observed issues.

System information:

Platform: V5
PROS Kernel Version: any

Additional Information

As I'm thinking about it, it seems the best solution will be to add accessor functions:

lv_mutex_take(void);
lv_mutex_give(void);

My first thought was to just have a single function that would just return the mutex itself, but I have since realized that would potentially allow users to delete it, which would not be desirable. As such, I think the above solution is the way to go.

Screenshots/Output Dumps/Stack Traces

N/A

Port LVGL 5.3 for PROS 3 Compatability

Since LVGL 8.3 has a different API than LVGL 5.3 (the one in PROS 3), users might have issues with that transition. For this reason, we should port over the version from PROS 3 so that users can choose whether to use LVGL 8.3 or LVGL 5.3.

This should simply be moving the files in include/display and src/display on the PROS repo into this project, changing a few functions slightly, and creating a dedicated 5.3 branch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.