freemaster dashboard variable input

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

freemaster dashboard variable input

跳至解决方案
833 次查看
paul_ephraim_13
Contributor III

In freemaster software i am unable to overwrite a virtual variable in the watch variabe section from the dashboard input for that variable.
Kindly Clarify!

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>PWM Dashboard</title>
</head>
<body onload="main()">
    <object id="pcm" height="0" width="0" classid="clsid:48A185F1-FFDB-11D3-80E3-00C04F176153"></object>
    <h1>PWM Dashboard</h1>
    var01inc: <input id="input_var01inc" value="1" type="text" size="10">
    <input type="button" value="Write!" onclick="writevar()">
    <span id="span_status" type="text"></span><br><br>

    <div class="footer">
        Copyright 2020 NXP
    </div>

    <script language="Javascript">
        var i_var01inc;
        var s_status;

        function main() {
            i_var01inc = document.getElementById("input_var01inc");
            s_status = document.getElementById("span_status");

            // Check if FreeMASTER is available
            if (!pcm) {
                s_status.innerText = "ERROR: FreeMASTER not initialized!";
                return;
            }

            // Display a message that FreeMASTER has initialized correctly
            console.log("FreeMASTER initialized. Ready to write variable.");
        }

        function writevar() {
            var v = i_var01inc.value; // Get the input value for var01inc

            // Attempt to write to FreeMASTER's virtual variable
            if (pcm.WriteVariable("var01inc", v)) {
                s_status.innerText = "Written: " + v;
            } else {
                s_status.innerText = "ERROR: " + pcm.LastRetMsg;
            }

            console.log("Attempting to write value: ", v);
        }
    </script>

    <script type="text/javascript" src="/js/simple-jsonrpc-js.js"></script>
    <script type="text/javascript" src="/js/freemaster-client.js"></script>
</body>
</html>
0 项奖励
回复
1 解答
806 次查看
MichalH
NXP Apps Support
NXP Apps Support

Hello, 

your script works well on my side.

MichalH_1-1725980527609.png

Please remember that the variable needs to be modifiable:

MichalH_0-1725980370862.png

Also note that current version of FreeMASTER will not update the variable value in the Watch view until you open the communication port. This issue will be fixed in the upcoming release - the virtual variables will not need a port being open at all and their value will refresh variable watch views.

Regards,
Michal

 

 

在原帖中查看解决方案

1 回复
807 次查看
MichalH
NXP Apps Support
NXP Apps Support

Hello, 

your script works well on my side.

MichalH_1-1725980527609.png

Please remember that the variable needs to be modifiable:

MichalH_0-1725980370862.png

Also note that current version of FreeMASTER will not update the variable value in the Watch view until you open the communication port. This issue will be fixed in the upcoming release - the virtual variables will not need a port being open at all and their value will refresh variable watch views.

Regards,
Michal