Skip to content

Commit

Permalink
Merge pull request #50 from raul-ortega/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
raul-ortega authored Jul 30, 2019
2 parents 2a886b6 + d894539 commit c444206
Show file tree
Hide file tree
Showing 20 changed files with 127 additions and 117 deletions.
2 changes: 1 addition & 1 deletion src/main/blackbox/blackbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ void handleBlackbox(void)

static bool canUseBlackboxWithCurrentConfiguration(void)
{
return feature(FEATURE_BLACKBOX);
return false;//feature(FEATURE_BLACKBOX);
}

/**
Expand Down
22 changes: 12 additions & 10 deletions src/main/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,7 @@ static void resetConf(void)
setControlRateProfile(0);

masterConfig.version = EEPROM_CONF_VERSION;
#if defined(SPRACINGF3)
masterConfig.mixerMode = MIXER_FLYING_WING;
#else
masterConfig.mixerMode = MIXER_QUADX;
#endif
featureClearAll();
//////// Nueva Líneas
featureSet(FEATURE_SERVO_TILT);
Expand Down Expand Up @@ -675,7 +671,7 @@ static void resetConf(void)
/////////////////////////////
//TRACKER CONFIG

featureSet(FEATURE_SOFTSERIAL);
//featureSet(FEATURE_SOFTSERIAL);

//Serial 1
masterConfig.serialConfig.portConfigs[0].identifier = SERIAL_PORT_USART1;
Expand All @@ -685,6 +681,7 @@ static void resetConf(void)
masterConfig.serialConfig.portConfigs[1].identifier = SERIAL_PORT_USART2;
masterConfig.serialConfig.portConfigs[1].gps_baudrateIndex = BAUD_9600;
masterConfig.serialConfig.portConfigs[1].functionMask = FUNCTION_GPS;

//Softserial 1
/*masterConfig.serialConfig.portConfigs[2].identifier = SERIAL_PORT_SOFTSERIAL1;
masterConfig.serialConfig.portConfigs[2].telemetry_baudrateIndex = BAUD_9600;
Expand All @@ -703,6 +700,7 @@ static void resetConf(void)
masterConfig.max_pid_divider = 15;

//PAN
masterConfig.pan_pin = 0;
masterConfig.pan0 = 1500;
pwmPan0 = masterConfig.pan0;
masterConfig.pan_calibration_pulse = 1400;
Expand All @@ -719,19 +717,20 @@ static void resetConf(void)
masterConfig.mag_calibrated = 0;

//TILT
masterConfig.tilt_pin = 1;
masterConfig.tilt0 = 500;
masterConfig.tilt90 = 1400;
masterConfig.tilt_max_angle = 0;

//EASING
featureSet(FEATURE_EASING);
//featureSet(FEATURE_EASING);
masterConfig.easing = 2 ;
masterConfig.easing_steps = 60;
masterConfig.easing_min_angle = 4;
masterConfig.easing_millis = 15;

//NOPID feature by default
featureSet(FEATURE_NOPID);
//featureSet(FEATURE_NOPID);
masterConfig.nopid_min_delta = 0.2;
masterConfig.nopid_max_speed = 200;
masterConfig.nopid_map_angle = 90;
Expand All @@ -744,7 +743,7 @@ static void resetConf(void)
masterConfig.telemetry_provider = 0;

//Display
featureSet(FEATURE_DISPLAY);
//featureSet(FEATURE_DISPLAY);

//GPS
featureClear(FEATURE_GPS);
Expand All @@ -764,19 +763,22 @@ static void resetConf(void)
// FILTERS
masterConfig.max_speed_filter = 0;
//VBAT
featureSet(FEATURE_VBAT);
//featureSet(FEATURE_VBAT);

//BUTTONS
masterConfig.min_logic_level=60;

//TELEMETRY OUT
featureSet(FEATURE_TELEMETRY);
//featureSet(FEATURE_TELEMETRY);

//RSSI
//featureSet(FEATURE_RSSI_ADC);
masterConfig.rxConfig.rssi_scale = RSSI_SCALE_DEFAULT;
masterConfig.rxConfig.rssi_zoom = 35;

//ALTITUDE
masterConfig.altitude_priority = 0;

/////////////////////////////

// copy first profile into remaining profile
Expand Down
1 change: 1 addition & 0 deletions src/main/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ typedef enum {
FEATURE_RX_PPM = 1 << 15,*/
} features_e;

