Do ordering for the receiver board

This meant improving the handling of multiple kinds of DNP parts in
ordering.rb.

Change-Id: Id853c1a94a358ace8d09253a54f7bd0c18751254
diff --git a/motors/big_schematic/ordering.rb b/motors/big_schematic/ordering.rb
index 1b7b389..bf5fc9a 100755
--- a/motors/big_schematic/ordering.rb
+++ b/motors/big_schematic/ordering.rb
@@ -88,63 +88,80 @@
   end
 
   def initialize(pn, value, footprint, device, secondary_value, refdes, tolerance, pn_optional, dev_only)
-    @pn, @value, @footprint, @device = pn, value, footprint, device
-    @secondary_value, @tolerance = secondary_value, tolerance
-    @pn_optional, @dev_only = pn_optional, dev_only
+    if value == 'DNP'
+      if pn
+        puts "Error: part #{pn} for DNP from #{refdes}"
+      end
+      @value = 'DNP'
+      @pn, @footprint, @device = nil, nil, nil
+      @secondary_value, @tolerance = nil
+      @pn_optional, @dev_only = nil
+    else
+      @pn, @value, @footprint, @device = pn, value, footprint, device
+      @secondary_value, @tolerance = secondary_value, tolerance
+      @pn_optional, @dev_only = pn_optional, dev_only
 
-    puts "#{refdes} has no footprint" unless footprint
+      puts "#{refdes} has no footprint" unless footprint
+    end
 
     @refdeses = [refdes]
   end
   def found_another(pn, value, footprint, device, secondary_value, refdes, tolerance, pn_optional, dev_only)
     error = false
-    if pn != @pn
-      puts "Error: pn #@pn vs #{pn}."
-      error = true
-    end
-    if value != @value
-      puts "Error: value #@value vs #{value}."
-      error = true
-    end
-    if footprint != @footprint
-      puts "Error: footprint #@footprint vs #{footprint}."
-      error = true
-    end
-    if device != @device
-      puts "Error: device #@device vs #{device}."
-      error = true
-    end
-
-    if pn_optional != @pn_optional
-      puts "Error: pn_optional #@pn_optional vs #{pn_optional}."
-      error = true
-    end
-    if dev_only != @dev_only
-      puts "Error: dev_only #@dev_only vs #{dev_only}."
-      error = true
-    end
-
-    if tolerance && @tolerance
-      if tolerance != @tolerance
-        puts "Error: tolerance #@tolerance vs #{tolerance}."
+    if value == 'DNP'
+      if @value != 'DNP'
+        puts "Error: DNP vs not"
         error = true
       end
-    elsif tolerance
-      @tolerance = tolerance
-    end
-
-    new_secondary_match = SecondaryValueRegex.match secondary_value
-    my_secondary_match = SecondaryValueRegex.match @secondary_value
-    if new_secondary_match && my_secondary_match &&
-       new_secondary_match[2] == my_secondary_match[2]
-      new_value = new_secondary_match[1].to_f
-      my_value = my_secondary_match[1].to_f
-      @secondary_value = [new_value, my_value].max.to_s + ' ' + my_secondary_match[2]
     else
-      if secondary_value != @secondary_value
-        puts "Error: secondary_value #@secondary_value vs #{secondary_value}."
+      if pn != @pn
+        puts "Error: pn #@pn vs #{pn}."
         error = true
       end
+      if value != @value
+        puts "Error: value #@value vs #{value}."
+        error = true
+      end
+      if footprint != @footprint
+        puts "Error: footprint #@footprint vs #{footprint}."
+        error = true
+      end
+      if device != @device
+        puts "Error: device #@device vs #{device}."
+        error = true
+      end
+
+      if pn_optional != @pn_optional
+        puts "Error: pn_optional #@pn_optional vs #{pn_optional}."
+        error = true
+      end
+      if dev_only != @dev_only
+        puts "Error: dev_only #@dev_only vs #{dev_only}."
+        error = true
+      end
+
+      if tolerance && @tolerance
+        if tolerance != @tolerance
+          puts "Error: tolerance #@tolerance vs #{tolerance}."
+          error = true
+        end
+      elsif tolerance
+        @tolerance = tolerance
+      end
+
+      new_secondary_match = SecondaryValueRegex.match secondary_value
+      my_secondary_match = SecondaryValueRegex.match @secondary_value
+      if new_secondary_match && my_secondary_match &&
+        new_secondary_match[2] == my_secondary_match[2]
+        new_value = new_secondary_match[1].to_f
+        my_value = my_secondary_match[1].to_f
+        @secondary_value = [new_value, my_value].max.to_s + ' ' + my_secondary_match[2]
+      else
+        if secondary_value != @secondary_value
+          puts "Error: secondary_value #@secondary_value vs #{secondary_value}."
+          error = true
+        end
+      end
     end
 
     if error
