added gps baudrage config setting
renamed gcc startup file to .S (breaks some lunix dudes apparently) ppm sum handler waws hardcoded to TIM2 instead of using passed parameter. fixed. (thanks sbaron) invalid data from pwm/ppm read are returned as midrc, not 1500. (robert_b) git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@133 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
791d67b4ee
commit
da5ac020e1
4777
obj/baseflight.hex
4777
obj/baseflight.hex
File diff suppressed because it is too large
Load Diff
|
@ -104,6 +104,7 @@ const clivalue_t valueTable[] = {
|
|||
{ "tilt_roll_prop", VAR_INT8, &cfg.tilt_roll_prop, -100, 100 },
|
||||
{ "acc_lpf_factor", VAR_UINT8, &cfg.acc_lpf_factor, 0, 32 },
|
||||
{ "gyro_lpf", VAR_UINT16, &cfg.gyro_lpf, 0, 256 },
|
||||
{ "gps_baudrate", VAR_UINT16, &cfg.gps_baudrate, 1200, 57600 },
|
||||
{ "p_pitch", VAR_UINT8, &cfg.P8[PITCH], 0, 200},
|
||||
{ "i_pitch", VAR_UINT8, &cfg.I8[PITCH], 0, 200},
|
||||
{ "d_pitch", VAR_UINT8, &cfg.D8[PITCH], 0, 200},
|
||||
|
|
11
src/config.c
11
src/config.c
|
@ -2,14 +2,18 @@
|
|||
#include "mw.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifndef FLASH_PAGE_COUNT
|
||||
#define FLASH_PAGE_COUNT 64
|
||||
#endif
|
||||
|
||||
#define FLASH_PAGE_SIZE ((uint16_t)0x400)
|
||||
#define FLASH_WRITE_ADDR (0x08000000 + (uint32_t)FLASH_PAGE_SIZE * 63) // use the last KB for storage
|
||||
#define FLASH_WRITE_ADDR (0x08000000 + (uint32_t)FLASH_PAGE_SIZE * (FLASH_PAGE_COUNT - 1)) // use the last KB for storage
|
||||
|
||||
config_t cfg;
|
||||
const char rcChannelLetters[] = "AERT1234";
|
||||
|
||||
static uint32_t enabledSensors = 0;
|
||||
static uint8_t checkNewConf = 8;
|
||||
static uint8_t checkNewConf = 9;
|
||||
|
||||
void parseRcChannels(const char *input)
|
||||
{
|
||||
|
@ -144,6 +148,9 @@ void checkFirstTime(bool reset)
|
|||
cfg.tilt_pitch_prop = 10;
|
||||
cfg.tilt_roll_prop = 10;
|
||||
|
||||
// gps baud-rate
|
||||
cfg.gps_baudrate = 9600;
|
||||
|
||||
writeParams();
|
||||
}
|
||||
|
||||
|
|
|
@ -71,13 +71,13 @@ static void ppmIRQHandler(TIM_TypeDef *tim)
|
|||
static uint16_t last = 0;
|
||||
static uint8_t chan = 0;
|
||||
|
||||
if (TIM_GetITStatus(TIM2, TIM_IT_CC1) == SET) {
|
||||
if (TIM_GetITStatus(tim, TIM_IT_CC1) == SET) {
|
||||
last = now;
|
||||
now = TIM_GetCapture1(TIM2);
|
||||
now = TIM_GetCapture1(tim);
|
||||
rcActive = true;
|
||||
}
|
||||
|
||||
TIM_ClearITPendingBit(TIM2, TIM_IT_CC1);
|
||||
TIM_ClearITPendingBit(tim, TIM_IT_CC1);
|
||||
|
||||
if (now > last) {
|
||||
diff = (now - last);
|
||||
|
|
|
@ -9,7 +9,7 @@ static void GPS_NewData(uint16_t c);
|
|||
static bool GPS_newFrame(char c);
|
||||
static void GPS_distance(int32_t lat1, int32_t lon1, int32_t lat2, int32_t lon2, uint16_t * dist, int16_t * bearing);
|
||||
|
||||
void gpsInit(void)
|
||||
void gpsInit(uint32_t baudrate)
|
||||
{
|
||||
uart2Init(9600, GPS_NewData);
|
||||
sensorsSet(SENSOR_GPS);
|
||||
|
|
|
@ -87,7 +87,7 @@ int main(void)
|
|||
// spektrum and GPS are mutually exclusive
|
||||
// Optional GPS - available only when using PPM, otherwise required pins won't be usable
|
||||
if (feature(FEATURE_PPM) && feature(FEATURE_GPS))
|
||||
gpsInit();
|
||||
gpsInit(cfg.gps_baudrate);
|
||||
}
|
||||
|
||||
previousTime = micros();
|
||||
|
|
2
src/mw.c
2
src/mw.c
|
@ -279,7 +279,7 @@ uint16_t pwmReadRawRC(uint8_t chan)
|
|||
failsafeCnt = 0;
|
||||
data = pwmRead(cfg.rcmap[chan]);
|
||||
if (data < 750 || data > 2250)
|
||||
data = 1500;
|
||||
data = cfg.midrc;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
5
src/mw.h
5
src/mw.h
|
@ -179,6 +179,9 @@ typedef struct config_t {
|
|||
int8_t tilt_pitch_prop; // servo proportional (tied to angle) ; can be negative to invert movement
|
||||
int8_t tilt_roll_prop; // servo proportional (tied to angle) ; can be negative to invert movement
|
||||
|
||||
// gps baud-rate
|
||||
uint16_t gps_baudrate;
|
||||
|
||||
} config_t;
|
||||
|
||||
extern int16_t gyroZero[3];
|
||||
|
@ -292,4 +295,4 @@ bool spektrumFrameComplete(void);
|
|||
void cliProcess(void);
|
||||
|
||||
// gps
|
||||
void gpsInit(void);
|
||||
void gpsInit(uint32_t baudrate);
|
||||
|
|
Loading…
Reference in New Issue