uint8_t pwmPanPin;
uint16_t pwmPan0;
uint16_t pwmPanCalibrationPulse;

Expand Down
3 changes: 3 additions & 0 deletions src/main/config/config_master.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,14 @@ typedef struct master_t {
uint16_t max_pid_gain;
uint8_t max_pid_divider;
// EASING
uint8_t pan_pin;
uint16_t pan0;
uint8_t pan0_calibrated;
uint8_t mag_calibrated;
uint8_t min_pan_speed;
int16_t offset;
int8_t offset_trim;
uint8_t tilt_pin;
uint16_t tilt0;
uint16_t tilt90;
uint8_t tilt_max_angle;
Expand Down Expand Up @@ -147,6 +149,7 @@ typedef struct master_t {
uint8_t update_home_by_local_gps;
uint16_t pan_calibration_pulse;
uint8_t max_speed_filter;
uint8_t altitude_priority;
} master_t;

extern master_t masterConfig;
Expand Down
16 changes: 8 additions & 8 deletions src/main/drivers/pwm_mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ enum {
#if defined(NAZE) || defined(OLIMEXINO) || defined(NAZE32PRO) || defined(STM32F3DISCOVERY) || defined(EUSTM32F103RC) || defined(PORT103R)
static const uint16_t multiPPM[] = {
PWM1 | (MAP_TO_PPM_INPUT << 8), // PPM input
PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
PWM10 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
PWM11 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM12 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM9 | (MAP_TO_SERVO_OUTPUT << 8), // Swap to servo if needed
PWM10 | (MAP_TO_SERVO_OUTPUT << 8), // Swap to servo if needed
PWM11 | (MAP_TO_SERVO_OUTPUT << 8),
PWM12 | (MAP_TO_SERVO_OUTPUT << 8),
PWM13 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM14 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
Expand Down Expand Up @@ -329,10 +329,10 @@ static const uint16_t airPWM[] = {
static const uint16_t multiPPM[] = {
PWM1 | (MAP_TO_PPM_INPUT << 8), // PPM input

PWM9 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM10 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM11 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM12 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM9 | (MAP_TO_SERVO_OUTPUT << 8),
PWM10 | (MAP_TO_SERVO_OUTPUT << 8),
PWM11 | (MAP_TO_SERVO_OUTPUT << 8),
PWM12 | (MAP_TO_SERVO_OUTPUT << 8),
PWM13 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM14 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM15 | (MAP_TO_MOTOR_OUTPUT << 8),
Expand Down
4 changes: 2 additions & 2 deletions src/main/flight/gtune.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void calculate_Gtune(uint8_t axis)
}
int16_t newP = constrain((result_P64[axis] >> 6), (int16_t)pidProfile->gtune_lolimP[axis], (int16_t)pidProfile->gtune_hilimP[axis]);

#ifdef BLACKBOX
/*#ifdef BLACKBOX
if (feature(FEATURE_BLACKBOX)) {
flightLogEvent_gtuneCycleResult_t eventData;
Expand All @@ -194,7 +194,7 @@ void calculate_Gtune(uint8_t axis)
eventData.gtuneNewP = newP; // for float PID the logged P value is still mutiplyed by 10
blackboxLogEvent(FLIGHT_LOG_EVENT_GTUNE_RESULT, (flightLogEventData_t*)&eventData);
}
#endif
#endif*/

if (floatPID) {
pidProfile->P_f[axis] = (float)newP / 10.0f; // new P value for float PID
Expand Down
8 changes: 4 additions & 4 deletions src/main/io/rc_controls.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ void blackboxLogInflightAdjustmentEvent(adjustmentFunction_e adjustmentFunction,
UNUSED(adjustmentFunction);
UNUSED(newValue);
#else
if (feature(FEATURE_BLACKBOX)) {
/* if (feature(FEATURE_BLACKBOX)) {
flightLogEvent_inflightAdjustment_t eventData;
eventData.adjustmentFunction = adjustmentFunction;
eventData.newValue = newValue;
eventData.floatFlag = false;
blackboxLogEvent(FLIGHT_LOG_EVENT_INFLIGHT_ADJUSTMENT, (flightLogEventData_t*)&eventData);
}
}*/
#endif
}

Expand All @@ -91,13 +91,13 @@ void blackboxLogInflightAdjustmentEventFloat(adjustmentFunction_e adjustmentFunc
UNUSED(adjustmentFunction);
UNUSED(newFloatValue);
#else
if (feature(FEATURE_BLACKBOX)) {
/*if (feature(FEATURE_BLACKBOX)) {
flightLogEvent_inflightAdjustment_t eventData;
eventData.adjustmentFunction = adjustmentFunction;
eventData.newFloatValue = newFloatValue;
eventData.floatFlag = true;
blackboxLogEvent(FLIGHT_LOG_EVENT_INFLIGHT_ADJUSTMENT, (flightLogEventData_t*)&eventData);
}
}*/
#endif
}

Expand Down
39 changes: 23 additions & 16 deletions src/main/io/serial_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ static const char * const lookupTabletelemetryProvider[] = {
"NONE", "DIY_GPS","INAV","APM10"
};

static const char * const lookupTableAltitudePriority[] = {
"BARO","GPS"
};

static const char * const lookupTabletelemetryHome[] = {
"DEFAULT", "AUTO"
};
Expand Down Expand Up @@ -405,6 +409,7 @@ typedef enum {
TABLE_UNIT,
TABLE_ALIGNMENT,
TABLE_TELEMETRY_PROVIDER,
TABLE_ALTITUDE_PRIORITY,
TABLE_TELEMETRY_HOME,
#ifdef GPS
TABLE_GPS_PROVIDER,
Expand All @@ -424,6 +429,7 @@ static const lookupTableEntry_t lookupTables[] = {
{ lookupTableUnit, sizeof(lookupTableUnit) / sizeof(char *) },
{ lookupTableAlignment, sizeof(lookupTableAlignment) / sizeof(char *) },
{ lookupTabletelemetryProvider, sizeof(lookupTabletelemetryProvider) / sizeof(char *) },
{ lookupTableAltitudePriority, sizeof(lookupTableAltitudePriority) / sizeof(char *) },
{ lookupTabletelemetryHome, sizeof(lookupTabletelemetryHome) / sizeof(char *) },
#ifdef GPS
{ lookupTableGPSProvider, sizeof(lookupTableGPSProvider) / sizeof(char *) },
Expand Down Expand Up @@ -551,7 +557,7 @@ const clivalue_t valueTable[] = {
*/
#endif

/* { "serialrx_provider", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.rxConfig.serialrx_provider, .config.lookup = { TABLE_SERIAL_RX } },
/* { "serialrx_provider", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.rxConfig.serialrx_provider, .config.lookup = { TABLE_SERIAL_RX } },
{ "spektrum_sat_bind", VAR_UINT8 | MASTER_VALUE, &masterConfig.rxConfig.spektrum_sat_bind, .config.minmax = { SPEKTRUM_SAT_BIND_DISABLED, SPEKTRUM_SAT_BIND_MAX} },
{ "telemetry_switch", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.telemetryConfig.telemetry_switch, .config.lookup = { TABLE_OFF_ON } },*/
Expand All @@ -568,23 +574,21 @@ const clivalue_t valueTable[] = {
{ "vbat_max_cell_voltage", VAR_UINT8 | MASTER_VALUE, &masterConfig.batteryConfig.vbatmaxcellvoltage, .config.minmax = { 10, 50 } },
{ "vbat_min_cell_voltage", VAR_UINT8 | MASTER_VALUE, &masterConfig.batteryConfig.vbatmincellvoltage, .config.minmax = { 10, 50 } },
{ "vbat_warning_cell_voltage", VAR_UINT8 | MASTER_VALUE, &masterConfig.batteryConfig.vbatwarningcellvoltage, .config.minmax = { 10, 50 } },
// { "current_meter_scale", VAR_INT16 | MASTER_VALUE, &masterConfig.batteryConfig.currentMeterScale, .config.minmax = { -10000, 10000 } },
// { "current_meter_offset", VAR_UINT16 | MASTER_VALUE, &masterConfig.batteryConfig.currentMeterOffset, .config.minmax = { 0, 3300 } },
// { "multiwii_current_meter_output", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.batteryConfig.multiwiiCurrentMeterOutput, .config.lookup = { TABLE_OFF_ON } },
// { "current_meter_type", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.batteryConfig.currentMeterType, .config.lookup = { TABLE_CURRENT_SENSOR } },
/*
// { "current_meter_scale", VAR_INT16 | MASTER_VALUE, &masterConfig.batteryConfig.currentMeterScale, .config.minmax = { -10000, 10000 } },
// { "current_meter_offset", VAR_UINT16 | MASTER_VALUE, &masterConfig.batteryConfig.currentMeterOffset, .config.minmax = { 0, 3300 } },
// { "multiwii_current_meter_output", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.batteryConfig.multiwiiCurrentMeterOutput, .config.lookup = { TABLE_OFF_ON } },
// { "current_meter_type", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.batteryConfig.currentMeterType, .config.lookup = { TABLE_CURRENT_SENSOR } },
{ "align_gyro", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.sensorAlignmentConfig.gyro_align, .config.lookup = { TABLE_ALIGNMENT } },
{ "align_acc", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.sensorAlignmentConfig.acc_align, .config.lookup = { TABLE_ALIGNMENT } },
*/ { "align_mag", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.sensorAlignmentConfig.mag_align, .config.lookup = { TABLE_ALIGNMENT } },
/*
// { "align_acc", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.sensorAlignmentConfig.acc_align, .config.lookup = { TABLE_ALIGNMENT } },
{ "align_mag", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.sensorAlignmentConfig.mag_align, .config.lookup = { TABLE_ALIGNMENT } },

{ "align_board_roll", VAR_INT16 | MASTER_VALUE, &masterConfig.boardAlignment.rollDegrees, .config.minmax = { -180, 360 } },
{ "align_board_pitch", VAR_INT16 | MASTER_VALUE, &masterConfig.boardAlignment.pitchDegrees, .config.minmax = { -180, 360 } },
{ "align_board_yaw", VAR_INT16 | MASTER_VALUE, &masterConfig.boardAlignment.yawDegrees, .config.minmax = { -180, 360 } },
{ "max_angle_inclination", VAR_UINT16 | MASTER_VALUE, &masterConfig.max_angle_inclination, .config.minmax = { 100, 900 } },
// { "max_angle_inclination", VAR_UINT16 | MASTER_VALUE, &masterConfig.max_angle_inclination, .config.minmax = { 100, 900 } },

{ "gyro_lpf", VAR_UINT16 | MASTER_VALUE, &masterConfig.gyro_lpf, .config.minmax = { 0, 256 } },
{ "moron_threshold", VAR_UINT8 | MASTER_VALUE, &masterConfig.gyroConfig.gyroMovementCalibrationThreshold, .config.minmax = { 0, 128 } },
/* { "moron_threshold", VAR_UINT8 | MASTER_VALUE, &masterConfig.gyroConfig.gyroMovementCalibrationThreshold, .config.minmax = { 0, 128 } },
{ "gyro_cmpf_factor", VAR_UINT16 | MASTER_VALUE, &masterConfig.gyro_cmpf_factor, .config.minmax = { 100, 1000 } },
{ "gyro_cmpfm_factor", VAR_UINT16 | MASTER_VALUE, &masterConfig.gyro_cmpfm_factor, .config.minmax = { 100, 1000 } },
Expand Down Expand Up @@ -720,13 +724,15 @@ const clivalue_t valueTable[] = {
{ "max_pid_accumulator", VAR_UINT16 | TRACKER_VALUE, &masterConfig.max_pid_accumulator, .config.minmax = { 0, 50000 } },
{ "max_pid_gain", VAR_UINT16 | TRACKER_VALUE, &masterConfig.max_pid_gain, .config.minmax = { 0, 5000 } },
{ "pid_divider", VAR_UINT8 | TRACKER_VALUE, &masterConfig.max_pid_divider, .config.minmax = { 0, 255 } },
{ "pan_pin", VAR_UINT8 | TRACKER_VALUE, &masterConfig.pan_pin, .config.minmax = { 0, 7 } },
{ "pan0", VAR_UINT16 | TRACKER_VALUE, &masterConfig.pan0, .config.minmax = { 0, 3000 } },
{ "pan0_calibrated", VAR_UINT8 | TRACKER_VALUE, &masterConfig.pan0_calibrated, .config.minmax = { 0, 1 } },
{ "pan_calibration_pulse", VAR_UINT16 | TRACKER_VALUE, &masterConfig.pan_calibration_pulse, .config.minmax = { 1, 1500 } },
{ "min_pan_speed", VAR_INT8 | TRACKER_VALUE, &masterConfig.min_pan_speed, .config.minmax = { 0, 100 } },
{ "min_pan_speed", VAR_UINT8 | TRACKER_VALUE, &masterConfig.min_pan_speed, .config.minmax = { 0, 100 } },
{ "offset", VAR_INT16 | TRACKER_VALUE, &masterConfig.offset, .config.minmax = { -360, 360 } },
{ "offset_trim", VAR_INT8 | TRACKER_VALUE, &masterConfig.offset_trim, .config.minmax = { -20, 20 } },
{ "init_servos", VAR_UINT8 | TRACKER_VALUE, &masterConfig.init_servos, .config.minmax = { 0, 1 } },
{ "tilt_pin", VAR_UINT8 | TRACKER_VALUE, &masterConfig.tilt_pin, .config.minmax = { 0, 7 } },
{ "tilt0", VAR_UINT16 | TRACKER_VALUE, &masterConfig.tilt0, .config.minmax = { 0, 3000 } },
{ "tilt90", VAR_UINT16 | TRACKER_VALUE, &masterConfig.tilt90, .config.minmax = { 0, 3000 } },
{ "tilt_max_angle", VAR_UINT8 | TRACKER_VALUE, &masterConfig.tilt_max_angle, .config.minmax = { 0, 90 } },
Expand Down Expand Up @@ -757,7 +763,8 @@ const clivalue_t valueTable[] = {
{ "eps_interpolation", VAR_UINT8 | TRACKER_VALUE | MODE_LOOKUP, &masterConfig.eps_interpolation, .config.lookup = { TABLE_OFF_ON } },
{ "eps_interpolation_points", VAR_UINT8 | TRACKER_VALUE, &masterConfig.eps_interpolation_points, .config.minmax = { 2, 10 } },
{ "update_home_by_local_gps", VAR_UINT8 | TRACKER_VALUE | MODE_LOOKUP, &masterConfig.update_home_by_local_gps, .config.lookup = { TABLE_OFF_ON } },
{ "max_speed_filter", VAR_UINT8 | TRACKER_VALUE, &masterConfig.max_speed_filter, .config.minmax = { 0, 255 } }
{ "max_speed_filter", VAR_UINT8 | TRACKER_VALUE, &masterConfig.max_speed_filter, .config.minmax = { 0, 255 } },
{ "telemetry_altitude_priority", VAR_UINT8 | TRACKER_VALUE | MODE_LOOKUP, &masterConfig.altitude_priority, .config.lookup = {TABLE_ALTITUDE_PRIORITY} }
};

#define VALUE_COUNT (sizeof(valueTable) / sizeof(clivalue_t))
Expand Down Expand Up @@ -2530,7 +2537,7 @@ static void cliSetPanServoSpeed()
{
masterConfig.pan0_calibrated=0;
pwmPan0=masterConfig.pan0;
pwmWritePanServo(masterConfig.pan0);
pwmWriteServo(masterConfig.pan_pin,masterConfig.pan0);
cliPrint("\r\nWhen pan servo stops moving then you must set parameter pan0_calibrated to 1.\r\n");
}
static void cliSetOffset()
Expand Down Expand Up @@ -2571,7 +2578,7 @@ static void cliDumpTracker() {

printSectionBreak();

cliPrint("\r\n\r\n# feature\r\n");
cliPrint("\r\n\r\n# parameters\r\n");

dumpValues(TRACKER_VALUE);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/io/serial_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,11 +705,11 @@ void mspInit(serialConfig_t *serialConfig)
}
#endif

#ifdef BLACKBOX
/*#ifdef BLACKBOX
if (feature(FEATURE_BLACKBOX)){
activeBoxIds[activeBoxIdCount++] = BOXBLACKBOX;
}
#endif
#endif*/

/*if (feature(FEATURE_FAILSAFE)){
activeBoxIds[activeBoxIdCount++] = BOXFAILSAFE;
Expand Down
2 changes: 1 addition & 1 deletion src/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ void init(void)
if (masterConfig.mixerMode == MIXER_GIMBAL) {
//accSetCalibrationCycles(CALIBRATING_ACC_CYCLES);
}
//gyroSetCalibrationCycles(CALIBRATING_GYRO_CYCLES);
gyroSetCalibrationCycles(CALIBRATING_GYRO_CYCLES);
#ifdef BARO
//baroSetCalibrationCycles(CALIBRATING_BARO_CYCLES);
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/main/mw.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ void mwDisarm(void)
if (ARMING_FLAG(ARMED)) {
DISABLE_ARMING_FLAG(ARMED);

#ifdef BLACKBOX
/*#ifdef BLACKBOX
if (feature(FEATURE_BLACKBOX)) {
finishBlackbox();
}
#endif
#endif*/

beeper(BEEPER_DISARMING); // emit disarm tone
}
Expand Down
7 changes: 5 additions & 2 deletions src/main/sensors/compass.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@
#include "tracker/config.h"
#include "io/display.h"

#include "tracker/servos.h"

mag_t mag; // mag access functions

extern uint32_t currentTime; // FIXME dependency on global variable, pass it in instead.

extern uint8_t pwmPanPin;
extern uint16_t pwmPan0;
extern uint16_t pwmPanCalibrationPulse;

Expand Down Expand Up @@ -97,7 +100,7 @@ void updateCompass(flightDynamicsTrims_t *magZero)
displayShowFixedPage(PAGE_CALIBRATING_MAG);
displayResetPageCycling();
displayDisablePageCycling();
pwmWriteServo(panServo, pwmPanCalibrationPulse);
pwmWriteServo(pwmPanPin, pwmPanCalibrationPulse);
}

if (magInit) { // we apply offset only once mag calibration is done
Expand All @@ -120,7 +123,7 @@ void updateCompass(flightDynamicsTrims_t *magZero)
for (axis = 0; axis < 3; axis++) {
magZero->raw[axis] = (magZeroTempMin.raw[axis] + magZeroTempMax.raw[axis]) / 2; // Calculate offsets
}
pwmWriteServo(panServo, pwmPan0);
pwmWriteServo(pwmPanPin, pwmPan0);
DISABLE_PROTOCOL(TP_CALIBRATING_MAG);

if(cliMode && feature(FEATURE_DISPLAY)) {
Expand Down
Loading

0 comments on commit c444206

Please sign in to comment.