aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorGabriel Hart2021-10-29 12:51:10 -0500
committerGabriel Hart2021-10-29 12:51:10 -0500
commit78417e78ef4dbeed7a9a3c0b2cad81341685dca0 (patch)
tree39db7a2d52b8e7cd9bafa8e5557df24f46049507 /spaghetti-monster
parentAdd thefreeman's DAC linear driver (beta); also update Sofirn bilds to use th... (diff)
parentClarified Ramp->2C behavior a bit more. (diff)
downloadanduril-78417e78ef4dbeed7a9a3c0b2cad81341685dca0.tar.gz
anduril-78417e78ef4dbeed7a9a3c0b2cad81341685dca0.tar.bz2
anduril-78417e78ef4dbeed7a9a3c0b2cad81341685dca0.zip
Merge TKs changes through her commit 628
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/MODELS111
-rw-r--r--spaghetti-monster/anduril/Makefile8
-rw-r--r--spaghetti-monster/anduril/anduril-manual.txt8
-rw-r--r--spaghetti-monster/anduril/aux-leds.c2
-rwxr-xr-xspaghetti-monster/anduril/models.py71
-rw-r--r--spaghetti-monster/anduril/tint-ramping.c2
-rw-r--r--spaghetti-monster/fsm-ramping.c2
7 files changed, 137 insertions, 67 deletions
diff --git a/spaghetti-monster/anduril/MODELS b/spaghetti-monster/anduril/MODELS
index 7a2c438..317bb6a 100644
--- a/spaghetti-monster/anduril/MODELS
+++ b/spaghetti-monster/anduril/MODELS
@@ -1,55 +1,58 @@
-Model numbers:
-0111 emisar-d4
-0112 emisar-d4-219c
-0113 emisar-d4v2
-0114 emisar-d4v2-219
-0115 emisar-d4v2-nofet
-0121 emisar-d1
-0122 emisar-d1s
-0123 emisar-d1v2
-0131 emisar-d4s
-0132 emisar-d4s-219c
-0133 emisar-d4sv2
-0134 emisar-d4sv2-219
-0135 emisar-d4sv2-tintramp
-0136 emisar-d4sv2-tintramp-fet
-0141 emisar-d18
-0142 emisar-d18-219
-0211 noctigon-kr4
-0212 noctigon-kr4-nofet
-0213 noctigon-kr4-219
-0214 noctigon-kr4-219b
-0251 noctigon-k1
-0252 noctigon-k1-sbt90
-0253 noctigon-k1-12v
-0261 noctigon-k9.3
-0262 noctigon-k9.3-nofet
-0263 noctigon-k9.3-219
-0265 noctigon-k9.3-tintramp-nofet
-0266 noctigon-k9.3-tintramp-fet
-0267 noctigon-k9.3-tintramp-219
-0311 fw3a
-0312 fw3a-219
-0313 fw3a-nofet
-0314 fw3x-lume1
-0321 blf-gt
-0322 blf-gt-mini
-0411 ff-rot66
-0412 ff-rot66-219
-0413 ff-rot66g2
-0421 ff-pl47
-0422 ff-pl47-219
-0423 ff-pl47g2
-0441 ff-e01
-0511 mateminco-mf01s
-0521 mateminco-mf01-mini
-0611 blf-q8
-0612 sofirn-sp36
-0613 blf-q8-t1616
-0614 sofirn-sp36-t1616
-0621 blf-lantern
-0622 blf-lantern-t1616
-0631 sofirn-sp10-pro
-1618 gchart-fet1-t1616
+Model Name MCU
+----- ---- ---
+0111 emisar-d4 attiny85
+0112 emisar-d4-219c attiny85
+0113 emisar-d4v2 attiny1634
+0114 emisar-d4v2-219 attiny1634
+0115 emisar-d4v2-nofet attiny1634
+0121 emisar-d1 attiny85
+0122 emisar-d1s attiny85
+0123 emisar-d1v2 attiny1634
+0131 emisar-d4s attiny85
+0132 emisar-d4s-219c attiny85
+0133 emisar-d4sv2 attiny1634
+0134 emisar-d4sv2-219 attiny1634
+0135 emisar-d4sv2-tintramp attiny1634
+0136 emisar-d4sv2-tintramp-fet attiny1634
+0141 emisar-d18 attiny85
+0142 emisar-d18-219 attiny85
+0211 noctigon-kr4 attiny1634
+0212 noctigon-kr4-nofet attiny1634
+0213 noctigon-kr4-219 attiny1634
+0214 noctigon-kr4-219b attiny1634
+0251 noctigon-k1 attiny1634
+0252 noctigon-k1-sbt90 attiny1634
+0253 noctigon-k1-12v attiny1634
+0261 noctigon-k9.3 attiny1634
+0262 noctigon-k9.3-nofet attiny1634
+0263 noctigon-k9.3-219 attiny1634
+0265 noctigon-k9.3-tintramp-nofet attiny1634
+0266 noctigon-k9.3-tintramp-fet attiny1634
+0267 noctigon-k9.3-tintramp-219 attiny1634
+0311 fw3a attiny85
+0312 fw3a-219 attiny85
+0313 fw3a-nofet attiny85
+0314 fw3x-lume1 attiny1634
+0321 blf-gt attiny85
+0322 blf-gt-mini attiny85
+0411 ff-rot66 attiny85
+0412 ff-rot66-219 attiny85
+0413 ff-rot66g2 attiny85
+0421 ff-pl47 attiny85
+0422 ff-pl47-219 attiny85
+0423 ff-pl47g2 attiny85
+0441 ff-e01 attiny85
+0511 mateminco-mf01s attiny85
+0521 mateminco-mf01-mini attiny85
+0611 blf-q8 attiny85
+0612 sofirn-sp36 attiny85
+0613 blf-q8-t1616 attiny1616
+0614 sofirn-sp36-t1616 attiny1616
+0621 blf-lantern attiny85
+0622 blf-lantern-t1616 attiny1616
+0631 sofirn-sp10s attiny1616
+1618 gchart-fet1-t1616 attiny1616
+
Duplicates:
-Missing:
+
+Missing: \ No newline at end of file
diff --git a/spaghetti-monster/anduril/Makefile b/spaghetti-monster/anduril/Makefile
index d1e6b46..332f0f3 100644
--- a/spaghetti-monster/anduril/Makefile
+++ b/spaghetti-monster/anduril/Makefile
@@ -8,13 +8,7 @@ todo:
@egrep 'TODO:|FIXME:' *.[ch]
models:
- @echo -n > MODELS
- @echo 'Model numbers:' >> MODELS
- @grep '^#define MODEL_NUMBER' cfg-*.h | perl -ne '/cfg-(.*)\.h:#define MODEL_NUMBER "(.*)"/ && print "$$2\t$$1\n";' | sort -n >> MODELS
- @echo 'Duplicates:' >> MODELS
- @cat cfg-*.h | grep '^#define MODEL_NUMBER' | sort | uniq -c | grep -v ' 1 ' || true >> MODELS
- @echo 'Missing:' >> MODELS
- @for f in cfg-*.h ; do grep --silent '^#define MODEL_NUMBER' $$f ; if [ "$$?" = "1" ] ; then echo " $$f" ; fi ; done >> MODELS
+ @./models.py > MODELS
@cat MODELS
.phony: clean todo
diff --git a/spaghetti-monster/anduril/anduril-manual.txt b/spaghetti-monster/anduril/anduril-manual.txt
index a8f3730..009e95e 100644
--- a/spaghetti-monster/anduril/anduril-manual.txt
+++ b/spaghetti-monster/anduril/anduril-manual.txt
@@ -173,8 +173,9 @@ There are four ways to access ramping mode when the light is off:
While the light is on, a few actions are available:
- 1C: Turn off.
- - 2C: Go to or from the ceiling level.
- (or if already at ceiling, and not in Simple UI, go to/from turbo)
+ - 2C: Go to or from the turbo level.
+ (or if it has regulated down, "bump" back up to turbo)
+ (turbo level / behavior is configurable)
- 1H: Change brightness (up). If the button was released less than a
second ago, or if it's already at the ceiling, it goes down instead.
- 2H: Change brightness (down).
@@ -760,8 +761,7 @@ Off Any 15+C Version check
Ramp Any 1C Off
Ramp Any 1H Ramp (up, with reversing)
Ramp Any 2H Ramp (down)
-Ramp Simple 2C Go to/from ceiling
-Ramp Full 2C Go to/from ceiling (or turbo if at ceil already)
+Ramp Any 2C Go to/from ceiling or turbo (configurable)
Ramp Full 3C Change ramp style (smooth / stepped)
Ramp Any 3H Tint ramping (on some lights)
Ramp Full 3H Momentary turbo (on lights without tint ramping)
diff --git a/spaghetti-monster/anduril/aux-leds.c b/spaghetti-monster/anduril/aux-leds.c
index 3195fdc..a0a6d7a 100644
--- a/spaghetti-monster/anduril/aux-leds.c
+++ b/spaghetti-monster/anduril/aux-leds.c
@@ -64,7 +64,7 @@ uint8_t voltage_to_rgb() {
255, 6, // 7, R+G+B
};
uint8_t volts = voltage;
- if (volts < 29) return 0;
+ if (volts < VOLTAGE_LOW) return 0;
uint8_t i;
for (i = 0; volts >= levels[i]; i += 2) {}
diff --git a/spaghetti-monster/anduril/models.py b/spaghetti-monster/anduril/models.py
new file mode 100755
index 0000000..1985352
--- /dev/null
+++ b/spaghetti-monster/anduril/models.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+import os
+import re
+
+def main(args):
+ """models.py: scan build targets to generate the MODELS file
+ """
+
+ models = []
+
+ # load all cfg-*.h files
+ paths = os.listdir('.')
+ for p in paths:
+ if p.startswith('cfg-') and p.endswith('.h'):
+ m = load_cfg(p)
+ models.append(m)
+
+ # sort by model number
+ foo = [(m.num, m.name, m) for m in models]
+ foo.sort()
+ models = [x[-1] for x in foo]
+
+ fmt = '%s\t%-30s\t%s'
+ print(fmt % ('Model', 'Name', 'MCU'))
+ print(fmt % ('-----', '----', '---'))
+ for m in models:
+ print(fmt % (m.num, m.name, m.attiny))
+
+ print('\nDuplicates:')
+ for i, m in enumerate(models):
+ for m2 in models[i+1:]:
+ #if (m.num == m2.num) and (m is not m2):
+ if m.num == m2.num:
+ print('%s\t%s, %s' % (m.num, m.name, m2.name))
+
+ print('\nMissing:')
+ for m in models:
+ if not m.num:
+ print(m.name)
+
+
+class Empty:
+ pass
+
+
+def load_cfg(path):
+ m = Empty()
+ m.name, m.num, m.attiny = '', '', 'attiny85'
+
+ m.name = path.replace('cfg-', '').replace('.h', '')
+
+ num_pat = re.compile(r'#define\s+MODEL_NUMBER\s+"(\d+)"')
+ mcu_pat = re.compile(r'ATTINY:\s+(\d+)')
+ # TODO? use C preprocessor to generate more complete file to scan
+ with open(path) as fp:
+ for line in fp:
+ found = num_pat.search(line)
+ if found:
+ m.num = found.group(1)
+ found = mcu_pat.search(line)
+ if found:
+ m.attiny = 'attiny' + found.group(1)
+
+ return m
+
+
+if __name__ == "__main__":
+ import sys
+ main(sys.argv[1:])
+
diff --git a/spaghetti-monster/anduril/tint-ramping.c b/spaghetti-monster/anduril/tint-ramping.c
index 0b077ef..aa9b1f6 100644
--- a/spaghetti-monster/anduril/tint-ramping.c
+++ b/spaghetti-monster/anduril/tint-ramping.c
@@ -31,7 +31,7 @@ uint8_t tint_ramping_state(Event event, uint16_t arg) {
if (! arg) {
tint = !tint;
set_level(actual_level);
- blink_once();
+ //blink_once(); // unnecessary, and kind of annoying on moon
}
return EVENT_HANDLED;
}
diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c
index e8fcde7..05c2e0e 100644
--- a/spaghetti-monster/fsm-ramping.c
+++ b/spaghetti-monster/fsm-ramping.c
@@ -267,7 +267,9 @@ void gradual_tick() {
)
{
//actual_level = gt + 1;
+ uint8_t orig = gradual_target;
set_level(gt + 1);
+ gradual_target = orig;
}
// is handled in set_level()
//#ifdef USE_TINT_RAMPING
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.