Exemplo n.º 1
0
def __startSequence(instr):

    print "\nInitiating RMA tests for device: %s\n" % DEVICE_TYPE

    internet_on = True

    # Set range, get reading from the Agilent
    instr.setRange(params['default_current_range'])  # 100 mA
    if DEBUG_MODE:
        print instr.getReading()

    # Check to see if the internet is on
    if not MDapi.internet_on():
        internet_on = False
        print "\nWarning: RaspberryPi not connected to internet.\n"
    params['internet_on'] = internet_on

    # Turn on DUT, into customer mode
    configureSuccess = turnOnDUT()

    # Set current local time
    os.environ['TZ'] = TIMEZONE
    time.tzset()
    curr_time = datetime.datetime.now()
    print "Current local time is %s" % datetime.datetime.strftime(
        curr_time, "%Y-%m-%d %H:%M:%S")

    # Check whether operating current directory exists
    if SAVE_OP_CURRENT_CSV or SAVE_OP_CURRENT_PNG:
        subprocess.call(
            "/home/pi/misfit/Production/src/scripts/checkOpCurrDirectory.sh")

    return (configureSuccess, params)
Exemplo n.º 2
0
def checkInternetWithRetries():
    tries = 0
    failed = True

    while tries < MAX_INTERNET_CONNECT_ATTEMPTS and failed:
        failed = False
        internet_on = MDapi.internet_on()
        if not internet_on:
            failed = True
            tries += 1
            print "\nInternet connect attempt %s/%s\n" % (
                tries, MAX_INTERNET_CONNECT_ATTEMPTS)

    if tries >= MAX_INTERNET_CONNECT_ATTEMPTS:
        print "\n...\n...\n..."
        print "\nFailed connecting to internet after %s retries." % tries
        print "...\n...\n..."

    if internet_on:
        print "\nConnected to the internet on attempt %s." % tries

    return internet_on