From d629afcf92edad894c72c42d2d3c6ae7f7098985 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Tue, 18 Jan 2022 16:06:17 -0300 Subject: [PATCH] Added support for the controlled impedance flag in KiCad 6 --- kibot/globals.py | 6 ++++++ kibot/gs.py | 1 + kibot/out_report.py | 1 + kibot/report_templates/report_full.txt | 8 +++++--- kibot/report_templates/report_simple.txt | 8 +++++--- .../kicad_6/light_control.kicad_pcb | 16 ++++++++-------- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/kibot/globals.py b/kibot/globals.py index 54519577..6a3a7cef 100644 --- a/kibot/globals.py +++ b/kibot/globals.py @@ -83,6 +83,9 @@ class Globals(FiltersOptions): self.copper_thickness = 35 """ Copper thickness in micrometers (1 Oz is 35 micrometers). KiCad 6: you should set this in the Board Setup -> Physical Stackup """ + self.impedance_controlled = False + """ The PCB needs specific dielectric characteristics. + KiCad 6: you should set this in the Board Setup -> Physical Stackup """ self.set_doc('filters', " [list(dict)] KiBot warnings to be ignored ") self._filter_what = 'KiBot warnings' self._unkown_is_error = True @@ -172,6 +175,9 @@ class Globals(FiltersOptions): elif name == 'edge_plating': self.edge_plating = value == 'yes' logger.debug("- Edge plating: "+value) + elif name == 'dielectric_constraints': + self.impedance_controlled = value == 'yes' + logger.debug("- Impedance controlled: "+value) elif name == 'layer': ly = PCBLayer.parse(e) stackup.append(ly) diff --git a/kibot/gs.py b/kibot/gs.py index a9d49f4b..88cca7a4 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -98,6 +98,7 @@ class GS(object): global_edge_connector = None global_castellated_pads = None global_edge_plating = None + global_impedance_controlled = None test_boolean = True stackup = None diff --git a/kibot/out_report.py b/kibot/out_report.py index 2721923f..ffd753bb 100644 --- a/kibot/out_report.py +++ b/kibot/out_report.py @@ -527,6 +527,7 @@ class ReportOptions(BaseOptions): self.castellated_pads = GS.global_castellated_pads self.edge_plating = GS.global_edge_plating self.copper_thickness = GS.global_copper_thickness + self.impedance_controlled = GS.global_impedance_controlled self.stackup = 'yes' if GS.stackup else '' self._stackup = GS.stackup if GS.stackup else [] self.collect_data(GS.board) diff --git a/kibot/report_templates/report_full.txt b/kibot/report_templates/report_full.txt index e1c561ea..f221cd20 100644 --- a/kibot/report_templates/report_full.txt +++ b/kibot/report_templates/report_full.txt @@ -23,12 +23,14 @@ Special features: #?stackup Stackup: +#?stackup and impedance_controlled +Impedance controlled: YES #?stackup -| Name | Type | Color | Thickness | Material | Epsilon_r | Loss tangent | +| Name | Type | Color | Thickness | Material | Epsilon_r | Loss tangent | #?stackup -|----------------------|----------------------|----------|-----------|----------|-----------|--------------| +|----------------------|----------------------|----------|-----------|-----------------|-----------|--------------| #?stackup -#stackup:| ${%-20s,name} | ${%-20s,type} | ${%-8s,color} | ${%9d,thickness} | ${%-8s,material} | ${%9.1f,epsilon_r} | ${%12.2f,loss_tangent} | +#stackup:| ${%-20s,name} | ${%-20s,type} | ${%-8s,color} | ${%9d,thickness} | ${%-15s,material} | ${%9.1f,epsilon_r} | ${%12.2f,loss_tangent} | #?stackup # Important sizes diff --git a/kibot/report_templates/report_simple.txt b/kibot/report_templates/report_simple.txt index 75724b49..53f85e65 100644 --- a/kibot/report_templates/report_simple.txt +++ b/kibot/report_templates/report_simple.txt @@ -20,12 +20,14 @@ Special features: #?stackup Stackup: +#?stackup and impedance_controlled +Impedance controlled: YES #?stackup -| Name | Type | Color | Thickness | Material | Epsilon_r | Loss tangent | +| Name | Type | Color | Thickness | Material | Epsilon_r | Loss tangent | #?stackup -|----------------------|----------------------|----------|-----------|----------|-----------|--------------| +|----------------------|----------------------|----------|-----------|-----------------|-----------|--------------| #?stackup -#stackup:| ${%-20s,name} | ${%-20s,type} | ${%-8s,color} | ${%9d,thickness} | ${%-8s,material} | ${%9.1f,epsilon_r} | ${%12.2f,loss_tangent} | +#stackup:| ${%-20s,name} | ${%-20s,type} | ${%-8s,color} | ${%9d,thickness} | ${%-15s,material} | ${%9.1f,epsilon_r} | ${%12.2f,loss_tangent} | #?stackup Materials: diff --git a/tests/board_samples/kicad_6/light_control.kicad_pcb b/tests/board_samples/kicad_6/light_control.kicad_pcb index a523ab3e..e3dac948 100644 --- a/tests/board_samples/kicad_6/light_control.kicad_pcb +++ b/tests/board_samples/kicad_6/light_control.kicad_pcb @@ -37,21 +37,21 @@ (setup (stackup - (layer "F.SilkS" (type "Top Silk Screen") (color "White")) + (layer "F.SilkS" (type "Top Silk Screen") (color "White") (material "Liquid Photo")) (layer "F.Paste" (type "Top Solder Paste")) - (layer "F.Mask" (type "Top Solder Mask") (color "Blue") (thickness 0.01)) + (layer "F.Mask" (type "Top Solder Mask") (color "Blue") (thickness 0.01) (material "Liquid Ink") (epsilon_r 3.3) (loss_tangent 0)) (layer "F.Cu" (type "copper") (thickness 0.035)) - (layer "dielectric 1" (type "core") (thickness 0.48) (material "FR4") (epsilon_r 4.5) (loss_tangent 0.02)) + (layer "dielectric 1" (type "prepreg") (thickness 0.48) (material "FR4") (epsilon_r 4.5) (loss_tangent 0.02)) (layer "In1.Cu" (type "copper") (thickness 0.035)) - (layer "dielectric 2" (type "prepreg") (thickness 0.48) (material "FR4") (epsilon_r 4.5) (loss_tangent 0.02)) + (layer "dielectric 2" (type "core") (thickness 0.48) (material "FR4") (epsilon_r 4.5) (loss_tangent 0.02)) (layer "In2.Cu" (type "copper") (thickness 0.035)) - (layer "dielectric 3" (type "core") (thickness 0.48) (material "FR4") (epsilon_r 4.5) (loss_tangent 0.02)) + (layer "dielectric 3" (type "prepreg") (thickness 0.48) (material "FR4") (epsilon_r 4.5) (loss_tangent 0.02)) (layer "B.Cu" (type "copper") (thickness 0.035)) - (layer "B.Mask" (type "Bottom Solder Mask") (color "Red") (thickness 0.01)) + (layer "B.Mask" (type "Bottom Solder Mask") (color "Red") (thickness 0.01) (material "Dry Film") (epsilon_r 3.3) (loss_tangent 0)) (layer "B.Paste" (type "Bottom Solder Paste")) - (layer "B.SilkS" (type "Bottom Silk Screen") (color "Black")) + (layer "B.SilkS" (type "Bottom Silk Screen") (color "Black") (material "Direct Printing")) (copper_finish "ENIG") - (dielectric_constraints no) + (dielectric_constraints yes) (edge_connector bevelled) (castellated_pads yes) (edge_plating yes)