PyRadmon install and set up on Raspberry Pi (Wheezy Raspbian)
- ThibmoRozier
- Offline
- Elite Member
9 years 8 months ago #789
by ThibmoRozier
True true.
Yet they send the datetime in a unmasked format... but cpm in a masked manner... >.<
Confusing stuff...
But it's just a mater of accepting and going on with trying to fix it, in the end-user product.
//Footnote: I wish DX_MON was more interested in this field, she's a genius programmer on firmware and end-user level.. Been trying to involve her into this, but egh, too busy.
Replied by ThibmoRozier on topic PyRadmon install and set up on Raspberry Pi (Wheezy Raspbian)
Cool, hope it will be fixed now
Stuff like that tends to be done in firmware because its all low level asm. Using spare bits for adding in functions on top of older code etc. The and-or mask is a classic, ever wonder how 'sprites' were plotted on top of backgrounds without a nasty rectangular block around them?
True true.
Yet they send the datetime in a unmasked format... but cpm in a masked manner... >.<
Confusing stuff...
But it's just a mater of accepting and going on with trying to fix it, in the end-user product.
//Footnote: I wish DX_MON was more interested in this field, she's a genius programmer on firmware and end-user level.. Been trying to involve her into this, but egh, too busy.
Please Log in or Create an account to join the conversation.
9 years 8 months ago #790
by jnissen
Replied by jnissen on topic PyRadmon install and set up on Raspberry Pi (Wheezy Raspbian)
DO I only change the gmc class or anything else? I am going to apply this in an hour or two. I have to run out now. The Main is as you sent earlier.
Please Log in or Create an account to join the conversation.
- ThibmoRozier
- Offline
- Elite Member
9 years 8 months ago #791
by ThibmoRozier
Sorry... Yes indeed.
I wish there was an ability to test it on my side.. Will see if I can create a simulator for it, or something in that area.. But for now, sorry for these changes.
All I am really going to change for now is the GMC class. { class gmc(...): }
Replied by ThibmoRozier on topic PyRadmon install and set up on Raspberry Pi (Wheezy Raspbian)
DO I only change the gmc class or anything else? I am going to apply this in an hour or two. I have to run out now. The Main is as you sent earlier.
Sorry... Yes indeed.
I wish there was an ability to test it on my side.. Will see if I can create a simulator for it, or something in that area.. But for now, sorry for these changes.
All I am really going to change for now is the GMC class. { class gmc(...): }
Please Log in or Create an account to join the conversation.
9 years 8 months ago #792
by jnissen
Replied by jnissen on topic PyRadmon install and set up on Raspberry Pi (Wheezy Raspbian)
Not quite...
==============================
Reading configuration:
User name configured
Password configured
Serial port name configured
Serial port speed configured
Protocol configured
Device number configured
Protocol configured
Using GMC protocol for 1 => geiger 1
No samples in queue, waiting 5 seconds => geiger 1
Gathering data started => geiger 1
Initializing GMC protocol communication => geiger 1
Found GMC-compatible device, version => geiger 1: GMC-300Re 2.36
Please note data will be acquired once per 5 seconds => geiger 1
Unit shows time as => geiger 1:
No samples in queue, waiting 5 seconds => geiger 1
Problem in getData procedure (disconnected USB device?) => geiger 1:
unsupported operand type(s) for &: 'str' and 'int'
Exiting
Waiting and reap threads
==============================
Reading configuration:
User name configured
Password configured
Serial port name configured
Serial port speed configured
Protocol configured
Device number configured
Protocol configured
Using GMC protocol for 1 => geiger 1
No samples in queue, waiting 5 seconds => geiger 1
Gathering data started => geiger 1
Initializing GMC protocol communication => geiger 1
Found GMC-compatible device, version => geiger 1: GMC-300Re 2.36
Please note data will be acquired once per 5 seconds => geiger 1
Unit shows time as => geiger 1:
No samples in queue, waiting 5 seconds => geiger 1
Problem in getData procedure (disconnected USB device?) => geiger 1:
unsupported operand type(s) for &: 'str' and 'int'
Exiting
Waiting and reap threads
Please Log in or Create an account to join the conversation.
- ThibmoRozier
- Offline
- Elite Member
9 years 8 months ago #795
by ThibmoRozier
Hmm....
One small change, then I go to my studies, with coffee.
Please try the following.
The only change is the gmc class
Replied by ThibmoRozier on topic PyRadmon install and set up on Raspberry Pi (Wheezy Raspbian)
Not quite...
==============================
Reading configuration:
User name configured
Password configured
Serial port name configured
Serial port speed configured
Protocol configured
Device number configured
Protocol configured
Using GMC protocol for 1 => geiger 1
No samples in queue, waiting 5 seconds => geiger 1
Gathering data started => geiger 1
Initializing GMC protocol communication => geiger 1
Found GMC-compatible device, version => geiger 1: GMC-300Re 2.36
Please note data will be acquired once per 5 seconds => geiger 1
Unit shows time as => geiger 1:
No samples in queue, waiting 5 seconds => geiger 1
Problem in getData procedure (disconnected USB device?) => geiger 1:
unsupported operand type(s) for &: 'str' and 'int'
Exiting
Waiting and reap threads
Hmm....
One small change, then I go to my studies, with coffee.
Please try the following.
The only change is the gmc class
class gmc(baseGeigerCommunication):
def initCommunication(self):
print "Initializing GMC protocol communication => geiger 1\r\n"
# get firmware version
self.serialPort.flushInput()
self.serialPort.write("<GETVER>>")
# assume that device responds within 1s
time.sleep(1)
response=""
while (self.serialPort.inWaiting()>0 and self.stopwork==0):
response = response + self.serialPort.read()
# response=self.sendCommand("< GETVER >>")
if len(response)>0:
print "Found GMC-compatible device, version => geiger 1: ", response, "\r\n"
# get serial number
# serialnum=self.sendCommand("<GETSERIAL>>")
# serialnum.int=struct.unpack('!1H', serialnum(7))[0]
# print "Device Serial Number is: ", serialnum.int
# disable heartbeat, we will request data from script
self.serialPort.flushInput()
self.serialPort.write("<HEARTBEAT0>>")
# self.sendCommand("< HEARTBEAT0 >>")
print "Please note data will be acquired once per 5 seconds => geiger 1\r\n"
# update the device time
self.serialPort.flushInput()
self.serialPort.write("<GETDATETIME>>")
# assume that device responds within 1s
time.sleep(1)
unitTime=""
while (self.serialPort.inWaiting()>0 and self.stopwork==0):
unitTime = unitTime + self.serialPort.read()
# unitTime=self.sendCommand("< GETDATETIME >>")
time.sleep(0.5)# just to ensure all CPM bytes are in serial port buffer
print "Unit shows time as => geiger 1: ", unitTime, "\r\n"
# self.sendCommand("<SETDATETIME[" + time.strftime("%y%m%d%H%M%S") + "]>>")
# print "<SETDATETIME[" + time.strftime("%y%m%d%H%M%S") + "]>>"
else:
print "No response from device => geiger 1\r\n"
self.stop()
sys.exit(1)
def getData(self):
cpm=-1
response=""
try:
# wait, we want sample every 30s
for i in range(0,3):
time.sleep(1)
# send request
self.serialPort.flushInput()
self.serialPort.write("<GETCPM>>")
# assume that device responds within 1s
time.sleep(1)
while (self.serialPort.inWaiting()>0 and self.stopwork==0):
response = response + self.serialPort.read()
# response=self.sendCommand("< GETCPM >>")
# wait for data
time.sleep(0.5) # just to ensure all CPM bytes are in serial port buffer
if len(response)==2:
# convert bytes to 16 bit int
msb = (hex(response[0]) & hex(0x3F))
lsb = (hex(response[1]) & hex(0xFF))
cpm = int((msb << 8) | lsb)
elif len(response) > 2:
edata=""
for i in range(1,len(response)):
edata = edata + ord(response[0])*256+ord(response[i])
cpm = int( ( float(edata) / ( len(response) - 1 ) ) +0.5)
else:
edata=""
for i in range(1,len(response)):
edata = edata + ord(response[0])*256+ord(response[i])
print "Unknown response to CPM request, device is not GMC-compatible? => geiger 1\r\n"
print "Data recieved was: ",str(edata),"\r\n"
except Exception as e:
print "\r\nProblem in getData procedure (disconnected USB device?) => geiger 1:\r\n\t",str(e),"\r\nExiting\r\n"
self.stop()
sys.exit(1)
utcTime=datetime.datetime.utcnow()
data=[cpm, utcTime]
return data
Please Log in or Create an account to join the conversation.
9 years 8 months ago #797
by jnissen
Replied by jnissen on topic PyRadmon install and set up on Raspberry Pi (Wheezy Raspbian)
Seems we are fighting a data type issue. Perhaps if the data were considered binary can Python handle that? Bitwise logical operations are easy in assembly and C but seems this is difficult in Python. I must tell you I have little to no Python experience so I do appreciate the assistance.
Reading configuration:
User name configured
Password configured
Serial port name configured
Serial port speed configured
Protocol configured
Device number configured
Protocol configured
Using GMC protocol for 1 => geiger 1
No samples in queue, waiting 5 seconds => geiger 1
Gathering data started => geiger 1
Initializing GMC protocol communication => geiger 1
Found GMC-compatible device, version => geiger 1: GMC-300Re 2.36
Please note data will be acquired once per 5 seconds => geiger 1
Unit shows time as => geiger 1:
No samples in queue, waiting 5 seconds => geiger 1
Problem in getData procedure (disconnected USB device?) => geiger 1:
hex() argument can't be converted to hex
Exiting
Waiting and reap threads
Please Log in or Create an account to join the conversation.
Moderators: Gamma-Man
Time to create page: 0.252 seconds