Closed ovi1337 closed 6 years ago
Ok, the error code given by the server is 1797: parameter size not correct
. I don't know if the server has more detailed logs, that would definetly help debugging the issue.
I would also try to change the types.
Hey, thank you for your quick response!
Currently i'm not at home to dig deeper, but maybe i found something:
Actually the object for getting single values looks like this:
{
symname: '.AI_Light_Sensor',
bytelength: ads.INT,
}
Can it be that it's wanted like this?
{
name: '.AI_Light_Sensor',
readLength: ads.INT,
}
The value assignments are looking quite different and not consistent, can it be?
Please take a look here:
multiRead
https://github.com/roccomuso/node-ads/blob/master/lib/ads.js#L262-L268
read https://github.com/roccomuso/node-ads/blob/master/lib/ads.js#L337-L342
I think it really can be possible, because the length don't will be defined and also the name is missing, so the defined length of the value the name is left in undefined|null
state. There are 7 values in my example example, but all values are not defined in case of different namings of the necessary parameters, because there is no error check for missing parameters at this place.
@ovi1337 I didn't noticed it. But you seem right. The multiread oneOption.name
should be renamed in oneOption.symname
in the lib. Could you try it when you get back home?
Then we should also write a multiread sample usage on the README.md
doc.
This is related to #3
Yes I will try it out when I'm back home. I also can open a pull request with a compatibility patch for consistency if you want.
Yes sure. That would be really appreciated
mmh... something is absolutely strange in this method. The whole buffer calculation is wrong and is wrong and all seems to be completely broken here. Could it be that this function has never worked before and is unfinished?
@ovi1337 It's highly possible and It's also not documented. We could try to fix it.
I checked out the documentation - there's no useful sample for communicating via TCP in javascript, but this can maybe help us to fix it. I think the transmission container is basically the same and only the way of communication is a bit different. (simple web request vs TCP sockets)
This also can be helpful (It's for Java and is also utilizing the SDK, but there are some more descriptions about the data packets): https://infosys.beckhoff.com/content/1033/tcsample_java/html/tcjavatoads_sample12.html?id=6497303773881420725
The communication via tcp should be the same used by the single read. Here It's just a matter of dealing with the data packets parsing, but i wasn't able to find a clear pdf.
I've found a solution for this problem yesterday evening and i'm working on a fix. With the current solution it's only possible to make a multiRead by using the indexGroup
together with the indexOffset
instead of just using the symName
.
I think it's necessary to make a larger refactoring for more comfort. There are also many things in the library which needs to have adjustments and improvements.
But at first it's working so far and we can plan the next improvements.
@ovi1337 great. I could give you access to the repo as mantainer
hahaha, okay 😅
By the way, i think that i've handled the way to use just the SymbolName - We have to resolve the ID's with AdsReadSymbolDesc
before, after that i have the whole configuration of the Symbol, including indexGroup
and indexOffset
.
https://infosys.beckhoff.com/english.php?content=../content/1033/tcadsocx/html/tcadsocx_methadsreadsymboldesc.htm&id=3582448685738059069
The funny side-effect is, that we normally also don't need to define the byteLength anymore. To save unnecessary CPU time is it also possible to implement a Symbol-Cache. But for this "ultra comfortable" way should it be a complete refactoring i think :)
Let's just fix this part first ^^
OK, we're first gonna merge the existing PR if you agree
@roccomuso yes, absolutely! I'm still on the multiRead. I hadn't much time at the weekend, but i think that have some time to finish it today :)
Great, In the meanwhile I'll merge any pending PR. (I'm not gonna publish a new release yet, first let's try to do a test and fix the multiRead). Try working with the new merged lib on github to make sure we don't introduce bugs or any breaking change with the new additions :)
Fixed by myself
Hi, i have a problem by using the
multiRead
method, i tried different things and also only one value, but it's returning every time only the error messageError: parameter size not correct
. What i'm doing wrong? The communication itself is working well so far. Single values are working as expected.I'm using a Beckhoff TwinCAT v2.11.
This is the error message on the console: