From 988378fa09bdb56e3e831ad57b741e616b61100c Mon Sep 17 00:00:00 2001
From: Thomas Dornberger <noreply@fortiss.org>
Date: Thu, 20 Jul 2017 20:45:12 +0000
Subject: [PATCH] adjust formula to compute speed Value for motor (transform
 value from mm/s to the input value for the Motor Driver) refs 7860

---
 org.fortiss.af3.platform.raspberry/trunk/lib/inc/PWM.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/PWM.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/PWM.h
index 6519009a..8b72ff55 100644
--- a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/PWM.h
+++ b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/PWM.h
@@ -12,7 +12,10 @@
 #include "inc/libmaestro.h"
 
 // macros
-#define PWM_ADJUST_VALUE(x) (6000 + 4 * x / 66)
+// 	6072 is the value for 0, max. value to motor is currently 7572
+//	from AF3 you get a max. speed value in mm/s : 1471
+//	Hence, add the constant 6072 and map values -1471-1471 to -1500-1500
+#define PWM_ADJUST_VALUE(x) (6072 + 1500 * x /1471)
 
 // types
 typedef unsigned char PWM_CHANNEL_T;
-- 
GitLab