tomcx / tame4

JS library for the access to a TwinCAT PLC. Current version V4.3.1 final.
GNU General Public License v3.0
44 stars 8 forks source link

Cannot process the values in oc at polling #2

Closed burcakDemircioglu closed 8 years ago

burcakDemircioglu commented 8 years ago

Hi, We created our web service and constructed a polling structure. When we watch the polled values on browser's inspect element, we can see their values as true or false but in the if statements in oc function the variables are not processed as they suppose to. As an example:

oc: function() { if (s_B2D_k === true) {document.getElementById('field_s_B2D').style.backgroundColor = 'red';} else if(s_B2D_y===true) {document.getElementById('field_s_B2D').style.backgroundColor = 'green';} else if(s_B2D_s===true) {document.getElementById('field_s_B2D').style.backgroundColor = 'yellow';} else {document.getElementById('field_s_B2D').style.backgroundColor = 'orange';} }

since we see s_B2D_k as true on the inspection the element background color becomes orange for some reason and when I try to show the s_B2D_k's value on window.alert() in oc:function() it says "undefined". Also there are a lot of warnings comes from tame.js and TcAdsWebService.dll which is not explaining any issue properly but it says "Request Dropped". Also if it means anything, we are not connected to Internet when we run the program, we are just connected to PLC. We can send you the files if it is necessary..

Can you help? Any suggestions?

burcakDemircioglu commented 8 years ago

We just found the solution =) Our var's were not global and that was the reason. Now it works as charm. Sorry for taking your time =)

tomcx commented 8 years ago

Hi Burcak,

glad to hear that. A wrong variable scope was the first what came in my mind.

Regards,

Thomas Am 09.05.2016 16:59 schrieb "Burcak Demircioglu" notifications@github.com:

We just found the solution =) Our var's were not global and that was the reason. Now it works as charm. Sorry for taking your time =)

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/tomcx/tame4/issues/2#issuecomment-217889554