You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.
I managed to read the distance value with your code.
Thank you very much for that.
The GLM 50 C can also measure angle/inclination.
I found the command to start the measuring of the angle, but
unfortunately I didn't find the correct command to read the value from the device.
Finding the command was a little bit tricky,
but I add a function to your code that automatically tries all possible commands.
(Sorry for the bad code, but these are my first tests with python)
It would be tool, if you could check, if there is a command to read the angle.
Thanks in advance
Some of the commands I found:
#[192, 64, 0, 238], #measure length#[192, 65, 0, 150], #laser on#[192, 66, 0, 205], #laser off#[192, 69, 0, 208], #horn on#[192, 70, 0, 139], #horn off#[192, 71, 0, 243], #backlight on#[192, 72, 0, 177], #backlight off#[192, 84, 0, 22], #level in mainframe off#[192, 85, 0, ???],#lock angle on device (first time locked, second call releases the measuring)#[194, 64, 0, ???],#measure length but with longer received data b'\x00\x044<\x96\x08\x00\x00'
deffindCmd2(self):
withopen ('cmds'+str(time.time()), 'w') asf:
f.write('start finding command structure\n\n')
#listaddrList=range(192,256) #startbyte: everything greater greater or equal 192 [C0] workscmdList=range(0,256) #commandcmdData=range(0,1)#range(0,2) #data: found no use so far#build commandforginaddrList:
foriincmdList:
forcincmdData:
checkSumArr= [g, i, 0] #create command used for checksumcheckSumBytes=bytes(checkSumArr) #convert decimal commandk=crc8(checkSumBytes) #calculate checksumcmdArr= [g,i,c,k] #create full command for devicecmd=bytes(cmdArr) #convert decimal command#exclude bad commands#command cause strange beahviour or decive rebootif ((cmdArr== [192, 53, 0, 166]) or
(cmdArr== [192, 55, 0, 86]) or
(cmdArr== [192, 56, 0, 20]) or
(cmdArr== [192, 54, 0, 46]) or
(cmdArr== [192, 58, 0, 228]) or
(cmdArr== [192, 59, 0, 156]) or
(cmdArr== [192, 60, 0, 82]) or
(cmdArr== [192, 61, 0, 42]) or
(cmdArr== [192, 55, 1, 86]) or
(cmdArr== [192, 55, 1, 240]) or
(cmdArr== [192, 56, 1, 20]) or
(cmdArr== [192, 56, 1, 178]) or
(cmdArr== [192, 53, 1, 0]) or
(cmdArr== [192, 54, 1, 46]) or
(cmdArr== [192, 55, 1, 240]) or
(cmdArr== [192, 54, 1, 136]) or
(cmdArr== [192, 58, 1, 228]) or
(cmdArr== [192, 59, 1, 156]) or
(cmdArr== [192, 60, 1, 82]) or
(cmdArr== [192, 61, 1, 42]) or
(cmdArr== [192, 57, 1, 108]) or
(cmdArr== [192, 57, 1, 202]) or
(cmdArr== [192, 58, 1, 66]) or
(cmdArr== [192, 59, 1, 58]) or
(cmdArr== [192, 60, 1, 244]) or
(cmdArr== [192, 61, 1, 140]) or
(cmdArr== [192, 62, 0, 162]) or
(cmdArr== [192, 62, 1, 4]) or
(cmdArr== [192, 63, 0, 218]) or
(cmdArr== [193, 54, 0, 102]) or
(cmdArr== [192, 57, 0, 108]) or
((i>50) and (i<60))):
continueprint("cmd:\t ", end='')
print(cmdArr, end='')
f.write("cmd:\t ")
f.write(str(cmdArr))
self.socket.send(cmd)
sleep(0.01) #seems not necessarydata=self.socket.recv(1024)
sleep(0.5) #seems not necessaryif ((self.status[data[0]] is'ok') or (self.status[data[0]] is'invalid access level')):
#print('')print("\tdata:\t", end='')
print(data)
f.write("\tdata:\t")
f.write(str(data))
f.write('\n')
#print(data, end='')#print("cmd status: ", end='')#print(self.status[data[0]])continueelse:
print('')
if (self.status[data[0]] !='communication timeout'):
print('--> unknown return:\t', end='')
print(data)
f.write('\n')
ifself.status[data[0]] is'unknown command':
print('uC', end='')
ifself.status[data[0]] is'unknown return value2':
print('uC', end='')
ifself.status[data[0]] is'invalid access level':
print('--> invalid access level')
ifself.status[data[0]] is'hardware error':
print('--> hardware error')
ifself.status[data[0]] is'device not ready':
print('--> device not ready')
ifself.status[data[0]] is'communication timeout':
print('--> communication timeout')
thanks for your work! Unfortunately I don't own a GLM50C nor do I have access to one, so I cannot test your findings. If you have any progress here, keep me informed ;)
Hello all,
I managed to read the distance value with your code.
Thank you very much for that.
The GLM 50 C can also measure angle/inclination.
I found the command to start the measuring of the angle, but
unfortunately I didn't find the correct command to read the value from the device.
Finding the command was a little bit tricky,
but I add a function to your code that automatically tries all possible commands.
(Sorry for the bad code, but these are my first tests with python)
It would be tool, if you could check, if there is a command to read the angle.
Thanks in advance
Some of the commands I found:
The text was updated successfully, but these errors were encountered: