From 7406108f84e673f54c5a4015b5776324ed447d1b Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 9 Jul 2021 07:00:02 -0600 Subject: set Emisar/Noctigon "219" builds to 65% FET power (was 75% or 80% before) (change requested by Emisar) --- spaghetti-monster/anduril/cfg-emisar-d4-219c.h | 6 +++++- spaghetti-monster/anduril/cfg-emisar-d4s-219c.h | 6 +++++- spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h | 6 ++++-- spaghetti-monster/anduril/cfg-emisar-d4v2-219.h | 6 ++++-- spaghetti-monster/anduril/cfg-noctigon-kr4-219.h | 4 ++-- 5 files changed, 20 insertions(+), 8 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/cfg-emisar-d4-219c.h b/spaghetti-monster/anduril/cfg-emisar-d4-219c.h index 1f07008..e525d86 100644 --- a/spaghetti-monster/anduril/cfg-emisar-d4-219c.h +++ b/spaghetti-monster/anduril/cfg-emisar-d4-219c.h @@ -5,5 +5,9 @@ #undef MODEL_NUMBER #define MODEL_NUMBER "0112" +// don't turn off first channel at turbo level +#undef PWM1_LEVELS +#define PWM1_LEVELS 1,1,2,2,3,3,4,4,5,6,7,8,9,10,12,13,14,15,17,19,20,22,24,26,29,31,34,36,39,42,45,48,51,55,59,62,66,70,75,79,84,89,93,99,104,110,115,121,127,134,140,147,154,161,168,176,184,192,200,209,217,226,236,245,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 +// 65% FET power #undef PWM2_LEVELS -#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,5,6,7,8,9,11,12,13,15,16,17,19,20,21,23,24,26,28,29,31,32,34,36,38,40,41,44,45,47,49,51,53,56,57,60,62,64,67,69,72,74,76,79,81,84,87,89,92,95,97,100,103,106,109,112,115,118,121,124,128,132,135,138,141,145,148,152,156,160,164,167,171,175,179,183,187,191,195,200,204 +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,13,15,16,17,18,19,21,22,23,25,26,27,28,30,32,33,34,36,38,39,41,42,44,46,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,78,80,82,84,87,90,92,94,97,99,102,104,108,110,113,116,119,121,125,127,130,134,136,140,143,146,149,153,156,159,163,166 diff --git a/spaghetti-monster/anduril/cfg-emisar-d4s-219c.h b/spaghetti-monster/anduril/cfg-emisar-d4s-219c.h index ef783d8..6489b34 100644 --- a/spaghetti-monster/anduril/cfg-emisar-d4s-219c.h +++ b/spaghetti-monster/anduril/cfg-emisar-d4s-219c.h @@ -5,5 +5,9 @@ #undef MODEL_NUMBER #define MODEL_NUMBER "0132" +// don't turn off first channel at turbo level +#undef PWM1_LEVELS +#define PWM1_LEVELS 1,1,2,2,3,3,4,4,5,5,6,6,7,8,8,9,10,10,11,12,13,14,15,16,17,18,19,21,22,23,25,26,27,29,31,32,34,36,38,40,42,44,46,49,51,54,56,59,62,65,68,71,74,78,81,85,89,93,97,101,106,110,115,120,125,130,136,141,147,153,160,166,173,180,187,195,202,210,219,227,236,245,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 +// 65% FET power #undef PWM2_LEVELS -#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,5,6,8,8,10,11,12,14,15,16,18,20,21,23,24,27,28,30,32,34,36,38,40,43,45,48,50,52,55,57,60,63,66,69,72,76,79,82,85,89,92,96,100,104,108,112,116,121,126,130,135,140,145,150,156,161,167,172,178,184,191,197,204 +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,18,19,21,23,24,25,27,28,30,32,34,36,38,39,41,43,45,47,50,52,54,57,60,62,65,67,70,73,76,79,82,86,89,92,95,99,103,106,110,114,119,123,127,132,136,141,145,151,156,161,166 diff --git a/spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h b/spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h index 65bf116..54a2e6b 100644 --- a/spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h +++ b/spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h @@ -4,9 +4,11 @@ #define MODEL_NUMBER "0134" // ATTINY: 1634 +// don't turn off first channel at turbo level #undef PWM1_LEVELS #undef PWM2_LEVELS -#undef PWM3_LEVELS #define PWM1_LEVELS 1,1,2,2,3,3,4,5,5,6,7,8,9,10,11,12,13,17,18,19,20,21,22,24,26,28,30,33,35,38,41,44,47,50,54,57,61,65,69,74,79,84,89,94,100,106,113,119,126,134,142,150,158,167,176,186,196,207,218,230,242,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 #define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,16,21,25,30,35,41,46,52,58,64,71,77,84,92,99,107,115,124,133,142,151,161,172,182,193,205,217,229,242,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 -#define PWM3_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,6,7,9,10,12,13,15,17,18,20,22,24,26,28,30,33,35,37,40,43,45,48,50,53,56,59,62,65,69,72,76,80,83,87,91,95,99,104,108,113,117,123,127,132,138,143,148,154,160,166,172,178,185,192 +// 65% FET power +#undef PWM3_LEVELS +#define PWM3_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,6,7,8,10,11,12,13,15,17,18,20,21,23,25,27,29,31,33,35,38,39,42,44,47,49,52,54,57,60,63,66,69,73,76,79,83,86,90,94,98,102,106,110,115,119,124,129,134,139,144,149,155,160,166 diff --git a/spaghetti-monster/anduril/cfg-emisar-d4v2-219.h b/spaghetti-monster/anduril/cfg-emisar-d4v2-219.h index cef89be..414971a 100644 --- a/spaghetti-monster/anduril/cfg-emisar-d4v2-219.h +++ b/spaghetti-monster/anduril/cfg-emisar-d4v2-219.h @@ -4,7 +4,9 @@ #define MODEL_NUMBER "0114" // ATTINY: 1634 +// don't turn off first channel at turbo level #undef PWM1_LEVELS -#undef PWM2_LEVELS #define PWM1_LEVELS 1,1,2,2,3,3,4,4,5,6,7,8,9,10,12,13,14,15,17,19,20,22,24,26,29,31,34,36,39,42,45,48,51,55,59,62,66,70,75,79,84,89,93,99,104,110,115,121,127,134,140,147,154,161,168,176,184,192,200,209,217,226,236,245,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 -#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,3,5,6,6,8,9,10,11,12,14,15,16,18,18,20,21,23,24,26,27,29,30,32,33,36,37,39,41,43,44,46,48,50,52,54,56,58,61,63,65,67,70,72,74,77,79,82,84,86,89,92,95,97,100,103,106,108,111,114,117,120,124,127,130,133,137,140,144,147,151,154,157,161,165,169,172,176,180,184,188,192 +// 65% FET power +#undef PWM2_LEVELS +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,13,15,16,17,18,19,21,22,23,25,26,27,28,30,32,33,34,36,38,39,41,42,44,46,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,78,80,82,84,87,90,92,94,97,99,102,104,108,110,113,116,119,121,125,127,130,134,136,140,143,146,149,153,156,159,163,166 diff --git a/spaghetti-monster/anduril/cfg-noctigon-kr4-219.h b/spaghetti-monster/anduril/cfg-noctigon-kr4-219.h index 083995f..1c86b10 100644 --- a/spaghetti-monster/anduril/cfg-noctigon-kr4-219.h +++ b/spaghetti-monster/anduril/cfg-noctigon-kr4-219.h @@ -7,7 +7,7 @@ // don't turn off first channel at turbo level #undef PWM1_LEVELS #define PWM1_LEVELS 0,0,1,1,2,2,3,3,4,4,5,6,7,8,9,10,11,13,14,15,17,19,20,22,24,26,28,30,33,35,38,40,43,46,49,52,55,59,62,66,70,74,78,82,86,91,96,100,105,111,116,121,127,133,139,145,151,158,165,172,179,186,193,201,209,217,225,234,243,251,261,270,280,289,299,310,320,331,342,353,364,376,388,400,412,425,438,451,464,478,492,506,521,536,551,566,582,597,614,630,647,664,681,699,717,735,754,772,792,811,831,851,871,892,913,935,956,978,1001,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023 -// 75% FET power +// 65% FET power #undef PWM2_LEVELS -#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,39,60,82,104,126,149,172,195,219,243,268,293,318,343,369,396,422,449,476,504,531,560,588,617,646,676,706,737,768 +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,34,52,71,90,110,129,149,169,190,211,233,254,275,298,320,343,366,389,413,437,461,485,510,535,560,586,612,639,665 -- cgit v1.2.3 From ab4705edd066c203ef6a709f066759f3695c89f9 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 11 Jul 2021 12:58:20 -0600 Subject: added Emisar D18 Nichia 219 build target (same as normal but reduced FET power) --- spaghetti-monster/anduril/MODELS | 1 + spaghetti-monster/anduril/cfg-emisar-d18-219.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 spaghetti-monster/anduril/cfg-emisar-d18-219.h (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/MODELS b/spaghetti-monster/anduril/MODELS index 13ce2e4..27241ef 100644 --- a/spaghetti-monster/anduril/MODELS +++ b/spaghetti-monster/anduril/MODELS @@ -12,6 +12,7 @@ Model numbers: 0133 emisar-d4sv2 0134 emisar-d4sv2-219 0141 emisar-d18 +0142 emisar-d18-219 0211 noctigon-kr4 0212 noctigon-kr4-nofet 0213 noctigon-kr4-219 diff --git a/spaghetti-monster/anduril/cfg-emisar-d18-219.h b/spaghetti-monster/anduril/cfg-emisar-d18-219.h new file mode 100644 index 0000000..23229f4 --- /dev/null +++ b/spaghetti-monster/anduril/cfg-emisar-d18-219.h @@ -0,0 +1,14 @@ +// Emisar D18 (FET+13+1) reduced-FET config options for Anduril +#include "cfg-emisar-d18.h" +#undef MODEL_NUMBER +#define MODEL_NUMBER "0142" + +// don't turn off first channels at turbo level +#undef PWM1_LEVELS +#undef PWM2_LEVELS +#define PWM1_LEVELS 1,1,2,2,3,4,4,5,6,7,8,9,10,11,15,16,18,20,22,24,26,28,30,33,36,39,43,47,51,56,61,66,72,78,85,92,99,107,116,125,135,145,156,168,180,194,208,222,238,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,8,10,11,13,14,16,18,19,21,23,26,28,30,33,35,38,41,44,47,51,54,58,62,66,70,75,79,84,90,95,101,106,112,119,126,133,140,147,155,164,172,181,190,200,210,221,232,243,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 +// 65% FET power +#undef PWM3_LEVELS +#define PWM3_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5,6,8,9,10,12,13,15,17,19,21,23,25,26,29,31,34,36,38,41,43,46,49,52,55,58,62,65,68,72,75,79,83,88,91,96,101,105,110,115,119,125,130,136,142,147,153,160,166 + -- cgit v1.2.3 From 1549e246f83fe132315d8a51ea9b1cb1a5a583ba Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 11 Jul 2021 13:58:41 -0600 Subject: rewrote hybrid memory (manual memory timer) to eliminate corner cases Old method: - at 1-click power-on, choose a brightness based on off-time (manual level or last-ramped level) New method: - when off longer than the timer, set last-ramped level to manual level This fixes a bug: - turn light off - wait for timer - turn light on with a shortcut to moon - turn light off - turn light on - pre-patch, light went to last-ramped level instead of manual level This change also reduces the ROM size slightly. --- spaghetti-monster/anduril/off-mode.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/off-mode.c b/spaghetti-monster/anduril/off-mode.c index 094cca8..ae54f60 100644 --- a/spaghetti-monster/anduril/off-mode.c +++ b/spaghetti-monster/anduril/off-mode.c @@ -27,11 +27,6 @@ #endif uint8_t off_state(Event event, uint16_t arg) { - #ifdef USE_MANUAL_MEMORY_TIMER - // keep track of how long the light was off, - // so we can do different things on waking, depending on how long asleep - static uint16_t off_time = 0; - #endif // turn emitter off when entering state if (event == EV_enter_state) { @@ -65,7 +60,14 @@ uint8_t off_state(Event event, uint16_t arg) { // blink the indicator LED, maybe else if (event == EV_sleep_tick) { #ifdef USE_MANUAL_MEMORY_TIMER - off_time = arg; + // reset to manual memory level when timer expires + if (manual_memory && + (arg >= (manual_memory_timer * SLEEP_TICKS_PER_MINUTE))) { + memorized_level = manual_memory; + #ifdef USE_TINT_RAMPING + tint = manual_memory_tint; + #endif + } #endif #ifdef USE_INDICATOR_LED if ((indicator_led_mode & 0b00000011) == 0b00000011) { @@ -126,18 +128,15 @@ uint8_t off_state(Event event, uint16_t arg) { #if (B_TIMING_ON != B_TIMEOUT_T) // 1 click (before timeout): go to memorized level, but allow abort for double click else if (event == EV_click1_release) { - #ifdef USE_MANUAL_MEMORY - // for full manual memory, set manual_memory_timer to 0 - if (manual_memory - #ifdef USE_MANUAL_MEMORY_TIMER - && (off_time >= (manual_memory_timer * SLEEP_TICKS_PER_MINUTE)) - #endif - ) { + #if defined(USE_MANUAL_MEMORY) && !defined(USE_MANUAL_MEMORY_TIMER) + // this clause probably isn't used by any configs any more + // but is included just in case someone configures it this way + if (manual_memory) { + memorized_level = manual_memory; #ifdef USE_TINT_RAMPING tint = manual_memory_tint; #endif - set_level(nearest_level(manual_memory)); - } else + } #endif set_level(nearest_level(memorized_level)); return MISCHIEF_MANAGED; -- cgit v1.2.3 From 2b6e0240465aee32b14e5dfba98b3d4a1567e2bd Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 22 Jul 2021 10:14:07 -0600 Subject: summarize results at end of batch build process --- spaghetti-monster/anduril/build-all.sh | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/build-all.sh b/spaghetti-monster/anduril/build-all.sh index 42a36fd..78ebb20 100755 --- a/spaghetti-monster/anduril/build-all.sh +++ b/spaghetti-monster/anduril/build-all.sh @@ -4,12 +4,41 @@ UI=anduril date '+#define VERSION_NUMBER "%Y%m%d"' > version.h +PASS=0 +FAIL=0 +PASSED='' +FAILED='' + for TARGET in cfg-*.h ; do + + # friendly name for this build NAME=$(echo "$TARGET" | perl -ne '/cfg-(.*).h/ && print "$1\n";') echo "===== $NAME =====" + + # figure out MCU type ATTINY=$(grep 'ATTINY:' $TARGET | awk '{ print $3 }') if [ -z "$ATTINY" ]; then ATTINY=85 ; fi + + # try to compile echo ../../../bin/build.sh $ATTINY "$UI" "-DCONFIGFILE=${TARGET}" ../../../bin/build.sh $ATTINY "$UI" "-DCONFIGFILE=${TARGET}" - mv -f "$UI".hex "$UI".$NAME.hex + + # track result, and rename compiled files + if [ 0 = $? ] ; then + mv -f "$UI".hex "$UI".$NAME.hex + PASS=$(($PASS + 1)) + PASSED="$PASSED $NAME" + else + echo "ERROR: build failed" + FAIL=$(($FAIL + 1)) + FAILED="$FAILED $NAME" + fi + done + +# summary +echo "===== $PASS builds succeeded, $FAIL failed =====" +#echo "PASS: $PASSED" +if [ 0 != $FAIL ]; then + echo "FAIL:$FAILED" +fi -- cgit v1.2.3 From 3f76df8c0fb69c15fd0dc7101bc9de59b1be0c40 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 25 Jul 2021 23:49:35 -0600 Subject: allow building only some targets, instead of always doing all --- spaghetti-monster/anduril/build-all.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/build-all.sh b/spaghetti-monster/anduril/build-all.sh index 78ebb20..b9f6d15 100755 --- a/spaghetti-monster/anduril/build-all.sh +++ b/spaghetti-monster/anduril/build-all.sh @@ -1,5 +1,12 @@ #!/bin/sh +# Usage: build-all.sh [pattern] +# If pattern given, only build targets which match. + +if [ ! -z "$1" ]; then + SEARCH="$1" +fi + UI=anduril date '+#define VERSION_NUMBER "%Y%m%d"' > version.h @@ -11,6 +18,12 @@ FAILED='' for TARGET in cfg-*.h ; do + # maybe limit builds to a specific pattern + if [ ! -z "$SEARCH" ]; then + echo "$TARGET" | grep -i "$SEARCH" > /dev/null + if [ 0 != $? ]; then continue ; fi + fi + # friendly name for this build NAME=$(echo "$TARGET" | perl -ne '/cfg-(.*).h/ && print "$1\n";') echo "===== $NAME =====" -- cgit v1.2.3 From b83b64bcff9807884eee33cc401609ee02cf4ea0 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 25 Jul 2021 23:53:11 -0600 Subject: added Nichia 219B build for KR4 and K9.3, adjusted 219C builds, for intl-outdoor --- spaghetti-monster/anduril/MODELS | 2 ++ spaghetti-monster/anduril/cfg-emisar-d18-219.h | 4 ++-- spaghetti-monster/anduril/cfg-noctigon-k9.3-219.h | 18 ++++++++++++++++++ spaghetti-monster/anduril/cfg-noctigon-kr4-219.h | 6 +++--- spaghetti-monster/anduril/cfg-noctigon-kr4-219b.h | 13 +++++++++++++ 5 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 spaghetti-monster/anduril/cfg-noctigon-k9.3-219.h create mode 100644 spaghetti-monster/anduril/cfg-noctigon-kr4-219b.h (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/MODELS b/spaghetti-monster/anduril/MODELS index 27241ef..f4a0531 100644 --- a/spaghetti-monster/anduril/MODELS +++ b/spaghetti-monster/anduril/MODELS @@ -16,11 +16,13 @@ Model numbers: 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 0311 fw3a 0312 fw3a-219 0313 fw3a-nofet diff --git a/spaghetti-monster/anduril/cfg-emisar-d18-219.h b/spaghetti-monster/anduril/cfg-emisar-d18-219.h index 23229f4..1f3a3c2 100644 --- a/spaghetti-monster/anduril/cfg-emisar-d18-219.h +++ b/spaghetti-monster/anduril/cfg-emisar-d18-219.h @@ -8,7 +8,7 @@ #undef PWM2_LEVELS #define PWM1_LEVELS 1,1,2,2,3,4,4,5,6,7,8,9,10,11,15,16,18,20,22,24,26,28,30,33,36,39,43,47,51,56,61,66,72,78,85,92,99,107,116,125,135,145,156,168,180,194,208,222,238,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 #define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,8,10,11,13,14,16,18,19,21,23,26,28,30,33,35,38,41,44,47,51,54,58,62,66,70,75,79,84,90,95,101,106,112,119,126,133,140,147,155,164,172,181,190,200,210,221,232,243,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 -// 65% FET power +// 85% FET power #undef PWM3_LEVELS -#define PWM3_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5,6,8,9,10,12,13,15,17,19,21,23,25,26,29,31,34,36,38,41,43,46,49,52,55,58,62,65,68,72,75,79,83,88,91,96,101,105,110,115,119,125,130,136,142,147,153,160,166 +#define PWM3_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,6,8,10,12,13,16,17,20,22,24,27,29,32,34,38,40,44,46,50,53,57,60,64,68,72,76,80,85,89,94,98,103,108,114,119,125,131,137,143,150,156,163,170,177,185,193,200,209,217 diff --git a/spaghetti-monster/anduril/cfg-noctigon-k9.3-219.h b/spaghetti-monster/anduril/cfg-noctigon-k9.3-219.h new file mode 100644 index 0000000..a88ad2c --- /dev/null +++ b/spaghetti-monster/anduril/cfg-noctigon-k9.3-219.h @@ -0,0 +1,18 @@ +// Noctigon K9.3 (reduced FET) config options for Anduril +#include "cfg-noctigon-k9.3.h" +#undef MODEL_NUMBER +#define MODEL_NUMBER "0263" +// ATTINY: 1634 + +// main LEDs +#undef PWM1_LEVELS +#undef PWM2_LEVELS +// don't turn off first channel at turbo level +#define PWM1_LEVELS 0,0,1,1,2,2,3,3,4,4,5,6,7,8,9,10,11,13,14,15,17,19,20,22,24,26,28,30,33,35,38,40,43,46,49,52,55,59,62,66,70,74,78,82,86,91,96,100,105,111,116,121,127,133,139,145,151,158,165,172,179,186,193,201,209,217,225,234,243,251,261,270,280,289,299,310,320,331,342,353,364,376,388,400,412,425,438,451,464,478,492,506,521,536,551,566,582,597,614,630,647,664,681,699,717,735,754,772,792,811,831,851,871,892,913,935,956,978,1001,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023 +// 65% FET power +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,34,52,71,90,110,129,149,169,190,211,233,254,275,298,320,343,366,389,413,437,461,485,510,535,560,586,612,639,665 + +// 2nd LEDs (unchanged) +//#undef PWM3_LEVELS +//#define PWM3_LEVELS 0,0,1,1,2,2,3,3,4,4,5,5,6,7,8,9,10,11,12,13,15,16,17,18,20,21,23,24,26,27,29,31,33,35,37,39,41,43,45,48,50,53,55,58,61,63,66,69,72,75,79,82,85,89,92,96,100,104,108,112,116,120,125,129,134,138,143,148,153,158,163,169,174,180,185,191,197,203,209,215,222,228,235,242,248,255,263,270,277,285,292,300,308,316,324,333,341,350,359,368,377,386,395,405,414,424,434,444,454,465,475,486,497,508,519,531,542,554,566,578,590,603,615,628,641,654,667,680,694,708,722,736,750,765,779,794,809,825,840,856,872,888,904,920,937,954,971,988,1005,1023 + diff --git a/spaghetti-monster/anduril/cfg-noctigon-kr4-219.h b/spaghetti-monster/anduril/cfg-noctigon-kr4-219.h index 1c86b10..e0e9317 100644 --- a/spaghetti-monster/anduril/cfg-noctigon-kr4-219.h +++ b/spaghetti-monster/anduril/cfg-noctigon-kr4-219.h @@ -1,4 +1,4 @@ -// Noctigon KR4 (75% FET) config options for Anduril +// Noctigon KR4 (reduced FET) config options for Anduril #include "cfg-noctigon-kr4.h" #undef MODEL_NUMBER #define MODEL_NUMBER "0213" @@ -7,7 +7,7 @@ // don't turn off first channel at turbo level #undef PWM1_LEVELS #define PWM1_LEVELS 0,0,1,1,2,2,3,3,4,4,5,6,7,8,9,10,11,13,14,15,17,19,20,22,24,26,28,30,33,35,38,40,43,46,49,52,55,59,62,66,70,74,78,82,86,91,96,100,105,111,116,121,127,133,139,145,151,158,165,172,179,186,193,201,209,217,225,234,243,251,261,270,280,289,299,310,320,331,342,353,364,376,388,400,412,425,438,451,464,478,492,506,521,536,551,566,582,597,614,630,647,664,681,699,717,735,754,772,792,811,831,851,871,892,913,935,956,978,1001,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023 -// 65% FET power +// 60% FET power #undef PWM2_LEVELS -#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,34,52,71,90,110,129,149,169,190,211,233,254,275,298,320,343,366,389,413,437,461,485,510,535,560,586,612,639,665 +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,31,48,66,83,101,119,138,156,176,195,215,234,254,275,296,317,338,359,381,403,425,448,471,494,517,541,565,590,614 diff --git a/spaghetti-monster/anduril/cfg-noctigon-kr4-219b.h b/spaghetti-monster/anduril/cfg-noctigon-kr4-219b.h new file mode 100644 index 0000000..c1cac84 --- /dev/null +++ b/spaghetti-monster/anduril/cfg-noctigon-kr4-219b.h @@ -0,0 +1,13 @@ +// Noctigon KR4 (reduced FET) config options for Anduril +#include "cfg-noctigon-kr4.h" +#undef MODEL_NUMBER +#define MODEL_NUMBER "0214" +// ATTINY: 1634 + +// don't turn off first channel at turbo level +#undef PWM1_LEVELS +#define PWM1_LEVELS 0,0,1,1,2,2,3,3,4,4,5,6,7,8,9,10,11,13,14,15,17,19,20,22,24,26,28,30,33,35,38,40,43,46,49,52,55,59,62,66,70,74,78,82,86,91,96,100,105,111,116,121,127,133,139,145,151,158,165,172,179,186,193,201,209,217,225,234,243,251,261,270,280,289,299,310,320,331,342,353,364,376,388,400,412,425,438,451,464,478,492,506,521,536,551,566,582,597,614,630,647,664,681,699,717,735,754,772,792,811,831,851,871,892,913,935,956,978,1001,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023 +// 50% FET power +#undef PWM2_LEVELS +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,26,40,55,69,84,99,115,130,146,162,179,195,212,229,246,264,281,299,317,336,354,373,392,411,431,451,471,491,512 + -- cgit v1.2.3 From 437a0bd41e42fa5f657a87ed47a5f46b29d7f430 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 12 Aug 2021 03:00:11 -0600 Subject: document the actual maximum for manual memory timer (~140 minutes, not 255) --- spaghetti-monster/anduril/anduril-manual.txt | 4 +++- spaghetti-monster/anduril/ramp-mode.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/anduril-manual.txt b/spaghetti-monster/anduril/anduril-manual.txt index e3b3cf5..57f1986 100644 --- a/spaghetti-monster/anduril/anduril-manual.txt +++ b/spaghetti-monster/anduril/anduril-manual.txt @@ -182,13 +182,15 @@ Memory determines which brightness level the light goes to with 1 click from off. There are three types of brightness memory to choose from: - Automatic: Always uses the last-ramped brightness. + (does not memorize levels accessed by a shortcut, + like turbo, 2C for ceiling, or 1H-from-off for floor) - Manual: Always uses the user's saved brightness. - Hybrid: Uses the automatic memory brightness if the light was only off for a short time, or resets to the manual memory level if it was off for a longer time. - The timer for this is configurable from 0 to 255 minutes. + The timer for this is configurable from 0 to ~140 minutes. Another way to think of it is: There are three styles of memory for the last-ramped brightness level... diff --git a/spaghetti-monster/anduril/ramp-mode.c b/spaghetti-monster/anduril/ramp-mode.c index 0baffde..8ab4ec4 100644 --- a/spaghetti-monster/anduril/ramp-mode.c +++ b/spaghetti-monster/anduril/ramp-mode.c @@ -462,6 +462,9 @@ void manual_memory_timer_config_save(uint8_t step, uint8_t value) { // item 1: disable manual memory, go back to automatic if (step == 1) { manual_memory = 0; } // item 2: set manual memory timer duration + // FIXME: should be limited to (65535 / SLEEP_TICKS_PER_MINUTE) + // to avoid overflows or impossibly long timeouts + // (by default, the effective limit is 145, but it allows up to 255) else { manual_memory_timer = value; } } -- cgit v1.2.3 From effdfa49064136a59cbd9d4f59a461e96688ce1e Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 12 Aug 2021 03:01:10 -0600 Subject: made blink_once() brightness configurable per build --- spaghetti-monster/anduril/misc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/misc.c b/spaghetti-monster/anduril/misc.c index 523bbf0..9c7f0dd 100644 --- a/spaghetti-monster/anduril/misc.c +++ b/spaghetti-monster/anduril/misc.c @@ -25,7 +25,7 @@ /* no longer used void blink_confirm(uint8_t num) { uint8_t brightness = actual_level; - uint8_t bump = actual_level + (MAX_LEVEL/6); + uint8_t bump = actual_level + BLINK_BRIGHTNESS; if (bump > MAX_LEVEL) bump = 0; for (; num>0; num--) { set_level(bump); @@ -41,9 +41,12 @@ void blink_confirm(uint8_t num) { #ifndef BLINK_ONCE_TIME #define BLINK_ONCE_TIME 10 #endif +#ifndef BLINK_BRIGHTNESS +#define BLINK_BRIGHTNESS (MAX_LEVEL/6) +#endif void blink_once() { uint8_t brightness = actual_level; - uint8_t bump = brightness + (MAX_LEVEL/6); + uint8_t bump = brightness + BLINK_BRIGHTNESS; if (bump > MAX_LEVEL) bump = 0; set_level(bump); -- cgit v1.2.3 From 41189343748b60ace6a72b4dfe85e85efcb99695 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 12 Aug 2021 03:02:50 -0600 Subject: added a "jump start moon" option for hold-from-off, for lights with slow-activating circuits (briefly pulses the light at a higher level to wake up the circuit faster) --- spaghetti-monster/anduril/off-mode.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/off-mode.c b/spaghetti-monster/anduril/off-mode.c index ae54f60..b1faf47 100644 --- a/spaghetti-monster/anduril/off-mode.c +++ b/spaghetti-monster/anduril/off-mode.c @@ -96,6 +96,12 @@ uint8_t off_state(Event event, uint16_t arg) { #if (B_TIMING_ON == B_PRESS_T) // hold (initially): go to lowest level (floor), but allow abort for regular click else if (event == EV_click1_press) { + #ifdef JUMP_START_MOON + if (!arg) { + set_level(JUMP_START_MOON); + delay_4ms(3); + } + #endif set_level(nearest_level(1)); return MISCHIEF_MANAGED; } @@ -110,6 +116,13 @@ uint8_t off_state(Event event, uint16_t arg) { } else #endif #else // B_RELEASE_T or B_TIMEOUT_T + #ifdef JUMP_START_MOON + // pulse the output for a moment to wake up the power regulator + if (!arg) { + set_level(JUMP_START_MOON); + delay_4ms(3); + } + #endif set_level(nearest_level(1)); #endif // don't start ramping immediately; -- cgit v1.2.3 From 73b67cccbe050be9e7e7ea671ffbbdd1d6f14f61 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 12 Aug 2021 05:32:51 -0600 Subject: got PFM / dynamic PWM actually working on Noctigon KR4 (and also added "jump start moon" to it) (and generally finished adding dynamic PWM support to FSM) --- spaghetti-monster/anduril/cfg-noctigon-kr4-219.h | 4 +- spaghetti-monster/anduril/cfg-noctigon-kr4-219b.h | 4 +- spaghetti-monster/anduril/cfg-noctigon-kr4-nofet.h | 21 ++++++---- spaghetti-monster/anduril/cfg-noctigon-kr4.h | 48 ++++++++++++++-------- spaghetti-monster/fsm-ramping.c | 26 ++++++++++++ spaghetti-monster/fsm-ramping.h | 8 ++++ 6 files changed, 83 insertions(+), 28 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/cfg-noctigon-kr4-219.h b/spaghetti-monster/anduril/cfg-noctigon-kr4-219.h index e0e9317..28fc595 100644 --- a/spaghetti-monster/anduril/cfg-noctigon-kr4-219.h +++ b/spaghetti-monster/anduril/cfg-noctigon-kr4-219.h @@ -6,8 +6,8 @@ // don't turn off first channel at turbo level #undef PWM1_LEVELS -#define PWM1_LEVELS 0,0,1,1,2,2,3,3,4,4,5,6,7,8,9,10,11,13,14,15,17,19,20,22,24,26,28,30,33,35,38,40,43,46,49,52,55,59,62,66,70,74,78,82,86,91,96,100,105,111,116,121,127,133,139,145,151,158,165,172,179,186,193,201,209,217,225,234,243,251,261,270,280,289,299,310,320,331,342,353,364,376,388,400,412,425,438,451,464,478,492,506,521,536,551,566,582,597,614,630,647,664,681,699,717,735,754,772,792,811,831,851,871,892,913,935,956,978,1001,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023 +#define PWM1_LEVELS 0,1,1,2,2,3,4,5,6,7,8,9,11,12,14,16,17,19,22,24,26,29,31,34,37,40,43,46,49,53,56,60,63,67,71,74,78,82,86,89,93,96,99,103,105,108,110,112,114,115,116,116,115,114,112,109,106,101,95,89,81,71,60,48,34,19,20,21,22,23,24,26,27,28,30,31,32,34,36,37,39,41,43,45,47,49,51,53,56,58,61,63,66,69,72,75,78,81,84,88,91,95,99,103,107,111,115,119,124,129,133,138,143,149,154,159,165,171,177,183,189,196,203,210,217,224,231,239,247,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 // 60% FET power #undef PWM2_LEVELS -#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,31,48,66,83,101,119,138,156,176,195,215,234,254,275,296,317,338,359,381,403,425,448,471,494,517,541,565,590,614 +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,12,18,25,32,38,45,53,60,68,75,83,91,99,108,117,125,135,144,153 diff --git a/spaghetti-monster/anduril/cfg-noctigon-kr4-219b.h b/spaghetti-monster/anduril/cfg-noctigon-kr4-219b.h index c1cac84..39ac57c 100644 --- a/spaghetti-monster/anduril/cfg-noctigon-kr4-219b.h +++ b/spaghetti-monster/anduril/cfg-noctigon-kr4-219b.h @@ -6,8 +6,8 @@ // don't turn off first channel at turbo level #undef PWM1_LEVELS -#define PWM1_LEVELS 0,0,1,1,2,2,3,3,4,4,5,6,7,8,9,10,11,13,14,15,17,19,20,22,24,26,28,30,33,35,38,40,43,46,49,52,55,59,62,66,70,74,78,82,86,91,96,100,105,111,116,121,127,133,139,145,151,158,165,172,179,186,193,201,209,217,225,234,243,251,261,270,280,289,299,310,320,331,342,353,364,376,388,400,412,425,438,451,464,478,492,506,521,536,551,566,582,597,614,630,647,664,681,699,717,735,754,772,792,811,831,851,871,892,913,935,956,978,1001,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023 +#define PWM1_LEVELS 0,1,1,2,2,3,4,5,6,7,8,9,11,12,14,16,17,19,22,24,26,29,31,34,37,40,43,46,49,53,56,60,63,67,71,74,78,82,86,89,93,96,99,103,105,108,110,112,114,115,116,116,115,114,112,109,106,101,95,89,81,71,60,48,34,19,20,21,22,23,24,26,27,28,30,31,32,34,36,37,39,41,43,45,47,49,51,53,56,58,61,63,66,69,72,75,78,81,84,88,91,95,99,103,107,111,115,119,124,129,133,138,143,149,154,159,165,171,177,183,189,196,203,210,217,224,231,239,247,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 // 50% FET power #undef PWM2_LEVELS -#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,26,40,55,69,84,99,115,130,146,162,179,195,212,229,246,264,281,299,317,336,354,373,392,411,431,451,471,491,512 +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,10,15,21,26,32,38,44,50,56,63,69,76,83,90,97,104,112,120,128 diff --git a/spaghetti-monster/anduril/cfg-noctigon-kr4-nofet.h b/spaghetti-monster/anduril/cfg-noctigon-kr4-nofet.h index 3043035..871a405 100644 --- a/spaghetti-monster/anduril/cfg-noctigon-kr4-nofet.h +++ b/spaghetti-monster/anduril/cfg-noctigon-kr4-nofet.h @@ -10,13 +10,16 @@ // 0/1023: 0.35 lm // 1/1023: 2.56 lm // max regulated: 1740 lm -// level_calc.py 3.0 1 150 7135 0 5 1740 #undef PWM_CHANNELS #define PWM_CHANNELS 1 #define RAMP_LENGTH 150 +// prioritize low lows, at risk of visible ripple +// level_calc.py 5.01 1 149 7135 1 0.3 1740 --pwm dyn:78:16384:255 #undef PWM1_LEVELS -#define PWM1_LEVELS 0,0,1,1,2,2,3,3,4,4,5,5,6,7,8,9,10,11,12,13,15,16,17,18,20,21,23,24,26,27,29,31,33,35,37,39,41,43,45,48,50,53,55,58,61,63,66,69,72,75,79,82,85,89,92,96,100,104,108,112,116,120,125,129,134,138,143,148,153,158,163,169,174,180,185,191,197,203,209,215,222,228,235,242,248,255,263,270,277,285,292,300,308,316,324,333,341,350,359,368,377,386,395,405,414,424,434,444,454,465,475,486,497,508,519,531,542,554,566,578,590,603,615,628,641,654,667,680,694,708,722,736,750,765,779,794,809,825,840,856,872,888,904,920,937,954,971,988,1005,1023 +#define PWM1_LEVELS 0,1,1,1,2,3,3,4,5,6,7,8,9,10,11,13,14,16,17,19,21,23,25,27,29,31,34,36,39,42,44,47,50,53,57,60,63,67,70,74,77,81,85,88,92,96,99,103,107,110,113,117,120,123,126,128,130,133,134,136,137,137,137,137,136,135,133,130,126,122,117,111,104,96,87,76,65,52,38,22,23,25,26,27,28,29,30,32,33,34,36,37,39,40,42,43,45,47,49,51,53,55,57,59,61,63,66,68,70,73,76,78,81,84,87,90,93,96,99,103,106,110,113,117,121,125,129,133,137,142,146,151,155,160,165,170,175,181,186,192,197,203,209,215,222,228,234,241,248,255 #undef PWM2_LEVELS +#undef PWM_TOPS +#define PWM_TOPS 16383,16383,12404,8140,11462,14700,11041,12947,13795,14111,14124,13946,13641,13248,12791,13418,12808,13057,12385,12428,12358,12209,12000,11746,11459,11147,11158,10793,10708,10576,10173,9998,9800,9585,9527,9278,9023,8901,8634,8486,8216,8053,7881,7615,7440,7261,7009,6832,6656,6422,6196,6031,5819,5615,5419,5190,4973,4803,4571,4386,4179,3955,3745,3549,3340,3145,2940,2729,2513,2312,2109,1903,1697,1491,1286,1070,871,662,459,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 #undef DEFAULT_LEVEL #define DEFAULT_LEVEL 50 #undef MAX_1x7135 @@ -28,14 +31,14 @@ #undef RAMP_DISCRETE_CEIL #undef RAMP_DISCRETE_STEPS -#define RAMP_SMOOTH_FLOOR 3 // level 1 is unreliable +#define RAMP_SMOOTH_FLOOR 1 // level 1 may be unreliable #define RAMP_SMOOTH_CEIL 130 // 10, 30, [50], 70, 90, 110, 130 (plus [150] on turbo) #define RAMP_DISCRETE_FLOOR 10 #define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL #define RAMP_DISCRETE_STEPS 7 -// safe limit ~67% power / ~1200 lm (can sustain 900 lm) +// safe limit ~1000 lm (can sustain 900 lm) #undef SIMPLE_UI_FLOOR #undef SIMPLE_UI_CEIL #define SIMPLE_UI_FLOOR RAMP_DISCRETE_FLOOR @@ -49,9 +52,13 @@ // (only needed on no-FET build) #define PARTY_STROBE_ONTIME 2 -// stop panicking at ~90% power or ~1600 lm +// jump start a bit higher than base driver +#undef JUMP_START_MOON +#define JUMP_START_MOON 25 + +// stop panicking at ~1300 lm #undef THERM_FASTER_LEVEL -#define THERM_FASTER_LEVEL 143 +#define THERM_FASTER_LEVEL 140 #undef MIN_THERM_STEPDOWN -#define MIN_THERM_STEPDOWN DEFAULT_LEVEL +#define MIN_THERM_STEPDOWN 80 // must be > end of dynamic PWM range diff --git a/spaghetti-monster/anduril/cfg-noctigon-kr4.h b/spaghetti-monster/anduril/cfg-noctigon-kr4.h index 82b8df5..f5625c7 100644 --- a/spaghetti-monster/anduril/cfg-noctigon-kr4.h +++ b/spaghetti-monster/anduril/cfg-noctigon-kr4.h @@ -24,31 +24,40 @@ // 1/1023: 2.56 lm // max regulated: 1740 lm // FET: ~3700 lm -// maxreg at 130: level_calc.py cube 2 150 7135 0 2.5 1740 FET 1 10 2565 -// maxreg at 120: level_calc.py cube 2 150 7135 0 2.5 1740 FET 1 10 3190 #define RAMP_LENGTH 150 -#define PWM1_LEVELS 0,0,1,1,2,2,3,3,4,4,5,6,7,8,9,10,11,13,14,15,17,19,20,22,24,26,28,30,33,35,38,40,43,46,49,52,55,59,62,66,70,74,78,82,86,91,96,100,105,111,116,121,127,133,139,145,151,158,165,172,179,186,193,201,209,217,225,234,243,251,261,270,280,289,299,310,320,331,342,353,364,376,388,400,412,425,438,451,464,478,492,506,521,536,551,566,582,597,614,630,647,664,681,699,717,735,754,772,792,811,831,851,871,892,913,935,956,978,1001,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,0 -#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,51,79,109,138,168,198,229,260,292,324,357,390,423,457,492,527,562,598,634,671,708,746,784,822,861,901,941,982,1023 -#define DEFAULT_LEVEL 46 -#define MAX_1x7135 120 -#define HALFSPEED_LEVEL 10 -#define QUARTERSPEED_LEVEL 2 - -#define RAMP_SMOOTH_FLOOR 3 // level 1 is unreliable -#define RAMP_SMOOTH_CEIL 120 -// 10, 28, [46], 65, 83, 101, [120] +#define USE_DYN_PWM +// nice low lows, but might have visible ripple on some lights: +// maxreg at 130, dynamic PWM: level_calc.py 5.01 2 149 7135 1 0.3 1740 FET 1 10 3190 --pwm dyn:64:16384:255 +// (plus one extra level at the beginning for moon) +#define PWM1_LEVELS 0,1,1,2,2,3,4,5,6,7,8,9,11,12,14,16,17,19,22,24,26,29,31,34,37,40,43,46,49,53,56,60,63,67,71,74,78,82,86,89,93,96,99,103,105,108,110,112,114,115,116,116,115,114,112,109,106,101,95,89,81,71,60,48,34,19,20,21,22,23,24,26,27,28,30,31,32,34,36,37,39,41,43,45,47,49,51,53,56,58,61,63,66,69,72,75,78,81,84,88,91,95,99,103,107,111,115,119,124,129,133,138,143,149,154,159,165,171,177,183,189,196,203,210,217,224,231,239,247,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0 +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,20,30,41,52,63,75,87,99,112,125,138,151,165,179,194,208,224,239,255 +#define PWM_TOPS 16383,16383,11750,14690,9183,12439,13615,13955,13877,13560,13093,12529,13291,12513,12756,12769,11893,11747,12085,11725,11329,11316,10851,10713,10518,10282,10016,9729,9428,9298,8971,8794,8459,8257,8043,7715,7497,7275,7052,6753,6538,6260,5994,5798,5501,5271,5006,4758,4525,4268,4030,3775,3508,3263,3010,2752,2517,2256,1998,1763,1512,1249,994,749,497,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 +// less ripple, but lows are a bit higher than ideal: +// maxreg at 130, dynamic PWM: level_calc.py 5.01 2 149 7135 1 0.3 1740 FET 1 10 3190 --pwm dyn:64:4096:255 +// (plus one extra level at the beginning for moon) +//#define PWM1_LEVELS 0,1,1,1,1,1,1,2,2,2,2,3,3,3,4,4,5,5,6,6,7,8,8,9,10,11,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,32,33,33,34,34,34,34,34,34,33,32,31,30,28,26,24,21,19,20,21,22,23,24,26,27,28,30,31,32,34,36,37,39,41,43,45,47,49,51,53,56,58,61,63,66,69,72,75,78,81,84,88,91,95,99,103,107,111,115,119,124,129,133,138,143,149,154,159,165,171,177,183,189,196,203,210,217,224,231,239,247,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0 +//#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,20,30,41,52,63,75,87,99,112,125,138,151,165,179,194,208,224,239,255 +//#define PWM_TOPS 4095,4095,3760,3403,3020,2611,2176,3582,3062,2515,1940,3221,2761,2283,2998,2584,3004,2631,2899,2555,2735,2836,2538,2606,2636,2638,2387,2382,2361,2328,2286,2238,2185,2129,2070,2010,1949,1887,1826,1766,1706,1648,1591,1536,1482,1429,1379,1329,1242,1199,1122,1084,1016,953,895,842,791,723,659,602,549,482,422,367,302,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 +#define MAX_1x7135 130 +#define DEFAULT_LEVEL 50 +#define HALFSPEED_LEVEL 12 +#define QUARTERSPEED_LEVEL 4 + +#define RAMP_SMOOTH_FLOOR 3 // level 1 may be unreliable +#define RAMP_SMOOTH_CEIL 130 +// 10 30 [50] 70 90 110 [130] #define RAMP_DISCRETE_FLOOR 10 #define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL #define RAMP_DISCRETE_STEPS 7 -// safe limit ~30% power / ~1400 lm (can sustain 900 lm) +// safe limit ~30% power / ~1300 lm (can sustain 900 lm) #define SIMPLE_UI_FLOOR RAMP_DISCRETE_FLOOR -#define SIMPLE_UI_CEIL 110 +#define SIMPLE_UI_CEIL 120 #define SIMPLE_UI_STEPS 5 -// stop panicking at ~25% power or ~1000 lm -#define THERM_FASTER_LEVEL 100 -#define MIN_THERM_STEPDOWN DEFAULT_LEVEL +// stop panicking at ~1300 lm +#define THERM_FASTER_LEVEL 120 +#define MIN_THERM_STEPDOWN 66 // must be > end of dynamic PWM range #define THERM_NEXT_WARNING_THRESHOLD 16 // accumulate less error before adjusting #define THERM_RESPONSE_MAGNITUDE 128 // bigger adjustments @@ -58,5 +67,10 @@ #define THERM_CAL_OFFSET 5 +// the power regulator is a bit slow, so push it harder for a quick response from off +#define JUMP_START_MOON 25 +#define BLINK_BRIGHTNESS DEFAULT_LEVEL +#define BLINK_ONCE_TIME 12 + // can't reset the normal way because power is connected before the button #define USE_SOFT_FACTORY_RESET diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c index d6a14ef..503f90f 100644 --- a/spaghetti-monster/fsm-ramping.c +++ b/spaghetti-monster/fsm-ramping.c @@ -151,6 +151,32 @@ void set_level(uint8_t level) { #endif #endif // ifdef USE_TINT_RAMPING + + #ifdef USE_DYN_PWM + // pulse frequency modulation, a.k.a. dynamic PWM + PWM1_TOP = PWM_GET(pwm_tops, level); + #ifdef PMW2_TOP + PWM2_TOP = PWM_GET(pwm_tops, level); + #endif + #ifdef PMW3_TOP + PWM3_TOP = PWM_GET(pwm_tops, level); + #endif + + // reset the phase, to avoid random long pulses + // see attiny1634 reference manual page 103 for a warning about + // the timing of changing the TOP value (section 12.8.4) + // (we don't care about being phase-correct, so the brute-force + // approach can be used to reset it here) + #ifdef PWM1_CNT + PWM1_CNT = 0; + #endif + #ifdef PWM2_CNT + PWM2_CNT = 0; + #endif + #ifdef PWM3_CNT + PWM3_CNT = 0; + #endif + #endif } #endif // ifdef OVERRIDE_SET_LEVEL #ifdef USE_DYNAMIC_UNDERCLOCKING diff --git a/spaghetti-monster/fsm-ramping.h b/spaghetti-monster/fsm-ramping.h index 8fd89c7..d1ef6bc 100644 --- a/spaghetti-monster/fsm-ramping.h +++ b/spaghetti-monster/fsm-ramping.h @@ -53,7 +53,9 @@ void gradual_tick(); #define PWM_GET(x,y) pgm_read_byte(x+y) #else #define PWM_DATATYPE uint16_t +#ifndef PWM_TOP #define PWM_TOP 1023 // 10 bits by default +#endif // pointer plus 2*y bytes //#define PWM_GET(x,y) pgm_read_word(x+(2*y)) // nope, the compiler was already doing the math correctly @@ -74,6 +76,12 @@ PROGMEM const PWM_DATATYPE pwm3_levels[] = { PWM3_LEVELS }; PROGMEM const PWM_DATATYPE pwm4_levels[] = { PWM4_LEVELS }; #endif +// pulse frequency modulation, a.k.a. dynamic PWM +// (different ceiling / frequency at each ramp level) +#ifdef USE_DYN_PWM +PROGMEM const PWM_DATATYPE pwm_tops[] = { PWM_TOPS }; +#endif + // default / example ramps #ifndef PWM1_LEVELS #if PWM_CHANNELS == 1 -- cgit v1.2.3