Commit Graph

115 Commits

Author SHA1 Message Date
Roberto Fernandez Bautista 235688e459 Less restrictive Arc Track Dragging tool
Use the connecting straight tracks even if not exactly parallel - allow
an error margin configurable in ADVANCED_CFG (default 1 degree). Also
be less strict about end point matching and use the width of the track
as the criteria to determine suitability.

Finally, delete any short lengths of track at the end of the operation
and amend the arc end points to keep connectivity.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7967
2021-04-06 12:52:01 +00:00
Jon Evans f57dcf2a34 Fix connectivity to only resolve conflicts on netlist load
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8007
2021-03-23 17:43:24 -04:00
Jon Evans 37242f67e0 Connectivity: just pick the most popular net to update conflicting clusters
CHANGED: when pad net assignments are changed in a conflicting way (i.e.,
         tracks exist that short out more than one net after the change,
         track nets will be updated to the net with the most pads).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7929
2021-03-21 15:31:37 -04:00
Jon Evans c04e19f9ac Include optimization: move some things from common.h to point-of-use 2021-03-20 12:09:18 -04:00
Dominik Wernberger e2aa7be4b3 Added a lot of consts and refactored a few lines 2021-03-08 12:49:48 -08:00
Ian McInerney 51d445007f Switch to using make_shared in another place 2021-03-03 02:19:46 +00:00
Marek Roszko 9d0b16e814 bool/int type safety 2021-01-31 19:54:32 -05:00
Wayne Stambaugh 6a39b81647 Fix the last of broken Doxygen comment specifiers. 2021-01-27 17:39:44 -05:00
Jon Evans 1e33928b96 Fix issues with zone filling connectivity locking
Two issues found with the locking system used to prevent access to
stale connectivity data during the zone fill process:

1) a std::mutex has undefined behavior if you try to use it to guard
against access from the same thread.  Because of the use of wx event
loops (and coroutines) it is entirely possible, and in some situations
inevitable, that the same thread will try to redraw the ratsnest in the
middle of zone refilling.

2) The mutex was only guarding the ZONE_FILLER::Fill method, but the callers
of that method also do connectivity updates as part of the COMMIT::Push.
Redrawing the ratsnest after the Fill but before the Push will result in
stale connectivity pointers to zone filled areas.

Fixed (1) by switching to a trivial spinlock implementation.  Spinlocks would
generally not be desirable if the contention for the connectivity data crossed
thread boundaries, but at the moment I believe it's guaranteed that the reads
and writes to connectivity that are guarded by this lock happen from the main
UI thread.  The writes are also quite rare compared to reads, and reads are
generally fast, so I'm not really worried about the UI thread spinning for any
real amount of time.

Fixed (2) by moving the locking location up to the call sites of
ZONE_FILLER::Fill.

This issue was quite difficult to reproduce, but I found a fairly reliable way:
It only happens (for me) on Windows, MSYS2 build, with wxWidgets 3.0
It also only happens if I restrict PcbNew to use 2 CPU cores.
With those conditions, I can reproduce the issue described in #6471 by
repeatedly editing a zone properties and changing its net.  The crash is
especially easy to trigger if you press some keys (such as 'e' for edit)
while the progress dialog is displayed.  It's easiest to do this in a debug
build as the slower KiCad is running, the bigger the window is to trigger this
bug.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6471
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7048
2021-01-18 13:22:12 -05:00
jean-pierre charras 067b94c410 DRC: Fix a incorrect message and marker position when testing dangling vias.
Commit 6ffb721 detects vias connected on only one layer.
But the DRC diag (marker position and error message) were not correctly initialized
for this new test.
2021-01-10 10:21:24 +01:00
Seth Hillbrand 6ffb72159a Remove vias if they only connect to single layer
A via takes up zone space on additional layers, so if we are not
connecting to those layers, then we should remove it.

Fixes https://gitlab.com/kicad/code/kicad/issues/7004
2021-01-08 09:39:43 -08:00
Jon Evans 70c397a9b4 Implement free vias fully
CHANGED: manually-placed (stitching) vias won't have their nets automatically updated
(unless the via is placed directly on a track segment)

