Optimizing performance for ESP32


UI Optimization

What MCU/Processor/Board and compiler are you using?


What do you want to achieve?

What have you tried so far?

On page 6 of the documentation, there are some tips on how to improve ui performance. Seems like the instructions are not accesible for me using the arduino ide. Is it using C or can i achieve it on Micropython?

I hit a snag on what i am working on. Ive combined grbl sourcode with what i have done so far to work on the remaining functions. This i cannot do cause the screen is frozen. Not even a blinking cursor on the text area.

I am reading on using the second core of the microprocessor. Not having any luck with it.

Any tip will be greatly appreciated.

Warms regards

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

It’s not really clear what your question is. A specific problem you are having with information on what you’ve tried so far to solve it is easier to work with.

Most low-level things like high-performance code have to be implemented in C (as that’s where the display driver usually is).

Im forking ESP32 GRBL on github.

I created a function for my gui and included it in the main set up function. The programs main loop alone have several function calls. There i included lv_task_handler almost at the end of the loop.

Here’s how it look like.

void loop() {  
   // Reset system variables.
  uint8_t prior_state = sys.state;
  memset(&sys, 0, sizeof(system_t)); // Clear system struct variable.
  sys.state = prior_state;
  sys.f_override = DEFAULT_FEED_OVERRIDE;  // Set to 100%
  sys.r_override = DEFAULT_RAPID_OVERRIDE; // Set to 100%
  sys.spindle_speed_ovr = DEFAULT_SPINDLE_SPEED_OVERRIDE; // Set to 100%
  memset(sys_probe_position,0,sizeof(sys_probe_position)); // Clear probe position.
  sys_probe_state = 0;
  sys_rt_exec_state = 0;
  sys_rt_exec_alarm = 0;
  sys_rt_exec_motion_override = 0;
  sys_rt_exec_accessory_override = 0;

  // Reset Grbl primary systems.
  serial_reset_read_buffer(CLIENT_ALL); // Clear serial read buffer
  gc_init(); // Set g-code parser to default state  
  plan_reset(); // Clear block buffer and planner variables
  st_reset(); // Clear stepper subsystem variables
//  // Sync cleared gcode and planner positions to current system position.
//  // put your main code here, to run repeatedly:
  // Start Grbl main loop. Processes program inputs and executes them.  

I still have the gui showing on the screen but looks like the app is frozen. its about 2mb. am i overloading the microprocessor?

You need to call lv_task_handler in a loop, not just once.

its already in the main loop. newbie question but, isnt that not enough?

My apologies; I didn’t realize it was the standard Arduino loop function. Sorry about that.

Did you try using a debugger to see if the program hangs (halts) in a certain spot?

im afraid arduino ide doesnt have that feature.

Ive just transferred the project successfully to vscode platformio which i think does have a debug console. this is my first time using vscode pio. so i think ill look at the debug feature first.

thanks and have a great day. :smiley: