Latching/Interrupt based digital inputs #10

Open
opened 2025-07-03 13:55:09 +02:00 by o.winkels · 5 comments
Owner

Currently, the Lightgate reflections are usually missed because we only send the pin state at each sending interval. That's stupid.

Solution A, the simple but bad one:

Declare the pin as latching, sample at 1kHz and if during one sending interval we've seen a 1 at any point in time, send a 1 after the interval.

Problem: Even at 1 kHz at max vehicle speed, the reflection zone needs to be at least 2.2cm wide, which is way too close to the usable width of the cone to be a safe reading. Also, this might explain why the readings were always dodgy even with the Autobox, which also sampled at 1kHz

Solution B, the proper one:

Use Pin Interrupts (CubeMX Pin Mode GPIO_EXTI) to detect even shorter pulses.

Annoyance: Usually we'd do this through CubeMX, but we don't want 2 separate IOCs. So ideally we'd either use Pin interrupts both in the front and the back (either for those 2 pins or for all of them) or we re-implement the code gen's interrupt config using our pin configuration system.

Currently, the Lightgate reflections are usually missed because we only send the pin state at each sending interval. That's stupid. ## Solution A, the simple but bad one: Declare the pin as latching, sample at 1kHz and if during one sending interval we've seen a 1 at any point in time, send a 1 after the interval. Problem: Even at 1 kHz at max vehicle speed, the reflection zone needs to be at least 2.2cm wide, which is way too close to the usable width of the cone to be a safe reading. Also, this might explain why the readings were always dodgy even with the Autobox, which also sampled at 1kHz ## Solution B, the proper one: Use Pin Interrupts (CubeMX Pin Mode `GPIO_EXTI`) to detect even shorter pulses. Annoyance: Usually we'd do this through CubeMX, but we don't want 2 separate IOCs. So ideally we'd either use Pin interrupts both in the front and the back (either for those 2 pins or for all of them) or we re-implement the code gen's interrupt config using our pin configuration system.
o.winkels added the
bug
feature
labels 2025-07-03 13:55:12 +02:00
Author
Owner

@l.gies hat Option A schon irgendwo implementiert und könnte bald ausprobiert werden

@l.gies hat Option A schon irgendwo implementiert und könnte bald ausprobiert werden
Author
Owner

@k.winkels CC

@k.winkels CC
Owner

Würde Option B nehmen mit unmodifizierter IOC, das sollten nur ein paar zeilen sein, mmn einfacher als mehrere iocs zu pflegen.

Würde Option B nehmen mit unmodifizierter IOC, das sollten nur ein paar zeilen sein, mmn einfacher als mehrere iocs zu pflegen.
Author
Owner

Ja denke ich auch. Hast du Bock das zu machen? Hab bis nächste Woche keine Zeit leider

Ja denke ich auch. Hast du Bock das zu machen? Hab bis nächste Woche keine Zeit leider
Owner

Ja gerne, ab Montag aber erst wahrscheinlich

Ja gerne, ab Montag aber erst wahrscheinlich
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: FaSTTUBe/sensor-node#10
No description provided.