4 # Parse release targets for sensors etc.
6 # Public domain or equivalent, e.g. [Zero Clause BSD](https://tldrlegal.com/license/bsd-0-clause-license)
9 SENSORS=[:imu, :baro, :mag, :rangefinder]
16 if l.match(/SKIP_RELEASES/)
29 next unless l.match(/^\s*#define /)
32 if m = l.match(/USE_#{sn}_(\S+)/)
33 next if m[1].match(/DATA_READY/)
37 if m = l.match(/USE_FAKE_#{sn}/)
48 abort "find_sensors.rb dir version" unless ARGV.size == 2
50 puts DATA.read % [ Time.now.strftime("%F"), ARGV[1]]
53 puts "| Target | IMU | Baro | Mag | Rangefinder |"
54 puts "| ------ | ---- | ---- | ---- | ----------- |"
56 Find.find('.').select { |f| f =~ /target\.h$/ }.each do |fn|
57 next unless fn.match(/src\/main\/target/)
58 target=File.dirname(fn).gsub('./','')
59 STDERR.puts "#{target} #{fn}\n"
60 cfn = "#{target}/CMakeLists.txt"
61 next unless File.exist?(cfn)
62 next unless check_rel(cfn)
63 devs = find_sensors(fn)
70 # STDERR.puts "DS #{target} #{d} #{ds}"
77 f.each_with_index do |l,n|
80 if m=l.match(/target_\S{2,3}32\w+\((\w+)/)
86 c0 = cols[0].split('/')[-1]
89 cols[0] = "#{cols[0]} \\*"
90 if textras and !textras.empty?
91 tstr = textras.join(' ')
92 cols[0] = "#{cols[0]} (#{tstr})"
95 str = cols.join(" | ")
103 The following table was machine generated by [find_sensors.rb](assets/find_sensors.rb) script on %s against INAV %s, E&OE
105 Targets suffixed by \* indicates that there are (probably) multiple hardware variations covered by one or more firmware images (or just a strange target.h). Additional, related targets are listed in parentheses. The user may check the hardware documentation (or `target.h` / `CMakeLists.txt`) to determine the actual supported sensors.