Dynomotion

Group: DynoMotion Message: 6350 From: fireup_kev Date: 12/29/2012
Subject: "SetMcodeAction" don't work for M100 = M119
"CoordMotion.Interpreter.SetMcodeAction" for .NET don't seem to work for M100 to M119 (unless I'm using it wrong)

Thanks,
Kevin
Group: DynoMotion Message: 6353 From: Tom Kerekes Date: 12/30/2012
Subject: Re: "SetMcodeAction" don't work for M100 = M119
Hi Kevin,

I'm not sure how you are using it but the "MCode Action" number is not the same as the MCode number.  All the MCodes 0-10, the 10 user button actions, and the 20 M100-119 actions are all packed into an array of  41 actions.

M100 is the 21st Action not the 100th.  Here is the related constants from GCodeInterpreter.h.  We should export them to C#

#define MAX_MCODE_ACTIONS_M1 11        // actually only 2-10 are used
#define MAX_MCODE_ACTIONS_BUTTONS 10
#define MAX_MCODE_ACTIONS_M100 20
#define MAX_MCODE_ACTIONS (MAX_MCODE_ACTIONS_M1+MAX_MCODE_ACTIONS_M100+MAX_MCODE_ACTIONS_BUTTONS)
#define MAX_MCODE_DOUBLE_PARAMS 5
#define MCODE_ACTIONS_M100_OFFSET (MAX_MCODE_ACTIONS_M1+MAX_MCODE_ACTIONS_BUTTONS)

HTH
Regards
TK

Group: DynoMotion Message: 6356 From: fireup_kev Date: 12/30/2012
Subject: Re: "SetMcodeAction" don't work for M100 = M119
I tried using SetMcodeAction(21, ... for M100 with no effect.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Kevin,
>
> I'm not sure how you are using it but the "MCode Action" number is not the same as the MCode number.  All the MCodes 0-10, the 10 user button actions, and the 20 M100-119 actions are all packed into an array of  41 actions.
>
> M100 is the 21st Action not the 100th.  Here is the related constants from GCodeInterpreter.h.  We should export them to C#
>
> #define MAX_MCODE_ACTIONS_M1 11        // actually only 2-10 are used
> #define MAX_MCODE_ACTIONS_BUTTONS 10
> #define MAX_MCODE_ACTIONS_M100 20
> #define MAX_MCODE_ACTIONS (MAX_MCODE_ACTIONS_M1+MAX_MCODE_ACTIONS_M100+MAX_MCODE_ACTIONS_BUTTONS)
> #define MAX_MCODE_DOUBLE_PARAMS 5
> #define MCODE_ACTIONS_M100_OFFSET (MAX_MCODE_ACTIONS_M1+MAX_MCODE_ACTIONS_BUTTONS)
>
>
> HTH
> Regards
> TK
>
>
>
> ________________________________
> From: fireup_kev <kliboon@...>
> To: DynoMotion@yahoogroups.com
> Sent: Saturday, December 29, 2012 11:50 PM
> Subject: [DynoMotion] "SetMcodeAction" don't work for M100 = M119
>
>
>  
> "CoordMotion.Interpreter.SetMcodeAction" for .NET don't seem to work for M100 to M119 (unless I'm using it wrong)
>
> Thanks,
> Kevin
>
Group: DynoMotion Message: 6360 From: Tom Kerekes Date: 12/31/2012
Subject: Re: "SetMcodeAction" don't work for M100 = M119
Hi Kevin,

It seems to work fine for me using the Dynomotion VB.NET Example in V4.30j:

I configured M100 and M101 actions to toggle Bit 46 (KFLOP LED0) on and off with:

    Public Sub Run()

        _Controller.CoordMotion.Interpreter.SetMcodeAction(21, KMotion_dotNet.MCODE_TYPE.M_Action_Setbit, 46, 1, 0, 0, 0, "")
        _Controller.CoordMotion.Interpreter.SetMcodeAction(22, KMotion_dotNet.MCODE_TYPE.M_Action_Setbit, 46, 0, 0, 0, 0, "")

        _InterpreterStatus = ""
        If System.IO.File.Exists(_InterpreterFileName) = True Then
            _Controller.CoordMotion.Interpreter.Interpret(_InterpreterFileName)
        End If


Then ran GCode of:

G0 X0 Y0 Z0
F40
M100
G1 X0 Y1
M101
G1 X0 Y0
M100
G1 X1 Y0
M101
G1 X0 Y0
M2

And the KFLOP LED toggles on and off

Regards
TK