@@ -168,10 +185,14 @@
   args = [attrs[:pn], attrs[:value], attrs[:footprint], attrs[:device],
           attrs[:secondary_value], refdes, attrs[:tolerance],
           attrs[:pn_optional], attrs[:dev_only]]
-  key = attrs[:pn]
-  unless key
-    key = attrs[:value] || ''
-    key += attrs[:footprint] || ''
+  if attrs[:value] == 'DNP'
+    key = 'DNP'
+  else
+    key = attrs[:pn]
+    unless key
+      key = attrs[:value] || ''
+      key += attrs[:footprint] || ''
+    end
   end
   raise "No pn or value for #{args} (#{refdes})" unless key && !key.empty?
   if $parts.include?(key)
diff --git a/motors/receiver_schematic/board-connectors.sch b/motors/receiver_schematic/board-connectors.sch
index 6fc183a..2565bff 100644
--- a/motors/receiver_schematic/board-connectors.sch
+++ b/motors/receiver_schematic/board-connectors.sch
@@ -595,6 +595,8 @@
 refdes=R271
 T 12900 58200 5 10 1 1 0 0 1
 value=100
+T 12700 58400 5 10 0 0 0 0 1
+pn=RC0603JR-07100RL
 }
 C 20900 64400 1 180 0 connector3-1.sym
 {
@@ -735,6 +737,8 @@
 refdes=R281
 T 12900 63900 5 10 1 1 0 0 1
 value=100
+T 12700 64100 5 10 0 0 0 0 1
+pn=RC0603JR-07100RL
 }
 N 14800 64200 14800 62200 4
 N 11300 62200 14800 62200 4
@@ -944,6 +948,8 @@
 refdes=R295
 T 12900 69900 5 10 1 1 0 0 1
 value=100
+T 12700 70100 5 10 0 0 0 0 1
+pn=RC0603JR-07100RL
 }
 C 20900 76100 1 180 0 connector3-1.sym
 {
@@ -1084,6 +1090,8 @@
 refdes=R291
 T 12900 75600 5 10 1 1 0 0 1
 value=100
+T 12700 75800 5 10 0 0 0 0 1
+pn=RC0603JR-07100RL
 }
 N 14800 75900 14800 73900 4
 N 11300 73900 14800 73900 4
@@ -1143,6 +1151,8 @@
 refdes=R258
 T 14100 81400 5 10 1 1 0 0 1
 value=100
+T 13900 81600 5 10 0 0 0 0 1
+pn=RC0603JR-07100RL
 }
 C 17300 79800 1 180 0 generic-power.sym
 {
@@ -1222,6 +1232,8 @@
 refdes=R267
 T 11300 81700 5 10 1 1 0 0 1
 value=100
+T 11100 81900 5 10 0 0 0 0 1
+pn=RC0603JR-07100RL
 }
 N 12000 82000 19200 82000 4
 N 13900 81700 6200 81700 4
@@ -1318,6 +1330,8 @@
 refdes=R297
 T 37000 71500 5 10 1 1 0 0 1
 value=100
+T 36800 71700 5 10 0 0 0 0 1
+pn=RC0603JR-07100RL
 }
 C 35600 70400 1 90 0 gnd-1.sym
 N 35100 70500 35300 70500 4
@@ -1690,7 +1704,9 @@
 T 43700 68800 5 10 1 1 270 0 1
 refdes=R298
 T 43200 68800 5 10 1 1 270 0 1
-value=1k
+value=1 k
+T 43400 69000 5 10 0 0 0 0 1
+pn=RC0603JR-071KL
 }
 C 43400 67600 1 0 0 gnd-1.sym
 N 43500 68100 43500 67900 4
diff --git a/motors/receiver_schematic/board-main.sch b/motors/receiver_schematic/board-main.sch
index 13b74c2..f3cf353 100644
--- a/motors/receiver_schematic/board-main.sch
+++ b/motors/receiver_schematic/board-main.sch
@@ -7,6 +7,8 @@
 device=Kinetis LQFP144
 T 59900 64000 5 10 1 1 0 0 1
 refdes=U301
