set_serialdevice(args.serial_device) #print(args.serial_console_untouched) if args.abc_on: mh_z19.abc_on(args.serial_console_untouched) print ("Set ABC logic as on.") elif args.abc_off: mh_z19.abc_off(args.serial_console_untouched) print ("Set ABC logic as off.") elif args.span_point_calibration is not None: mh_z19.span_point_calibration(args.span_point_calibration, args.serial_console_untouched) print ("Call Calibration with SPAN point.") elif args.zero_point_calibration: print ("Call Calibration with ZERO point.") mh_z19.zero_point_calibration(args.serial_console_untouched) elif args.detection_range_5000: mh_z19.detection_range_5000(args.serial_console_untouched) print ("Set Detection range as 5000.") elif args.detection_range_2000: mh_z19.detection_range_2000(args.serial_console_untouched) print ("Set Detection range as 2000.") elif args.version: print (mh_z19.version) elif args.all: value = mh_z19.read_all(args.serial_console_untouched) print (json.dumps(value)) else: value = mh_z19.read(args.serial_console_untouched) print (json.dumps(value))
action='store_true', help='''Set detection range as 2000''') args = parser.parse_args() if args.abc_on: mh_z19.abc_on() print ("Set ABC logic as on.") elif args.abc_off: mh_z19.abc_off() print ("Set ABC logic as off.") elif args.span_point_calibration is not None: mh_z19.span_point_calibration(args.span_point_calibration) print ("Call Calibration with SPAN point.") elif args.zero_point_calibration: mh_z19.zero_point_calibration() print ("Call Calibration with ZERO point.") elif args.detection_range_5000: mh_z19.detection_range_5000() print ("Set Detection range as 5000.") elif args.detection_range_2000: mh_z19.detection_range_2000() print ("Set Detection range as 2000.") elif args.version: print (mh_z19.version) elif args.all: value = mh_z19.read_all() print (json.dumps(value)) else: value = mh_z19.read() print (json.dumps(value))