[PROS] memory error in GUI creation


Hello, I’m attempting to create a graphical user interface in PROS. However, I keep getting a memory permission error 0000000. Also, I’ve tried breaking it down piece by piece and I seem to get the error even when i just create only a window or page.
Thanks in advance,

lv_style_t style1;
lv_obj_t * home;
lv_obj_t * frontBlueScr;

lv_obj_t * title;
lv_obj_t * blueFrontBtn;
lv_obj_t * redFrontBtn;
lv_obj_t * blueBackBtn;
lv_obj_t * redBackBtn;

static lv_res_t homeScreenButtonPress(lv_obj_t * btn)

    uint8_t id = lv_obj_get_free_num(btn);
    printf("Button %d is released\n", id);
      GUIScreen = "BF";//sets the GUIScreen to the blue front screen
        GUIScreen = "RF";//sets GUIScreen to red front
          GUIScreen = "BB";
            GUIScreen = "RB";
    return LV_RES_OK; /*Return OK if the button is not deleted*/

static void guiFunction(void*){
  /*Create a style*/

lv_style_copy(&style1, &lv_style_plain);    /*Copy a built-in style to initialize the new style*/
style1.body.main_color = LV_COLOR_WHITE;
style1.body.grad_color = LV_COLOR_BLUE;
style1.body.radius = 10;
style1.body.border.color = LV_COLOR_GRAY;
style1.body.border.width = 2;
style1.body.border.opa = LV_OPA_50;
style1.body.padding.hor = 5;            /*Horizontal padding, used by the bar indicator below*/
style1.body.padding.ver = 5;            /*Vertical padding, used by the bar indicator below*/
style1.text.color = LV_COLOR_RED;

while (true) {
  /* code */
  if(GUIScreen=="H") {
      home = lv_obj_create(lv_scr_act(), NULL);
      title = lv_label_create(home, NULL); //First parameters (scr) is the parent
      lv_label_set_text(title, "Auton Selection Screen");  /*Set the text*/
      lv_obj_set_x(title, 50);

      blueFrontBtn = lv_btn_create(home, NULL);
      lv_btn_set_action(blueFrontBtn, LV_BTN_ACTION_CLICK, homeScreenButtonPress);
      lv_obj_set_free_num(blueFrontBtn, 1);
      lv_cont_set_fit(blueFrontBtn, true, true);
      lv_obj_t * blueFrontLabel = lv_label_create(blueFrontBtn, NULL);
      lv_obj_align(blueFrontBtn, blueFrontLabel, LV_ALIGN_CENTER, 0, 0);
      lv_label_set_text(blueFrontLabel, "Blue Front");

      redFrontBtn = lv_btn_create(home, blueFrontBtn);
      lv_obj_set_free_num(redFrontBtn, 2);
      lv_obj_t * redFrontLabel = lv_label_create(redFrontBtn, NULL);
      lv_label_set_text(redFrontLabel, "Red Front");

      blueBackBtn = lv_btn_create(home, blueFrontBtn);
      lv_obj_set_free_num(blueBackBtn, 3);
      lv_obj_t * blueBackLabel = lv_label_create(blueBackBtn, NULL);
      lv_label_set_text(blueBackLabel, "Blue Back");

      redBackBtn = lv_btn_create(home, blueFrontBtn);
      lv_obj_set_free_num(redBackBtn, 14);
      lv_obj_t * redBackLabel = lv_label_create(redBackBtn, NULL);
      lv_label_set_text(redBackLabel, "Red Back");

      while (GUIScreen == "H") {

    else if (GUIScreen=="FB"){
      frontBlueScr = lv_page_create(NULL, NULL);
      lv_page_set_style(frontBlueScr, LV_PAGE_STYLE_SB, &style1);


This method is called to in OpControl

void opcontrol() {
	pros::Task GUI(guiFunction);


You can look here to find an example GUI using LVGL that runs on V5. There are actually two GUI examples that can be compiled using “#define USE_BTNM_GUI”.

I’m not sure what you are trying to do, but don’t wrap the LVGL calls in a while loop in a task. PROS already has an LVGL task that processes the GUI you setup. So you also don’t need them in a task.

If what you want is to press a button on the screen and that creates another screen with more options and then de-allocates the original screen, that is above what I’ve done. It can be done, I’ve just not done it. If you just want a few different views you might want to look at tabs.


Thanks. The while loop appears to have been causing issues. I removed it and it now displaying the mess of a GUI that I’ll be debugging for a bit. It also appears that calling the function through a task was a mistake, as well. Thank you for the advice