This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/CODECOMPOSER: GUI Composer data pre-processing

Part Number: CODECOMPOSER

Tool/software: Code Composer Studio

Hello,

I have been using the GUI Composer for creating an application with some linear graphs, buttons and indicators. I am using XDS100v2 for communication with a Delfino F28379D control card. I am very happy with it and it is satisfying my needs beside a little problem. 

The problem I have is to pre-process some data arrays before displaying them in graphs. To be more precise I have some 16bit data arrays to save communication performance, which I need to scale back to float.

I have seen the example (www.youtube.com/watch and replicate it and seems to work fine.  As soon as I am setting up the communication with my control card the javascript binding stops working. Am I missing something here???

Thanks in advance,

Radu

  • When you add the pre-processing function, make sure you remove the binding for this widget in the properties view.
  • Dear Patrick,

    It was removed from the beginning, so the problem does not come from there.

    Regards,

    Radu

  • Can you copy/paste your processing function here? I like to see how you add the binding in the javascript file.
  • Hello Patrick,
    I have copied the code and attached a GUI picture. If I do not have a binding to the model in the javascript (3rd numberbox called OutModel binded to my_model.UgRms) the app will connect, flash and disconnect from the hardware. The variable I am reading exists in the model and has its value set to 15. If I am binding it from widget properties it works fine, but the other two still do not work.
    I hope this helps...
    Regards,
    Radu

    /* * gc global variable provides access to GUI Composer infrastructure components and project information. * For more information, please see the Working with Javascript guide in the online help. */ var gc = gc || {}; gc.services = gc.services || {}; /* * Boilerplate code for creating computed data bindings */ document.addEventListener('gc-databind-ready', function() { /* * Add custom computed value databindings here, using the following method: * * function gc.databind.registry.bind(targetBinding, modelBinding, [getter], [setter]); * * param targetBinding - single binding string or expression, or array of binding strings for multi-way binding. * param modelBinding - single binding string or expression, or array of binding strings for multi-way binding. * param getter - (optional) - custom getter function for computing the targetBinding value(s) based on modelBinding value(s). * param setter - (optional) - custom setter function for computing the modelBinding value(s) based on targetBinding value(s). */ // For example, a simple computed values based on simple expression // gc.databind.registry.bind('widget.id.propertyName', "targetVariable == 1 ? 'binding is one' : 'binding is not one'"); // Or a custom two-way binding with custome getter and setter functions. (setter is optional) (getter only indicates one-way binding) // gc.databind.registry.bind('widget.id.propertyName', "targetVariable", function(value) { return value*5/9 + 32; }, function(value) { (return value-32)*9/5; }); // Event 1 to n bindings gc.databind.registry.bind('Out.value', // dependant bindings needed in order to compute the date, in name/value pairs. "In.value", // getter for date computation function(value) { // compute and return the string value to bind to the widget with id 'date' return value*2; }, function(value) { // compute and return the string value to bind to the widget with id 'date' return value/2; } ); gc.databind.registry.bind('OutModel.value', // dependant bindings needed in order to compute the date, in name/value pairs. "my_model.UgRms", // getter for date computation function(value) { // compute and return the string value to bind to the widget with id 'date' return value; } ); }); /* * Boilerplate code for creating custom actions */ document.addEventListener('gc-nav-ready', function() { /* * Add custom actions for menu items using the following api: * * function gc.nav.registryAction(id, runable, [isAvailable], [isVisible]); * * param id - uniquely identifies the action, and should correspond to the action property of the menuaction widget. * param runable - function that performs the custom action. * param isAvailable - (optional) - function called when the menu action is about to appear. Return false to disable the action, or true to enable it. * param isVisible - (optional) - function called when the menu action is about to appear. Return false to hide the action, or true to make it visible. */ // For example, // gc.nav.registerAction('myCustomCloseAction', function() { window.close(); }, function() { return true; }, function() { return true; }); // Alternatively, to programmatically disable a menu action at any time use: // gc.nav.disableAction('myCustomCloseAction); then enable it again using: gc.nav.enableAction('myCustomCloseAction'); }); /* * Boilerplate code for working with components in the application gist */ /* var initComplete = false; var templateObj; // Wait for DOMContentLoaded event before trying to access the application template var init = function() { templateObj = document.querySelector('#template_obj'); // Wait for the template to fire a dom-change event to indicate that it has been 'stamped' // before trying to access components in the application. templateObj.addEventListener('dom-change',function(){ if (initComplete) return; this.async(function(){ initComplete = true; console.log("Application template has been stamped."); // Now that the template has been stamped, you can use 'automatic node finding' $ syntax to access widgets. // e.g. to access a widget with an id of 'widget_id' you can use templateObj.$.widgetId },1); }); }; templateObj = document.querySelector('#template_obj'); if (templateObj) { init(); } else { document.addEventListener('DOMContentLoaded',init.bind(this)) } */

  • Hi Radu,

    I see that you are missing the widget token before the id of your widget in the bind statements. Try changing Out.value and In.value to widget.Out.value and widget.In.value. See the documentation example code just above the first gc.databind.registry.bind call in the javascript file.

    Regards,
    Patrick

  • Hi Patrick,
    Thank you very much, this solved my issue. You (TI) might consider updating the youtube video (www.youtube.com/watch I have been using as inspiration. This token is also missing there.
    Regards,
    Radu