I wrote a little python3 script (to be run out of the src/main/targets directory) that counts how many times each #define in the target.h is used overall, my thought being that #defines only used in one target might be mistakes, e.g. caused by copy&paste of betaflight files. I used it to find #3404.
Unfortunately, I know too little about the low-level magic of iNav to determine which define is made by mistake.
The output of the script (below) is a little lengthy, but I'll include a few lines:
import os
import operator
import glob
if __name__ == '__main__':
files = glob.glob('*/target.h')
defines = {}
for file in files:
target = os.path.dirname(file)
with open(file, 'r') as handle:
for line in handle:
line = line.strip()
if line.startswith('#define'):
try:
line = line.replace('\t', ' ')
define = line.split(' ')[1].strip()
if define not in defines:
defines[define] = []
defines[define].append(target)
except IndexError:
pass
counts = {k: len(v) for k, v in defines.items()}
for define, count in sorted(counts.items(), key=operator.itemgetter(1)):
print("{}\t{}\t{}".format(define, count, ', '.join(sorted(defines[define]))))
I wrote a little python3 script (to be run out of the src/main/targets directory) that counts how many times each #define in the target.h is used overall, my thought being that #defines only used in one target might be mistakes, e.g. caused by copy&paste of betaflight files. I used it to find #3404.
Unfortunately, I know too little about the low-level magic of iNav to determine which define is made by mistake.
The output of the script (below) is a little lengthy, but I'll include a few lines: