aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-07-06 14:24:28 -0600
committerSelene ToyKeeper2020-07-06 14:24:28 -0600
commit24270b394a0119bff8681ed75c1e21876c11439f (patch)
tree432756e4b5bf26bac78c7809128d52e0d531262c /bin
parentadded a compile flag to fix compatibility with GCC 7/8/9's new semantics for ... (diff)
parentmerged in support for Noctigon K1-SBT90.2 (diff)
downloadanduril-24270b394a0119bff8681ed75c1e21876c11439f.tar.gz
anduril-24270b394a0119bff8681ed75c1e21876c11439f.tar.bz2
anduril-24270b394a0119bff8681ed75c1e21876c11439f.zip
merged nearly a year of updates from the fsm branch, including the new product map
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build.sh2
-rwxr-xr-xbin/level_calc.py16
2 files changed, 15 insertions, 3 deletions
diff --git a/bin/build.sh b/bin/build.sh
index fbb24ea..3992c38 100755
--- a/bin/build.sh
+++ b/bin/build.sh
@@ -14,7 +14,7 @@ export PROGRAM=$1 ; shift
export MCU=attiny$ATTINY
export CC=avr-gcc
export OBJCOPY=avr-objcopy
-export CFLAGS="-Wall -g -Os -mmcu=$MCU -c -std=gnu99 -fgnu89-inline -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums"
+export CFLAGS="-Wall -g -Os -mmcu=$MCU -c -std=gnu99 -fgnu89-inline -fwhole-program -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums"
export OFLAGS="-Wall -g -Os -mmcu=$MCU"
export LDFLAGS="-fgnu89-inline"
export OBJCOPYFLAGS='--set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex'
diff --git a/bin/level_calc.py b/bin/level_calc.py
index 6f07621..a780405 100755
--- a/bin/level_calc.py
+++ b/bin/level_calc.py
@@ -8,6 +8,8 @@ interactive = False
# supported shapes: ninth, seventh, fifth, cube, square, log
#ramp_shape = 'cube'
+max_pwm = 255
+
def main(args):
"""Calculates PWM levels for visually-linear steps.
@@ -22,7 +24,7 @@ def main(args):
(str, 'type', '7135', 'Type of channel - 7135 or FET:'),
(int, 'pwm_min', 6, 'Lowest visible PWM level:'),
(float, 'lm_min', 0.25, 'How bright is the lowest level, in lumens?'),
- #(int, 'pwm_max', 255, 'Highest PWM level:'),
+ #(int, 'pwm_max', max_pwm, 'Highest PWM level:'),
(float, 'lm_max', 1000, 'How bright is the highest level, in lumens?'),
]
@@ -48,7 +50,7 @@ def main(args):
if not args:
print('===== Channel %s =====' % (chan_num+1))
chan = Empty()
- chan.pwm_max = 255
+ chan.pwm_max = max_pwm
ask(questions_per_channel, chan)
chan.type = chan.type.upper()
if chan.type not in ('7135', 'FET'):
@@ -152,6 +154,16 @@ def multi_pwm(answers, channels):
(cnum+1,
','.join([str(int(round(i))) for i in channel.modes])))
+ # Show highest level for each channel before next channel starts
+ for cnum, channel in enumerate(channels[:-1]):
+ prev = 0
+ i = 1
+ while (i < answers.num_levels) \
+ and (channel.modes[i] >= channel.modes[i-1]) \
+ and (channels[cnum+1].modes[i] == 0):
+ i += 1
+ print('Ch%i max: %i (%.2f/%s)' % (cnum, i, channel.modes[i-1], max_pwm))
+
def get_value(text, default, args):
"""Get input from the user, or from the command line args."""