Changeset 305


Ignore:
Timestamp:
May 10, 2011, 3:13:20 PM (14 years ago)
Author:
Rick van der Zwet
Message:

Hacks and comments to make it work with other device.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • powerbar/npm4000.py

    r75 r305  
    77# XXX: Make proper classes for use
    88# XXX: Documentation
     9#
     10# TODO: Make it work for the NPM2000 series, which are using a different codes to address individual ports.
     11#
    912#
    1013# Licence: BSD
     
    146149def getStatusAll():
    147150    raw_status= doCommand('status')
    148     for i in range(1,25):
     151    for i in range(1,MAX_PORTS+1):
    149152        print "Port %02i [%s]:" % (i, getPortName(i)),
    150153        if getPortState(i,raw_status):
     
    154157
    155158def togglePort(port):
    156     if getPortState(port):
     159    raw_status= doCommand('status')
     160    if getPortState(port,raw_status):
    157161        doCommand('portOff',port)
    158162    else:
     
    169173
    170174    print "TEST: Enable and disable ports one by one"
    171     for i in range(1,25):
     175    for i in range(1,MAX_PORTS+1):
    172176        print getPortName(i)
    173177        doCommand('portOn', getPortHex(i))
     
    272276    if opt_action == "toggle":
    273277        if opt_port == "all":
    274             for i in range(1,25):
     278            for i in range(1,MAX_PORTS+1):
    275279                togglePort(getPortHex(i))
    276280        else:
     
    285289            doCommand("allPortsOff");
    286290        else:
    287             doCommand("portOn", opt_port)
     291            doCommand("portOff", opt_port)
    288292
    289293
Note: See TracChangeset for help on using the changeset viewer.