Increased Resolution for Multishot

This commit is contained in:
borisbstyle 2016-06-18 12:39:24 +02:00
parent f44ceb0769
commit 987cede279
2 changed files with 3 additions and 2 deletions

View File

@ -38,7 +38,7 @@
#define PWM_TIMER_MHZ 1
#define PWM_BRUSHED_TIMER_MHZ 8
#define MULTISHOT_TIMER_MHZ 12
#define MULTISHOT_TIMER_MHZ 72
#define ONESHOT42_TIMER_MHZ 24
#define ONESHOT125_TIMER_MHZ 8

View File

@ -19,6 +19,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#include "platform.h"
@ -138,7 +139,7 @@ static void pwmWriteStandard(uint8_t index, uint16_t value)
static void pwmWriteMultiShot(uint8_t index, uint16_t value)
{
*motors[index]->ccr = 60001 * (value - 1000) / 250000 + 60;
*motors[index]->ccr = lrintf(((float)(value-1000) / 0.69444f) + 360);
}
void pwmWriteMotor(uint8_t index, uint16_t value)