Page 1 of 1

Calling a serial command function

Posted: Thu Sep 23, 2021 7:49 am
by JohnPalmerGT
Hi all,
I am trying to call a function that is also one of my serial command functions. I thought this could be an efficient way to reuse a serial command function's code.
For example if I have the following function, what syntax is required to call this function?

void Cmd_Clutch(CommandParameter &Parameters){
"CODE"
}

Thanks,
John

Re: Calling a serial command function

Posted: Sat Oct 02, 2021 4:54 am
by philr
Hi John, are you planning on pulling variables out of it when you run that function or just triggering some other code?

Re: Calling a serial command function

Posted: Mon Oct 04, 2021 8:04 am
by JohnPalmerGT
Hi, I will just be running the code inside the function.

Re: Calling a serial command function

Posted: Mon Oct 11, 2021 7:04 am
by philr
I think you should just create a separate function that is reusable. Call it from inside the command handler function and elsewhere in your code.

Re: Calling a serial command function

Posted: Mon Oct 11, 2021 7:11 am
by JohnPalmerGT
That is a very simple logical solution, thanks.