From e0c04a9d8a3947443e0303238234cbfc8da7718c Mon Sep 17 00:00:00 2001 From: Gabriel Hart Date: Mon, 20 Sep 2021 14:18:45 -0500 Subject: SP10 Pro: lower AA LVP to 0.7v --- spaghetti-monster/anduril/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/version.h b/spaghetti-monster/anduril/version.h index 82d6a9f..0da142b 100644 --- a/spaghetti-monster/anduril/version.h +++ b/spaghetti-monster/anduril/version.h @@ -1 +1 @@ -#define VERSION_NUMBER "20210919" +#define VERSION_NUMBER "20210920" -- cgit v1.2.3 From 892c6985b8e64997ff61c0510d087364c80e72d4 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Wed, 22 Sep 2021 01:54:19 -0600 Subject: added attiny type to the MODELS file, rewrote how MODELS file gets generated (because it's kind of important to know which MCU each light uses, and because this will be helpful later when the build system is rewritten) --- spaghetti-monster/anduril/MODELS | 109 ++++++++++++++++++------------------ spaghetti-monster/anduril/Makefile | 8 +-- spaghetti-monster/anduril/models.py | 71 +++++++++++++++++++++++ 3 files changed, 128 insertions(+), 60 deletions(-) create mode 100755 spaghetti-monster/anduril/models.py (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/MODELS b/spaghetti-monster/anduril/MODELS index 11f7dfa..ca9da30 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-sp10s -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: 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/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:]) + -- cgit v1.2.3 From f8abab2fa92d05f1f709c1b5c297e4ab804c483e Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 9 Oct 2021 09:57:48 -0600 Subject: don't hardcode 2.9V for aux LED shutoff (use the same value as LVP; easier to configure if it's in only one place) --- spaghetti-monster/anduril/aux-leds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spaghetti-monster') 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) {} -- cgit v1.2.3 From e3aeb180f0a7337740b949f97db736c80fedd04b Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 14 Oct 2021 08:20:39 -0600 Subject: don't blink when toggling tint --- spaghetti-monster/anduril/tint-ramping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spaghetti-monster') 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; } -- cgit v1.2.3 From cb735ab69b7c9f43ef30dec30110107068f3e267 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Mon, 25 Oct 2021 12:15:14 -0600 Subject: fixed too-slow thermal regulation bug introduced in d4sv2-tintramp branch (2021-09-10 r619.1.11) The gradual_target var was getting clobbered and causing thermal regulation to stop until the next thermal warning event, every time it reached a new ramp step. So... save/restore it to prevent it from getting clobbered. --- spaghetti-monster/fsm-ramping.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'spaghetti-monster') 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 -- cgit v1.2.3 From 11d3a36cdf726226b083a57f0bcfbb4a9f9b5243 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 28 Oct 2021 17:57:08 -0600 Subject: Clarified Ramp->2C behavior a bit more. (old wording was confusing people) --- spaghetti-monster/anduril/anduril-manual.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'spaghetti-monster') 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) -- cgit v1.2.3 From 17027a533661d14082f6566848bfb9cd122d03c6 Mon Sep 17 00:00:00 2001 From: Gabriel Hart Date: Fri, 29 Oct 2021 12:32:30 -0500 Subject: Add thefreeman's DAC linear driver (beta); also update Sofirn bilds to use the new 2C_STYLE defines --- spaghetti-monster/anduril/cfg-blf-lantern.h | 4 +- spaghetti-monster/anduril/cfg-blf-q8-t1616.h | 4 +- spaghetti-monster/anduril/cfg-blf-q8.h | 4 +- .../anduril/cfg-thefreeman-lin16dac.h | 45 ++++++++++++++++++++++ spaghetti-monster/anduril/version.h | 2 +- 5 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 spaghetti-monster/anduril/cfg-thefreeman-lin16dac.h (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/cfg-blf-lantern.h b/spaghetti-monster/anduril/cfg-blf-lantern.h index ff28a98..a989ca4 100644 --- a/spaghetti-monster/anduril/cfg-blf-lantern.h +++ b/spaghetti-monster/anduril/cfg-blf-lantern.h @@ -53,8 +53,8 @@ #define SIMPLE_UI_CEIL RAMP_DISCRETE_CEIL #define SIMPLE_UI_STEPS RAMP_DISCRETE_STEPS -// also at Sofirn's request, enable 2 click turbo -#define USE_2C_MAX_TURBO +// also at Sofirn's request, enable 2 click turbo (Anduril 1 style) +#define DEFAULT_2C_STYLE 1 #define USE_SOS_MODE #define USE_SOS_MODE_IN_BLINKY_GROUP diff --git a/spaghetti-monster/anduril/cfg-blf-q8-t1616.h b/spaghetti-monster/anduril/cfg-blf-q8-t1616.h index 340faa1..30a3368 100644 --- a/spaghetti-monster/anduril/cfg-blf-q8-t1616.h +++ b/spaghetti-monster/anduril/cfg-blf-q8-t1616.h @@ -34,8 +34,8 @@ #define SIMPLE_UI_CEIL 150 #define SIMPLE_UI_STEPS 5 -// also at Sofirn's request, enable 2 click turbo -#define USE_2C_MAX_TURBO +// also at Sofirn's request, enable 2 click turbo (Anduril 1 style) +#define DEFAULT_2C_STYLE 1 // enable SOS in the blinkies group #define USE_SOS_MODE diff --git a/spaghetti-monster/anduril/cfg-blf-q8.h b/spaghetti-monster/anduril/cfg-blf-q8.h index 00bdd8a..6a5055c 100644 --- a/spaghetti-monster/anduril/cfg-blf-q8.h +++ b/spaghetti-monster/anduril/cfg-blf-q8.h @@ -33,8 +33,8 @@ #define SIMPLE_UI_CEIL 150 #define SIMPLE_UI_STEPS 5 -// also at Sofirn's request, enable 2 click turbo -#define USE_2C_MAX_TURBO +// also at Sofirn's request, enable 2 click turbo (Anduril 1 style) +#define DEFAULT_2C_STYLE 1 // enable SOS in the blinkies group #define USE_SOS_MODE diff --git a/spaghetti-monster/anduril/cfg-thefreeman-lin16dac.h b/spaghetti-monster/anduril/cfg-thefreeman-lin16dac.h new file mode 100644 index 0000000..64dcd8c --- /dev/null +++ b/spaghetti-monster/anduril/cfg-thefreeman-lin16dac.h @@ -0,0 +1,45 @@ +// thefreeman's Linear 16 driver using DAC control +#define MODEL_NUMBER "0000" // TBD +#include "hwdef-thefreeman-lin16dac.h" +// ATTINY: 1616 + +// the button lights up +#define USE_INDICATOR_LED +// the button is visible while main LEDs are on +#define USE_INDICATOR_LED_WHILE_RAMPING +// off mode: low (1) +// lockout: blinking (3) +#define INDICATOR_LED_DEFAULT_MODE ((3<<2) + 1) + +#undef BLINK_AT_RAMP_MIDDLE + +// We're abusing the Dynamic PWM functionality to set the VREF instead of PWM TOP. +// We don't want the Gradual functionality to mess with the PWM_TOP value. +#ifdef USE_SET_LEVEL_GRADUALLY +#undef USE_SET_LEVEL_GRADUALLY +#endif + +// level_calc.py ninth 2 150 7135 1 0.03 6.4 7135 1 6.3 1600 +#define RAMP_LENGTH 150 +#define USE_DYN_PWM + +// PWM1: DAC Data, PWM Tops: VREF selector +#define PWM1_LEVELS 25,25,33,41,41,50,58,66,75,83,92,108,117,133,150,167,192,209,234,58,64,71,80,90,99,110,121,134,149,163,180,198,218,241,1,1,1,1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,5,5,6,6,7,7,8,8,9,10,11,11,12,13,14,15,16,18,19,20,22,23,25,26,28,30,32,34,36,39,41,44,47,50,53,56,59,63,67,71,75,79,84,89,94,100,105,112,118,124,131,139,146,154,163,172,181,191,201,212,223,234,246,57,60,63,66,69,73,76,80,84,88,93,97,102,107,112,117,123,129,135,141,147,154,161,169,176,184,193,201,210,220,229,239,250,255 +#define PWM_TOPS 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18 + +#define MAX_1x7135 34 +#define HALFSPEED_LEVEL 14 +#define QUARTERSPEED_LEVEL 6 + +#define RAMP_SMOOTH_FLOOR 1 +#define RAMP_SMOOTH_CEIL 120 +// 10, 28, 46, [65], 83, 101, 120 +#define RAMP_DISCRETE_FLOOR 10 +#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL +#define RAMP_DISCRETE_STEPS 7 + +// stop panicking at ~30% power +#define THERM_FASTER_LEVEL 123 + +// enable 2 click turbo +#define DEFAULT_2C_STYLE 1 diff --git a/spaghetti-monster/anduril/version.h b/spaghetti-monster/anduril/version.h index 0da142b..7560ef2 100644 --- a/spaghetti-monster/anduril/version.h +++ b/spaghetti-monster/anduril/version.h @@ -1 +1 @@ -#define VERSION_NUMBER "20210920" +#define VERSION_NUMBER "20211029" -- cgit v1.2.3