freemaster dashboard variable input

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

freemaster dashboard variable input

ソリューションへジャンプ
216件の閲覧回数
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 解決策
189件の閲覧回数
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 返信
190件の閲覧回数
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