Skip to content

transferTo()

CreateiveRobotics edited this page Mar 7, 2020 · 2 revisions
bool transferTo(const commandList_t \*commands, uint32_t size, String newName)

Transfer this Commander object to a new command list, and give it a new name that will appear when the command prompt prints.

This function will return true if Commander finds and handles a command in this new command set.

This is normally used in conjunction with transferBack() when working with multiple command lists.

Example:

Cmdr.println("Passing to sub command handler");
if(Cmdr.transferTo(subCommands, numOfSubCmds, "sub")){
  //commander returns true if it is passing back control
  //If not we remain in the sub command system.
  Cmdr.transferBack(masterCommands, numOfMasterCmds, "Cmd");
}
Clone this wiki locally