Commit Graph

137 Commits

Author SHA1 Message Date
Seth Hillbrand 40d44c94cd Fix single-threaded loads/connectivity
We cannot set thread counts to hardware_concurrency()-1 without
considering that single core machines will get a thread count of 0.
2021-12-14 17:18:46 -08:00
Seth Hillbrand 779629ad33 Fix deadlock
Fixes https://gitlab.com/kicad/code/kicad/issues/9959
2021-12-12 07:20:03 -08:00
Seth Hillbrand 758ce43d9c Lock Connectivity Data when resetting
When we reset m_connAlgo, we need to lock the data mutex otherwise,
yields to the system may sometimes issue calls back to invalid data
until m_connAlgo has finished rebuilding

Fixes https://gitlab.com/kicad/code/kicad/issues/9922
2021-12-11 15:11:10 -08:00
Jon Evans 44e01dcd0a Skip newly-added footprints in connectivity
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9892
2021-12-08 20:39:12 -05:00
Jeff Young 0e65fe5d8d Coding standards and commenting. 2021-12-01 23:15:37 +00:00
Jon Evans 8026863d4c Use progress reporting in more places when loading a board
Prevents application-not-responding events while opening large designs
2021-11-25 11:19:03 -05:00
Jeff Young 5985a21b74 Offset internal items by drag amount.
Some tools move only preview items while keeping the real items
hidden.  Those tools must use this new offset parameter.

Other tools move the real items.  Those tools can ignore this
parameter (which will default to {0,0}).

Fixes https://gitlab.com/kicad/code/kicad/issues/9391
2021-11-25 14:54:12 +00:00
Jeff Young 36d11f745e Update ratsnest while dragging footprints.
Fixes https://gitlab.com/kicad/code/kicad/issues/9391
2021-10-25 21:45:30 +01:00
Jeff Young e6ca9837a2 Clear numbers from non-numberable pads and don't run DRC on them.
This was also the last straw on the misnamed PAD::GetName() and
PAD::SetName(), which are now PAD::GetNumber() and PAD::SetNumber().

Fixes https://gitlab.com/kicad/code/kicad/issues/9017
2021-08-24 01:03:06 +01:00
Jeff Young 41619ebbe2 Decouple PROGRESS_REPORTER interface from implementations. 2021-08-14 21:05:49 +01:00
Jeff Young 43523df843 Measure distance from pad center, not pad hull.
Otherwise we think the wrong end of really short track segments is
connected to the pad, leaving the other end dangling.

Fixes https://gitlab.com/kicad/code/kicad/issues/8909
2021-08-02 22:42:54 +01:00
Jeff Young 0d539a84a2 Fix bugs in Tracks Cleaner.
1) Implement more robust connection checking so we don't decide very
short segments with both endpoints within a single track are connected
at both ends.

2) Make use of the IS_DELETED flag to perform iteration during dryRun
so that all deletions to be made are flagged.

Fixes https://gitlab.com/kicad/code/kicad/issues/8883
2021-08-01 15:50:01 +01:00
Jeff Young b573712326 Cleanup. 2021-08-01 15:37:12 +01:00
Jeff Young 6aaf4413b3 Fix kicad_string.h / string.cpp mismatch.
They don't define a KiCad string class, so the header file name was
somewhat misleading. But the fact that they didn't match definitely
made coding more difficult.
2021-07-29 16:03:25 +01:00
Jeff Young 096e342386 Prefix TRACK, ARC and VIA. 2021-06-11 22:07:02 +01:00
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00:00
Wayne Stambaugh e6346e3103 Pass objects by reference instead of on the stack part 2. 2021-06-08 13:47:21 -04:00
Marek Roszko b610b905fc Cleanup track.h includes 2021-06-06 09:06:55 -04:00
Wayne Stambaugh c69c68a558 Pcbnew header housekeeping round 2. 2021-06-04 12:21:48 -04:00
Marek Roszko cf2bb5692a Remove the wxLog calls from math/util.h for now
This was leaking windows headers and partial wx headers to 1084 compilation units......
This also means math/util.h is leaking to 1084 compilation units which seems a bit high too.
2021-06-01 18:44:22 -04:00
Marek Roszko 03cf2b517f Enum class PAD_ATTR_T
Renamed such that python stays the same
2021-05-01 10:51:54 -04:00
Marek Roszko b243c2280d enum class PAD_SHAPE_T 2021-05-01 08:22:35 -04:00
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