Dynomotion

Group: DynoMotion Message: 6415 From: himykabibble Date: 1/11/2013
Subject: MainStatus...
Last time I tried to use MainStatus, there was a function "UpdateMainStatus()", that now seems to no longer exist. There is, instead "CurrentStatus". I assume this is now refreshed automatically by dotNet? How often?

Regards,
Ray L.
Group: DynoMotion Message: 6418 From: himykabibble Date: 1/11/2013
Subject: Re: MainStatus...
On a related note.... What is the difference between using:

KM_Controller.CurrentStatus.GetKFlopBitState(pinnum)

KM_IO.GetDigitalValue();

For some reason, the latter has been working for me, the former does not work for me.

Regards,
Ray L.


--- In DynoMotion@yahoogroups.com, "himykabibble" wrote:
>
> Last time I tried to use MainStatus, there was a function "UpdateMainStatus()", that now seems to no longer exist. There is, instead "CurrentStatus". I assume this is now refreshed automatically by dotNet? How often?
>
> Regards,
> Ray L.
>
Group: DynoMotion Message: 6421 From: Tom Kerekes Date: 1/11/2013
Subject: Re: MainStatus...
Hi Ray,

There is a CurrentStatus Structure/Mechanism that is intended to automatically check every time it is referenced how old the data is and refresh it if necessary.

I think it is better to use the method described in the previous email where you explicitly decide where and when to refresh the Bulk Status.

The GetKFlopBitState method is not (necessarily) doing any communication to the KFLOP board.  It is just extracting data from the Bulk Status record for you.

KM_IO.GetDigitalValue() performs a ReadBit operation to KFLOP to get the current state.  This takes much longer (~1ms) and consumes USB bandwidth.

Regards
TK

Group: DynoMotion Message: 6442 From: Brad Murry Date: 1/12/2013
Subject: Re: MainStatus...

Howdy,

 

 

CurrentStatus is designed to cache the value structure since it is a fairly expensive call.

 

To remove/reduce the cache time::

 

If you look at the property to grab the MainStatus Structure (CurrentStatus )-

You can see that setting StatusUpdateInterval to a small number will basically make the property behave like an on-demand method.

 

 

While you could set it to zero, I would recommend at least 5-10 so it will remain cached in the event you have multiple pieces of code querying it.

 

