HAL_ChibiOS: define INS_MAX_INSTANCES if less than 3

save some flash and memory
This commit is contained in:
Andrew Tridgell 2020-11-07 17:42:52 +11:00
parent 4ef7d5b468
commit bb3b59966f
1 changed files with 2 additions and 0 deletions

View File

@ -1017,6 +1017,8 @@ def write_IMU_config(f):
'#define HAL_INS_PROBE%u %s ADD_BACKEND(AP_InertialSensor_%s::probe(*this,%s))\n'
% (n, wrapper, driver, ','.join(dev[1:])))
if len(devlist) > 0:
if len(devlist) < 3:
f.write('#define INS_MAX_INSTANCES %u\n' % len(devlist))
f.write('#define HAL_INS_PROBE_LIST %s\n\n' % ';'.join(devlist))