Speeduino
Loading...
Searching...
No Matches
crankMaths.h
Go to the documentation of this file.
1#ifndef CRANKMATHS_H
2#define CRANKMATHS_H
3
4#include "maths.h"
5#include "globals.h"
6
17
31
33#define MICROS_PER_DEG_1_RPM INT32_C(166667)
34
40#define MAX_RPM INT16_C(18000)
41
47#define MIN_RPM ((MICROS_PER_DEG_1_RPM/(UINT16_MAX/16UL))+1UL)
48
55
67
78
79#endif
uint16_t timeToAngleDegPerMicroSec(uint32_t time)
Definition crankMaths.cpp:40
static int16_t injectorLimits(int16_t angle)
Makes one pass at nudging the angle to within [0,CRANK_ANGLE_MAX_INJ].
Definition crankMaths.h:24
static int16_t ignitionLimits(int16_t angle)
Makes one pass at nudging the angle to within [0,CRANK_ANGLE_MAX_IGN].
Definition crankMaths.h:13
void setAngleConverterRevolutionTime(uint32_t revolutionTime)
Set the revolution time, from which some of the degree<-->angle conversions are derived.
Definition crankMaths.cpp:30
uint32_t angleToTimeMicroSecPerDegree(uint16_t angle)
Definition crankMaths.cpp:35
int CRANK_ANGLE_MAX_IGN
Definition globals.cpp:136
int CRANK_ANGLE_MAX_INJ
The number of crank degrees that the system track over. Typically 720 divided by the number of squirt...
Definition globals.cpp:137
uint32_t revolutionTime
Definition globals.cpp:114
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
static int16_t nudge(int16_t min, int16_t max, int16_t value, int16_t nudgeAmount)
Make one pass at correcting the value into the range [min, max)
Definition maths.h:211