RPM_Motor_Stop_Bugfix
using calculateThrottleStatus, send 0 as RPM when THROTTLE_LOW and MOTOR_STOP
This commit is contained in:
parent
8a9d2e3708
commit
7220365575
|
@ -747,7 +747,7 @@ void loop(void)
|
||||||
|
|
||||||
#ifdef TELEMETRY
|
#ifdef TELEMETRY
|
||||||
if (!cliMode && feature(FEATURE_TELEMETRY)) {
|
if (!cliMode && feature(FEATURE_TELEMETRY)) {
|
||||||
handleTelemetry();
|
handleTelemetry(&masterConfig.rxConfig, masterConfig.flight3DConfig.deadband3d_throttle);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -193,11 +193,15 @@ static void sendGpsAltitude(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void sendThrottleOrBatterySizeAsRpm(void)
|
static void sendThrottleOrBatterySizeAsRpm(rxConfig_t *rxConfig, uint16_t deadband3d_throttle)
|
||||||
{
|
{
|
||||||
|
uint16_t throttleForRPM = rcCommand[THROTTLE] / BLADE_NUMBER_DIVIDER;
|
||||||
sendDataHead(ID_RPM);
|
sendDataHead(ID_RPM);
|
||||||
if (ARMING_FLAG(ARMED)) {
|
if (ARMING_FLAG(ARMED)) {
|
||||||
serialize16(rcCommand[THROTTLE] / BLADE_NUMBER_DIVIDER);
|
throttleStatus_e throttleStatus = calculateThrottleStatus(rxConfig, deadband3d_throttle);
|
||||||
|
if (throttleStatus == THROTTLE_LOW && feature(FEATURE_MOTOR_STOP))
|
||||||
|
throttleForRPM = 0;
|
||||||
|
serialize16(throttleForRPM);
|
||||||
} else {
|
} else {
|
||||||
serialize16((batteryConfig->batteryCapacity / BLADE_NUMBER_DIVIDER));
|
serialize16((batteryConfig->batteryCapacity / BLADE_NUMBER_DIVIDER));
|
||||||
}
|
}
|
||||||
|
@ -460,7 +464,7 @@ void checkFrSkyTelemetryState(void)
|
||||||
freeFrSkyTelemetryPort();
|
freeFrSkyTelemetryPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleFrSkyTelemetry(void)
|
void handleFrSkyTelemetry(rxConfig_t *rxConfig, uint16_t deadband3d_throttle)
|
||||||
{
|
{
|
||||||
if (!frskyTelemetryEnabled) {
|
if (!frskyTelemetryEnabled) {
|
||||||
return;
|
return;
|
||||||
|
@ -491,7 +495,7 @@ void handleFrSkyTelemetry(void)
|
||||||
|
|
||||||
if ((cycleNum % 8) == 0) { // Sent every 1s
|
if ((cycleNum % 8) == 0) { // Sent every 1s
|
||||||
sendTemperature1();
|
sendTemperature1();
|
||||||
sendThrottleOrBatterySizeAsRpm();
|
sendThrottleOrBatterySizeAsRpm(rxConfig, deadband3d_throttle);
|
||||||
|
|
||||||
if (feature(FEATURE_VBAT)) {
|
if (feature(FEATURE_VBAT)) {
|
||||||
sendVoltage();
|
sendVoltage();
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "rx/rx.h"
|
||||||
|
|
||||||
#ifndef TELEMETRY_FRSKY_H_
|
#ifndef TELEMETRY_FRSKY_H_
|
||||||
#define TELEMETRY_FRSKY_H_
|
#define TELEMETRY_FRSKY_H_
|
||||||
|
|
||||||
|
@ -23,7 +25,7 @@ typedef enum {
|
||||||
FRSKY_VFAS_PRECISION_HIGH
|
FRSKY_VFAS_PRECISION_HIGH
|
||||||
} frskyVFasPrecision_e;
|
} frskyVFasPrecision_e;
|
||||||
|
|
||||||
void handleFrSkyTelemetry(void);
|
void handleFrSkyTelemetry(rxConfig_t *rxConfig, uint16_t deadband3d_throttle);
|
||||||
void checkFrSkyTelemetryState(void);
|
void checkFrSkyTelemetryState(void);
|
||||||
|
|
||||||
void initFrSkyTelemetry(telemetryConfig_t *telemetryConfig);
|
void initFrSkyTelemetry(telemetryConfig_t *telemetryConfig);
|
||||||
|
|
|
@ -80,9 +80,9 @@ void checkTelemetryState(void)
|
||||||
checkSmartPortTelemetryState();
|
checkSmartPortTelemetryState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleTelemetry(void)
|
void handleTelemetry(rxConfig_t *rxConfig, uint16_t deadband3d_throttle)
|
||||||
{
|
{
|
||||||
handleFrSkyTelemetry();
|
handleFrSkyTelemetry(rxConfig, deadband3d_throttle);
|
||||||
handleHoTTTelemetry();
|
handleHoTTTelemetry();
|
||||||
handleMSPTelemetry();
|
handleMSPTelemetry();
|
||||||
handleSmartPortTelemetry();
|
handleSmartPortTelemetry();
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
* Created on: 6 Apr 2014
|
* Created on: 6 Apr 2014
|
||||||
* Author: Hydra
|
* Author: Hydra
|
||||||
*/
|
*/
|
||||||
|
#include "rx/rx.h"
|
||||||
|
|
||||||
#ifndef TELEMETRY_COMMON_H_
|
#ifndef TELEMETRY_COMMON_H_
|
||||||
#define TELEMETRY_COMMON_H_
|
#define TELEMETRY_COMMON_H_
|
||||||
|
@ -46,7 +47,7 @@ typedef struct telemetryConfig_s {
|
||||||
} telemetryConfig_t;
|
} telemetryConfig_t;
|
||||||
|
|
||||||
void checkTelemetryState(void);
|
void checkTelemetryState(void);
|
||||||
void handleTelemetry(void);
|
void handleTelemetry(rxConfig_t *rxConfig, uint16_t deadband3d_throttle);
|
||||||
|
|
||||||
bool determineNewTelemetryEnabledState(portSharing_e portSharing);
|
bool determineNewTelemetryEnabledState(portSharing_e portSharing);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue