Increased Resolution for Multishot
This commit is contained in:
parent
f44ceb0769
commit
987cede279
|
@ -38,7 +38,7 @@
|
||||||
#define PWM_TIMER_MHZ 1
|
#define PWM_TIMER_MHZ 1
|
||||||
|
|
||||||
#define PWM_BRUSHED_TIMER_MHZ 8
|
#define PWM_BRUSHED_TIMER_MHZ 8
|
||||||
#define MULTISHOT_TIMER_MHZ 12
|
#define MULTISHOT_TIMER_MHZ 72
|
||||||
#define ONESHOT42_TIMER_MHZ 24
|
#define ONESHOT42_TIMER_MHZ 24
|
||||||
#define ONESHOT125_TIMER_MHZ 8
|
#define ONESHOT125_TIMER_MHZ 8
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include "platform.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)
|
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)
|
void pwmWriteMotor(uint8_t index, uint16_t value)
|
||||||
|
|
Loading…
Reference in New Issue