Discussion on using tasks in ROBOTC

Interrupts are not normally disabled. There are some situations where we disable, copy some data and then re-enable. The VM was originally designed to run on 16 bit hardware, 32 bit data copy on those old architectures was not atomic. Some opcodes take a long time to process (sprintf for example), it would be a bad idea to disable interrupts for that long.

Another question on this. We would normally hog the CPU, then update all motors on the same sub-system (drive, shooter, lift, etc…), then release the cpu. If we use the slave/mirror feature for motors (mirror a single motor) does this solve the problem of a task being interrupted by another task. Meaning, will the opcode generated call a function that performs the mirror/slave feature in an atomic fashion (disregarding system level interrupts, i.e. this does nothing to affect the 15ms SPI update discussion above)

Yes, after the master motor has its value updated there is a check made to see if that motor has any slaves that also need to be set.

Correct, the SPI interrupt can still happen at any point and whatever has been already set into the buffer will be sent.