/Designs/Measuring_instruments/ISMS01A/SW/Geozor.json
0,0 → 1,22
{
"logging": [
{
"file_name": "/home/odroid/bolidozor/radio-observer.log",
"log_level": "debug",
},
],
 
"project": "geozor",
"project_home_folder": "/home/odroid/geozor/station/",
"storage_hostname": "space.astro.cz",
"storage_username": "kaklik",
"storage_stationpath": "/storage/geozor/",
 
"raw_sample_interval": 5,
"data_path": "./station/data/", // path to measured data directory
"data_archive": "/home/odroid/geozor/station/data_archive/", // path to raw data archive directory
"data_upload": "/home/odroid/geozor/station/data_upload/", // path to data ready for upload
"origin": "VRTY-S2", // name of detection station
}
 
 
/Designs/Measuring_instruments/ISMS01A/SW/button_monitor.py
1,49 → 1,69
#!/usr/bin/python
import hid
import time
import datetime
from time import sleep
import os, sys
 
def init():
global h
print "Opening device"
h = hid.device()
h.open(0x10C4, 0xEA90)
from mlabutils import ejson
 
print "Manufacturer: %s" % h.get_manufacturer_string()
print "Product: %s" % h.get_product_string()
print "Serial No: %s" % h.get_serial_number_string()
parser = ejson.Parser()
 
h.write([0x02, 0b00000110, 0x00, 0x00, 0x00]) # setup io pin direction
sleep( 1.00 )
#### Script Arguments ###############################################
 
if len(sys.argv) != 2:
sys.stderr.write("Invalid number of arguments.\n")
sys.stderr.write("Usage: %s CONFIG_FILE\n" % (sys.argv[0], ))
sys.exit(1)
 
def light(timea):
h.write([0x04, 0xFF, 0xFF])
time.sleep(timea)
value = parser.parse_file(sys.argv[1])
path = value['data_path']
stationName = value['origin']
 
def dark(timea):
h.write([0x04, 0x00, 0xFF])
time.sleep(timea)
def main():
 
def blik():
dark(0.8)
light(1)
while True:
 
def check_button():
response = h.get_feature_report(0x03,2)
return response[1]
print "Opening device"
h = hid.device()
h.open(0x10C4, 0xEA90)
 
def main():
init()
while True:
print "Manufacturer: %s" % h.get_manufacturer_string()
print "Product: %s" % h.get_product_string()
print "Serial No: %s" % h.get_serial_number_string()
 
h.write([0x02, 0b00000110, 0x00, 0x00, 0x00]) # setup io pin direction
sleep( 1.00 )
 
response = h.get_feature_report(0x03,2)
previous_inputs = response[1]
 
try:
 
while True:
inputs = check_button()
response = h.get_feature_report(0x03,2)
inputs = response[1]
 
print bin(inputs)
 
now = datetime.datetime.now()
filename = path + time.strftime("%Y%m%d%H", time.gmtime())+"0000_"+stationName+"_freq.csv"
 
if not os.path.exists(filename):
with open(filename, "a") as f:
f.write('#timestamp,IO_state \n')
f.write("%.1f,%s\n" % (time.time(), hex(inputs)))
 
if (previous_inputs != inputs):
with open(filename, "a") as f:
f.write("%.1f,%s\n" % (time.time(), hex(inputs)))
previous_inputs = inputs
 
if not (inputs & 0b00000001) and (0b00000001):
blik()
h.write([0x04, 0x00, 0xFF])
time.sleep(0.8)
h.write([0x04, 0xFF, 0xFF])
time.sleep(0.5)
 
time.sleep(0.5)
 
53,6 → 73,7
except KeyboardInterrupt:
print "Closing device"
h.close()
exit()
 
print "Done"