If I do not include a break statement in a case branch will the switch be reassessed after exiting the branch? I wish to modify the variable assessed in the switch clause while within a case that is currently true. I can set a flag when I altered the conditions and have the main loop re run the function containing the switch tree.
No.
What branch? You mean case?
Can you post your code?
The switch structer is quite lengthy so I will post a short form version. However I have already added a if statement to look for a verb changed flag and rerun the ExecuteMovement();
....in void loop()
.....
ExecuteMovement();
if(CodeChangedVerb)
{
CodeChangedVerb = false;
ExecuteMovement();
}
....
}
within ExecuteMovement()..
switch (ThisOperation.Verb)
{
.........
case 0x4241: //'BA' or 'ba' Batch apend. Adds a command to the batch job.
{
if((sizeof(Batches) - 1)<= BatchItem)
{
Batches[BatchItem] = ThisOperation;
Batches[BatchItem].Verb = QueuedVerb;
BatchItem ++;
}
break;
}
case 0x4245: //'BE' or 'be' Batch Execute.
{
if(IsBusy == true)
{
if(BatchItem<= (sizeof(Batches) - 1))
ThisOperation = Batches[BatchItem]
CodeChangedVerb = true;
BatchItem ++;
}
else
{
BatchItem = 0;
IsBusy = false;
}
break;
Within BE //Batch Execute case, the batch item is copied to the current command ThisOperation.
Of course the element ThisOperation.Verb has now changed. The question was will the cases be reassessed or will it rely on the flags for re entry.
As Morris said, no.
And I'm a bit worried about this:
switch (ThisOperation.Verb)
What data type is ThisOperation.Verb?
word. as in 2 unsigned integers. The case value is a verb in hexadecimal form. Verb is literally the hex value of 2 ascii characters BE, MA ect.
JFYI Nick, I have a BX verb for box, and is working sweetly, aside from pole slip in the motors due to binding in the Y slide leadscrew. But this is a mechanical issue and the total matmatical error from start to finish has been +- 1 from the beginning coordinate. Not too bad if not allowed to propagate, and equates to only .05 thousandth of an inch on the table @ a scaling factor of 1. I really need to get the GUI written to a reasonable operating level, entering signed hex values is getting to exceed annoying when using the serial monitor as a interface.