Skip to content

Commit

Permalink
Merge pull request #54 from iNavFlight/update_contistency_script
Browse files Browse the repository at this point in the history
improve consistency check script in the face of missing enums
  • Loading branch information
stronnag authored May 14, 2022
2 parents 46c7fee + 65a4c19 commit 25e5442
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions tools/rcmodes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,26 @@ def process_enums wanted,have,enums
processed = []
enums.each_with_index do |l,j|
l.chomp!
if m = l.match(/^([A-Za-z]\S+)/)
ev = nil
k = -1
if m = l.match(/^([A-Za-z]\S+)\s+=\s+(.*?),/)
ev = m[1]
ex = m[2]
if z = ex.match(/\(1 << (\d+)\)/)
k = z[1].to_i
else
k = ex.to_i
end
elsif m = l.match(/^([A-Za-z]\S+)/)
ev = m[1]
end
if !ev.nil?
break if ev.match(/_COUNT$/) && j = enums.size - 1
processed << ev
if k != -1
processed[k] =ev
else
processed << ev
end
end
end

Expand All @@ -27,6 +43,9 @@ def process_enums wanted,have,enums
when 'adjustmentFunction_e'
l = l.sub(/^ADJUSTMENT_/,'')
end
if l.nil?
l = "**** MISSING ****"
end
l.gsub!(',','')
puts " \"#{l}\",\t\t// #{j}"
end
Expand Down

0 comments on commit 25e5442

Please sign in to comment.