aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2018-09-05 03:26:42 -0600
committerSelene ToyKeeper2018-09-05 03:26:42 -0600
commita806f151acb73301f8cceaebc64229d1be64ee40 (patch)
tree1d16022472ce161618ef73791111c684115501cb
parentReduced ROM size another 10 bytes by removing redundant call to nearest_level(). (diff)
downloadanduril-a806f151acb73301f8cceaebc64229d1be64ee40.tar.gz
anduril-a806f151acb73301f8cceaebc64229d1be64ee40.tar.bz2
anduril-a806f151acb73301f8cceaebc64229d1be64ee40.zip
Fixed bug: stepped ramp sometimes acted weird with specific values.
Diffstat (limited to '')
-rw-r--r--spaghetti-monster/anduril/anduril.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index bbf661d..c85433c 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -1595,7 +1595,7 @@ uint8_t nearest_level(int16_t target) {
for(uint8_t i=0; i<ramp_discrete_steps; i++) {
this_level = ramp_discrete_floor + (i * (uint16_t)ramp_range / (ramp_discrete_steps-1));
- int8_t diff = target - this_level;
+ int16_t diff = target - this_level;
if (diff < 0) diff = -diff;
if (diff <= (ramp_discrete_step_size>>1))
return this_level;