From 28993e9704aed83b0f6803de61d33f618a2c76e6 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 16 Sep 2017 20:19:45 -0600 Subject: Added my firmware thread to the readme. --- README | 4 ++++ 1 file changed, 4 insertions(+) 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 -- cgit v1.2.3 From c725c38b36539c223cb84589c4d59452478ef595 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 14 Oct 2017 14:57:38 -0600 Subject: Made level_calc.py support both python2.7 and python3. Fixed bug when user specified 'FET' instead of 'fet'. --- bin/level_calc.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) 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:]) -- cgit v1.2.3