ERC warning for parts that are obviously incorrectly connected

Aperta
#97 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend, testing

Direzione di ricerca

Start by reading dflt_part_erc and the ERC unit tests that use mock resistors connected to themselves; the issue says the proposed check breaks 10 tests. Check how pin connectivity and Pin.types.NOCONNECT are represented, then assess whether the warning should distinguish accidental duplicate connections from valid test circuits. Done means reaching a maintainer decision and, if accepted, adding the check with updated tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Is your feature request related to a problem? Please describe.

I had a case where I was intending to do something along the lines of

ic['A'] & r1 & net 

However, I accidentally did a double assignment while making additions to code written earlier

ic[...multiple pins... 'A'] += ...multiple nets..., net
...
... quite a few lines of some other stuff
...
ic['A'] & r1 & net 

The end result was naturally that r1 was connected to net on both pins. This didn't raise any ERC warnings. OK, not unreasonable, eeschema doesn't raise any warnings from such either, but on the other hand this kind of mistake is much more obvious when viewed visually on a schematic. In fact, I noticed it from netlistsvg output.. heh.

Describe the solution you'd like
I experimented a bit with adding a check to dflt_part_erc

    # Check that the total net count is not less than two
    connected_pins = [pin for pin in part.pins if pin.do_erc and pin.net and pin.func != Pin.types.NOCONNECT]
    if len(connected_pins) >= 2:
        connected_nets = {pin.net for pin in connected_pins}
        if len(connected_nets) < 2:
            erc_logger.warning(
                "Part has {p} pins active but has only {n} nets".format(
                    p=len(connected_pins), n=len(connected_nets)
                )
            )

However this broke 10 other ERC related unit tests (quite a few tests that test other areas of the ERC by just using a single mock resistor connected to itself). Not a big deal to fix those, but I'd like a second opinion on whether this is a good idea in the first place. Any foreseeable drawbacks?

Lingua principale
Python
Stelle
1.7k
Fork
184
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di devbisme/skidl

Tutte le issue di devbisme/skidl

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.