mirror of
https://github.com/okalachev/flix.git
synced 2025-07-27 09:39:33 +00:00
Consistently use defines to set parameters
This commit is contained in:
parent
39875cafb9
commit
9eaa45c1d9
@ -5,8 +5,7 @@
|
||||
#include <MPU9250.h>
|
||||
|
||||
#define IMU_CS_PIN 4 // chip-select pin for IMU SPI connection
|
||||
|
||||
const bool CALIBRATE_GYRO_ON_START = false;
|
||||
#define CALIBRATE_GYRO_ON_START false
|
||||
|
||||
MPU9250 IMU(SPI, IMU_CS_PIN);
|
||||
|
||||
|
10
flix/log.ino
10
flix/log.ino
@ -3,11 +3,11 @@
|
||||
|
||||
// In-RAM logging
|
||||
|
||||
const int LOG_RATE = 100;
|
||||
const int LOG_DURATION = 10;
|
||||
const float LOG_PERIOD = 1 / LOG_RATE;
|
||||
const int LOG_SIZE = LOG_DURATION * LOG_RATE;
|
||||
const int LOG_COLUMNS = 14;
|
||||
#define LOG_RATE 100
|
||||
#define LOG_DURATION 10
|
||||
#define LOG_PERIOD 1 / LOG_RATE
|
||||
#define LOG_SIZE LOG_DURATION * LOG_RATE
|
||||
#define LOG_COLUMNS 14
|
||||
|
||||
float logBuffer[LOG_SIZE][LOG_COLUMNS]; // * 4 (float)
|
||||
int logPointer = 0;
|
||||
|
@ -15,10 +15,10 @@
|
||||
|
||||
#define PWM_NEUTRAL 1500
|
||||
|
||||
static const uint16_t pwmMin[] = {1600, 1600, 1600, 1600};
|
||||
static const uint16_t pwmMax[] = {2300, 2300, 2300, 2300};
|
||||
static const uint16_t pwmReverseMin[] = {1390, 1440, 1440, 1440};
|
||||
static const uint16_t pwmReverseMax[] = {1100, 1100, 1100, 1100};
|
||||
const uint16_t pwmMin[] = {1600, 1600, 1600, 1600};
|
||||
const uint16_t pwmMax[] = {2300, 2300, 2300, 2300};
|
||||
const uint16_t pwmReverseMin[] = {1390, 1440, 1440, 1440};
|
||||
const uint16_t pwmReverseMax[] = {1100, 1100, 1100, 1100};
|
||||
|
||||
void setupMotors() {
|
||||
Serial.println("Setup Motors");
|
||||
@ -39,7 +39,7 @@ void setupMotors() {
|
||||
Serial.println("Motors initialized");
|
||||
}
|
||||
|
||||
static uint16_t getPWM(float val, int n)
|
||||
uint16_t getPWM(float val, int n)
|
||||
{
|
||||
if (val == 0) {
|
||||
return PWM_NEUTRAL;
|
||||
@ -50,7 +50,7 @@ static uint16_t getPWM(float val, int n)
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t pwmToDutyCycle(uint16_t pwm) {
|
||||
uint8_t pwmToDutyCycle(uint16_t pwm) {
|
||||
return map(pwm, 0, 1000000 / PWM_FREQUENCY, 0, (1 << PWM_RESOLUTION) - 1);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user