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V,
DRV,
DRV,
NOD,
DRV,
NOD,
DRV,
DRV,
DRV,
NPI },
79 {
NOD,
NOD,
NOD,
NOD,
NOD,
NOD,
NOD,
NOD,
NOD,
NOD,
NOD,
NPI },
80 {
DRV,
DRV,
DRV,
DRV,
DRV,
NOD,
DRV,
NOD,
DRV,
DRV,
DRV,
NPI },
81 {
NOD,
DRV,
NOD,
NOD,
NOD,
NOD,
NOD,
NOD,
DRV,
NOD,
NOD,
NPI },
82 {
DRV,
DRV,
DRV,
DRV,
DRV,
NOD,
DRV,
DRV,
DRV,
DRV,
DRV,
NPI },
83 {
DRV,
DRV,
DRV,
DRV,
DRV,
NOD,
DRV,
NOD,
DRV,
DRV,
DRV,
NPI },
84 {
DRV,
DRV,
DRV,
DRV,
DRV,
NOD,
DRV,
NOD,
DRV,
DRV,
DRV,
NPI },
85 {
NPI,
NPI,
NPI,
NPI,
NPI,
NPI,
NPI,
NPI,
NPI,
NPI,
NPI,
NPI }
126 [&]() -> nlohmann::json
128 nlohmann::json ret = {};
132 wxString
name = item.GetSettingsKey();
133 int code = item.GetErrorCode();
143 [&](
const nlohmann::json& aJson )
145 if( !aJson.is_object() )
150 int code = item.GetErrorCode();
151 wxString
name = item.GetSettingsKey();
153 std::string key(
name.ToUTF8() );
155 if( aJson.contains( key ) )
162 [&]() -> nlohmann::json
164 nlohmann::json js = nlohmann::json::array();
171 [&](
const nlohmann::json& aObj )
175 if( !aObj.is_array() )
178 for(
const nlohmann::json& entry : aObj )
180 if( entry.is_array() )
182 wxString serialized = entry[0].get<wxString>();
186 else if( entry.is_string() )
195 [&]() -> nlohmann::json
197 nlohmann::json ret = nlohmann::json::array();
201 nlohmann::json inner = nlohmann::json::array();
206 ret.push_back( inner );
211 [&](
const nlohmann::json& aJson )
218 if( i > aJson.size() - 1 )
221 nlohmann::json inner = aJson[i];
228 if( inner[j].is_number_integer() )
230 int val = inner[j].get<
int>();
262 m_parent->ReleaseNestedSettings(
this );
307 wxS(
"Missing severity from map in ERC_SETTINGS!" ) );
329 wxCHECK( item1 && item2,
false );
341 std::set<SCH_SCREEN*> seenScreens;
345 bool firstTime = seenScreens.count( sheet.LastScreen() ) == 0;
348 seenScreens.insert( sheet.LastScreen() );
350 std::set<SCH_MARKER*, CompareMarkers> orderedMarkers;
353 orderedMarkers.insert(
static_cast<SCH_MARKER*
>( item ) );
355 for(
SCH_ITEM* item : orderedMarkers )
362 std::shared_ptr<const ERC_ITEM> ercItem =
363 std::static_pointer_cast<const ERC_ITEM>( marker->
GetRCItem() );
366 if( ercItem->IsSheetSpecific() )
368 if( ercItem->GetSpecificSheetPath() != sheet )
373 if( !firstTime && !ercItem->IsSheetSpecific() )
408 return a->GetSeverity() > b->GetSeverity();
432 if( ( markerSeverity & aSeverity ) > 0 )
444 return marker ? std::static_pointer_cast<ERC_ITEM>( marker->
GetRCItem() ) :
nullptr;
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Container for ERC settings.
ERC_PIN_SORTING_METRIC m_ERCSortingMetric
The type of sorting used by the ERC checker to resolve multi-pin errors.
std::map< wxString, wxString > m_ErcExclusionComments
std::map< ELECTRICAL_PINTYPE, int > m_PinTypeWeights
Weights for electrical pins used in ERC to decide which pin gets the marker in case of a multi-pin er...
static PIN_ERROR m_defaultPinMap[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]
Default Look up table which gives the ERC error level for a pair of connected pins.
SEVERITY GetSeverity(int aErrorCode) const
ERC_SETTINGS(JSON_SETTINGS *aParent, const std::string &aPath)
void SetSeverity(int aErrorCode, SEVERITY aSeverity)
PIN_ERROR GetPinMapValue(int aFirstType, int aSecondType) const
std::map< int, SEVERITY > m_ERCSeverities
std::set< wxString > m_ErcExclusions
static int m_PinMinDrive[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]
Look up table which gives the minimal drive for a pair of connected pins on a net.
void SetPinMapValue(int aFirstType, int aSecondType, PIN_ERROR aValue)
PIN_ERROR m_PinMap[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
JSON_SETTINGS(const wxString &aFilename, SETTINGS_LOC aLocation, int aSchemaVersion)
std::shared_ptr< RC_ITEM > GetRCItem() const
enum MARKER_T GetMarkerType() const
JSON_SETTINGS * m_parent
A pointer to the parent object to load and store from.
NESTED_SETTINGS(const std::string &aName, int aSchemaVersion, JSON_SETTINGS *aParent, const std::string &aPath, bool aLoadFromFile=true)
Like a normal param, but with custom getter and setter functions.
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
Base class for any item which can be embedded within the SCHEMATIC container class,...
wxString SerializeToString() const
VECTOR2I GetPosition() const override
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
void DeleteMarker(SCH_MARKER *aMarker)
Delete a specific marker.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
int GetCount(int aSeverity=-1) const override
void SetSeverities(int aSeverities) override
void visitMarkers(std::function< void(SCH_MARKER *)> aVisitor) const
void DeleteItem(int aIndex, bool aDeep) override
Remove (and optionally deletes) the indexed item from the list.
std::shared_ptr< ERC_ITEM > GetERCItem(int aIndex) const
std::vector< SCH_MARKER * > m_filteredMarkers
std::shared_ptr< RC_ITEM > GetItem(int aIndex) const override
Retrieve a RC_ITEM by index.
const int ercSettingsSchemaVersion
@ ERCE_DRIVER_CONFLICT
Conflicting drivers (labels, etc) on a subgraph.
@ ERCE_SIMILAR_POWER
2 power pins are equal for case insensitive comparisons.
@ ERCE_UNCONNECTED_WIRE_ENDPOINT
A label is connected to more than one wire.
@ ERCE_GROUND_PIN_NOT_GROUND
A ground-labeled pin is not on a ground net while another pin is.
@ ERCE_SIMILAR_LABELS
2 labels are equal for case insensitive comparisons.
@ ERCE_STACKED_PIN_SYNTAX
Pin name resembles stacked pin notation.
@ ERCE_ENDPOINT_OFF_GRID
Pin or wire-end off grid.
@ ERCE_SAME_LOCAL_GLOBAL_LABEL
2 labels are equal for case insensitive comparisons.
@ ERCE_SIMILAR_LABEL_AND_POWER
label and pin are equal for case insensitive comparisons.
@ ERCE_LABEL_SINGLE_PIN
A label is connected only to a single pin.
@ ERCE_BUS_ENTRY_CONFLICT
A wire connected to a bus doesn't match the bus.
@ ERCE_FOOTPRINT_LINK_ISSUES
The footprint link is invalid, or points to a missing (or inactive) footprint or library.
@ ERCE_DUPLICATE_PIN_ERROR
@ ERCE_NOCONNECT_NOT_CONNECTED
A no connect symbol is not connected to anything.
@ ERCE_FOUR_WAY_JUNCTION
A four-way junction was found.
@ ERCE_SIMULATION_MODEL
An error was found in the simulation model.
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
@ ERCE_NOCONNECT_CONNECTED
A no connect symbol is connected to more than 1 pin.
@ ERCE_PIN_TO_PIN_WARNING
@ ERCE_MISSING_INPUT_PIN
Symbol has input pins that are not placed.
@ ERCE_MISSING_UNIT
Symbol has units that are not placed on the schematic.
@ ERCE_MISSING_BIDI_PIN
Symbol has bi-directional pins that are not placed.
@ ERCE_LIB_SYMBOL_ISSUES
Symbol not found in active libraries.
@ ERCE_FOOTPRINT_FILTERS
The assigned footprint doesn't match the footprint filters.
@ ERCE_SINGLE_GLOBAL_LABEL
A label only exists once in the schematic.
@ ERCE_LABEL_MULTIPLE_WIRES
A label is connected to more than one wire.
PIN_ERROR
The values a pin-to-pin entry in the pin matrix can take on.
#define NPI
Types of drive on a net (used for legacy ERC)
@ PT_INPUT
usual pin input: must be connected
@ PT_NC
not connected (must be left open)
@ PT_TRISTATE
tri state bus pin
@ PT_NIC
not internally connected (may be connected to anything)
@ PT_BIDI
input or output (like port for a microprocessor)
@ PT_OPENEMITTER
pin type open emitter
@ PT_POWER_OUT
output of a regulator: intended to be connected to power input pins
@ PT_OPENCOLLECTOR
pin type open collector
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
@ PT_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin.
#define ELECTRICAL_PINTYPES_TOTAL
SEVERITY SeverityFromString(const wxString &aSeverity)
wxString SeverityToString(const SEVERITY &aSeverity)