Tried to make filedecoding just alike to position decoding

Added typedefs to be able to declare the same variable types.
Added an alternative to try to aproach the pattern with
by increasing it in one for each pad at a time
before bumping it all 1 for for the next try
Tries to approach the pattern on one position at a time

Instead of increasing `margin` on all pads at once,
I do a first try with the same margin for all,
the try with an extra 1 on each of the pads.
If none of those individual pads fit, only then I bump it up
for the whole lot.