From 7c5d1fa5627ac58d954147e453965402ea61a5bb Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 22 Dec 2018 10:38:47 -0700 Subject: Turn off at beginning of 3rd click, not 2nd click. Makes off-to-ceiling transition smoother. --- spaghetti-monster/anduril/anduril.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index 85390e2..a0d587b 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -394,11 +394,6 @@ uint8_t off_state(Event event, uint16_t arg) { set_state(steady_state, memorized_level); return MISCHIEF_MANAGED; } - // 2 clicks (initial press): off, to prep for later events - else if (event == EV_click2_press) { - set_level(0); - return MISCHIEF_MANAGED; - } // click, hold: go to highest level (ceiling) (for ramping down) else if (event == EV_click2_hold) { set_state(steady_state, MAX_LEVEL); @@ -409,6 +404,11 @@ uint8_t off_state(Event event, uint16_t arg) { set_state(steady_state, MAX_LEVEL); return MISCHIEF_MANAGED; } + // 3 clicks (initial press): off, to prep for later events + else if (event == EV_click3_press) { + set_level(0); + return MISCHIEF_MANAGED; + } #ifdef USE_BATTCHECK // 3 clicks: battcheck mode / blinky mode group 1 else if (event == EV_3clicks) { -- cgit v1.2.3 From 8c23428528805a54c8cbb97409b8852dcb1d43de Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 22 Dec 2018 10:45:12 -0700 Subject: copied Anduril off-to-ceiling improvement to RampingIOS V3 --- spaghetti-monster/rampingios/rampingiosv3.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spaghetti-monster/rampingios/rampingiosv3.c b/spaghetti-monster/rampingios/rampingiosv3.c index ff81f61..894b405 100644 --- a/spaghetti-monster/rampingios/rampingiosv3.c +++ b/spaghetti-monster/rampingios/rampingiosv3.c @@ -274,11 +274,6 @@ uint8_t off_state(Event event, uint16_t arg) { set_state(steady_state, memorized_level); return MISCHIEF_MANAGED; } - // 2 clicks (initial press): off, to prep for later events - else if (event == EV_click2_press) { - set_level(0); - return MISCHIEF_MANAGED; - } // click, hold: go to highest level (ceiling) (for ramping down) else if (event == EV_click2_hold) { set_state(steady_state, MAX_LEVEL); @@ -289,6 +284,11 @@ uint8_t off_state(Event event, uint16_t arg) { set_state(steady_state, MAX_LEVEL); return MISCHIEF_MANAGED; } + // 3 clicks (initial press): off, to prep for later events + else if (event == EV_click3_press) { + set_level(0); + return MISCHIEF_MANAGED; + } #ifdef USE_BATTCHECK // 3 clicks: battcheck mode / blinky mode group 1 else if (event == EV_3clicks) { -- cgit v1.2.3 From aa97ec520c079eeb44ab581ecc6e2dd67eecd425 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 3 Jan 2019 11:03:43 -0700 Subject: removed redundant clock speed lines, updated some comments --- spaghetti-monster/anduril/anduril.c | 4 ---- spaghetti-monster/darkhorse/darkhorse.c | 1 + spaghetti-monster/fsm-adc.c | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index a0d587b..4816fcd 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -1817,9 +1817,6 @@ void loop() { StatePtr state = current_state; - #ifdef USE_DYNAMIC_UNDERCLOCKING - auto_clock_speed(); - #endif if (0) {} #ifdef USE_STROBE_STATE @@ -1838,7 +1835,6 @@ void loop() { uint8_t del = strobe_delays[st]; // TODO: make tac strobe brightness configurable? set_level(STROBE_BRIGHTNESS); - CLKPR = 1< + inkscape:export-xdpi="342.78015" + inkscape:export-ydpi="342.78015"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3017,10 +3225,11 @@ style="opacity:1;fill:#c0c0c0;fill-opacity:1;stroke:#040000;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> - - - OFF - @@ -3592,244 +3780,52 @@ inkscape:connector-curvature="0" sodipodi:nodetypes="cc" /> + id="g14617" + transform="translate(-13.294351,-32.815344)"> - - - - - - - Bike - - Flasher - - - Party - - Strobe - - - Tactical - - Strobe - - - Lightning - - Storm - - - Candle - - - - - - - Brighter/ Faster - - - - Dimmer/ Slower + id="path5213-6-8-4-9-9-9-4-6-4-2" + d="m 1215.6497,872.07607 c -92.2951,14.34989 -90.2875,-65.11743 -29.8514,-66.50842 51.6628,-1.18906 77.3999,68.69862 -5.9066,54.96341" + style="fill:none;stroke:#000000;stroke-width:2.13333344;stroke-miterlimit:4;stroke-dasharray:12.8, 2.13333333;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Mend-31-1-0-9)" /> + Brighter/ Faster + + + + Dimmer/ Slower - - - - - +30 min - - - + id="g25629"> + + + sodipodi:nodetypes="cc" /> + id="path5213-6-8-4-9-9-56-6-28-7" + d="m 1099.1838,1002.8716 c -10.8263,-13.32961 -17.2825,-22.994 -19.3174,-41.90761" + style="fill:none;stroke:#009d00;stroke-width:2.13333344;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Mend-367-3-5-2)" /> + id="path5213-6-8-4-9-9-56-6-28-8" + d="m 1386.1562,953.29137 c -0.01,16.47992 -3.5377,27.95532 -16.4966,45.71352" + style="fill:none;stroke:#009d00;stroke-width:2.13333344;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Mend-367-3-5-6)" /> + id="path5213-6-8-4-9-9-56-6-9-6" + d="m 1286.1122,1044.9041 c -32.6374,7.6868 -68.0318,7.3275 -98.7961,1.9808" + style="fill:none;stroke:#009d00;stroke-width:2.13333344;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Mend-367-3-8-4)" /> + sodipodi:nodetypes="cc" /> + sodipodi:nodetypes="cc" /> + sodipodi:nodetypes="cc" /> + sodipodi:nodetypes="cc" /> + + + Bike + + Flasher + + + Party + + Strobe + + + Tactical + + Strobe + + + Lightning + + Storm + + + Candle + + + + + +30 min + + + + + + + + + + + + + + + + + + + + + OFF + + + + + + + -- cgit v1.2.3 From 0fa81f7412245e28c03aac8d72c38bab5557586a Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 8 Jan 2019 23:50:47 -0700 Subject: Wrote up a basic user manual for Anduril. --- spaghetti-monster/anduril/anduril-manual.txt | 349 +++++++++++++++++++++++++++ 1 file changed, 349 insertions(+) create mode 100644 spaghetti-monster/anduril/anduril-manual.txt diff --git a/spaghetti-monster/anduril/anduril-manual.txt b/spaghetti-monster/anduril/anduril-manual.txt new file mode 100644 index 0000000..65aebee --- /dev/null +++ b/spaghetti-monster/anduril/anduril-manual.txt @@ -0,0 +1,349 @@ +Anduril User Manual +------------------- + +Anduril is an open-source firmware for flashlights, distributed under +the terms of the GPL v3. The sources can be obtained here: + + http://FIXME + + +Quick Start +----------- + +After putting a battery in the light and tightening the parts together, +the light should quickly blink once to confirm it has power and is now +operational. After that, basic usage is simple: + + - Click to turn the light on or off. + - Hold the button to change brightness. + - Release and hold again to change brightness the other way. + +That is all the user needs to know for basic use, but there are many +more modes and features available for people who want more. + +Before reading the rest of this manual, it is recommended that users +look at the Anduril UI diagram, which should be provided along with the +flashlight. + + +Ramping / Stepped Ramping Modes +------------------------------- + +Anduril's normal operation mode uses a smooth ramp or a stepped ramp, +depending on which style the user prefers. + +Each ramp has its own settings -- floor (lowest level), ceiling (highest +level), and the stepped ramp can also have a configurable number of +steps. + +There are four ways to access this mode when the light is off: + + - Click: Turn on at the memorized brightness. + - Hold: Turn on at the floor level. The light should give a very + subtle dark blink when the user can let go of the button to stay at + the floor, or keep holding the button to ramp up. + - 2 clicks: Turn on at the ceiling level. + - Click, hold: Turn on at the ceiling level, then ramp down. + +While the light is on, a few basic actions are available: + + - Click: Turn off. + - 2 clicks: Go to or from turbo (full power). + - Hold: Change brightness (up). If the button was released less than + 1 second ago, or if it's already at the ceiling, it goes down + instead. + - Click, hold: Change brightness (down). + - 3 clicks: Switch to the other ramp. + - 4 clicks: Go to ramp config mode. + + +Other Modes +----------- + +Anduril has several other modes too. To access these, press the button +more than 2 times when the light is off: + + - 3 clicks: Access the blinky / utility modes. + - Click, click, hold: Access the strobe modes. + - 4 clicks: Lockout mode. + - 5 clicks: Momentary mode. + - 6 clicks: Muggle mode. + + +Blinky / Utility Modes +---------------------- + +Click 3 times from Off to access Anduril's blinky / utility modes. This +always starts at battery check and the user can proceed to other blinky +modes from there. The sequence is: + + 1. Battery check. + 2. Sunset mode. + 3. Beacon mode. + 4. Temperature check. + +In all of these modes, some basic actions are available: + + - Click: Turn off. + - 2 clicks: Next blinky mode. + +Additionally, in beacon and temperature check modes: + + - 4 clicks: Go to the beacon config mode or thermal config mode. + +In more detail, this is what each blinky / utility mode does: + + 1. Battery check. + + Blinks out the battery voltage per cell. Full is 4.2V, empty is + about 3.0V. The light blinks the whole-number digit first, pauses, + then blinks out the "tenths" digit. Then a longer pause, and it + repeats. + So for 4.2V, it would be "blink-blink-blink-blink .. blink-blink". + + A "zero" digit is represented by a very quick blink. + + 2. Sunset mode. + + This starts at a low level, then dims gradually for an hour, and + then shuts off. It is intended for use when going to bed. + + 3. Beacon mode. + + Blinks at a slow speed. The light stays on for half a second, and + then stays off until the next blink. The brightness and the number + of seconds between pulses is configurable: + + - Brightness is the user's last-ramped level, so set this in + ramping mode before starting beacon mode. + + - Speed is configured in beacon config mode. Click 4 times to + enter beacon config mode, wait for the light to stutter, then + click to enter the number of seconds per blink. For example, + to do a 10-second alpine beacon, click 10 times. + + 4. Temperature check. + + Blinks out the current temperature in degrees C. This number + should be pretty close to what a real thermometer says. If not, it + would be a good idea to click 4 times to enter thermal config mode, + and calibrate the sensor. + + Thermal config mode has two settings: + + - Current temperature. Click once per degree C to calibrate the + sensor. For example, if the ambient temperature is 21 C, then + click 21 times. + + - Temperature limit. This sets the maximum temperature the light + can reach before it will start doing thermal regulation to keep + itself from overheating. Click once per degree C above 30. For + example, to set the limit to 50 C, click 20 times. The default + is 45 C. + + +Strobe / Mood Modes +------------------- + +Anduril includes a few extra modes for a variety of purposes: + + - Candle mode + - Bike flasher + - Party strobe + - Tactical strobe + - Lightning storm mode + +Click 3 times from Off to access these, but hold the third click for a +moment. Click, click, hold. The last-used strobe mode is remembered, +so it will return to whichever one you used last. + +In all of these modes, a few actions are available: + + - Click: Turn off. + - 2 Clicks: Next strobe / mood mode. + - Hold: Increase brightness, or strobe faster. (except lightning) + - Click, hold: Decrease brightness, or strobe slower. (except lightning) + +Additionally, candle mode has one more action: + + - 3 clicks: Add 30 minutes to the timer. + +In more detail, here is what each mode does: + + - Candle mode + + Brightness changes randomly in a pattern resembling a candle flame. + If a timer is set, it will run until the timer expires, then get + dimmer for one minute, then sputter and turn itself off. Without a + timer, candle mode runs until the user turns it off. Brightness is + configurable. + + - Bike flasher + + Runs at a medium level, but stutters to a brighter level once per + second. Designed to be more visible than a normal ramping mode, but + otherwise works mostly the same. Brightness is configurable. + + - Party strobe + + Motion-freezing strobe light. Can be used to freeze spinning fans + and falling water. Speed is configurable. + + - Tactical strobe + + Disorienting strobe light. Can be used to irritate people. Speed + is configurable, and the duty cycle is always 33%. + + - Lightning storm mode + + Flashes at random brightness and random speed to simulate lightning + strikes during a busy lightning storm. Do not look directly at the + flashlight when this mode is running, because it may suddenly go to + full power without warning. + + +Lockout Mode +------------ + +Click 4 times from Off to enter Lockout mode. This makes the light safe +to carry in a pocket or a bag or anywhere else the button might be +pressed by accident. + +To exit lockout mode, click 4 times. The light should blink briefly and +then return to the regular "off" mode. + +Lockout mode also doubles as a momentary moon mode, so the user can do +quick tasks without having to unlock the light. The brightness in +lockout mode is determined by the floor setting of the current ramp. + + +Momentary Mode +-------------- + +Click 5 times from Off to enter Momentary mode. This locks the +flashlight into a single-mode interface where the LEDs are only on when +the button is held down. It is intended for Morse code and other +signalling tasks. + +Brightness is the last-ramped level, so adjust that before entering +momentary mode. + +To exit this mode, physically disconnect power by unscrewing the tailcap +or battery tube. + + +Muggle Mode +----------- + +Click 6 times from Off to enter Muggle mode. This is a simpler and +less-bright interface which makes the light relatively safe to lend to +children or other people who could use the light unsafely. + +In Muggle mode, there are only a few available actions: + + - Click: Turn the light on or off. + - Hold: Change brightness. + - 6 clicks: Exit Muggle mode. + +The brightness in this mode usually goes from about 10 lm to 300 lm. + +Muggle mode is remembered even after changing the battery. This helps +prevent children from exiting the mode by unscrewing the tailcap. +However, be sure to supervise children whenever they are using any +powerful tools, including a bright flashlight. + + +Configuration Modes +------------------- + +Every config mode has the same interface. The menu has one or more +options the user can configure, and it will go through them in order. +For each menu item, the light will follow the same pattern: + + - Blink one or more times, corresponding to the item number. + + - Stutter or "buzz" quickly between two brightness levels for a few + seconds. This indicates that the user can click one or more times + to enter a number. It will keep buzzing until the user stops + clicking, so there is no need to hurry. + + - Pause, and then go to the next option. + +After the light has gone through all of the menu options, it should +return to whatever mode the light was in before entering the config +mode. + +If the user doesn't press a button during a menu item's "buzz" phase, +that item remains unchanged from its previous value. + + +Ramp Config Mode +---------------- + +While the light is on in a ramping mode, click 4 times to enter the +config mode for the current ramp. + +For smooth ramping mode, there are two menu options: + + 1. Floor. (default = 1/150) + 2. Ceiling. (default = 120/150) + +For the stepped ramping mode, there are three menu options: + + 1. Floor. (default = 20/150) + 2. Ceiling. (default = 120/150) + 3. Number of steps. (default = 7) + +To configure the floor level, click the button equal to the number of +ramp levels (out of 150) at which the floor should be. To set the +lowest possible level, click once. + +To configure the ceiling level, each click goes one level lower. So 1 +click sets the highest possible level, 2 clicks is the 2nd-highest, 3 +clicks is the 3rd-highest level, etc. To set the default of 120/150, +click 31 times. + +When configuring the number of steps, the value can be anything from 2 +to 150. + + +Protection Features +------------------- + +Anduril includes low voltage protection (LVP) and thermal regulation. + +LVP makes the light step down to a lower level when the battery is low, +and if the light is already at the lowest level, it shuts itself off. +This activates at 2.8V. LVP adjustments happen suddenly, in large +steps. + +Thermal regulation attempts to keep the light from overheating, and +otherwise adjusts output to stay as close as possible to the +user-configured temperature limit. Thermal adjustments happen +gradually, in steps so small they are difficult for humans to perceive. + + +Aux LEDs / Button LEDs +---------------------- + +Some lights have aux LEDs or button LEDs. These can be configured to do +different things while the main emitters are off. There is one aux LED +mode for the regular "off" mode, and another aux LED mode for "lockout" +mode. This allows the user to see at a glance whether the light is +locked. + +Aux LED modes typically include: + + - Off + - Low + - High + - Blinking + +To configure the aux LEDs, go to the mode you want to configure and then +click the button a few times: + + - Off mode: 7 clicks. + - Lockout mode: 3 clicks. + +This should change the aux LEDs to the next mode supported on this +light. -- cgit v1.2.3 From 9d5e6e6a5862d8a0551674e6abdb15639df9458f Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Wed, 9 Jan 2019 00:12:25 -0700 Subject: Added missing URL (oops). --- spaghetti-monster/anduril/anduril-manual.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spaghetti-monster/anduril/anduril-manual.txt b/spaghetti-monster/anduril/anduril-manual.txt index 65aebee..66a8ba0 100644 --- a/spaghetti-monster/anduril/anduril-manual.txt +++ b/spaghetti-monster/anduril/anduril-manual.txt @@ -4,7 +4,8 @@ Anduril User Manual Anduril is an open-source firmware for flashlights, distributed under the terms of the GPL v3. The sources can be obtained here: - http://FIXME + http://tiny.cc/TKAnduril + https://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/files/head:/ToyKeeper/spaghetti-monster/anduril/ Quick Start -- cgit v1.2.3 From 6d7523f32093815e6dca02ee8e043be4710c62e6 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 12 Jan 2019 15:50:37 -0700 Subject: Small updates to the manual. --- spaghetti-monster/anduril/anduril-manual.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spaghetti-monster/anduril/anduril-manual.txt b/spaghetti-monster/anduril/anduril-manual.txt index 66a8ba0..cd4fe3e 100644 --- a/spaghetti-monster/anduril/anduril-manual.txt +++ b/spaghetti-monster/anduril/anduril-manual.txt @@ -51,7 +51,7 @@ While the light is on, a few basic actions are available: - Click: Turn off. - 2 clicks: Go to or from turbo (full power). - Hold: Change brightness (up). If the button was released less than - 1 second ago, or if it's already at the ceiling, it goes down + a second ago, or if it's already at the ceiling, it goes down instead. - Click, hold: Change brightness (down). - 3 clicks: Switch to the other ramp. @@ -113,7 +113,7 @@ In more detail, this is what each blinky / utility mode does: Blinks at a slow speed. The light stays on for half a second, and then stays off until the next blink. The brightness and the number - of seconds between pulses is configurable: + of seconds between pulses are configurable: - Brightness is the user's last-ramped level, so set this in ramping mode before starting beacon mode. @@ -348,3 +348,11 @@ click the button a few times: This should change the aux LEDs to the next mode supported on this light. + +For lights with a button LED, the button LED typically stays on while +the main emitters are on. Its brightness level is set in a way which +mirrors the main LED -- off, low, or high. + +For lights with front-facing aux LEDs, the aux LEDs typically stay off +when the main emitters are on, and when the light is otherwise awake. +The aux LEDs on most lights only turn on when the light is asleep. -- cgit v1.2.3 From a5d824071d0152afb085f71301251c8ba455c361 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 12 Jan 2019 15:51:56 -0700 Subject: Added an option for a "fancy" moon mode during lockout. 2nd click goes to the other ramp's floor level. --- spaghetti-monster/anduril/anduril.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index 4816fcd..09c7927 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -192,6 +192,8 @@ uint8_t beacon_state(Event event, uint16_t arg); uint8_t beacon_config_state(Event event, uint16_t arg); // soft lockout #define MOON_DURING_LOCKOUT_MODE +// if enabled, 2nd lockout click goes to the other ramp's floor level +//#define LOCKOUT_MOON_FANCY uint8_t lockout_state(Event event, uint16_t arg); // momentary / signalling mode uint8_t momentary_state(Event event, uint16_t arg); @@ -1111,6 +1113,13 @@ uint8_t lockout_state(Event event, uint16_t arg) { uint8_t lvl = ramp_smooth_floor; if (ramp_discrete_floor < lvl) lvl = ramp_discrete_floor; set_level(lvl); + #elif defined(LOCKOUT_MOON_FANCY) + uint8_t levels[] = { ramp_smooth_floor, ramp_discrete_floor }; + if ((event & 0x0f) == 2) { + set_level(levels[ramp_style^1]); + } else { + set_level(levels[ramp_style]); + } #else // Use moon from current ramp set_level(nearest_level(1)); -- cgit v1.2.3 From c7cbb85b02e39bdcc750ac184aa4241c56061b9b Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 15 Jan 2019 18:15:36 -0700 Subject: Updated README to point at build/flash scripts. --- README | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README b/README index 6d2cf24..3cb27e9 100644 --- a/README +++ b/README @@ -84,7 +84,7 @@ To test if you can flash firmware correctly, or to restore a light to something like a default state, try flashing the NLITE driver from DrJones. It's similar to the default nanjg / qlite firmware, but better. - ./bin/flash.sh DrJones/NLITE/nlite.hex + ./bin/flash-tiny13.sh DrJones/NLITE/nlite.hex For a quick test to make sure your tool chain works and your flashing tools are working, try the 'hello world' program: @@ -95,3 +95,12 @@ are working, try the 'hello world' program: If that works, you should be ready to start making changes to the code, or flashing any of the pre-built firmwares. + +Most projects can be compiled with the bin/build.sh script. For example, to +build Crescendo for an attiny25-based driver and then flash it: + + cd ToyKeeper/crescendo + ../../bin/build.sh 25 crescendo + ../../bin/flash-tiny25.sh crescendo.hex + +Other useful tools are in bin/ too, so they might be worth a look. -- cgit v1.2.3 From ecfcb63de7a79e7df4d851057df97bec24a4f0ed Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 8 Mar 2019 22:10:27 -0700 Subject: level_calc.py: Combined log_2 and log_e into just log, because all logs have the same curve shape. --- bin/level_calc.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/level_calc.py b/bin/level_calc.py index c903800..2edd5fd 100755 --- a/bin/level_calc.py +++ b/bin/level_calc.py @@ -5,7 +5,7 @@ from __future__ import print_function import math interactive = False -# supported shapes: ninth, fifth, cube, square, log_e, log_2 +# supported shapes: ninth, fifth, cube, square, log #ramp_shape = 'cube' @@ -14,7 +14,7 @@ def main(args): """ # Get parameters from the user questions_main = [ - (str, 'ramp_shape', 'cube', 'Ramp shape? [cube, square, fifth, ninth, log_e, log_2]'), + (str, 'ramp_shape', 'cube', 'Ramp shape? [cube, square, fifth, ninth, log]'), (int, 'num_channels', 1, 'How many power channels?'), (int, 'num_levels', 4, 'How many total levels do you want?'), ] @@ -172,8 +172,9 @@ shapes = dict( 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)), + log = (lambda x: math.e**x, lambda x: math.log(x, math.e)), + # makes no difference; all logs have the same curve + #log_2 = (lambda x: 2.0**x, lambda x: math.log(x, 2.0)), ) def power(x): -- cgit v1.2.3