diff options
| -rw-r--r-- | README | 20 | ||||
| -rwxr-xr-x | bin/level_calc.py | 23 |
2 files changed, 30 insertions, 13 deletions
@@ -23,9 +23,23 @@ A general overview of what you need to get going is here: Some useful hardware for flashing firmware: - http://www.fasttech.com/product/1002900-atmega-attiny-51-avr-isp-usbasp-usb-programmer - http://www.fasttech.com/product/1011800-40-pin-splittable-ribbon-cable-20cm - http://www.digikey.com/product-detail/en/5250/501-1311-ND/745102 + What TK uses: + + http://www.fasttech.com/product/1002900-atmega-attiny-51-avr-isp-usbasp-usb-programmer + http://www.fasttech.com/product/1011800-40-pin-splittable-ribbon-cable-20cm + http://www.digikey.com/product-detail/en/5250/501-1311-ND/745102 + + Ratus' guide: https://redd.it/8g5l5w (prices checked 2018-05-01) + + Store A: About $4.20 shipped + https://www.aliexpress.com/item/USB-ISP-Programmer-for-ATMEL-AVR-ATMega-ATTiny-51-AVR-Board-ISP-Downloader/32699341177.html + https://www.aliexpress.com/item/WAVGAT-Programmer-Testing-Clip-SOP8-SOP-SOIC-8-SOIC8-DIP8-DIP-8-Pin-IC-Test-Clamp/32827794024.html + https://www.aliexpress.com/item/40Pin-20CM-2-54MM-Row-Female-to-Female-F-F-Dupont-Cable-Breadboard-Jumper-Wire-for/32822958653.html + + Store B: About $4.18 shipped: + https://www.aliexpress.com/store/product/1pcs-New-USBASP-USBISP-AVR-Programmer-USB-ISP-USB-ASP-ATMEGA8-ATMEGA128-Support-Win7-64K/1171090_32809542958.html + https://www.aliexpress.com/store/product/Free-shipping-Programmer-Testing-Clip-SOP8-SOP-SOIC-8-SOIC8-DIP8-DIP-8-Pin-IC-Test/1171090_32402561848.html + https://www.aliexpress.com/store/product/20pcs-20cm-2-54mm-1p-1p-Pin-Female-to-Female-Color-Breadboard-Cable-Jump-Wire-Jumper/1171090_32628811461.html For Windows users, these links may be useful: diff --git a/bin/level_calc.py b/bin/level_calc.py index 4dc1356..2aa8727 100755 --- a/bin/level_calc.py +++ b/bin/level_calc.py @@ -5,6 +5,8 @@ from __future__ import print_function import math interactive = False +# supported shapes: ninth, fifth, cube, square, log_e, log_2 +ramp_shape = 'cube' def main(args): @@ -160,20 +162,21 @@ def get_value(text, default, args): return result +shapes = dict( + ninth = (lambda x: x**9, lambda x: math.pow(x, 1/9.0)), + fifth = (lambda x: x**5, lambda x: math.pow(x, 1/5.0)), + cube = (lambda x: x**3, lambda x: math.pow(x, 1/3.0)), + square = (lambda x: x**2, lambda x: math.pow(x, 1/2.0)), + log_e = (lambda x: math.e**x, lambda x: math.log(x, math.e)), + log_2 = (lambda x: 2.0**x, lambda x: math.log(x, 2.0)), + ) + def power(x): - #return x**5 - return x**3 - #return x**2 - #return math.e**x - #return 2.0**x + return shapes[ramp_shape][0](x) def invpower(x): - #return math.pow(x, 1/5.0) - return math.pow(x, 1/3.0) - #return math.pow(x, 1/2.0) - #return math.log(x, math.e) - #return math.log(x, 2.0) + return shapes[ramp_shape][1](x) def input_text(): |
