Update events.c

Array max is incorrectly calculated, can lead to missed events for ids > MAX_DEVICES