CHANGED: stitching vias can be placed on footprint pads and pick up their nets

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5484
2020-12-20 16:29:50 -05:00
Jeff Young b1f0bf7334 More consistent naming. 2020-12-08 13:05:39 +00:00
Jeff Young 7bd31d5237 Naming conventions. 2020-11-14 18:26:03 +00:00
Roberto Fernandez Bautista 498c4121b3 Fix and rename CONNECTIVITY_DATA::GetConnectedItems(aItem, aAnchor, aTypes[] ) to GetConnectedItemsAtAnchor
- Fix the function so it actually returns the connected items (previously it was returning aItem every time)
- Make the function const
- Rename the function so that it is not confused with the other function of the same name
- Add doxygen comments for the function
2020-11-13 17:43:21 +00:00
Jeff Young bdbb68f813 MODULE -> FOOTPRINT. 2020-11-13 16:04:03 +00:00
Jeff Young 3451ac3088 PCB_MODULE_T -> PCB_FOOTPRINT_T 2020-11-13 15:16:24 +00:00
Jeff Young 52a46341db More module -> footprint. 2020-11-13 15:16:24 +00:00
Jeff Young f5443de7f9 D_PAD -> PAD. 2020-11-13 15:16:24 +00:00
Jeff Young 84dd5108ba Remove some "class_" prefixes from files. 2020-11-13 15:16:23 +00:00
Jeff Young f7333ad64a Update some classnames including archaic zone names. 2020-11-12 10:31:25 +00:00
Werni a7d5d1f091 Add more consts all over the place 2020-10-27 11:03:35 +00:00
Jeff Young 397f3d07db Be more responsive to cancel when filling zones.
Fixes https://gitlab.com/kicad/code/kicad/issues/6077
2020-10-26 15:36:07 +00:00
Jeff Young 5fba0973ab Update formatting. 2020-10-26 15:36:07 +00:00
Marek Roszko 1984581c46 Remove common.h from more headers 2020-10-25 22:29:53 -04:00
Marek Roszko 81a7afc76e Use kicad_algo directly rather than common.h 2020-10-24 08:53:11 -04:00
Marek Roszko 52a12c6ccd Remove kicad_string.h from footprint_info.h 2020-10-15 18:39:43 -04:00
Jeff Young 6d50c9749c Mark the colliding shape so we know which one to highlight.
Also checks the nets when checking for a pad being flashed on a particular
layer (so we don't end up thinking the currently-routing-collided track
is a connection).
2020-10-05 22:32:07 +01:00
Seth Hillbrand bf3cb0b1d0 Standardize pad type enums 2020-09-30 08:38:35 -07:00
Tomasz Wlostowski 3cca2ace44 pcbnew: fix warnings in FROM_TO_CACHE 2020-09-27 17:49:54 +02:00
Tomasz Wlostowski 3654e7b795 pcbnew: add QueryFromToPath() method to FROM_TO_CACHE 2020-09-27 16:45:46 +02:00
Tomasz Wlostowski 7b7c3bde88 pcb_new: CONNECTIVITY_DATA now keeps a cache of DRC from-tos 2020-09-27 16:45:46 +02:00
Jeff Young f8875bc5a6 Move std::contains to alg::contains. 2020-09-26 14:42:40 +01:00
Jeff Young d7e80f8008 Add std::contains() to simplify a lot of code. 2020-09-26 12:40:32 +01:00
Seth Hillbrand 856cf51fc8 Fix typo 2020-09-23 14:00:39 -07:00
Seth Hillbrand b31eafdfa8 Restore missing layer check 2020-09-23 13:33:42 -07:00
Jeff Young 4a0d469cec Back out zone layer misunderstanding and make types clearer. 2020-09-23 20:02:21 +01:00
Jeff Young 1f284111b0 Faster algorithm for zone-to-zone connectivity test. 2020-09-23 18:51:52 +01:00
Jeff Young 6dae769944 Progress reporting for connectivity tests.
Also makes via annulus terminology more consistent.
2020-09-23 16:28:00 +01:00
Jeff Young 4d8537fcfa Handle multi-layer zones in connectivity. 2020-09-23 01:14:35 +01:00
Jeff Young 9e12ea9bb6 Cleanup some dead code and make better use of iterators.
Also applies coding style around auto and lambdas.
2020-08-28 11:05:58 +01:00
Jeff Young 502f2ca2ef Fix some snarled up event processing.
See the bug for details.  It's complicated.

Fixes https://gitlab.com/kicad/code/kicad/issues/5336
2020-08-24 13:20:29 +01:00
Wayne Stambaugh ede39780e2 Remove all debugging output that cannot be disabled.
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
2020-08-18 10:17:36 -04:00
Jon Evans bd14f8a82a ADDED: New appearance control widget for PcbNew
Featuring:
- Layer view presets
- Per-type opacity for tracks, vias, pads, zones
- Net and netclass color and visibility controls

CHANGED: Simplified object visibilty controls

Fixes https://gitlab.com/kicad/code/kicad/-/issues/1951
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1981
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2003
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2173
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2254
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4325
2020-08-15 15:24:28 -04:00
Seth Hillbrand b8b3d5c16d pcbnew: Remove all threading from dynamic ratsnest
The last remaining threaded operation in dynamic ratsnest was the
recalculation of the dynamic connectivity map.  Because we do not
require any of the extra features of the connectivity map, we can get
away with a lightweight move of the anchors to update the ratsnest.  The
resulting connectivity tree is not valid but it is not needed for the
ratsnest, which only needs a list of nets/anchors.
2020-08-14 17:48:33 -07:00
Seth Hillbrand 027b6c8cf9 Account for via width in connectivity
Fixes https://gitlab.com/kicad/code/kicad/issues/5176
2020-08-13 20:31:17 -07:00
Seth Hillbrand b351bec0d7 Handle blind/buried vias in connectivity 2020-08-13 20:14:23 -07:00
Seth Hillbrand f36c158696 Remove via contact minimum from connectivity check
Connectivity takes an absolute approach to whether elements are
connected.  DRC will be adjusted to check to illegal necks that are less
than the board minimum width
2020-08-10 14:47:49 -07:00
Seth Hillbrand e5ab97994d pcbnew: Fix error in proximity calc for zones
Zone ContainsPoint() accuracy should be calculating the radial distance
and so does not need to be halved.
2020-08-10 14:46:34 -07:00
Seth Hillbrand 5096deeb3b pcbnew: Handle module ratsnest
Ensure we display the module ratsnest appropriately
2020-08-10 12:09:32 -07:00