+T 51700 51800 5 10 0 0 0 0 1
+pn=MK64FX512VLQ12
 }
 C 48800 62800 1 0 0 gnd-1.sym
 N 48900 64400 48900 64200 4
@@ -314,7 +316,9 @@
 T 50300 57300 5 10 1 1 0 0 1
 refdes=R301
 T 50300 56800 5 10 1 1 0 0 1
-value=470
+value=0
+T 50100 57000 5 10 0 0 0 0 1
+pn=RC0603JR-070RL
 }
 N 49900 57700 49900 57100 4
 N 49900 57100 50100 57100 4
@@ -363,6 +367,8 @@
 value=33
 T 48900 56100 5 10 0 0 0 0 1
 tolerance=1 %
+T 48900 56100 5 10 0 0 0 0 1
+pn=RC0603FR-0733RL
 }
 C 50200 55800 1 0 0 resistor-1.sym
 {
@@ -376,6 +382,8 @@
 value=33
 T 50200 55800 5 10 0 0 0 0 1
 tolerance=1 %
+T 50200 55800 5 10 0 0 0 0 1
+pn=RC0603FR-0733RL
 }
 N 49800 56200 51800 56200 4
 N 51800 55900 51100 55900 4
@@ -751,7 +759,9 @@
 T 36100 50700 5 10 1 1 270 0 1
 refdes=R305
 T 35600 50700 5 10 1 1 270 0 1
-value=3 k
+value=3.16 k
+T 35800 50900 5 10 0 0 0 0 1
+pn=RC0603FR-073K16L
 }
 N 35900 51100 35900 50900 4
 N 35900 50000 35900 49800 4
@@ -811,6 +821,8 @@
 refdes=R307
 T 37600 50700 5 10 1 1 270 0 1
 value=20 k
+T 37800 50900 5 10 0 0 0 0 1
+pn=RC0603JR-0720KL
 }
 N 37900 51100 37900 50900 4
 N 37900 50000 37900 49800 4
@@ -1181,6 +1193,8 @@
 refdes=R322
 T 64500 66600 5 10 1 1 270 0 1
 value=10 k
+T 64700 66800 5 10 0 0 0 0 1
+pn=RC0603JR-0710KL
 }
 N 66800 68400 64800 68400 4
 N 64800 65900 64800 65700 4
diff --git a/motors/receiver_schematic/board-switcher.sch b/motors/receiver_schematic/board-switcher.sch
index d165eb2..6ce6331 100644
--- a/motors/receiver_schematic/board-switcher.sch
+++ b/motors/receiver_schematic/board-switcher.sch
@@ -58,9 +58,11 @@
 T 38500 69600 5 10 1 1 90 0 1
 refdes=D201
 T 39000 69300 5 10 0 0 270 0 1
-pn=SS2PH10-M3/84A
+pn2=SS2PH10-M3/84A
 T 39000 69300 5 10 0 0 270 0 1
 footprint=DO220AA
+T 39000 69300 5 10 0 0 0 0 1
+pn=ESH1PD-M3/84A
 }
 C 39700 70400 1 0 0 inductor-1.sym
 {
@@ -86,11 +88,11 @@
 T 41100 69000 5 10 0 0 270 0 1
 tolerance=1%
 T 41100 69000 5 10 0 0 0 0 1
-pn=RT0805BRD0710K4L
+pn=RC0805FR-0710K5L
 T 41400 68800 5 10 1 1 270 0 1
 refdes=R201
 T 40900 68800 5 10 1 1 270 0 1
-value=10.4 k
+value=10.5 k
 }
 C 41100 70300 1 270 0 resistor-1.sym
 {
diff --git a/motors/receiver_schematic/ordering.rb b/motors/receiver_schematic/ordering.rb
new file mode 120000
index 0000000..48325a4
--- /dev/null
+++ b/motors/receiver_schematic/ordering.rb
@@ -0,0 +1 @@
+../big_schematic/ordering.rb
\ No newline at end of file
diff --git a/motors/receiver_schematic/parts.rb b/motors/receiver_schematic/parts.rb
new file mode 120000
index 0000000..99f7624
--- /dev/null
+++ b/motors/receiver_schematic/parts.rb
@@ -0,0 +1 @@
+../big_schematic/parts.rb
\ No newline at end of file