hardbyte / hardbyte/python-can

SeeedBus: Allow setting hardware filter/mask during Bus Init

Aberta
#1,995 2 comentários 0 reações 0 responsáveis Ver no GitHub
enhancement
Linguagem predominante
Python
Estrelas
1.6k
Forks
697
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

## Main Problem
I don't like that the SeeedBus interface does not allow for the configuration of the hardware acceptance filter and mask during the bus initialization.

My use case involves a bootloader flasher client that communicates with a device over the CAN bus. The client sends a message with one CAN ID and needs to listen only for a response on another specific CAN ID. To achieve this efficiently, I need to use the hardware filter. The current implementation forces me to create the bus object, then manually change its internal attributes (filter_id, mask_id), and then re-call the internal init_frame() method. This workflow is not intuitive and feels like a workaround.

## Current Alternative
The only alternative at the moment is to manually re-configure the bus after it has been created. This involves the following steps:

```Python

import struct

# 1. Create the bus with default (disabled) filters
bus = can.interface.Bus(interface='seeedstudio', channel='/dev/ttyUSB0')

# 2. Manually overwrite the internal attributes
bus.filter_id = struct.pack('

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece em SeeedBus.__init__ e no caminho interno init_frame() descrito na issue. Rastreie como filter_id e mask_id são atualmente inicializados e enviados ao hardware e, em seguida, verifique se os valores opcionais configuram o filtro durante a construção, enquanto os valores omitidos preservam o comportamento atual sem filtro.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
embedded-iot, networking
Tipo de issue
Funcionalidade
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Claramente especificada
Facilidade para iniciantes
55/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.