aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spaghetti-monster/anduril/cfg-ff-e01.h15
-rw-r--r--spaghetti-monster/fireflies-ui/Makefile2
-rwxr-xr-xspaghetti-monster/fireflies-ui/build-all.sh2
-rw-r--r--spaghetti-monster/fireflies-ui/cfg-ff-e01.h44
-rw-r--r--spaghetti-monster/fireflies-ui/cfg-ff-e07-2.h (renamed from spaghetti-monster/fireflies-ui/cfg-ff-edc-thrower.h)16
-rw-r--r--spaghetti-monster/fireflies-ui/fireflies-ui.c76
6 files changed, 128 insertions, 27 deletions
diff --git a/spaghetti-monster/anduril/cfg-ff-e01.h b/spaghetti-monster/anduril/cfg-ff-e01.h
new file mode 100644
index 0000000..3b47165
--- /dev/null
+++ b/spaghetti-monster/anduril/cfg-ff-e01.h
@@ -0,0 +1,15 @@
+// Fireflies E01 SST-40 thrower config options for Anduril
+// most of the good stuff is in the FFUI config; just copy it
+#include "../fireflies-ui/cfg-ff-e01.h"
+
+#ifndef BLINK_AT_RAMP_CEILING
+#define BLINK_AT_RAMP_CEILING
+#endif
+
+// 20, 38, 56, 75, [93], 111, 130 (93 is highest regulated)
+// (9 / 45 / 116 / 248 / 467 / 742 / 1280 + 2140 lm)
+#undef RAMP_DISCRETE_STEPS
+#define RAMP_DISCRETE_STEPS 7
+
+// shortcut for first-time setup
+#define USE_TENCLICK_THERMAL_CONFIG
diff --git a/spaghetti-monster/fireflies-ui/Makefile b/spaghetti-monster/fireflies-ui/Makefile
index 8db198e..0b59898 100644
--- a/spaghetti-monster/fireflies-ui/Makefile
+++ b/spaghetti-monster/fireflies-ui/Makefile
@@ -2,6 +2,6 @@ all:
./build-all.sh
clean:
- rm -f *.hex cfg-*.h *~ *.elf *.o
+ rm -f *.hex cfg-ff-[pr]*.h *~ *.elf *.o
.phony: clean
diff --git a/spaghetti-monster/fireflies-ui/build-all.sh b/spaghetti-monster/fireflies-ui/build-all.sh
index 41d92d0..81ebd97 100755
--- a/spaghetti-monster/fireflies-ui/build-all.sh
+++ b/spaghetti-monster/fireflies-ui/build-all.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-cp -av ../anduril/cfg-ff*.h .
+cp -av --no-clobber ../anduril/cfg-ff*.h .
UI=fireflies-ui
diff --git a/spaghetti-monster/fireflies-ui/cfg-ff-e01.h b/spaghetti-monster/fireflies-ui/cfg-ff-e01.h
new file mode 100644
index 0000000..42c23b2
--- /dev/null
+++ b/spaghetti-monster/fireflies-ui/cfg-ff-e01.h
@@ -0,0 +1,44 @@
+// Fireflies EDC thrower config options for Fireflies UI
+// (uses PL47 driver)
+#include "hwdef-FF_PL47.h"
+
+// disable indicator LED; it's hardwired
+#ifdef USE_INDICATOR_LED
+#undef USE_INDICATOR_LED
+#endif
+
+// don't do this
+#undef BLINK_AT_RAMP_MIDDLE
+#undef BLINK_AT_RAMP_CEILING
+
+// ramp shape and size
+#define RAMP_LENGTH 150
+
+// driver is a FET + 3x7135, ~413 lm at highest regulated level
+// ../../../bin/level_calc.py seventh 2 150 7135 1 12 414 FET 2 10 1930
+#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,15,16,17,18,20,21,22,23,24,26,27,28,30,31,33,34,36,38,39,41,43,45,47,49,51,53,56,58,60,63,65,68,71,74,77,80,83,86,89,93,96,100,103,107,111,115,119,124,128,132,137,142,147,152,157,163,168,174,180,186,192,198,204,211,218,225,232,240,247,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,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,0,0,0,0,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,5,7,9,12,14,16,19,22,24,27,30,33,36,39,42,45,48,52,55,58,62,66,69,73,77,81,85,90,94,98,103,107,112,117,122,127,132,137,143,148,154,160,166,172,178,184,191,197,204,211,218,225,232,240,247,255
+#define MAX_1x7135 93
+#define HALFSPEED_LEVEL 14
+#define QUARTERSPEED_LEVEL 7
+
+#define MIN_THERM_STEPDOWN 65 // lowest value it'll step down to
+
+
+// ceiling is level 130/150 (50% power)
+#define RAMP_SMOOTH_FLOOR 1
+#define RAMP_SMOOTH_CEIL 130
+
+// 20, 56, [93], 130 (93 is highest regulated)
+// (8 / 102 / 413 / 1163 + 1930 lm)
+#define RAMP_DISCRETE_FLOOR 20
+#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
+#define RAMP_DISCRETE_STEPS 4
+
+// ~25 lm to ~400 lm
+#define MUGGLE_FLOOR 30
+#define MUGGLE_CEILING MAX_1x7135
+
+// throttle back faster when high
+#define THERM_FASTER_LEVEL 130
+
diff --git a/spaghetti-monster/fireflies-ui/cfg-ff-edc-thrower.h b/spaghetti-monster/fireflies-ui/cfg-ff-e07-2.h
index 31be0ef..48f9c15 100644
--- a/spaghetti-monster/fireflies-ui/cfg-ff-edc-thrower.h
+++ b/spaghetti-monster/fireflies-ui/cfg-ff-e07-2.h
@@ -1,20 +1,20 @@
-// Fireflies EDC thrower config options for Fireflies UI
+// Fireflies E07-2 config options for Anduril / FFUI
+// mostly the same as PL47
#include "cfg-ff-pl47.h"
-// disable indicator LED
-#undef USE_INDICATOR_LED
-
-// ceiling is level 130/150 (50% power)
+// ceiling is level 130/150 (50% power)
#undef RAMP_SMOOTH_CEIL
#define RAMP_SMOOTH_CEIL 130
-// 36, 83, 130 (83 is highest regulated)
+// 20, 56, 93, 130 (83 is highest regulated)
+// (requested config is 1%, 5%, 25%, 50%, double-click-turbo)
+// (but this doesn't allow us to hit level 83)
#undef RAMP_DISCRETE_FLOOR
-#define RAMP_DISCRETE_FLOOR 36
+#define RAMP_DISCRETE_FLOOR 20
#undef RAMP_DISCRETE_CEIL
#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
#undef RAMP_DISCRETE_STEPS
-#define RAMP_DISCRETE_STEPS 3
+#define RAMP_DISCRETE_STEPS 4
// regulate down faster when the FET is active, slower otherwise
#undef THERM_FASTER_LEVEL
diff --git a/spaghetti-monster/fireflies-ui/fireflies-ui.c b/spaghetti-monster/fireflies-ui/fireflies-ui.c
index 0fc2a1d..234ae92 100644
--- a/spaghetti-monster/fireflies-ui/fireflies-ui.c
+++ b/spaghetti-monster/fireflies-ui/fireflies-ui.c
@@ -33,7 +33,7 @@
// or too short)
#define MOON_TIMING_HINT
// short blips while ramping
-#define BLINK_AT_CHANNEL_BOUNDARIES
+#define BLINK_AT_RAMP_MIDDLE
//#define BLINK_AT_RAMP_FLOOR
#define BLINK_AT_RAMP_CEILING
//#define BLINK_AT_STEPS // whenever a discrete ramp mode is passed in smooth mode
@@ -319,8 +319,28 @@ void save_config_wl();
#define RAMP_DISCRETE_STEPS 7
#endif
+// mile marker(s) partway up the ramp
+// default: blink only at border between regulated and FET
+#ifdef BLINK_AT_RAMP_MIDDLE
+ #if PWM_CHANNELS >= 3
+ #ifndef BLINK_AT_RAMP_MIDDLE_1
+ #define BLINK_AT_RAMP_MIDDLE_1 MAX_Nx7135
+ #ifndef BLINK_AT_RAMP_MIDDLE_2
+ #define BLINK_AT_RAMP_MIDDLE_2 MAX_1x7135
+ #endif
+ #endif
+ #else
+ #ifndef BLINK_AT_RAMP_MIDDLE_1
+ #define BLINK_AT_RAMP_MIDDLE_1 MAX_1x7135
+ #endif
+ #endif
+#endif
+
// brightness control
-uint8_t memorized_level = MAX_1x7135;
+#ifndef DEFAULT_LEVEL
+#define DEFAULT_LEVEL MAX_1x7135
+#endif
+uint8_t memorized_level = DEFAULT_LEVEL;
// smooth vs discrete ramping
volatile uint8_t ramp_style = 0; // 0 = smooth, 1 = discrete
volatile uint8_t ramp_smooth_floor = RAMP_SMOOTH_FLOOR;
@@ -450,7 +470,7 @@ uint8_t off_state(Event event, uint16_t arg) {
// let the user know they can let go now to stay at moon
uint8_t temp = actual_level;
set_level(0);
- delay_4ms(2);
+ delay_4ms(3);
set_level(temp);
} else
#endif
@@ -531,8 +551,26 @@ uint8_t off_state(Event event, uint16_t arg) {
return MISCHIEF_MANAGED;
}
#endif
- // 7 clicks: temperature check
+ #ifdef USE_INDICATOR_LED
+ // 7 clicks: change indicator LED mode
else if (event == EV_7clicks) {
+ uint8_t mode = (indicator_led_mode & 3) + 1;
+ #ifdef TICK_DURING_STANDBY
+ mode = mode & 3;
+ #else
+ mode = mode % 3;
+ #endif
+ #ifdef INDICATOR_LED_SKIP_LOW
+ if (mode == 1) { mode ++; }
+ #endif
+ indicator_led_mode = (indicator_led_mode & 0b11111100) | mode;
+ indicator_led(mode);
+ save_config();
+ return MISCHIEF_MANAGED;
+ }
+ #endif
+ // 8 clicks: temperature check
+ else if (event == EV_8clicks) {
set_state(tempcheck_state, 0);
return MISCHIEF_MANAGED;
}
@@ -635,9 +673,13 @@ uint8_t steady_state(Event event, uint16_t arg) {
return MISCHIEF_MANAGED;
}
#ifdef USE_REVERSING
- // make it ramp down instead, if already at max
- if ((arg <= 1) && (actual_level >= mode_max)) {
- ramp_direction = -1;
+ // fix ramp direction on first frame if necessary
+ if (!arg) {
+ // make it ramp down instead, if already at max
+ if (actual_level >= mode_max) { ramp_direction = -1; }
+ // make it ramp up if already at min
+ // (off->hold->stepped_min->release causes this state)
+ else if (actual_level <= mode_min) { ramp_direction = 1; }
}
memorized_level = nearest_level((int16_t)actual_level \
+ (ramp_step_size * ramp_direction));
@@ -647,15 +689,15 @@ uint8_t steady_state(Event event, uint16_t arg) {
#ifdef USE_THERMAL_REGULATION
target_level = memorized_level;
#endif
- #if defined(BLINK_AT_RAMP_CEILING) || defined(BLINK_AT_CHANNEL_BOUNDARIES)
+ #if defined(BLINK_AT_RAMP_CEILING) || defined(BLINK_AT_RAMP_MIDDLE)
// only blink once for each threshold
if ((memorized_level != actual_level) && (
0 // for easier syntax below
- #ifdef BLINK_AT_CHANNEL_BOUNDARIES
- || (memorized_level == MAX_1x7135)
- #if PWM_CHANNELS >= 3
- || (memorized_level == MAX_Nx7135)
+ #ifdef BLINK_AT_RAMP_MIDDLE_1
+ || (memorized_level == BLINK_AT_RAMP_MIDDLE_1)
#endif
+ #ifdef BLINK_AT_RAMP_MIDDLE_2
+ || (memorized_level == BLINK_AT_RAMP_MIDDLE_2)
#endif
#ifdef BLINK_AT_RAMP_CEILING
|| (memorized_level == mode_max)
@@ -712,15 +754,15 @@ uint8_t steady_state(Event event, uint16_t arg) {
#ifdef USE_THERMAL_REGULATION
target_level = memorized_level;
#endif
- #if defined(BLINK_AT_RAMP_FLOOR) || defined(BLINK_AT_CHANNEL_BOUNDARIES)
+ #if defined(BLINK_AT_RAMP_FLOOR) || defined(BLINK_AT_RAMP_MIDDLE)
// only blink once for each threshold
if ((memorized_level != actual_level) && (
0 // for easier syntax below
- #ifdef BLINK_AT_CHANNEL_BOUNDARIES
- || (memorized_level == MAX_1x7135)
- #if PWM_CHANNELS >= 3
- || (memorized_level == MAX_Nx7135)
+ #ifdef BLINK_AT_RAMP_MIDDLE_1
+ || (memorized_level == BLINK_AT_RAMP_MIDDLE_1)
#endif
+ #ifdef BLINK_AT_RAMP_MIDDLE_2
+ || (memorized_level == BLINK_AT_RAMP_MIDDLE_2)
#endif
#ifdef BLINK_AT_RAMP_FLOOR
|| (memorized_level == mode_min)
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.