OPEnSLab-OSU / Loom

Arduino library for Internet of Things Rapid Prototyping in environmental sensing
GNU General Public License v3.0
26 stars 3 forks source link

Analog pin Interrupts not working in Loom #74

Closed udellc closed 3 years ago

udellc commented 4 years ago

Describe the bug Vanilla Attach interrupt works, but not Loom for Analog pins

Talk with Liam

prototypicalpro commented 4 years ago

I found the issue. Loom_Interrupt_Manager::register_ISR assigns the interrupt settings to the int_settings array using the pin number as an index, which has 16 spots available for pin interrupts. Unfortunately, the analog pins A2-A7 refer to values between 16-45, causing a segfault when a pin value >15 is used as an index access the int_settings array. I need to do more research on how to fix this issue, but in the meantime ISRs on pins > A1 should be considered broken.

prototypicalpro commented 4 years ago

I created a pull request to warn the user if their interrupt pin is out of bounds while we figure out how to solve this more permanently: https://github.com/OPEnSLab-OSU/Loom/pull/77.

akerr501 commented 3 years ago

This issue has been solved in version 2.5.0 which can be read about here. There are still limitations to the combinations of pins that interrupts can be attached to, but these are systemic to vanilla interrupts. There is also a sketch that demonstrates how to use interrupts now.