My device takes a user defined upper and lower voltage limit, then begins measuring an input voltage from a voltage divider. It takes the measured voltage and compares it to the user defined limits, then if that measured voltage falls outside of that range it logs it into SPI flash. The device uses two tilt switches as "device movement" sensors, these are tied to ground and utilize the internal pull-up. While looping the main measuring code, if movement is felt a timer is reset, if no movement is felt in 5 seconds the device goes to sleep. The device will wake with a change in the external interrupts attached to the tilt switches. This loop is continued indefinitely, except when it malfunctions.
The problem occurs after the device wakes from sleep and the tilt switches change status several times within a few seconds. If this happens, the device goes back to sleep immediately and will not wake up from sleep. I'm able to tell it's going to sleep in this condition by connection a power meter onto the device and monitoring the current draw.
When this malfunction occurs, could it be the interrupts not detaching when it wakes back up and causing this? I've attached my code and design. Thank you for your time
project.ino (13.7 KB)