def simple_logger_setup(args): """ Run the simple logger setup :type args: object :return: None """ global serials, origin, teensyComms, actuators, sensors, db print(args) # Unpack the input arguments serials = args.teensy origin = args.comp_serial Grasshopper = args.grasshopper_serial # A Dict of the communications in the form of SERIAL_NUMBER: CONNECTION print(map_ports(serials)) portmap = map_ports(serials) teensyComms = dict([(sn, simpleTeensyComs.initializeComms(portmap[sn])) for sn in portmap]) for sn in teensyComms: # Set up the Teensy communications numDevices = simpleTeensyComs.QueryNumDevices(teensyComms[sn], sn, origin) print("The teensy has", numDevices, "devices") devices = simpleTeensyComs.QueryIDs(teensyComms[sn], sn, origin) sensors[sn] = {} actuators[sn] = {} for i in range(len(devices)): print(devices[i].pr()) if devices[i].type % 2 == 0: sensors[sn][devices[i]] = 0 else: actuators[sn][devices[i]] = 0 # Set up the database client = MongoClient() db = client.USBStressTest
parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('teensy_comport', type=str, help='The Teensy com port.') parser.add_argument('teensy_serial', type=int, help='The Teensy serial number - usually 6-7 digits.') parser.add_argument('comp_serial', type=int, help='The computers serial number for the purposes of simulation [22222]', default=simpleTeensyComs.cbla_pc_id, nargs='?' ) parser.add_argument('grasshopper_serial', type=int, help='The Grasshopper nodes serial number for the purposes of simulation [33333]', default=simpleTeensyComs.udp_node_id, nargs='?' ) args = parser.parse_args() #Initialize Comms # Initialize Comms and setup the teensy destination = args.teensy_serial #simpleTeensyComs.teensy_sernum origin = args.comp_serial Grasshopper = args.grasshopper_serial teensyComms = simpleTeensyComs.initializeComms(args.teensy_comport) # Find out what the Teensy has numDevices = simpleTeensyComs.QueryNumDevices(teensyComms, destination, origin) print('The teensy has', numDevices, 'devices') devList = simpleTeensyComs.QueryIDs(teensyComms, destination, origin) numActs = 0 ActsList = [] numSens = 0 SensList = [] sensValues = [] actValues = [] for i in range(0,len(devList)): print(devList[i].pr())