aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2019-10-15 02:34:47 -0600
committerSelene ToyKeeper2019-10-15 02:34:47 -0600
commitc2e7b42b14271acbae1b28ae2289005dcb92e420 (patch)
tree23a3aa19171fc461b25acad76afc94599c362cc7
parentslowed down rainbow RGB mode, added a ramp-down on stuck-button for safety pu... (diff)
parentmerged Emisar D4S V2 support branch (diff)
downloadanduril-c2e7b42b14271acbae1b28ae2289005dcb92e420.tar.gz
anduril-c2e7b42b14271acbae1b28ae2289005dcb92e420.tar.bz2
anduril-c2e7b42b14271acbae1b28ae2289005dcb92e420.zip
merged changes from fsm branch, including version check and stuck-button safety
-rw-r--r--README7
-rwxr-xr-xbin/build.sh4
-rwxr-xr-xbin/level_calc.py24
-rw-r--r--hwdef-Emisar_D4Sv2.h124
-rw-r--r--hwdef-Mateminco_MF01-Mini.h51
-rw-r--r--spaghetti-monster/anduril/anduril-ui.pngbin286759 -> 281904 bytes
-rw-r--r--spaghetti-monster/anduril/anduril.c42
-rw-r--r--spaghetti-monster/anduril/anduril.svg238
-rw-r--r--spaghetti-monster/anduril/anduril.txt6
-rwxr-xr-xspaghetti-monster/anduril/build-all.sh2
-rw-r--r--spaghetti-monster/anduril/cfg-blf-lantern.h3
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d18.h6
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h10
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4sv2.h63
-rw-r--r--spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h61
-rw-r--r--spaghetti-monster/anduril/version.h4
-rw-r--r--spaghetti-monster/fsm-events.c2
-rw-r--r--spaghetti-monster/fsm-misc.c7
18 files changed, 596 insertions, 58 deletions
diff --git a/README b/README
index 3cb27e9..1e6e842 100644
--- a/README
+++ b/README
@@ -28,6 +28,7 @@ Some useful hardware for flashing firmware:
http://www.fasttech.com/product/1002900-atmega-attiny-51-avr-isp-usbasp-usb-programmer
http://www.fasttech.com/product/1011800-40-pin-splittable-ribbon-cable-20cm
http://www.digikey.com/product-detail/en/5250/501-1311-ND/745102
+ HQ ProgKey: http://budgetlightforum.com/node/63230
Ratus' guide: https://redd.it/8g5l5w (prices checked 2018-05-01)
@@ -69,6 +70,12 @@ To set up an attiny dev environment on Ubuntu (13.10):
Optional: (make avrdude usable by non-root users, is a security risk)
sudo chmod u+s $(which avrdude)
+To set up an attiny dev environment on Fedora (30):
+
+ sudo dnf install flex byacc bison gcc libusb libusb-devel glibc-devel
+ sudo dnf install avr-gcc avr-libc avr-binutils
+ sudo dnf install avrdude
+
Building/installing attiny dev tools on other UNIX systems (in general):
http://www.ladyada.net/learn/avr/setup-unix.html
diff --git a/bin/build.sh b/bin/build.sh
index 192fa30..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
diff --git a/bin/level_calc.py b/bin/level_calc.py
index f16f8ce..74385da 100755
--- a/bin/level_calc.py
+++ b/bin/level_calc.py
@@ -14,7 +14,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?'),
]
@@ -152,6 +152,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/255)' % (cnum, i, channel.modes[i-1]))
+
def get_value(text, default, args):
"""Get input from the user, or from the command line args."""
@@ -179,11 +189,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():
diff --git a/hwdef-Emisar_D4Sv2.h b/hwdef-Emisar_D4Sv2.h
new file mode 100644
index 0000000..da3a0ca
--- /dev/null
+++ b/hwdef-Emisar_D4Sv2.h
@@ -0,0 +1,124 @@
+#ifndef HWDEF_EMISAR_D4SV2_H
+#define HWDEF_EMISAR_D4SV2_H
+
+/* Emisar D4Sv2 driver layout (attiny1634)
+ * (same layout as D4v2, except it's a FET+3+1 instead of FET+1)
+ *
+ * Pin / Name / Function
+ * 1 PA6 FET PWM (PWM1B)
+ * 2 PA5 red aux LED (PWM0B)
+ * 3 PA4 green aux LED
+ * 4 PA3 blue aux LED
+ * 5 PA2 e-switch
+ * 6 PA1 (none)
+ * 7 PA0 (none)
+ * 8 GND GND
+ * 9 VCC VCC
+ * 10 PC5 (none)
+ * 11 PC4 (none)
+ * 12 PC3 RESET
+ * 13 PC2 (none)
+ * 14 PC1 SCK
+ * 15 PC0 3x7135 PWM (PWM0A)
+ * 16 PB3 1x7135 PWM (PWM1A)
+ * 17 PB2 MISO
+ * 18 PB1 MOSI
+ * 19 PB0 (none)
+ * 20 PA7 (none)
+ * ADC12 thermal sensor
+ */
+
+#ifdef ATTINY
+#undef ATTINY
+#endif
+#define ATTINY 1634
+#include <avr/io.h>
+
+#define SWITCH_PIN PA2 // pin 5
+#define SWITCH_PCINT PCINT2 // pin 5 pin change interrupt
+#define SWITCH_PCIE PCIE0 // PCIE0 is for PCINT[7:0]
+#define SWITCH_PCMSK PCMSK0 // PCMSK0 is for PCINT[7:0]
+#define SWITCH_PORT PINA // PINA or PINB or PINC
+
+#define PWM_CHANNELS 3
+
+#define PWM1_PIN PB3 // pin 16, 1x7135 PWM
+#define PWM1_LVL OCR1A // OCR1A is the output compare register for PB3
+
+#define PWM2_PIN PC0 // pin 15, 3x7135 PWM
+#define PWM2_LVL OCR0A // OCR0A is the output compare register for PC0
+
+#define PWM3_PIN PA6 // pin 1, FET PWM
+#define PWM3_LVL OCR1B // OCR1B is the output compare register for PB1
+
+
+#define ADC_PRSCL 0x06 // clk/64
+
+// average drop across diode on this hardware
+#ifndef VOLTAGE_FUDGE_FACTOR
+#define VOLTAGE_FUDGE_FACTOR 4 // add 0.20V (measured 0.22V)
+#endif
+
+#define TEMP_CHANNEL 0b00001111
+
+// this light has aux LEDs under the optic
+#define AUXLED_R_PIN PA5 // pin 2
+#define AUXLED_G_PIN PA4 // pin 3
+#define AUXLED_B_PIN PA3 // pin 4
+#define AUXLED_RGB_PORT PORTA // PORTA or PORTB or PORTC
+#define AUXLED_RGB_DDR DDRA // DDRA or DDRB or DDRC
+#define AUXLED_RGB_PUE PUEA // PUEA or PUEB or PUEC
+
+// with so many pins, doing this all with #ifdefs gets awkward...
+// ... so just hardcode it in each hwdef file instead
+inline void hwdef_setup() {
+ // enable output ports
+ // FET, aux R/G/B
+ DDRA = (1 << PWM3_PIN)
+ | (1 << AUXLED_R_PIN)
+ | (1 << AUXLED_G_PIN)
+ | (1 << AUXLED_B_PIN)
+ ;
+ // 1x7135
+ DDRB = (1 << PWM1_PIN);
+ // 3x7135
+ DDRC = (1 << PWM2_PIN);
+
+ // configure PWM
+ // Setup PWM. F_pwm = F_clkio / 2 / N / TOP, where N = prescale factor, TOP = top of counter
+ // pre-scale for timer: N = 1
+ // WGM1[3:0]: 0,0,0,1: PWM, Phase Correct, 8-bit (DS table 12-5)
+ // CS1[2:0]: 0,0,1: clk/1 (No prescaling) (DS table 12-6)
+ // COM1A[1:0]: 1,0: PWM OC1A in the normal direction (DS table 12-4)
+ // COM1B[1:0]: 1,0: PWM OC1B in the normal direction (DS table 12-4)
+ TCCR1A = (0<<WGM11) | (1<<WGM10) // 8-bit (TOP=0xFF) (DS table 12-5)
+ | (1<<COM1A1) | (0<<COM1A0) // PWM 1A in normal direction (DS table 12-4)
+ | (1<<COM1B1) | (0<<COM1B0) // PWM 1B in normal direction (DS table 12-4)
+ ;
+ TCCR1B = (0<<CS12) | (0<<CS11) | (1<<CS10) // clk/1 (no prescaling) (DS table 12-6)
+ | (0<<WGM13) | (0<<WGM12) // phase-correct PWM (DS table 12-5)
+ ;
+
+ // WGM0[2:0]: 0,0,1: PWM, Phase Correct (DS table 11-8)
+ // CS0[2:0]: 0,0,1: clk/1 (No prescaling) (DS table 11-9)
+ // COM0A[1:0]: 1,0: PWM OC0A in the normal direction (DS table 11-4)
+ // COM0B[1:0]: 0,0: OC0B disabled (DS table 11-7)
+ // TCCR0A: COM0A1, COM0A0, COM0B1, COM0B0, -, -, WGM01, WGM00
+ TCCR0A = (0<<WGM01) | (1<<WGM00) // PWM, Phase Correct, TOP=0xFF (DS table 11-5)
+ | (1<<COM1A1) | (0<<COM1A0) // PWM 0A in normal direction (DS table 11-4)
+ | (0<<COM1B1) | (0<<COM1B0) // PWM 0B disabled (DS table 11-7)
+ ;
+ // TCCR0B: FOC0A, FOC0B, -, -, WGM02, CS02, CS01, CS00
+ TCCR0B = (0<<CS02) | (0<<CS01) | (1<<CS00) // clk/1 (no prescaling) (DS table 11-9)
+ | (0<<WGM02) // PWM, Phase Correct, TOP=0xFF (DS table 11-8)
+ ;
+
+ // set up e-switch
+ //PORTA = (1 << SWITCH_PIN); // TODO: configure PORTA / PORTB / PORTC?
+ PUEA = (1 << SWITCH_PIN); // pull-up for e-switch
+ SWITCH_PCMSK = (1 << SWITCH_PCINT); // enable pin change interrupt
+}
+
+#define LAYOUT_DEFINED
+
+#endif
diff --git a/hwdef-Mateminco_MF01-Mini.h b/hwdef-Mateminco_MF01-Mini.h
new file mode 100644
index 0000000..6c420d7
--- /dev/null
+++ b/hwdef-Mateminco_MF01-Mini.h
@@ -0,0 +1,51 @@
+#ifndef HWDEF_MF01_MINI_H
+#define HWDEF_MF01_MINI_H
+
+/* MF01-Mini driver layout
+ * ----
+ * Reset -|1 8|- VCC
+ * eswitch -|2 7|- aux LEDs
+ * FET PWM -|3 6|- PWM (7x7135)
+ * GND -|4 5|- PWM (1x7135)
+ * ----
+ */
+
+#define PWM_CHANNELS 3
+
+#ifndef AUXLED_PIN
+#define AUXLED_PIN PB2 // pin 7
+#endif
+
+#ifndef SWITCH_PIN
+#define SWITCH_PIN PB3 // pin 2
+#define SWITCH_PCINT PCINT3 // pin 2 pin change interrupt
+#endif
+
+#ifndef PWM1_PIN
+#define PWM1_PIN PB0 // pin 5, 1x7135 PWM
+#define PWM1_LVL OCR0A // OCR0A is the output compare register for PB0
+#endif
+#ifndef PWM2_PIN
+#define PWM2_PIN PB1 // pin 6, 7x7135 PWM
+#define PWM2_LVL OCR0B // OCR0B is the output compare register for PB1
+#endif
+#ifndef PWM3_PIN
+#define PWM3_PIN PB4 // pin 3, FET PWM
+#define PWM3_LVL OCR1B // OCR1B is the output compare register for PB4
+#endif
+
+#define ADC_PRSCL 0x06 // clk/64
+
+// average drop across diode on this hardware
+#ifndef VOLTAGE_FUDGE_FACTOR
+#define VOLTAGE_FUDGE_FACTOR 5 // add 0.25V
+#endif
+
+#define TEMP_CHANNEL 0b00001111
+
+#define FAST 0xA3 // fast PWM both channels
+#define PHASE 0xA1 // phase-correct PWM both channels
+
+#define LAYOUT_DEFINED
+
+#endif
diff --git a/spaghetti-monster/anduril/anduril-ui.png b/spaghetti-monster/anduril/anduril-ui.png
index 3c032bc..70f6be0 100644
--- a/spaghetti-monster/anduril/anduril-ui.png
+++ b/spaghetti-monster/anduril/anduril-ui.png
Binary files differ
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index e8524a8..9f87dff 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -35,6 +35,8 @@
// (currently incompatible with factory reset)
//#define START_AT_MEMORIZED_LEVEL
+// include a function to blink out the firmware version
+#define USE_VERSION_CHECK
// short blip when crossing from "click" to "hold" from off
// (helps the user hit moon mode exactly, instead of holding too long
@@ -483,6 +485,11 @@ uint8_t triangle_wave(uint8_t phase);
volatile uint8_t beacon_seconds = 2;
#endif
+#ifdef USE_VERSION_CHECK
+#include "version.h"
+const PROGMEM uint8_t version_number[] = VERSION_NUMBER;
+uint8_t version_check_state(Event event, uint16_t arg);
+#endif
uint8_t off_state(Event event, uint16_t arg) {
// turn emitter off when entering state
@@ -682,6 +689,13 @@ uint8_t off_state(Event event, uint16_t arg) {
return MISCHIEF_MANAGED;
}
#endif
+ #ifdef USE_VERSION_CHECK
+ // 15+ clicks: show the version number
+ else if (event == EV_15clicks) {
+ set_state(version_check_state, 0);
+ return MISCHIEF_MANAGED;
+ }
+ #endif
#if defined(USE_FACTORY_RESET) && defined(USE_SOFT_FACTORY_RESET)
// 13 clicks and hold the last click: invoke factory reset (reboot)
else if (event == EV_click13_hold) {
@@ -796,6 +810,11 @@ uint8_t steady_state(Event event, uint16_t arg) {
else if ((arg > TICKS_PER_SECOND * 5) && (actual_level >= mode_max)) {
ramp_direction = -1;
}
+ // if the button is still stuck, lock the light
+ else if ((arg > TICKS_PER_SECOND * 10) && (actual_level <= mode_min)) {
+ blip();
+ set_state(lockout_state, 0);
+ }
memorized_level = nearest_level((int16_t)actual_level \
+ (ramp_step_size * ramp_direction));
#else
@@ -1960,6 +1979,13 @@ uint8_t muggle_state(Event event, uint16_t arg) {
#endif
+#ifdef USE_VERSION_CHECK
+uint8_t version_check_state(Event event, uint16_t arg) {
+ return EVENT_NOT_HANDLED;
+}
+#endif
+
+
// ask the user for a sequence of numbers, then save them and return to caller
uint8_t config_state_base(Event event, uint16_t arg,
uint8_t num_config_steps,
@@ -2587,6 +2613,22 @@ void loop() {
if (0) {}
+ #ifdef USE_VERSION_CHECK
+ else if (state == version_check_state) {
+ for (uint8_t i=0; i<sizeof(version_number)-1; i++) {
+ blink_digit(pgm_read_byte(version_number + i) - '0');
+ nice_delay_ms(300);
+ }
+ // FIXME: when user interrupts with button, "off" takes an extra click
+ // before it'll turn back on, because the click to cancel gets sent
+ // to the "off" state instead of version_check_state
+ //while (button_is_pressed()) {}
+ //empty_event_sequence();
+
+ set_state(off_state, 0);
+ }
+ #endif // #ifdef USE_VERSION_CHECK
+
#ifdef USE_STROBE_STATE
else if ((state == strobe_state)
|| ((state == momentary_state) && (momentary_mode == 1) && (momentary_active)) ) { // also handle momentary strobes
diff --git a/spaghetti-monster/anduril/anduril.svg b/spaghetti-monster/anduril/anduril.svg
index 36840a4..d58e478 100644
--- a/spaghetti-monster/anduril/anduril.svg
+++ b/spaghetti-monster/anduril/anduril.svg
@@ -22,6 +22,49 @@
inkscape:export-ydpi="109.75774">
<defs
id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Mend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="marker19840"
+ style="overflow:visible;"
+ inkscape:isstock="true">
+ <path
+ id="path18419"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+ transform="scale(0.4) rotate(180) translate(10,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="marker18673"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path18416"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+ transform="scale(0.4) translate(10,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker17250"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path17248"
+ d="M 0,0 5,-5 -12.5,0 5,5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="matrix(0.4,0,0,0.4,4,0)"
+ inkscape:connector-curvature="0" />
+ </marker>
<linearGradient
inkscape:collect="always"
id="linearGradient7690">
@@ -57,7 +100,7 @@
<path
id="path61710"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
- style="fill:#7777ff;fill-opacity:1;fill-rule:evenodd;stroke:#7777ff;stroke-width:1.00000003pt;stroke-opacity:1"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(0.4,0,0,0.4,4,0)"
inkscape:connector-curvature="0" />
</marker>
@@ -1896,16 +1939,6 @@
style="fill-rule:evenodd;stroke:#000000;stroke-width:0.42666668pt"
inkscape:connector-curvature="0" />
</marker>
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient1694"
- id="linearGradient1364-8"
- x1="415.74805"
- y1="495.00006"
- x2="415.74805"
- y2="215.43314"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(904.95044,-71.333651)" />
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
@@ -2773,6 +2806,42 @@
style="fill-rule:evenodd;stroke:#000000;stroke-width:0.42666668pt"
inkscape:connector-curvature="0" />
</marker>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient1694"
+ id="linearGradient1364-8-7"
+ x1="415.74805"
+ y1="495.00006"
+ x2="415.74805"
+ y2="215.43314"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(904.95036,-71.333648)" />
+ <marker
+ inkscape:stockid="Arrow1Mend"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow1Mend-597-9-5-1"
+ style="overflow:visible">
+ <path
+ id="path3856-76-6-3-3"
+ d="M -4.2666667,0 -6.4,2.1333333 1.0666667,0 -6.4,-2.1333333 Z"
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:0.42666668pt"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Mend"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow1Mend-88-34"
+ style="overflow:visible">
+ <path
+ id="path3856-868-0"
+ d="M -4.2666667,0 -6.4,2.1333333 1.0666667,0 -6.4,-2.1333333 Z"
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:0.42666668pt"
+ inkscape:connector-curvature="0" />
+ </marker>
</defs>
<sodipodi:namedview
id="base"
@@ -2786,10 +2855,10 @@
inkscape:cy="568.52482"
inkscape:document-units="px"
inkscape:current-layer="layer1"
- showgrid="false"
+ showgrid="true"
showguides="true"
gridtolerance="1"
- inkscape:window-width="2389"
+ inkscape:window-width="2548"
inkscape:window-height="1415"
inkscape:window-x="0"
inkscape:window-y="0"
@@ -2799,12 +2868,16 @@
fit-margin-right="0.5"
fit-margin-bottom="0.5"
units="px"
- inkscape:snap-global="false"
+ inkscape:snap-global="true"
inkscape:snap-bbox="true"
- inkscape:bbox-paths="true"
- inkscape:bbox-nodes="true"
+ inkscape:bbox-paths="false"
+ inkscape:bbox-nodes="false"
inkscape:snap-bbox-edge-midpoints="true"
- inkscape:snap-bbox-midpoints="true">
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-midpoints="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true">
<inkscape:grid
type="xygrid"
id="grid3065"
@@ -2876,6 +2949,49 @@
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<rect
+ style="opacity:1;fill:url(#linearGradient1364-8-7);fill-opacity:1;stroke:#000000;stroke-width:3.20000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1356-0-3"
+ width="37.795277"
+ height="264.56693"
+ x="1320.6984"
+ y="144.09947" />
+ <image
+ y="145.69688"
+ x="1339.1499"
+ id="image21186"
+ xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAMgCAYAAADVw8ezAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
+WXMAAC4mAAAuJgFVH1qAAAAAB3RJTUUH4wgWFywjmzkvJwAABGZJREFUeNrt08ENg0AQBEFjbf6R
+9vP+kMUKoeoQpjTXOef+6TX9TQBEQIAICBABASIgQAREQIAICBABASIgQAREQIAICBABASIgQARE
+QIAICBABASIgQAREQIAICBABASIgQAREQIAICBABASIgQAREQIAICBABASIgQAREQIAICBABASIg
+QAREQIAICBABASIgQAREQIAICBABASIgQAQEiIAICBABASIgX28qK3iIgAARECACAkRAgAiIgAAR
+ECACAkRAgAiIgAARECACAkRAgAiIgAARECACAkRAgAiIgAARECACAkRAgAiIgAARECACAkRAgAiI
+gAARECACAkRAgAiIgAARECACAkRAgAiIgAARECACAkRAgAgIEAERECACAkRAgAgIEAERECACAkRA
+gGivqazgIQICRECACAgQAQEiIAICRECACAgQAQEiIAICRECACAgQAQEiIAICRECACAgQAQEiIAIC
+RECACAgQAQEiIAICRECACAgQAQEiIAICRECACAgQAQEiIAICRECACAgQAQEiIAICRECACAgQAQEi
+IEAERECACAgQAQEiIEAERECACAgQAQGivaaygocICBABASIgQAQEiIAICBABASIgQAQEiIAICBAB
+ASIgQAQEiIAICBABASIgQAQEiIAICBABASIgQAQEiIAICBABASIgQAQEiIAICBABASIgQAQEiIAI
+CBABASIgQAQEiIAICBABASIgQAQEiIAAERABASIgQAQEiIAAERABASIgQAQEiPaaygoeIiBABASI
+gAARECACIiBABASIgAARECACIiBABASIgAARECACIiBABASIgAARECACIiBABASIgAARECACIiBA
+BASIgAARECACIiBABASIgAARECACIiBABASIgAARECACIiBABASIgAARECACAkRABASIgAARECAC
+AkRABASIgAARECDaayoreIiAABEQIAICRECACIiAABEQIAICRECACIiAABEQIAICRECACIiAABEQ
+IAICRECACIiAABEQIAICRECACIiAABEQIAICRECACIiAABEQIAICRECACIiAABEQIAICRECACIiA
+ABEQIAICRECACAgQAREQIAICRECACAgQAREQIAICRECAaK+prOAhAgJEQIAICBABASIgAgJEQIAI
+CBABASIgAgJEQIAICBABASIgAgJEQIAICBABASIgAgJEQIAICBABASIgAgJEQIAICBABASIgAgJE
+QIAICBABASIgAgJEQIAICBABASIgAgJEQIAICBABASIgQAREQIAICBABASIgQAREQIAICBABAaK9
+prKChwgIEAEBIiBABASIgAgIEAEBIiBABASIgAgIEAEBIiBABASIgAgIEAEBIiBABASIgAgIEAEB
+IiBABASIgAgIEAEBIiBABASIgAgIEAEBIiBABASIgAgIEAEBIiBABASIgAgIEAEBIiBABASIgAAR
+EAEBIiBABASIgAAREAEBIiBABASI9noABIsdhY+pbIsAAAAASUVORK5CYII=
+"
+ preserveAspectRatio="none"
+ height="261.36438"
+ width="17.741749" />
+ <path
+ style="opacity:1;fill:#c0c0c0;fill-opacity:1;stroke:#040000;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.80000007,1.80000007;stroke-dashoffset:2.19000029;stroke-opacity:1"
+ d="m 1339.1499,145.69688 0,261.36438"
+ id="path15687-2-6-9"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" />
+ <rect
style="fill:none;stroke:#000000;stroke-width:2.13333344;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect5159-4"
width="416.73956"
@@ -3113,13 +3229,6 @@
id="path5213-6-8-4-9-9-8-4-4"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
- <rect
- style="opacity:1;fill:url(#linearGradient1364-8);fill-opacity:1;stroke:#000000;stroke-width:3.20000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
- id="rect1356-0"
- width="37.795277"
- height="264.56693"
- x="1320.6984"
- y="144.09947" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.80000019px;line-height:0%;font-family:'DejaVu Sans';-inkscape-font-specification:Sans;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.06666672"
@@ -3136,35 +3245,35 @@
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.80000019px;line-height:0%;font-family:'DejaVu Sans';-inkscape-font-specification:Sans;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.06666672"
x="1268.1858"
- y="203.77095"
+ y="201.6805"
id="text3021-8-4-1-8-6-14-2-4-7-7-9"
transform="scale(1.0975814,0.91109416)"><tspan
sodipodi:role="line"
x="1268.1858"
- y="203.77095"
+ y="201.6805"
id="tspan3613-9-7-5-6"
style="font-size:17.06666756px;line-height:1.25;stroke-width:1.06666672">Ceil</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.80000019px;line-height:0%;font-family:'DejaVu Sans';-inkscape-font-specification:Sans;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.06666672"
x="1263.0579"
- y="426.17856"
+ y="417.30948"
id="text3021-8-4-1-8-6-14-2-4-7-7-3-1"
transform="scale(1.0975814,0.91109416)"><tspan
sodipodi:role="line"
x="1263.0579"
- y="426.17856"
+ y="417.30948"
id="tspan3613-9-7-5-5-0"
style="font-size:17.06666756px;line-height:1.25;stroke-width:1.06666672">Floor</tspan></text>
<path
style="fill:none;stroke:#009d00;stroke-width:2.13333344;stroke-miterlimit:4;stroke-dasharray:12.8, 2.13333333;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Mend-62-70)"
- d="M 1419.75,188.60753 V 372.1669"
+ d="m 1419.75,188.60753 0,174.38457"
id="path5213-6-8-2-4"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
- style="fill:none;stroke:#000000;stroke-width:2.13333344;stroke-miterlimit:4;stroke-dasharray:12.8, 2.13333333;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Mend-62-7-5)"
- d="M 1400.1843,366.71374 V 191.75683"
+ style="fill:none;stroke:#000000;stroke-width:2.1329999;stroke-miterlimit:4;stroke-dasharray:12.79799938,2.1329999;stroke-dashoffset:7.46549964;stroke-opacity:1;marker-end:url(#Arrow1Mend-62-7-5)"
+ d="M 1400.1843,359.40373 V 191.75683"
id="path5213-6-8-2-9-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
@@ -3245,22 +3354,16 @@
</g>
<path
style="opacity:1;fill:#c0c0c0;fill-opacity:1;stroke:#040000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:4, 4;stroke-dashoffset:7.30000019;stroke-opacity:1"
- d="m 1319.7047,180.764 h 69.7795"
+ d="m 1319.7047,178.2642 h 69.7795"
id="path15687-2-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#009d00;stroke-width:2.13333344;stroke-miterlimit:4;stroke-dasharray:12.8, 2.13333333;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Mend-367-6-0)"
- d="m 1131.0344,258.42719 c 48.1809,-3.99296 64.2076,-2.68523 79.9712,-42.47521 42.8072,-108.05255 133.489,-146.16407 131.2384,-34.5044"
+ d="m 1131.0344,258.42719 c 48.1809,-3.99296 64.2076,-2.68523 79.9712,-42.47521 42.8072,-108.05255 130.8373,-147.401507 128.5867,-35.74184"
id="path5213-6-8-4-9-9-9-29-5-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" />
- <path
- style="opacity:1;fill:#c0c0c0;fill-opacity:1;stroke:#040000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:4, 4;stroke-dashoffset:0;stroke-opacity:1"
- d="m 1319.7047,381.98134 h 64.5803"
- id="path15687-9-5"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cc" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:24px;line-height:0%;font-family:'DejaVu Sans';-inkscape-font-specification:Sans;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.06666672"
@@ -3842,19 +3945,19 @@
id="tspan7287-5-5-6-6-1"> 6 Clicks</tspan></textPath></text>
<path
style="fill:none;stroke:none;stroke-width:1.32938921;stroke-miterlimit:4;stroke-dasharray:1.32938933, 1.32938933;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Mend-88-9-4-0-4-9)"
- d="m 1400.1241,365.79536 c 0,0 0.043,-10.40514 -0.024,5.00754"
+ d="m 1400.1843,364.54546 c 0,0 -0.017,-16.32727 -0.084,-0.91459"
id="path5213-6-8-4-9-9-1-3-0-0-6-4-9"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#000000;stroke-width:2.13333344;stroke-miterlimit:4;stroke-dasharray:4.26666689, 4.26666689;stroke-dashoffset:4.05333376;stroke-opacity:1;marker-start:url(#marker14034-2-9);marker-end:url(#Arrow1Mend-597-9-5)"
- d="m 1159.7225,198.62656 c 67.9862,-0.44112 68.743,-36.42258 0.1793,-35.70399"
+ d="m 954.34165,198.62656 c 67.98625,-0.44112 68.74305,-36.42258 0.1793,-35.70399"
id="path5213-6-8-4-9-9-8-7-3-8"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<g
id="g18567"
- transform="translate(13.62988,7.3367765)">
+ transform="translate(-191.75097,7.3367765)">
<text
id="text56273"
y="160.56241"
@@ -3898,7 +4001,7 @@
</g>
<g
id="g18572"
- transform="translate(-76.57207,43.516866)">
+ transform="translate(-281.95292,43.516866)">
<rect
ry="3"
rx="3"
@@ -4249,7 +4352,7 @@
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Mend-367-6-0-0)"
- d="m 1131.0344,258.42719 c 48.1809,-3.99296 64.2076,-2.68523 79.9712,-42.47521 42.8072,-108.05255 133.489,-146.164071 131.2384,-34.5044"
+ d="m 1131.0344,258.42719 c 48.1809,-3.99296 64.2076,-2.68523 79.9712,-42.47521 42.8072,-108.05255 130.8373,-147.401511 128.5867,-35.74184"
id="path5213-6-8-4-9-9-9-29-5-2-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" />
@@ -4289,7 +4392,7 @@
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Mend-62-70-9)"
- d="M 1419.75,188.60753 V 372.1669"
+ d="M 1419.75,188.60753 V 362.9921"
id="path5213-6-8-2-4-1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
@@ -4639,11 +4742,11 @@
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:14.66666698px;line-height:110.00000238%;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- x="1185.0386"
+ x="979.65771"
y="185.57895"
id="text39623-4-9-0-0"><tspan
sodipodi:role="line"
- x="1185.0386"
+ x="979.65771"
y="185.57895"
id="tspan39625-9-1-3-5">3C</tspan></text>
<text
@@ -4666,8 +4769,8 @@
y="1179.0468"
id="tspan39625-9-1-3-9">3C</tspan></text>
<path
- style="fill:none;stroke:#040404;stroke-width:2.18333006;stroke-miterlimit:4;stroke-dasharray:13.09998035, 2.18333006;stroke-dashoffset:1.30999804;stroke-opacity:1;marker-end:url(#Arrow1Mend-367-6-0-0-2)"
- d="m 1130.3238,305.57915 c 48.1809,3.99296 64.2076,2.68523 79.9712,42.47521 42.8072,108.05255 133.489,146.16407 131.2384,34.5044"
+ style="fill:none;stroke:#040404;stroke-width:2.18300009;stroke-miterlimit:4;stroke-dasharray:13.09800053,2.18300009;stroke-dashoffset:6.76730027;stroke-opacity:1;marker-end:url(#Arrow1Mend-367-6-0-0-2)"
+ d="m 1130.3238,305.57915 c 48.1809,3.99296 64.2076,2.68523 79.9712,42.47521 42.8072,108.05255 131.144,142.50981 129.1171,41.94961"
id="path5213-6-8-4-9-9-9-29-5-2-7-4"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" />
@@ -4799,5 +4902,42 @@
x="1091.5458"
y="1212.6874"
id="tspan43995-1">Factory Reset: Loosen tailcap, Hold button, Tighten tailcap, Hold 3s (or 13H from Off)</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.29780102px;line-height:110.00000238%;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70212275px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="1341.7825"
+ y="220.06078"
+ id="text39623-4-9-0-0-1"
+ transform="scale(0.99329477,1.0067505)"><tspan
+ sodipodi:role="line"
+ x="1341.7825"
+ y="220.06078"
+ id="tspan39625-9-1-3-5-0"
+ style="stroke-width:0.70212275px">3C</tspan></text>
+ <g
+ id="g21114"
+ transform="matrix(0.5165354,0,0,0.5165354,676.70758,110.93007)">
+ <path
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.13333344;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:4.26666689, 4.26666689;stroke-dashoffset:4.26666689;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+ d="m 1263.3125,222.54688 h 4.2676 v -2.13282 h -4.2676 z m 8.5332,0 h 4.2676 v -2.13282 h -4.2676 z m 8.5332,0 h 4.2676 v -2.13282 h -4.2676 z m 8.5352,0 h 4.2656 v -2.13282 h -4.2656 z m 8.5332,0 h 4.2656 v -2.13282 h -4.2656 z"
+ id="path5213-6-8-4-9-9-8-3-3"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.85333344pt;stroke-opacity:1"
+ d="m 1267.5798,221.48082 4.2667,-4.26667 -14.9333,4.26667 14.9333,4.26667 z"
+ id="path21120"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.85333344pt;stroke-opacity:1"
+ d="m 1297.3647,221.48082 -4.2667,4.26667 14.9333,-4.26667 -14.9333,-4.26667 z"
+ id="path21122"
+ inkscape:connector-curvature="0" />
+ </g>
+ <path
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#040000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:4,4;stroke-dashoffset:3.4;stroke-opacity:1"
+ d="m 1319.7047,390.82553 h 19.4452 l 0,-16.40309 h 28.99 16.1451"
+ id="path15687-9-5-1"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccc" />
</g>
</svg>
diff --git a/spaghetti-monster/anduril/anduril.txt b/spaghetti-monster/anduril/anduril.txt
index db73cdb..0a3dc4c 100644
--- a/spaghetti-monster/anduril/anduril.txt
+++ b/spaghetti-monster/anduril/anduril.txt
@@ -162,6 +162,12 @@ Indicator LED / aux LED support:
TODO:
+ - change 6C to 6H for exiting muggle mode?
+ - move muggle mode from 6C to ... 8C or something?
+ - add 4H from lockout to turn light on and start ramping up?
+ - move config modes to 5C instead of 4C, and move manual memory to 4C?
+ - remove beacon config mode, and use a hold to set timing instead?
+ - rewrite muggle mode to split it into on and off states
* save settings in eeprom
* decide on "hold until hot" or "click N times" for thermal config mode
* test thermal regulation on an actual light
diff --git a/spaghetti-monster/anduril/build-all.sh b/spaghetti-monster/anduril/build-all.sh
index 56a88bf..42a36fd 100755
--- a/spaghetti-monster/anduril/build-all.sh
+++ b/spaghetti-monster/anduril/build-all.sh
@@ -2,6 +2,8 @@
UI=anduril
+date '+#define VERSION_NUMBER "%Y%m%d"' > version.h
+
for TARGET in cfg-*.h ; do
NAME=$(echo "$TARGET" | perl -ne '/cfg-(.*).h/ && print "$1\n";')
echo "===== $NAME ====="
diff --git a/spaghetti-monster/anduril/cfg-blf-lantern.h b/spaghetti-monster/anduril/cfg-blf-lantern.h
index 9467397..bf183eb 100644
--- a/spaghetti-monster/anduril/cfg-blf-lantern.h
+++ b/spaghetti-monster/anduril/cfg-blf-lantern.h
@@ -51,6 +51,9 @@
#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
#define RAMP_DISCRETE_STEPS 5
+#define MUGGLE_FLOOR 15 // about 20 lm
+#define MUGGLE_CEILING 115 // about 350 lm
+
// the sensor (attiny85) is nowhere near the emitters
// so thermal regulation can't work
#ifdef USE_THERMAL_REGULATION
diff --git a/spaghetti-monster/anduril/cfg-emisar-d18.h b/spaghetti-monster/anduril/cfg-emisar-d18.h
index 16fbacd..02e8f01 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d18.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d18.h
@@ -16,6 +16,12 @@
#define USE_TENCLICK_THERMAL_CONFIG
+// save space, and remove a mode which doesn't make much sense on this light
+#ifdef USE_MUGGLE_MODE
+#undef USE_MUGGLE_MODE
+#endif
+
+
// level_calc.py seventh 3 150 7135 1 1.4 117.99 7135 6 1 1706.86 FET 3 10 13000
// (designed to make 1x hit at level 50, and Nx hit at level 100)
#define RAMP_LENGTH 150
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h b/spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h
new file mode 100644
index 0000000..9898246
--- /dev/null
+++ b/spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h
@@ -0,0 +1,10 @@
+// Emisar D4Sv2-219 config options for Anduril
+#include "cfg-emisar-d4sv2.h"
+// ATTINY: 1634
+
+#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
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4sv2.h b/spaghetti-monster/anduril/cfg-emisar-d4sv2.h
new file mode 100644
index 0000000..acc9101
--- /dev/null
+++ b/spaghetti-monster/anduril/cfg-emisar-d4sv2.h
@@ -0,0 +1,63 @@
+// Emisar D4S V2 config options for Anduril
+#include "hwdef-Emisar_D4Sv2.h"
+// ATTINY: 1634
+
+// this light has three aux LED channels: R, G, B
+#define USE_AUX_RGB_LEDS
+// the aux LEDs are front-facing, so turn them off while main LEDs are on
+#ifdef USE_INDICATOR_LED_WHILE_RAMPING
+#undef USE_INDICATOR_LED_WHILE_RAMPING
+#endif
+// enable blinking aux LEDs
+#define TICK_DURING_STANDBY
+#define STANDBY_TICK_SPEED 3 // every 0.128 s
+//#define STANDBY_TICK_SPEED 4 // every 0.256 s
+//#define STANDBY_TICK_SPEED 5 // every 0.512 s
+
+
+// 1x7135 + 3x7135 + FET
+// ../../../bin/level_calc.py seventh 3 150 7135 1 2.3 130 7135 11 5 400.1 FET 2 10 4000
+// (and some manual edits to make the clock speed changes smoother)
+#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,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,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,0
+#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,3,5,6,8,10,12,14,16,18,20,23,25,27,30,32,35,38,41,44,47,50,53,57,60,64,67,71,75,79,83,87,92,96,101,106,111,116,121,127,132,138,144,150,156,163,169,176,183,190,197,205,213,221,229,237,246,255
+#define MAX_1x7135 62
+#define MAX_Nx7135 93
+#define HALFSPEED_LEVEL 18
+#define QUARTERSPEED_LEVEL 8
+
+#define RAMP_SMOOTH_FLOOR 1
+#define RAMP_SMOOTH_CEIL 130
+// 20, 38, 56, 75, [93], 111, 130
+#define RAMP_DISCRETE_FLOOR 20
+#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
+#define RAMP_DISCRETE_STEPS 7
+
+#define DEFAULT_LEVEL MAX_Nx7135
+#define STROBE_BRIGHTNESS MAX_LEVEL
+
+#define MUGGLE_FLOOR RAMP_DISCRETE_FLOOR
+#define MUGGLE_CEILING MAX_Nx7135
+
+// stop panicking at ~50% power or ~2000 lm
+#define THERM_FASTER_LEVEL 130
+
+// no need to be extra-careful on this light
+#ifdef THERM_HARD_TURBO_DROP
+#undef THERM_HARD_TURBO_DROP
+#endif
+
+// respond to thermal changes faster
+#define THERMAL_WARNING_SECONDS 3
+#define THERMAL_UPDATE_SPEED 2
+#define THERM_PREDICTION_STRENGTH 4
+
+// easier access to thermal config mode, for Emisar
+#define USE_TENCLICK_THERMAL_CONFIG
+
+#ifdef BLINK_AT_RAMP_MIDDLE
+#undef BLINK_AT_RAMP_MIDDLE
+#endif
+
+// seems relevant on attiny1634
+#define THERM_CAL_OFFSET 5
diff --git a/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h
new file mode 100644
index 0000000..a1d366d
--- /dev/null
+++ b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h
@@ -0,0 +1,61 @@
+// Mateminco/Astrolux MF01-Mini options for Anduril
+#include "hwdef-Mateminco_MF01-Mini.h"
+
+// the button lights up
+#define USE_INDICATOR_LED
+//#define INDICATOR_LED_SKIP_LOW // low mode doesn't work on this driver
+// the button is visible while main LEDs are on
+//#define USE_INDICATOR_LED_WHILE_RAMPING
+// enable blinking indicator LED while off
+#define TICK_DURING_STANDBY
+#define STANDBY_TICK_SPEED 3 // every 0.128 s
+#define USE_FANCIER_BLINKING_INDICATOR
+// off mode: low (1)
+// lockout: blinking (3)
+#define INDICATOR_LED_DEFAULT_MODE ((3<<2) + 1)
+
+
+// doesn't quite fit
+#ifdef USE_MUGGLE_MODE
+#undef USE_MUGGLE_MODE
+#endif
+
+
+// don't blink during ramp, it's irrelevant and annoying on this light
+#define BLINK_AT_RAMP_CEILING
+#undef BLINK_AT_RAMP_MIDDLE
+#undef BLINK_AT_RAMP_FLOOR
+
+// measured brightness with Sofirn 5500mAh cell at 3.97V:
+// moon: 0.3 lm
+// channel 1: 113 lm
+// channel 2: 718 lm
+// channel 3: 3500 lm
+// ../../../bin/level_calc.py ninth 3 150 7135 1 2.5 115.65 7135 11 5 708.65 FET 1 10 3500
+// (plus some manual tweaks for a smoother ramp)
+#define RAMP_LENGTH 150
+#define PWM1_LEVELS 1,1,2,2,3,3,4,5,5,6,7,8,9,9,10,14,15,16,17,18,19,20,21,22,24,26,28,30,32,34,37,39,42,45,48,51,54,58,62,65,69,74,78,83,88,93,98,104,110,116,123,130,137,145,153,161,170,179,188,198,208,219,231,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,255,255,255,255,255,255,255,255,255,255,255,255,255,255,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,11,13,16,18,20,23,25,28,31,34,37,40,43,47,50,54,58,62,66,70,75,80,85,90,95,100,106,112,118,125,131,138,145,153,161,169,177,185,194,204,213,223,233,244,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0
+#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,0,0,0,0,0,0,0,0,0,0,3,6,10,13,17,21,24,28,33,37,41,46,50,55,60,66,71,76,82,88,94,101,107,114,121,128,135,143,151,159,167,176,185,194,203,213,223,233,244,255
+#define MAX_1x7135 65 // ~113 lm
+#define MAX_Nx7135 110
+#define HALFSPEED_LEVEL 16
+#define QUARTERSPEED_LEVEL 8
+
+#define RAMP_SMOOTH_FLOOR 1 // ~0.3 lm
+#define RAMP_SMOOTH_CEIL 130 // ~??? lm
+// 14/135/6 = 14, 38, 62, 86, [110], 135
+// 20/110/7 = 20, 35, 50, [65], 80, 95, [110]
+// 15/130/7 = 15, 34, 53, 72, 91, [110], 130 <--
+#define RAMP_DISCRETE_FLOOR 15 // ~?? lm
+#define RAMP_DISCRETE_CEIL 130 // ~??? lm
+#define RAMP_DISCRETE_STEPS 7 // ??, ??, ... lm
+
+
+#define USE_TENCLICK_THERMAL_CONFIG // by request
+#define THERM_FASTER_LEVEL 130 // throttle back faster when high
+//#define THERM_HARD_TURBO_DROP // this light is massively overpowered
+#define THERMAL_WARNING_SECONDS 1 // FIXME: increase by 2 after merging newer code
+//#define THERMAL_UPDATE_SPEED 1
+//#define THERM_PREDICTION_STRENGTH 4
+
diff --git a/spaghetti-monster/anduril/version.h b/spaghetti-monster/anduril/version.h
new file mode 100644
index 0000000..8cf3c90
--- /dev/null
+++ b/spaghetti-monster/anduril/version.h
@@ -0,0 +1,4 @@
+// this file is replaced automatically by the build script
+// set your own date here if you're not using the build script
+// otherwise, default to first human contact with the moon
+#define VERSION_NUMBER "19690720"
diff --git a/spaghetti-monster/fsm-events.c b/spaghetti-monster/fsm-events.c
index 362a5cc..f35607d 100644
--- a/spaghetti-monster/fsm-events.c
+++ b/spaghetti-monster/fsm-events.c
@@ -42,7 +42,7 @@ uint8_t push_event(uint8_t ev_type) {
// set press flag
current_event |= B_PRESS;
// increase click counter
- if ((current_event & B_COUNT) < (B_COUNT-1)) {
+ if ((current_event & B_COUNT) < (B_COUNT)) {
current_event ++;
}
return 1; // event pushed, even if max clicks already reached
diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c
index 18dc7c5..8da7b5b 100644
--- a/spaghetti-monster/fsm-misc.c
+++ b/spaghetti-monster/fsm-misc.c
@@ -41,20 +41,21 @@ void auto_clock_speed() {
#endif
#if defined(USE_BLINK_NUM) || defined(USE_BLINK_DIGIT)
+#define BLINK_SPEED 1000
uint8_t blink_digit(uint8_t num) {
//StatePtr old_state = current_state;
// "zero" digit gets a single short blink
- uint8_t ontime = 200;
+ uint8_t ontime = BLINK_SPEED * 2 / 10;
if (!num) { ontime = 8; num ++; }
for (; num>0; num--) {
set_level(BLINK_BRIGHTNESS);
nice_delay_ms(ontime);
set_level(0);
- nice_delay_ms(400);
+ nice_delay_ms(BLINK_SPEED * 3 / 10);
}
- return nice_delay_ms(600);
+ return nice_delay_ms(BLINK_SPEED * 5 / 10);
}
#endif
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.