Merge pull request #2804 from betaflight/minor-changes-from-cf-1
Minor changes from CF
This commit is contained in:
commit
4b63fe0672
|
@ -294,11 +294,15 @@ void init(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_PWM) || defined(USE_PPM)
|
||||
if (feature(FEATURE_RX_PPM)) {
|
||||
ppmRxInit(ppmConfig(), motorConfig()->dev.motorPwmProtocol);
|
||||
} else if (feature(FEATURE_RX_PARALLEL_PWM)) {
|
||||
pwmRxInit(pwmConfig());
|
||||
if (0) {}
|
||||
#if defined(USE_PPM)
|
||||
else if (feature(FEATURE_RX_PPM)) {
|
||||
ppmRxInit(ppmConfig(), motorConfig()->dev.motorPwmProtocol);
|
||||
}
|
||||
#endif
|
||||
#if defined(USE_PWM)
|
||||
else if (feature(FEATURE_RX_PARALLEL_PWM)) {
|
||||
pwmRxInit(pwmConfig());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -812,8 +812,10 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn
|
|||
|
||||
#ifdef GPS
|
||||
case MSP_GPS_CONFIG:
|
||||
sbufWriteU8(dst, gpsConfig()->provider); // gps_type
|
||||
sbufWriteU8(dst, gpsConfig()->sbasMode); // gps_ubx_sbas
|
||||
sbufWriteU8(dst, gpsConfig()->provider);
|
||||
sbufWriteU8(dst, gpsConfig()->sbasMode);
|
||||
sbufWriteU8(dst, gpsConfig()->autoConfig);
|
||||
sbufWriteU8(dst, gpsConfig()->autoBaud);
|
||||
break;
|
||||
|
||||
case MSP_RAW_GPS:
|
||||
|
@ -1435,8 +1437,10 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
|
||||
#ifdef GPS
|
||||
case MSP_SET_GPS_CONFIG:
|
||||
gpsConfigMutable()->provider = sbufReadU8(src); // gps_type
|
||||
gpsConfigMutable()->sbasMode = sbufReadU8(src); // gps_ubx_sbas
|
||||
gpsConfigMutable()->provider = sbufReadU8(src);
|
||||
gpsConfigMutable()->sbasMode = sbufReadU8(src);
|
||||
gpsConfigMutable()->autoConfig = sbufReadU8(src);
|
||||
gpsConfigMutable()->autoBaud = sbufReadU8(src);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -234,10 +234,10 @@ static void osdDrawSingleElement(uint8_t item)
|
|||
{
|
||||
int32_t val;
|
||||
if (item == OSD_GPS_LAT) {
|
||||
buff[0] = 0xA6;
|
||||
buff[0] = 0x64; // right arrow
|
||||
val = GPS_coord[LAT];
|
||||
} else {
|
||||
buff[0] = 0xA7;
|
||||
buff[0] = 0x60; // down arrow
|
||||
val = GPS_coord[LON];
|
||||
}
|
||||
if (val >= 0) {
|
||||
|
|
|
@ -58,8 +58,8 @@
|
|||
|
||||
#define MSP_PROTOCOL_VERSION 0
|
||||
|
||||
#define API_VERSION_MAJOR 1 // increment when major changes are made
|
||||
#define API_VERSION_MINOR 33 // increment after a release, to set the version for all changes to go into the following release (if no changes to MSP are made between the releases, this can be reverted before the release)
|
||||
#define API_VERSION_MAJOR 1 // increment when major changes are made
|
||||
#define API_VERSION_MINOR 34 // increment after a release, to set the version for all changes to go into the following release (if no changes to MSP are made between the releases, this can be reverted before the release)
|
||||
|
||||
#define API_VERSION_LENGTH 2
|
||||
|
||||
|
|
|
@ -220,11 +220,12 @@ void currentMeterESCReadMotor(uint8_t motorNumber, currentMeter_t *meter)
|
|||
currentMeterReset(meter);
|
||||
#else
|
||||
escSensorData_t *escData = getEscSensorData(motorNumber);
|
||||
if (escData->dataAge <= ESC_BATTERY_AGE_MAX) {
|
||||
if (escData && escData->dataAge <= ESC_BATTERY_AGE_MAX) {
|
||||
meter->amperage = escData->current;
|
||||
meter->amperageLatest = escData->current;
|
||||
meter->mAhDrawn = escData->consumption;
|
||||
return;
|
||||
} else {
|
||||
currentMeterReset(meter);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -221,9 +221,13 @@ void voltageMeterESCReadMotor(uint8_t motorNumber, voltageMeter_t *voltageMeter)
|
|||
voltageMeterReset(voltageMeter);
|
||||
#else
|
||||
escSensorData_t *escData = getEscSensorData(motorNumber);
|
||||
if (escData) {
|
||||
voltageMeter->unfiltered = escData->dataAge <= ESC_BATTERY_AGE_MAX ? escData->voltage / 10 : 0;
|
||||
voltageMeter->filtered = voltageMeter->unfiltered; // no filtering for ESC motors currently.
|
||||
} else {
|
||||
voltageMeterReset(voltageMeter);
|
||||
}
|
||||
|
||||
voltageMeter->unfiltered = escData->dataAge <= ESC_BATTERY_AGE_MAX ? escData->voltage / 10 : 0;
|
||||
voltageMeter->filtered = voltageMeter->unfiltered; // no filtering for ESC motors currently.
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -32,13 +32,14 @@ void targetBusInit(void)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
if (hardwareRevision != NAZE32_SP) {
|
||||
i2cInit(I2C_DEVICE);
|
||||
if (hardwareRevision == NAZE32_SP) {
|
||||
serialRemovePort(SERIAL_PORT_SOFTSERIAL2);
|
||||
} else {
|
||||
|
||||
if (!doesConfigurationUsePort(SERIAL_PORT_USART3)) {
|
||||
serialRemovePort(SERIAL_PORT_USART3);
|
||||
i2cInit(I2C_DEVICE);
|
||||
}
|
||||
} else {
|
||||
i2cInit(I2C_DEVICE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <platform.h>
|
||||
|
||||
#include "common/axis.h"
|
||||
|
||||
#include "drivers/sensor.h"
|
||||
#include "drivers/compass.h"
|
||||
#include "drivers/serial.h"
|
||||
|
||||
#include "fc/rc_controls.h"
|
||||
|
||||
#include "flight/failsafe.h"
|
||||
#include "flight/mixer.h"
|
||||
#include "flight/pid.h"
|
||||
|
||||
#include "rx/rx.h"
|
||||
|
||||
#include "io/serial.h"
|
||||
|
||||
#include "telemetry/telemetry.h"
|
||||
|
||||
#include "sensors/sensors.h"
|
||||
#include "sensors/compass.h"
|
||||
#include "sensors/barometer.h"
|
||||
|
||||
#include "config/feature.h"
|
||||
|
||||
#include "fc/config.h"
|
||||
|
||||
#ifdef TARGET_CONFIG
|
||||
void targetConfiguration(void)
|
||||
{
|
||||
barometerConfigMutable()->baro_hardware = BARO_DEFAULT;
|
||||
compassConfigMutable()->mag_hardware = MAG_DEFAULT;
|
||||
rxConfigMutable()->sbus_inversion = 1;
|
||||
serialConfigMutable()->portConfigs[1].functionMask = FUNCTION_MSP; // So Bluetooth users don't have to change anything.
|
||||
serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIALRX_UART)].functionMask = FUNCTION_RX_SERIAL;
|
||||
serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(TELEMETRY_UART)].functionMask = FUNCTION_TELEMETRY_SMARTPORT;
|
||||
serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(GPS_UART)].functionMask = FUNCTION_GPS;
|
||||
telemetryConfigMutable()->telemetry_inversion = 0;
|
||||
telemetryConfigMutable()->sportHalfDuplex = 0;
|
||||
}
|
||||
#endif
|
|
@ -18,6 +18,7 @@
|
|||
#pragma once
|
||||
|
||||
#define TARGET_BOARD_IDENTIFIER "SP3N"
|
||||
#define TARGET_CONFIG
|
||||
|
||||
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT
|
||||
|
||||
|
@ -159,8 +160,12 @@
|
|||
|
||||
#define OSD
|
||||
|
||||
#define DEFAULT_RX_FEATURE FEATURE_RX_PPM
|
||||
#define DEFAULT_FEATURES (FEATURE_TRANSPONDER | FEATURE_RSSI_ADC | FEATURE_TELEMETRY)
|
||||
#define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
|
||||
#define DEFAULT_FEATURES (FEATURE_TRANSPONDER | FEATURE_RSSI_ADC | FEATURE_TELEMETRY | FEATURE_OSD | FEATURE_LED_STRIP)
|
||||
#define SERIALRX_UART SERIAL_PORT_USART2
|
||||
#define GPS_UART SERIAL_PORT_USART3
|
||||
#define TELEMETRY_UART SERIAL_PORT_UART5
|
||||
#define SERIALRX_PROVIDER SERIALRX_SBUS
|
||||
|
||||
#define BUTTONS
|
||||
#define BUTTON_A_PIN PD2
|
||||
|
|
Loading…
Reference in New Issue