aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2018-06-24 18:08:59 -0600
committerSelene ToyKeeper2018-06-24 18:08:59 -0600
commit80967413d823d7d23a2b44caf715c850b38169ea (patch)
tree0925858bc359732f2a8236761bde08909a6947b1 /spaghetti-monster
parentAdded script to build all supported Anduril targets. (diff)
downloadanduril-80967413d823d7d23a2b44caf715c850b38169ea.tar.gz
anduril-80967413d823d7d23a2b44caf715c850b38169ea.tar.bz2
anduril-80967413d823d7d23a2b44caf715c850b38169ea.zip
Initial D4S support for Anduril. (but only the parts which can't be public yet)
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/anduril.c19
-rw-r--r--spaghetti-monster/fsm-ramping.h20
2 files changed, 37 insertions, 2 deletions
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index 3d25c8c..2fec5b4 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -21,6 +21,7 @@
/********* User-configurable options *********/
// Physical driver type (uncomment one of the following or define it at the gcc command line)
//#define FSM_EMISAR_D4_DRIVER
+//#define FSM_EMISAR_D4S_DRIVER
//#define FSM_BLF_Q8_DRIVER
//#define FSM_FW3A_DRIVER
//#define FSM_BLF_GT_DRIVER
@@ -71,6 +72,16 @@
#define TICK_DURING_STANDBY
#define VOLTAGE_FUDGE_FACTOR 7 // add 0.35V
+#elif defined(FSM_EMISAR_D4S_DRIVER)
+#define USE_INDICATOR_LED
+#define TICK_DURING_STANDBY
+#define VOLTAGE_FUDGE_FACTOR 5 // add 0.25V
+#define RAMP_SMOOTH_CEIL (MAX_LEVEL*4/5)
+#undef MIN_THERM_STEPDOWN // this should be lower, because 3x7135 instead of 1x7135
+#define MIN_THERM_STEPDOWN 60 // lowest value it'll step down to
+#undef THERM_DOUBLE_SPEED_LEVEL // this should be lower too, because this light is a hot rod
+#define THERM_DOUBLE_SPEED_LEVEL (RAMP_LENGTH*2/3) // throttle back faster when high
+
#elif defined(FSM_EMISAR_D4_DRIVER)
#define VOLTAGE_FUDGE_FACTOR 5 // add 0.25V
@@ -227,8 +238,12 @@ uint8_t ramp_discrete_step_size; // don't set this
// bits 0-1 control "off" mode
// modes are: 0=off, 1=low, 2=high
// (TODO: 3=blinking)
-//uint8_t indicator_led_mode = (1<<2) + 2;
-uint8_t indicator_led_mode = (2<<2) + 1;
+#ifdef FSM_EMISAR_D4S_DRIVER
+uint8_t indicator_led_mode = (3<<2) + 1;
+#else
+uint8_t indicator_led_mode = (1<<2) + 2;
+//uint8_t indicator_led_mode = (2<<2) + 1;
+#endif
#endif
// calculate the nearest ramp level which would be valid at the moment
diff --git a/spaghetti-monster/fsm-ramping.h b/spaghetti-monster/fsm-ramping.h
index 86742f6..d530f6a 100644
--- a/spaghetti-monster/fsm-ramping.h
+++ b/spaghetti-monster/fsm-ramping.h
@@ -73,6 +73,26 @@ void gradual_tick();
#define MAX_1x7135 60 // where it switches from PWM to current control
#define HALFSPEED_LEVEL 17
#define QUARTERSPEED_LEVEL 6
+ #elif defined(FSM_EMISAR_D4S_DRIVER)
+ // 3x7135 + FET
+ #if 0
+ // ../../bin/level_calc.py 2 150 7135 1 6 450 FET 1 10 1810
+ // (because it made the ramp look better than accurate values)
+ PROGMEM const uint8_t pwm1_levels[] = { 1,1,2,2,3,3,4,5,5,6,7,7,8,9,10,11,12,13,14,15,16,18,19,20,22,23,25,26,28,30,32,33,35,37,39,42,44,46,48,51,53,56,58,61,64,67,70,73,76,79,83,86,89,93,97,100,104,108,112,116,121,125,129,134,139,143,148,153,158,163,169,174,180,185,191,197,203,209,215,222,228,235,241,248,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,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 };
+ PROGMEM const uint8_t 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,1,4,6,9,11,14,16,19,22,24,27,30,33,36,39,42,45,48,51,54,57,61,64,67,71,74,78,82,85,89,93,96,100,104,108,112,116,121,125,129,133,138,142,147,151,156,160,165,170,175,180,185,190,195,200,205,210,216,221,227,232,238,243,249,255 };
+ #define MAX_1x7135 85
+ #define HALFSPEED_LEVEL 11
+ #define QUARTERSPEED_LEVEL 5
+ #else
+ // ../../bin/level_calc.py 2 150 7135 1 11.2 450 FET 1 10 4000
+ // (with a x**9 curve instead of x**3)
+ // (because it made the ramp look better than accurate values)
+ PROGMEM const uint8_t 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 };
+ PROGMEM const uint8_t 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
+ #endif
#else
// ../../bin/level_calc.py 2 150 7135 4 0.33 150 FET 1 10 1500
//PROGMEM const uint8_t pwm1_levels[] = { 4,4,4,5,5,5,6,6,7,7,8,9,10,11,12,13,14,15,17,18,20,21,23,25,27,30,32,34,37,40,43,46,49,52,56,59,63,67,71,76,80,85,90,95,100,106,112,118,124,130,137,144,151,158,166,173,181,190,198,207,216,225,235,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,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0 };
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.