Alternatively I could set a MAX_SHIFT_DEVICES (rather than TOTAL_PINS which would be huge for a Mega) to create a smaller array, but the lookup would be tricky.