Announcement

Collapse
No announcement yet.

Update scope via MagicObject

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Update scope via MagicObject

    Hi!
    I'm using a uLCD-32PT as a user interface where the power requirement requires me to put the display in to sleep when not using it. This I have accomplished by using a magic object setting the sleep command. This works perfect, and just in case anyone else need the code, here it is:

    Code:
    func rMagicObject0(var action, var object, var newVal, var *ptr)
        var SleepTime, checksum;
           if(action == WRITE_MAGIC_BYTES)
                SleepTime := ptr[0];
                ActivateForm(7); // black form to avoid flickering
                serout(ACK);
                sys_Sleep(SleepTime);
                // Report that sleep has ended
                gfx_Contrast(0); // to set backlight off in case we're just want to go to sleep again
                seroutCS(REPORT_MAGIC_EVENT_BYTES);
                checksum := REPORT_MAGIC_EVENT_BYTES;
                seroutCS(object);
                checksum ^= object;
                seroutCS(1); //1 byte length
                checksum ^= 1;
                seroutCS(0xFF); //Send FF for OK
                checksum ^= 0xFF;
                seroutCS(checksum);
    
           endif
    endfunc
    Here I send magic byte to the object, where I can adjust the sleep time with the magic byte (sleepTime are in seconds). Sending byte A then puts the display to sleep for 10 seconds.

    What I need, is to re-draw the scope I have with new data when display wakes up and I decide to turn on backlight and activate Form0 (where the scope resides).
    The data I would like to plot is kept in the uC connected to the display, so it should be possible to send it to the display one it has come out of sleep. A rough breakdown of what I try to accomplish:

    1. Data is plottet to the display through the normal ViSi Genie, sending one value at the time
    2. Display is put to sleep, no data can be sent to display
    3. uC is storing data in array
    4. When scope is to be shown after a sleep(), uC sends magic object where:
    .......a) Scope is cleared
    .......b) Scope is re-plotted with historical data sent in array

    Is there anyone that have done this before, or have any suggestions on where to look?
    I have tried to find any reference to gfx_scope() in the documentation without any luck. What I would like to do, is to update the scope via a magic object as the example for Spectrum (https://4dsystems.com.au/blog/4d-an-00167/). However, I'm missing the information about what functionality I have available for doing this for Scope.

    Best Regards
    Comiter

  • #2
    Hi,

    We have an application note for the Scope widget. Please check this link:
    AN-00028 ViSi Genie Single Trace Scope
    https://4dsystems.com.au/blog/4d-an-00028/

    You may also take a look for the Sample Programs on the Workshop4.
    File->Samples->Picaso ViSi->Scope.4DVisi
    File->Samples->Picaso ViSi Genie->Scope.4DGenie
    File->Samples->ViSi Genie Magic->MagicScope.4DGenie

    Perhaps this may give you an idea on how you can implement the Scope widget on your application.

    I hope this helps.

    Best Regards,
    Kevin

    Comment

    Working...
    X