From 29e62c4e203aa05299602599caecb12021513824 Mon Sep 17 00:00:00 2001 From: David Rabel Date: Fri, 3 Apr 2015 15:55:00 +0200 Subject: [PATCH] SERVO_OFFSET deleted, SERVO_MIN added --- platform/osd-merkur/dev/servo.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/platform/osd-merkur/dev/servo.c b/platform/osd-merkur/dev/servo.c index 0a494ee47..74ce735be 100644 --- a/platform/osd-merkur/dev/servo.c +++ b/platform/osd-merkur/dev/servo.c @@ -52,9 +52,9 @@ * servo device */ -#define SERVO_OFFSET 1000 -#define SERVO_MAX 1000 -#define SERVO_INIT 500 +#define SERVO_MIN 575 +#define SERVO_MAX 2425 +#define SERVO_INIT 1500 unsigned int servoa=SERVO_INIT; unsigned int servob=SERVO_INIT; @@ -97,10 +97,10 @@ servo_init(void) ICR3L=0x20; // OCR3A will govern the steering servo, OCR3B will govern throttle - OCR3A = 1500; // set it to an initial position somewhere in the middle of the 1 to 2ms range + OCR3A = servoa; // set it to an initial position somewhere in the middle of the 1 to 2ms range // OCR3A will govern the steering servo, OCR3B will govern throttle - OCR3B = 1500; // set it to an initial position somewhere in the middle of the 1 to 2ms range + OCR3B = servob; // set it to an initial position somewhere in the middle of the 1 to 2ms range // start with motor off - no duty cycle at all OCR3CH=0x00; OCR3CL=0x00; @@ -135,18 +135,20 @@ unsigned int servo_set(unsigned i,unsigned int j) { if(j > SERVO_MAX) - j=SERVO_MAX; + j=SERVO_MAX; + if(j < SERVO_MIN) + j=SERVO_MIN; if(i==0) { servoa=j; - OCR3A = SERVO_OFFSET + servoa; + OCR3A = servoa; return 1; } if(i==1) { servob=j; - OCR3A = SERVO_OFFSET + servob; + OCR3B = servob; return 1; }