Moderators: TomKerekes, dynomotion
-
Moray
- Posts: 288
- Joined: Thu Apr 26, 2018 10:16 pm
Post
by Moray » Sat Nov 23, 2019 12:12 am
Tom,
I was just using InitInterpreterData() function within DeviceInteropHandler Interpretor.cs as a basis for setting the interpreter data in my app, and I think you've got the ENUM usage the wrong way in the Switch section for commands.
Code: Select all
case MCODE_TYPE.M_Action_Program_PC:
p0 = command.Thread;
p1 = command.VAR;
sdata = command.FileName;
break;
case MCODE_TYPE.M_Action_Program_wait:
p0 = command.Thread;
p1 = command.VAR;
sdata = command.FileName;
break;
case MCODE_TYPE.M_Action_Program_wait_sync:
sdata = command.FileName;
break;
I think you've got M_Action_Program_PC, and M_Action_Program_wait_sync in the wrong places...
-
TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Post
by TomKerekes » Sat Nov 23, 2019 1:13 am
Hi Moray,
You are correct. Thanks. Should be:
Code: Select all
switch (command.Type)
{
case MCODE_TYPE.M_Action_Callback:
break;
case MCODE_TYPE.M_Action_DAC:
p0 = command.Bit1;
p1 = command.DacScale;
p2 = command.DacOffset;
p3 = command.DacMin;
p4 = command.DacMax;
break;
case MCODE_TYPE.M_Action_Program:
p0 = command.Thread;
p1 = command.VAR;
sdata = command.FileName;
break;
case MCODE_TYPE.M_Action_Program_wait:
p0 = command.Thread;
p1 = command.VAR;
sdata = command.FileName;
break;
case MCODE_TYPE.M_Action_Program_wait_sync:
p0 = command.Thread;
p1 = command.VAR;
sdata = command.FileName;
break;
case MCODE_TYPE.M_Action_Program_PC:
sdata = command.FileName;
break;
case MCODE_TYPE.M_Action_Setbit:
p0 = command.Bit1;
p1 = command.State1 ? 1 : 0;
break;
case MCODE_TYPE.M_Action_Waitbit:
p0 = command.Bit1;
p1 = command.State1 ? 1 : 0;
break;
case MCODE_TYPE.M_Action_SetTwoBits:
p0 = command.Bit1;
p1 = command.State1 ? 1:0;
p2 = command.Bit2;
p3 = command.State2 ? 1:0;
break;
default:
init = false;
break;
}
Regards,
Tom Kerekes
Dynomotion, Inc.
-
Moray
- Posts: 288
- Joined: Thu Apr 26, 2018 10:16 pm
Post
by Moray » Sat Nov 23, 2019 1:37 am
For my own app, I actually simplified it a bit, and combined all the KFlop Program cases, since they all load the same information to the interpreter -
Code: Select all
case MCODE_TYPE.M_Action_Program:
case MCODE_TYPE.M_Action_Program_wait:
case MCODE_TYPE.M_Action_Program_wait_sync:
p0 = command.val1;
p1 = command.val2;
sdata = command.filename;
break;
This is the final puzzle piece for loading actions in my own app. I just need to sort out user buttons, and I then might be able to get a KFlop to do something meaningful with my own app..