A couple of comments:
1) Many motor controllers have an input directly on the motor controller for limit switches. You obviously can do this in code still, but just wanted to point it out.
2) You should look into command based programming. While it's "overkill" for your project - if you're hoping to take your programming to the next level in FRC, the command based programming allows you to set up various commands/subsystems that can then be reused in groups of commands. I personally am a big fan of thinking of programming commands into the robot vs programming a button that turn X motor.
https://wpilib.screenstepslive.com/s...ed-programming
3) I would absolutely break up your for loop into two separate ones. With what you have right now, if you only had 2 automodes you'd get an index out of bounds mode. And really, the number of drive motors you have shouldnt change. Just code those four lines out rather than have a for loop for it.
Nothing other than the max function use jumps out as a particularly bad practices to me. I would prefer renaming the dm# to leftFront, leftBack, rightFront, rightBack, and a more useful description for ds#.
You might consider having something to the driver station to report if you're limited your drivetrain speed or not.