aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2018-05-08 23:27:55 -0600
committerSelene ToyKeeper2018-05-08 23:27:55 -0600
commit64a11af0de4400cfecd9b0b205ab8f03b692cfb2 (patch)
treed37f2dc8ae22dfb83acf243ad6d71f7df6acb815
parentAdded "votive candle mode", a.k.a. candle mode timer. (diff)
parentMade level_calc.py support both python2.7 and python3. (diff)
downloadanduril-64a11af0de4400cfecd9b0b205ab8f03b692cfb2.tar.gz
anduril-64a11af0de4400cfecd9b0b205ab8f03b692cfb2.tar.bz2
anduril-64a11af0de4400cfecd9b0b205ab8f03b692cfb2.zip
merged trunk, prep for merging back
Diffstat (limited to '')
-rw-r--r--README4
-rwxr-xr-xbin/level_calc.py25
2 files changed, 23 insertions, 6 deletions
diff --git a/README b/README
index 27a8c00..c3f09e1 100644
--- a/README
+++ b/README
@@ -13,6 +13,10 @@ your needs.
Getting Started
===============
+The central firmware thread on BLF is here:
+
+ http://budgetlightforum.com/node/38364
+
A general overview of what you need to get going is here:
http://flashlightwiki.com/AVR_Drivers
diff --git a/bin/level_calc.py b/bin/level_calc.py
index de52998..4dc1356 100755
--- a/bin/level_calc.py
+++ b/bin/level_calc.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
+from __future__ import print_function
+
import math
interactive = False
@@ -41,6 +43,9 @@ def main(args):
chan = Empty()
chan.pwm_max = 255
ask(questions_per_channel, chan)
+ chan.type = chan.type.upper()
+ if chan.type not in ('7135', 'FET'):
+ raise ValueError('Invalid channel type: %s' % (chan.type,))
channels.append(chan)
# calculate total output of all previous channels
@@ -54,8 +59,8 @@ def main(args):
multi_pwm(answers, channels)
if interactive: # Wait on exit, in case user invoked us by clicking an icon
- print 'Press Enter to exit:'
- raw_input()
+ print('Press Enter to exit:')
+ input_text()
class Empty:
@@ -72,7 +77,7 @@ def multi_pwm(answers, channels):
lm_max = channels[-1].lm_max
else:
# this would be a stupid driver design
- raise ValueError, "FET channel isn't the most powerful?"
+ raise ValueError("FET channel isn't the most powerful?")
visual_min = invpower(lm_min)
visual_max = invpower(lm_max)
@@ -96,7 +101,7 @@ def multi_pwm(answers, channels):
# This shouldn't happen, the FET is assumed to be the highest channel
if channel.type == 'FET':
# this would be a stupid driver design
- raise ValueError, "FET channel isn't the most powerful?"
+ raise ValueError("FET channel isn't the most powerful?")
# Handle FET turbo specially
if (i == (answers.num_levels - 1)) \
@@ -149,8 +154,8 @@ def get_value(text, default, args):
else:
global interactive
interactive = True
- print text, '(%s)' % (default),
- result = raw_input()
+ print(text + ' (%s) ' % (default), end='')
+ result = input_text()
result = result.strip()
return result
@@ -171,6 +176,14 @@ def invpower(x):
#return math.log(x, 2.0)
+def input_text():
+ try:
+ value = raw_input() # python2
+ except NameError:
+ value = input() # python3
+ return value
+
+
if __name__ == "__main__":
import sys
main(sys.argv[1:])