Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions hvpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import sys
import time
import Monsoon.HVPM as HVPM
import Monsoon.LVPM as LVPM
import Monsoon.sampleEngine as sampleEngine
import Monsoon.Operations as op

Expand All @@ -36,8 +37,12 @@ def main(unused_argv):
if FLAGS.avg and FLAGS.avg < 0:
print "--avg must be greater than 0"
return

if FLAGS.lvpm:
mon = LVPM.Monsoon()
else:
mon = HVPM.Monsoon()

mon = HVPM.Monsoon()
mon.setup_usb()

if FLAGS.voltage is not None:
Expand All @@ -48,7 +53,7 @@ def main(unused_argv):

if FLAGS.status:
print "Serialno : %d\n" % mon.getSerialNumber();
mon.fillAllStatusPacket()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So,
I accidentally committed this work-in-progress :)

I did add fillAllStatusPacket (in only HVPM) in another pull request, but I had some questions as to what was the intention of it, or if my additions just belonged in fillStatusPacket.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this open for the moment. The intention of fillStatusPacket() is what you're suspecting it was, to fill in every applicable value from the firmware. Since I removed fillAllStatusPacket() from HVPM when merging them, your code will be break slightly.

mon.fillStatusPacket()
status = mon.statusPacket
attrs = vars(status)
print '\n'.join("%s : %s" % item for item in attrs.items())
Expand Down Expand Up @@ -108,6 +113,7 @@ def AmpsToApi(amps):
flags.DEFINE_list("output", ["main"], "Comma-separated list of sample types "
"to output (select from: main, usb, aux, voltage).")
flags.DEFINE_string("delimiter", " ", "Output delimiter.")
flags.DEFINE_boolean("lvpm", False, "Low-voltage power meter.")

main(FLAGS(sys.argv))