aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSelene ToyKeeper2019-09-29 00:02:14 -0600
committerSelene ToyKeeper2019-09-29 00:02:14 -0600
commit259b8a4fd4311720733d4da352f66dcf789cfd53 (patch)
treef498c5072dd0f32424ef979dcd12bdab78827a18 /bin
parentremapped D1S V2 pins to match new driver (diff)
parentafter safety ramp-down, if the button remains stuck, lock the light (diff)
downloadanduril-259b8a4fd4311720733d4da352f66dcf789cfd53.tar.gz
anduril-259b8a4fd4311720733d4da352f66dcf789cfd53.tar.bz2
anduril-259b8a4fd4311720733d4da352f66dcf789cfd53.zip
merged from fsm branch to get safety ramp-down and version check functions, among other updates
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build.sh8
-rwxr-xr-xbin/level_calc.py14
2 files changed, 16 insertions, 6 deletions
diff --git a/bin/build.sh b/bin/build.sh
index ddd2a72..fbb24ea 100755
--- a/bin/build.sh
+++ b/bin/build.sh
@@ -14,9 +14,9 @@ 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 -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums"
+export CFLAGS="-Wall -g -Os -mmcu=$MCU -c -std=gnu99 -fgnu89-inline -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums"
export OFLAGS="-Wall -g -Os -mmcu=$MCU"
-export LDFLAGS=
+export LDFLAGS="-fgnu89-inline"
export OBJCOPYFLAGS='--set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex'
export OBJS=$PROGRAM.o
@@ -33,4 +33,6 @@ function run () {
run $CC $OTHERFLAGS $CFLAGS -o $PROGRAM.o -c $PROGRAM.c
run $CC $OFLAGS $LDFLAGS -o $PROGRAM.elf $PROGRAM.o
run $OBJCOPY $OBJCOPYFLAGS $PROGRAM.elf $PROGRAM.hex
-run avr-size -C --mcu=$MCU $PROGRAM.elf | grep Full
+# deprecated
+#run avr-size -C --mcu=$MCU $PROGRAM.elf | grep Full
+run avr-objdump -Pmem-usage $PROGRAM.elf | grep Full
diff --git a/bin/level_calc.py b/bin/level_calc.py
index 59b75ee..a780405 100755
--- a/bin/level_calc.py
+++ b/bin/level_calc.py
@@ -16,7 +16,7 @@ def main(args):
"""
# Get parameters from the user
questions_main = [
- (str, 'ramp_shape', 'cube', 'Ramp shape? [cube, square, fifth, seventh, ninth, log]'),
+ (str, 'ramp_shape', 'cube', 'Ramp shape? [cube, square, fifth, seventh, ninth, log, N.NN]'),
(int, 'num_channels', 1, 'How many power channels?'),
(int, 'num_levels', 4, 'How many total levels do you want?'),
]
@@ -191,11 +191,19 @@ shapes = dict(
)
def power(x):
- return shapes[ramp_shape][0](x)
+ try:
+ factor = float(ramp_shape)
+ return math.pow(x, factor)
+ except ValueError:
+ return shapes[ramp_shape][0](x)
def invpower(x):
- return shapes[ramp_shape][1](x)
+ try:
+ factor = float(ramp_shape)
+ return math.pow(x, 1.0 / factor)
+ except ValueError:
+ return shapes[ramp_shape][1](x)
def input_text():
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.