02.07.2022, 19:05
(01.07.2022, 14:50)admin Wrote: Do you have any other scripts accessing the same port? Only a single script can access the port at any time.
Also the reading part does not seem correct. Usually the data should be read one byte at a time, at least to the point where a message starting point is found. But this all depends on how the protocol is designed. Do you have a protocol description for this device?
Hi admin!
Thank you for your help !
I made sure that this is the only script accessing this port...and read the blind specification...
And finally realized that the cause was in my code.... the valiable "value" in str2hex() keep storing all results and this made the message looks repetative. I wrote this in the resident script
So there is nothing wrong with the blind and its specification
I can fix this now.... thank you so much for your help always !
Code:
function str2hex(str)
raw_len = string.len(str)
i = 1
while i <= raw_len do
current_hexvalue = '0x' .. string.format("%02x", string.byte(str, i))
if value then -- this "value" keep storing all results
value = value .. ', ' .. current_hexvalue
else
value = current_hexvalue
end
i = i + 1
end
return value
end