This can be simplified down to
activeMotorID = motor_id;
or, better
if (motor_id < 5 && motor_id > 0)
activeMotorID = motor_id;
else
Serial.printf("Bad motor_id %d\r\n",motor_id);
The switch/case statement has hidden powers, but you don't use them ![]()
They are (assuming we are all using GCC-based compilers)
- case ranges: e.g. case 1...10:
- ability to fallthrough from one "case" to another
- "default" statement