Hello, I'm implementing Leonardo based ahrs system and I ran into a strange issue with compiler generating a program that is too big.
This code takes 92% of flash space: /*Based on the Madgwick algorithm found at:See: http://www.x-io.co.uk/open-s - Pastebin.com
After replacing these lines:
for (i = 0; i < 500;i++)
{
gyro.read();
compass.read();
Smoothing(&compass.a.x, &smoothAccX);
Smoothing(&compass.a.y, &smoothAccY);
Smoothing(&compass.a.z, &smoothAccZ);
delay(3);
}
With this:
while (true)
{
for (i = 0; i < 500;i++)
{
gyro.read();
compass.read();
Smoothing(&compass.a.x, &smoothAccX);
Smoothing(&compass.a.y, &smoothAccY);
Smoothing(&compass.a.z, &smoothAccZ);
delay(3);
}
}
It only takes 83% of space! I don't know how it's possible that ADDING code reduces the required space by almost 10%, but it's clearly some kind of a bug. Are there any flags or other tricks I can do to further reduce the size? Because I think it's using way too much space for a simple program like this.