From 25e8da3db9acee2c809176fa1f9169a65844f582 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 7 Oct 2018 18:52:00 -0600 Subject: First working PL47 build. Does aux LEDs on pin 7 but not pin 3. --- spaghetti-monster/anduril/anduril.c | 3 ++ spaghetti-monster/anduril/build-all.sh | 1 + spaghetti-monster/anduril/cfg-ff-pl47.h | 55 +++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 spaghetti-monster/anduril/cfg-ff-pl47.h (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index 1d4d0d2..4aaea74 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" 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..5a623fc --- /dev/null +++ b/spaghetti-monster/anduril/cfg-ff-pl47.h @@ -0,0 +1,55 @@ +// 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) + +// ... 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 + -- cgit v1.2.3 From 477082fc0c8671988b7bcac2a6d816b80a9fe675 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 7 Oct 2018 19:19:37 -0600 Subject: Added option to skip "low" mode for aux LEDs. Not actually used though. --- spaghetti-monster/anduril/anduril.c | 6 ++++++ spaghetti-monster/anduril/cfg-ff-pl47.h | 4 ++++ 2 files changed, 10 insertions(+) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index 4aaea74..d15e9a0 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -1189,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(); @@ -1205,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/cfg-ff-pl47.h b/spaghetti-monster/anduril/cfg-ff-pl47.h index 5a623fc..d916e06 100644 --- a/spaghetti-monster/anduril/cfg-ff-pl47.h +++ b/spaghetti-monster/anduril/cfg-ff-pl47.h @@ -15,6 +15,10 @@ // 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) -- cgit v1.2.3 From 7c3fe5878da90e1b5f540ebb2547e974715a6f98 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 7 Oct 2018 19:20:19 -0600 Subject: Made second aux LED copy the behavior of the first. (to make the PL47 switch LEDs mirror the front-facing aux LEDs) --- spaghetti-monster/fsm-misc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'spaghetti-monster') 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; } } -- cgit v1.2.3