aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2019-06-28 03:41:42 -0600
committerSelene ToyKeeper2019-06-28 03:41:42 -0600
commitc7b6a22af23fb611c66d3f6c5d6e9a934589f0ca (patch)
tree8680de353b1449cd8ff9b7e7a12e84a1c4cdece9
parentmerged from fsm branch for updates (diff)
downloadanduril-c7b6a22af23fb611c66d3f6c5d6e9a934589f0ca.tar.gz
anduril-c7b6a22af23fb611c66d3f6c5d6e9a934589f0ca.tar.bz2
anduril-c7b6a22af23fb611c66d3f6c5d6e9a934589f0ca.zip
added support for Mateminco MF01-Mini
-rw-r--r--hwdef-Mateminco_MF01-Mini.h51
-rw-r--r--spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h61
2 files changed, 112 insertions, 0 deletions
diff --git a/hwdef-Mateminco_MF01-Mini.h b/hwdef-Mateminco_MF01-Mini.h
new file mode 100644
index 0000000..9b29776
--- /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, FET 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/cfg-mateminco-mf01-mini.h b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h
new file mode 100644
index 0000000..2d1e5c7
--- /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: high (2)
+// lockout: blinking (3)
+#define INDICATOR_LED_DEFAULT_MODE ((3<<2) + 2)
+
+
+// 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
+#if 1
+#define RAMP_DISCRETE_FLOOR 15 // ~?? lm
+#define RAMP_DISCRETE_CEIL 130 // ~??? lm
+#define RAMP_DISCRETE_STEPS 7 // ??, ??, ... lm
+#else // testing only; for calibrating the ramp in detail
+#define RAMP_DISCRETE_FLOOR 1 // ~?? lm
+#define RAMP_DISCRETE_CEIL 150 // ~??? lm
+#define RAMP_DISCRETE_STEPS 150 // ??, ??, ... lm
+#endif
+
+
+#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
+