Page 1 of 1

KFlopWebNC bug

Posted: Sat Nov 23, 2019 12:12 am
by Moray
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...

Re: KFlopWebNC bug

Posted: Sat Nov 23, 2019 1:13 am
by TomKerekes
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;
                }

Re: KFlopWebNC bug

Posted: Sat Nov 23, 2019 1:37 am
by Moray
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..