ATmega328pb for SFOC control with two as5600(I2C)

Hey @zdldcyy,
I’m happy you were able to make it compile ad work a bit!

There is a few steps to downsize the code. One of them is definitely to build the minimal version of the library. You can follow the tutorial in the readme file of the minimal branch. It will not take you more than 10-15 minutes to create.

Furthermore, one of the biggest dynamical memory consumers is the sine table used to approximate the sine functions (to make the commutation faster). But in your case the performance is not as important. So what I would suggest you do, after you have created the minimal repository following the instructions in the readme file, is to open BLDCMotor.cpp file and replace all the _sin() and _cos() functions by sin() and cos(). A priori you those will be the lines: 283,284, 319,320.

Once you have changed these lines your dynamical memory use will be up to 20% smaller.

Let me know how it went!