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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 }
128 [&]() -> nlohmann::json
130 nlohmann::json ret = {};
134 wxString
name = item.GetSettingsKey();
135 int code = item.GetErrorCode();
145 [&](
const nlohmann::json& aJson )
147 if( !aJson.is_object() )
152 int code = item.GetErrorCode();
153 wxString
name = item.GetSettingsKey();
155 std::string key(
name.ToUTF8() );
157 if( aJson.contains( key ) )
164 [&]() -> nlohmann::json
166 nlohmann::json js = nlohmann::json::array();
173 [&](
const nlohmann::json& aObj )
177 if( !aObj.is_array() )
180 for(
const nlohmann::json& entry : aObj )
182 if( entry.is_array() )
184 wxString serialized = entry[0].get<wxString>();
188 else if( entry.is_string() )
197 [&]() -> nlohmann::json
199 nlohmann::json ret = nlohmann::json::array();
203 nlohmann::json inner = nlohmann::json::array();
208 ret.push_back( inner );
213 [&](
const nlohmann::json& aJson )
220 if( i > aJson.size() - 1 )
223 nlohmann::json inner = aJson[i];
230 if( inner[j].is_number_integer() )
232 int val = inner[j].get<
int>();
264 m_parent->ReleaseNestedSettings(
this );
309 wxS(
"Missing severity from map in ERC_SETTINGS!" ) );
331 wxCHECK( item1 && item2,
false );
343 std::set<SCH_SCREEN*> seenScreens;
347 bool firstTime = seenScreens.count( sheet.LastScreen() ) == 0;
350 seenScreens.insert( sheet.LastScreen() );
352 std::set<SCH_MARKER*, CompareMarkers> orderedMarkers;
355 orderedMarkers.insert(
static_cast<SCH_MARKER*
>( item ) );
357 for(
SCH_ITEM* item : orderedMarkers )
364 std::shared_ptr<const ERC_ITEM> ercItem =
365 std::static_pointer_cast<const ERC_ITEM>( marker->
GetRCItem() );
368 if( ercItem->IsSheetSpecific() )
370 if( ercItem->GetSpecificSheetPath() != sheet )
375 if( !firstTime && !ercItem->IsSheetSpecific() )
410 return a->GetSeverity() > b->GetSeverity();
440 if( ( markerSeverity & aSeverity ) > 0 )
452 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.
int GetSeverities() const override
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_SAME_LOCAL_GLOBAL_POWER
Local power port and global power port have the same name.
@ 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_FIELD_NAME_WHITESPACE
Field name has leading or trailing whitespace.
@ 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)