Alternatively, you could  disable the cache (setting interval to zero) and assign CurrentStatus  to a local variable every place you are using values from the MainStatus structure(downside is this structure reference can change if CurrentStatus  is accessed outside the current method on another thread.

 

 

 

       /// <summary>

        /// Locally maintained Main_Status struct

        /// </summary>

        public KM_MainStatus CurrentStatus

        {

            get

            {

                int duration = Math.Abs(Environment.TickCount - _CurrentStatus.TicksAtUpdate);

 

                if (duration > _StatusUpdateInterval)

                {

                    _CurrentStatus = GetStatus(_LockStatusOnUpdate);

                }

                return _CurrentStatus;

            }

        }

 

 

So-

 

If you do not need or want a caching mechanism your best bet is to not use the property at all .

 

Just grab a MainStatus object using the method:

 

public KM_MainStatus GetStatus(bool locked)

 

 

 

 

Good luck Ray!

 

-Brad Murry

From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of Tom Kerekes
Sent: Friday, January 11, 2013 10:36 AM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: MainStatus...

 

 

Hi Ray,

 

There is a CurrentStatus Structure/Mechanism that is intended to automatically check every time it is referenced how old the data is and refresh it if necessary.

 

I think it is better to use the method described in the previous email where you explicitly decide where and when to refresh the Bulk Status.

 

The GetKFlopBitState method is not (necessarily) doing any communication to the KFLOP board.  It is just extracting data from the Bulk Status record for you.

 

KM_IO.GetDigitalValue() performs a ReadBit operation to KFLOP to get the current state.  This takes much longer (~1ms) and consumes USB bandwidth.

 

Regards

TK

 


From: himykabibble <jagboy1964@...>
To: DynoMotion@yahoogroups.com
Sent: Friday, January 11, 2013 9:17 AM
Subject: [DynoMotion] Re: MainStatus...

 

 

On a related note.... What is the difference between using:

KM_Controller.CurrentStatus.GetKFlopBitState(pinnum)

KM_IO.GetDigitalValue();

For some reason, the latter has been working for me, the former does not work for me.

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, "himykabibble" wrote:
>
> Last time I tried to use MainStatus, there was a function "UpdateMainStatus()", that now seems to no longer exist. There is, instead "CurrentStatus". I assume this is now refreshed automatically by dotNet? How often?
>
> Regards,
> Ray L.
>

 

Group: DynoMotion Message: 6443 From: himykabibble Date: 1/12/2013
Subject: Re: MainStatus...
Brad,

Thanks! I should be able to do what I need by just grabbing a local copy of it when needed, since all updates occur in one place, at one time.

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Brad Murry wrote:
>
> Howdy,
>
>
>
>
>
> CurrentStatus is designed to cache the value structure since it is a fairly expensive call.
>
>
>
> To remove/reduce the cache time::
>
>
>
> If you look at the property to grab the MainStatus Structure (CurrentStatus )-
>
> You can see that setting StatusUpdateInterval to a small number will basically make the property behave like an on-demand method.
>
>
>
>
>
> While you could set it to zero, I would recommend at least 5-10 so it will remain cached in the event you have multiple pieces of code querying it.
>
>
>
> Alternatively, you could disable the cache (setting interval to zero) and assign CurrentStatus to a local variable every place you are using values from the MainStatus structure(downside is this structure reference can change if CurrentStatus is accessed outside the current method on another thread.
>
>
>
>
>
>
>
> ///
>
> /// Locally maintained Main_Status struct
>
> ///
>
> public KM_MainStatus CurrentStatus
>
> {
>
> get
>
> {
>
> int duration = Math.Abs(Environment.TickCount - _CurrentStatus.TicksAtUpdate);
>
>
>
> if (duration > _StatusUpdateInterval)
>
> {
>
> _CurrentStatus = GetStatus(_LockStatusOnUpdate);
>
> }
>
> return _CurrentStatus;
>
> }
>
> }
>
>
>
>
>
> So-
>
>
>
> If you do not need or want a caching mechanism your best bet is to not use the property at all .
>
>
>
> Just grab a MainStatus object using the method:
>
>
>
> public KM_MainStatus GetStatus(bool locked)
>
>
>
>
>
>
>
>
>
> Good luck Ray!
>
>
>
> -Brad Murry
>
> From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of Tom Kerekes
> Sent: Friday, January 11, 2013 10:36 AM
> To: DynoMotion@yahoogroups.com
> Subject: Re: [DynoMotion] Re: MainStatus...
>
>
>
>
>
> Hi Ray,
>
>
>
> There is a CurrentStatus Structure/Mechanism that is intended to automatically check every time it is referenced how old the data is and refresh it if necessary.
>
>
>
> I think it is better to use the method described in the previous email where you explicitly decide where and when to refresh the Bulk Status.
>
>
>
> The GetKFlopBitState method is not (necessarily) doing any communication to the KFLOP board. It is just extracting data from the Bulk Status record for you.
>
>
>
> KM_IO.GetDigitalValue() performs a ReadBit operation to KFLOP to get the current state. This takes much longer (~1ms) and consumes USB bandwidth.
>
>
>
> Regards
>
> TK
>
>
>
> _____
>
> From: himykabibble
> To: DynoMotion@yahoogroups.com
> Sent: Friday, January 11, 2013 9:17 AM
> Subject: [DynoMotion] Re: MainStatus...
>
>
>
>
>
> On a related note.... What is the difference between using:
>
> KM_Controller.CurrentStatus.GetKFlopBitState(pinnum)
>
> KM_IO.GetDigitalValue();
>
> For some reason, the latter has been working for me, the former does not work for me.
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com , "himykabibble" wrote:
> >
> > Last time I tried to use MainStatus, there was a function "UpdateMainStatus()", that now seems to no longer exist. There is, instead "CurrentStatus". I assume this is now refreshed automatically by dotNet? How often?
> >
> > Regards,
> > Ray L.
> >
>