aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hwdef-FF_PL47.h24
-rw-r--r--spaghetti-monster/anduril/anduril.c9
-rwxr-xr-xspaghetti-monster/anduril/build-all.sh1
-rw-r--r--spaghetti-monster/anduril/cfg-ff-pl47.h59
-rw-r--r--spaghetti-monster/fsm-misc.c12
-rw-r--r--tk-attiny.h3
6 files changed, 108 insertions, 0 deletions
diff --git a/hwdef-FF_PL47.h b/hwdef-FF_PL47.h
new file mode 100644
index 0000000..4189220
--- /dev/null
+++ b/hwdef-FF_PL47.h
@@ -0,0 +1,24 @@
+/* Fireflies PL47 driver layout
+ */
+// same as a D4S, basically
+#include "hwdef-Emisar_D4S.h"
+#undef FSM_EMISAR_D4S_DRIVER
+#undef FSM_EMISAR_D4_DRIVER
+
+// ... except the PL47 has aux LEDs on pin 7
+#ifdef AUXLED_PIN
+#undef AUXLED_PIN
+#endif
+#define AUXLED_PIN PB2 // pin 7
+
+// ... and switch LEDs on pin 3
+#ifdef AUXLED2_PIN
+#undef AUXLED2_PIN
+#endif
+#define AUXLED2_PIN PB4 // pin 3
+
+// average drop across diode on this hardware
+#ifdef VOLTAGE_FUDGE_FACTOR
+#undef VOLTAGE_FUDGE_FACTOR
+#endif
+#define VOLTAGE_FUDGE_FACTOR 7 // add 0.35V
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index 1d4d0d2..d15e9a0 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -102,6 +102,9 @@
#elif defined(FSM_EMISAR_D4S_DRIVER)
#include "cfg-emisar-d4s.h"
+#elif defined(FSM_FF_PL47_DRIVER)
+#include "cfg-ff-pl47.h"
+
#elif defined(FSM_FF_ROT66_DRIVER)
#include "cfg-ff-rot66.h"
@@ -1186,6 +1189,9 @@ uint8_t lockout_state(EventPtr event, uint16_t arg) {
#else
mode = (mode + 1) % 3;
#endif
+ #ifdef INDICATOR_LED_SKIP_LOW
+ if (mode == 1) { mode ++; }
+ #endif
indicator_led_mode = (mode << 2) + (indicator_led_mode & 0x03);
indicator_led(mode);
save_config();
@@ -1202,6 +1208,9 @@ uint8_t lockout_state(EventPtr event, uint16_t arg) {
#else
uint8_t mode = (arg >> 5) % 3;
#endif
+ #ifdef INDICATOR_LED_SKIP_LOW
+ if (mode == 1) { mode ++; }
+ #endif
indicator_led_mode = (indicator_led_mode & 0b11111100) | mode;
#ifdef TICK_DURING_STANDBY
if (mode == 3)
diff --git a/spaghetti-monster/anduril/build-all.sh b/spaghetti-monster/anduril/build-all.sh
index f652e16..9e2a83c 100755
--- a/spaghetti-monster/anduril/build-all.sh
+++ b/spaghetti-monster/anduril/build-all.sh
@@ -12,6 +12,7 @@ for TARGET in \
EMISAR_D4_219C \
EMISAR_D4S \
EMISAR_D4S_219C \
+ FF_PL47 \
FF_ROT66 \
FF_ROT66_219 \
FW3A \
diff --git a/spaghetti-monster/anduril/cfg-ff-pl47.h b/spaghetti-monster/anduril/cfg-ff-pl47.h
new file mode 100644
index 0000000..d916e06
--- /dev/null
+++ b/spaghetti-monster/anduril/cfg-ff-pl47.h
@@ -0,0 +1,59 @@
+// Fireflies PL47 config options for Anduril
+
+// the button lights up
+#define USE_INDICATOR_LED
+// the aux LEDs are in the same place as the main LEDs
+#ifdef USE_INDICATOR_LED_WHILE_RAMPING
+#undef USE_INDICATOR_LED_WHILE_RAMPING
+#endif
+//#define USE_INDICATOR_LED_WHILE_RAMPING
+// enable blinking indicator LED while off?
+#define TICK_DURING_STANDBY
+
+// If TICK_DURING_STANDBY is enabled...
+// off mode: high (2)
+// lockout: blinking (3)
+#define INDICATOR_LED_DEFAULT_MODE ((3<<2) + 2)
+
+// the "low" mode doesn't work on this light's aux LEDs
+// (but it does work on the switch LEDs)
+//#define INDICATOR_LED_SKIP_LOW
+
+// ... or if TICK_DURING_STANDBY is turned off:
+// off mode: high (2)
+// lockout: off (0)
+//#define INDICATOR_LED_DEFAULT_MODE ((0<<2) + 2)
+
+
+#ifdef RAMP_LENGTH
+#undef RAMP_LENGTH
+#endif
+#define RAMP_LENGTH 150
+
+// driver is a FET + 3x7135, ~400 lm at highest regulated level
+// ramp copied from Emisar D4S ramp
+#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,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,1,3,4,5,7,8,10,11,13,14,16,18,19,21,23,25,27,29,31,34,36,38,41,43,46,48,51,54,57,60,63,66,69,72,76,79,83,87,91,95,99,103,107,112,116,121,126,131,136,141,146,152,158,163,169,175,182,188,195,202,209,216,223,231,239,247,255
+#define MAX_1x7135 83
+#define HALFSPEED_LEVEL 13
+#define QUARTERSPEED_LEVEL 6
+
+// ceiling is level 120/150
+#define RAMP_SMOOTH_CEIL (MAX_LEVEL*4/5)
+
+// thermal regulation parameters
+#ifdef MIN_THERM_STEPDOWN
+#undef MIN_THERM_STEPDOWN // this should be lower, because 3x7135 instead of 1x7135
+#endif
+#define MIN_THERM_STEPDOWN 60 // lowest value it'll step down to
+
+// regulate down faster when the FET is active, slower otherwise
+#define THERM_FASTER_LEVEL 130 // throttle back faster when high
+
+// play it safe, don't try to regulate above the recommended safe level
+#define THERM_HARD_TURBO_DROP
+
+// don't do this
+#undef BLINK_AT_CHANNEL_BOUNDARIES
+#undef BLINK_AT_RAMP_CEILING
+
diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c
index e60909e..e61fe00 100644
--- a/spaghetti-monster/fsm-misc.c
+++ b/spaghetti-monster/fsm-misc.c
@@ -113,14 +113,26 @@ void indicator_led(uint8_t lvl) {
case 0: // indicator off
DDRB &= 0xff ^ (1 << AUXLED_PIN);
PORTB &= 0xff ^ (1 << AUXLED_PIN);
+ #ifdef AUXLED2_PIN // second LED mirrors the first
+ DDRB &= 0xff ^ (1 << AUXLED2_PIN);
+ PORTB &= 0xff ^ (1 << AUXLED2_PIN);
+ #endif
break;
case 1: // indicator low
DDRB &= 0xff ^ (1 << AUXLED_PIN);
PORTB |= (1 << AUXLED_PIN);
+ #ifdef AUXLED2_PIN // second LED mirrors the first
+ DDRB &= 0xff ^ (1 << AUXLED2_PIN);
+ PORTB |= (1 << AUXLED2_PIN);
+ #endif
break;
default: // indicator high
DDRB |= (1 << AUXLED_PIN);
PORTB |= (1 << AUXLED_PIN);
+ #ifdef AUXLED2_PIN // second LED mirrors the first
+ DDRB |= (1 << AUXLED2_PIN);
+ PORTB |= (1 << AUXLED2_PIN);
+ #endif
break;
}
}
diff --git a/tk-attiny.h b/tk-attiny.h
index d121709..54856bf 100644
--- a/tk-attiny.h
+++ b/tk-attiny.h
@@ -96,6 +96,9 @@
#elif defined(FSM_EMISAR_D1S_DRIVER)
#include "hwdef-Emisar_D1S.h"
+#elif defined(FSM_FF_PL47_DRIVER)
+#include "hwdef-FF_PL47.h"
+
#elif defined(FSM_FF_ROT66_DRIVER)
#include "hwdef-FF_ROT66.h"