-
Notifications
You must be signed in to change notification settings - Fork 92
Conversation
First thought is that pretty much all EP's with thermal vias has solder paste/mask disabled if I recall correctly. This could perhaps help in finding the EP |
I think for now we do not need to think about every conceivable way this could go wrong. Anything that checks a normal ep pad with thermal vias would already be a huge (and very much welcome) improvement. If a package is missing pins then it is still using ep pin number is one higher than if there are no missing pins. Another hint: for parts with a single ep you can use the size of the pad as it must be included in the footprint name. (We could even add another rule check for that fact.) |
Ah yeah, I think just reading the number of exposed pads in the name and getting the "x" amount of highest pad numbers is the way to go. Ideally there should be a check, that the footprint follows KLC naming convention, but assuming it does follow xxx-yEP-xxx this could work actually. |
TI footprints do not really follow that convention right now. (And other manufacturer specific ones might be added later) |
Right now I have updated it to handle exposed pads NOT placed in (0,0), but it assumes its placed on F.Cu, and it uses the -xep_ string in the footprint name to find the amount of exposed pads. Then for each exposed pad found, it iterates through the maximum pad number and down (as set by -xEP_) and adds (x,y) and size_x and size_y to an array, that is later iterated through. Seems to be working quite well. But again, it assumes the footprint name contains -xep (EP is NOT case sensitive for this script though). Please let me know, what you think. |
I kind of missed that there was progress made here. Sorry. Could you fix the merge conflict? I think this would otherwise be good to go (to be live tested) |
pcb/rules/F7_4.py
Outdated
# Looks for the string: | ||
# '-xEP' where x is any number between 0 and 9 and designates number of exposed pads. | ||
# EP is NOT case sensitive and registers 'ep' just as well as 'EP' | ||
m = re.search('\\-[0-9].[a-zA-Z]', fpName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this re. Why is there a dot?
how about
-\d+[EP]{2}
with case insensitive set?
pcb/rules/F7_4.py
Outdated
fpName = module.name | ||
|
||
# Check if footprint name contains the standard text strings for | ||
# footprints with exposed pad and _ThermalVias |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That comment seems to be outdated. The _ThermalVias stuff is commented out.
I had forgotten all about this PR. I'll have a look at this tomorrow to fix the merge conflict and update the code based @cpresser 's comments. |
Regular expression search is now more narrow, and still case-insensitive. Suggested by @cpresser.
Alright. I cannot for the life of me figure out, why there still is a merge conflict. Apparently it does not like me adding the 'import re' statement. But however I try to put it, it complains. Any suggestions on that? |
A merge conflict is not fixed by simply adding stuff to the files of the branch. You need to use git locally.
Edit: upstream is a remote pointer pointing to the official repo not to your personal fork An alternative is the rebase workflow. That leaves the history in a nicer state but is harder to understand for beginners |
I am familiar with my origin and my upstream, so that's gonna be easy enough. I was not familiar with the way of solving merge conflicts though. I'll have a new go. |
I believe, I managed to fix it. But boy, what a hassle for you to verify my changes now. |
github is intelligent here. It knows what you changed and what was pulled from master. The same i would do if github would not be intelligent. |
pcb/rules/rule.py
Outdated
return graph['end'] | ||
elif 'angle' in graph: | ||
# dosome magic to find the actual start point | ||
# fetch values | ||
x_c = graph['start']['x'] | ||
y_c = graph['start']['y'] | ||
x_e = graph['end']['x'] | ||
y_e = graph['end']['y'] | ||
a_arc = graph['angle'] | ||
# calculate radius | ||
dx = x_c - x_e | ||
dy = y_c - y_e | ||
r = math.hypot(dx, dy) | ||
# calculate vector of length 1 of the end point | ||
dx_s = dx / r | ||
dy_s = dy / r | ||
# now get the angle of the end point | ||
a = math.degrees(math.atan2(dy_s, dx_s)) | ||
a_s = math.radians(a + a_arc) | ||
x_s = x_c - math.cos(a_s) * r | ||
y_s = y_c - math.sin(a_s) * r | ||
return {'x': x_s, 'y': y_s} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this on purpose or is this a merge artefact?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure it should be a merge artifact. I did not deliberately touch that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So could you revert that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Odd that occurred. I thought the upstream/master also had this deleted. But just checked and it should in fact be there. I hope to get some time within the next few days to fix it.
b4bd3f0
to
cfea135
Compare
There should be a new commit ready for merge. |
Running this against the LED_THT lib leads to an exception
|
Interesting. I didn't catch this issue. Apparently I did not do the troubleshooting thoroughly enough. |
EParray was used without it being set, because it was defined in the wrong scope. Tidy up reg_exp search variable, because 'm' for a variable is not very intuitive.
Apparently I had been dumb enough to check for 'EParray' at other places, where it could happen not to be defined. It should be fixed now, while I also tidied up a little within the code. I can see, I used all sorts of conventions within my code, for which I apologize, and would like to know, if we adhere by pep8 and thus use underscores for function and variable names, or use camelCase (like I did). I think it would be beneficial, to clean up the code to make it adhere by whatever standard, we like. |
I don't think there is an official programming standard. It might be a good idea to define one long term. |
Should it become relevant, I'll update the code. |
Microchip_DRQFN-44-1EP_5x5mm_P0.7mm_EP2.65x2.65mm leads to
i modified the check_kicad_mod.py file line 117 with try:
rule.check()
except Exception as e:
printer.red("exception encountered checking rule {} on file {}"\
.format(rule.name, module.name))
raise e and then ran the script with |
Clearly my troubleshooting skills are poor. I manually tested this with 16 footprints, that all came up with no issue. Apparently I need some better testing skills. You terminal command tells me "zsh: argument list too long: python3". I can however replicate the issue otherhow. Interesting, I did not consider this corner case. I'll have a look at it. |
Well i use bash. Bash forwards the file string to python which then uses glob to unpack it. If zsh does this up front then it might just fail (as the extended list is quite long) |
If you just decide on a given .pretty directory, it's no big deal. But I may just set up a script, that does this for me. Handling letters within pad numbers was definitely not a consideration of mine, and I see no straightforward way to handle it, especially if exposed pads are just given the EP name. |
I think the proper way would be not to explicitly check for exposed pads but flag any tht pad inside a smd pad as a via. One can then require these pads to have the same pad number plus allow more freedoms for the layers of the via. Edit: An easy way out for now would be to flag pads that are non integer numbers as "not an exception" and let it be checked in the old way. |
I actually think, your first suggestion would be the better solution. Especially because it offers much more flexibility in the long-term. The second one is more the quick-fix solution, which albeit would work in this case, but not be the better long-term solution. Which one to go for depends a little on the librarians. |
I prefer the long term solution but i would not require you to invest the time to implement it. I would already be happy with the hotfix. (You are the only one who can know if you have the time for the full solution) |
Obviously depends on the haste, I am currently about to finish my master thesis and begin a new job, so time will be short very soon. But given it's taken a while already, it may not be a big deal, if we add some more time for the better solution. |
Or we put in a first solution working for most of the lib and then improve it later on. |
Great. I'll make a makeshift solution ;) |
Components with letters in pad names caused the script to crash. Now they are handled with an exception instead, that just breaks the loop. The script still catches violations in these cases.
Here is one. I tested it by jumping into the 'kicad-footprints/' directory and executing:
Which looped all .kicad_mod files in all .pretty directories over. I caught no python errors. The script still catches errors in general, but will not catch the violations of rule F7.4 in footprints with pads with lettered names. |
I did a few tests and am happy with the current result. Of course, we can improve it further and you are welcome to come back to this topic at any time. |
Great to hear @poeschlr. I think I'll come up with a new merge request eventually. |
Vias have different layer requirements compared to normal through hole pads. This meant they wrongly triggered F7.4. This change excludes THT pads identified as thermal vias from this test. Known limitations of this implementation: - Reliance on the footprint name for identifying possible exposed pads with vias - The largest (integer) pad number is assumed to be the pad that holds possible vias - Footprints with non integer pad numbers are ignored. - Different pad numbering conventions (example the use of pad 0 for the EP) are not supported - No support for handling vias in pads other than an exposed pad
For now i documented our findings in #322 Feel free to comment on that issue with your ideas. |
As it currently is, F7.4 causes travis and library-utils to generate errors upon thermal vias in exposed pads.
To solve this I have made (started making) a script to disregard the check of required_layers, if the through-hole pad is within the exposed pad.
For simple exposed pads placed in (0,0) it works splendidly. But when it comes to exposed pads offset from (0,0) like Texas_RWH0032A_ThermalVias or double exposed pads like in Microsemi_QFN-40-32-2EP_6x8mm_P0.5mm it obviously fails.
Then comes a question, how an exposed pad is most easily recognized.
My train of thought was:
The only issue with this technique is for packages with x number of pins, where only y is populated, for instance Microsemi_QFN-40-32-2EP_6x8mm_P0.5mm where only 32 pins are populated, and exposed pads are labelled 33 and 34, no 41 and 42 as the script would suppose.
Do you guys have any suggestions, as how best to solve this?