aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-04-29 01:45:00 -0600
committerSelene ToyKeeper2023-04-29 01:45:00 -0600
commit0c88040fa1c2f3ffd5f6b6f6f5b12f5bd2193b06 (patch)
tree9255ba4507ec415e2f8575e3e9e175d5c87a556b
parentmissed this file on previous commit (diff)
downloadanduril-0c88040fa1c2f3ffd5f6b6f6f5b12f5bd2193b06.tar.gz
anduril-0c88040fa1c2f3ffd5f6b6f6f5b12f5bd2193b06.tar.bz2
anduril-0c88040fa1c2f3ffd5f6b6f6f5b12f5bd2193b06.zip
KR4: ramp can use 8 bits, since values never go over 255
also, don't blink at top of linear range
-rw-r--r--hwdef-noctigon-kr4.c2
-rw-r--r--hwdef-noctigon-kr4.h12
-rw-r--r--spaghetti-monster/anduril/cfg-noctigon-kr4.h5
3 files changed, 12 insertions, 7 deletions
diff --git a/hwdef-noctigon-kr4.c b/hwdef-noctigon-kr4.c
index bcb98fc..5813a9b 100644
--- a/hwdef-noctigon-kr4.c
+++ b/hwdef-noctigon-kr4.c
@@ -22,7 +22,7 @@ void set_level_main(uint8_t level) {
PWM_DATATYPE ch1_pwm = PWM_GET(pwm1_levels, level);
PWM_DATATYPE ch2_pwm = PWM_GET(pwm2_levels, level);
// pulse frequency modulation, a.k.a. dynamic PWM
- uint16_t top = PWM_GET(pwm_tops, level);
+ uint16_t top = PWM_GET16(pwm_tops, level);
CH1_PWM = ch1_pwm;
CH2_PWM = ch2_pwm;
diff --git a/hwdef-noctigon-kr4.h b/hwdef-noctigon-kr4.h
index 8caf262..2e19ba4 100644
--- a/hwdef-noctigon-kr4.h
+++ b/hwdef-noctigon-kr4.h
@@ -75,12 +75,12 @@
#define PWM_CHANNELS 2 // old, remove this
-#define PWM_BITS 16 // 0 to 16383 at variable Hz, not 0 to 255 at 16 kHz
-#define PWM_GET PWM_GET16
-#define PWM_DATATYPE uint16_t
-#define PWM_DATATYPE2 uint32_t // only needs 32-bit if ramp values go over 255
-#define PWM1_DATATYPE uint16_t // linear ramp
-#define PWM2_DATATYPE uint16_t // DD FET ramp
+#define PWM_BITS 16 // dynamic 16-bit, but never goes over 255
+#define PWM_GET PWM_GET8
+#define PWM_DATATYPE uint16_t // is used for PWM_TOPS
+#define PWM_DATATYPE2 uint16_t // only needs 32-bit if ramp values go over 255
+#define PWM1_DATATYPE uint8_t // linear ramp
+#define PWM2_DATATYPE uint8_t // DD FET ramp
// PWM parameters of both channels are tied together because they share a counter
#define PWM_TOP ICR1 // holds the TOP value for for variable-resolution PWM
diff --git a/spaghetti-monster/anduril/cfg-noctigon-kr4.h b/spaghetti-monster/anduril/cfg-noctigon-kr4.h
index bfecbea..78c76de 100644
--- a/spaghetti-monster/anduril/cfg-noctigon-kr4.h
+++ b/spaghetti-monster/anduril/cfg-noctigon-kr4.h
@@ -90,6 +90,11 @@
// the default of 26 looks a bit rough, so increase it to make it smoother
#define CANDLE_AMPLITUDE 33
+// don't blink while ramping
+#ifdef BLINK_AT_RAMP_MIDDLE
+#undef BLINK_AT_RAMP_MIDDLE
+#endif
+
// can't reset the normal way because power is connected before the button
#define USE_SOFT_FACTORY_RESET