Closed GoogleCodeExporter closed 8 years ago
When this local declaration is done in pid.h, the compiler makes
zeroIntegralError() inline and it unrolls the code, so it gets quite large.
Prevent this by forcing zeroIntegralError() to be noinline.
void zeroIntegralError() __attribute__ ((noinline));
void zeroIntegralError() {
for (byte axis = ROLL; axis < LASTLEVELAXIS; axis++)
PID[axis].integratedError = 0;
}
Original comment by al...@arcor.de
on 27 Dec 2010 at 4:06
Pretty amazing! Those updates saved about 700 bytes. Do you think these
updates cause the code to run slower though?
Original comment by CaranchoEngineering@gmail.com
on 7 Jan 2011 at 7:42
The fix causes the code to run faster, it takes longer to increment and use a
global integer than a byte register, but not so much, maybe it saves 0.5 µs
per usage. For the overall speed of this has just a minor effect, as the serial
and eeprom stuff does not run in the main loop and is relative slow anyway.
Original comment by al...@arcor.de
on 7 Jan 2011 at 9:52
Original issue reported on code.google.com by
al...@arcor.de
on 27 Dec 2010 at 4:00