From 1a23a4f023ac97d7910428e10b3cd19b024ce4cc Mon Sep 17 00:00:00 2001 From: Michael Jakob Date: Wed, 10 Aug 2016 11:10:44 +0200 Subject: [PATCH 1/5] Sparky 2.0 UART fix --- src/main/target/SPARKY2/target.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/target/SPARKY2/target.h b/src/main/target/SPARKY2/target.h index 0ed29e661..febebfa1f 100644 --- a/src/main/target/SPARKY2/target.h +++ b/src/main/target/SPARKY2/target.h @@ -77,18 +77,18 @@ #define USE_VCP #define VBUS_SENSING_PIN PA8 -#define USE_USART1 -#define USART1_RX_PIN PA10 -#define USART1_TX_PIN PA9 -#define USART1_AHB1_PERIPHERALS RCC_AHB1Periph_DMA2 +#define USE_UART1 +#define UART1_RX_PIN PA10 +#define UART1_TX_PIN PA9 +#define UART1_AHB1_PERIPHERALS RCC_AHB1Periph_DMA2 -#define USE_USART3 -#define USART3_RX_PIN PB11 -#define USART3_TX_PIN PB10 +#define USE_UART3 +#define UART3_RX_PIN PB11 +#define UART3_TX_PIN PB10 -#define USE_USART6 -#define USART6_RX_PIN PC7 -#define USART6_TX_PIN PC6 //inverter +#define USE_UART6 +#define UART6_RX_PIN PC7 +#define UART6_TX_PIN PC6 //inverter #define SERIAL_PORT_COUNT 4 From 66f1abe1be4ae571a9e071bccbe974d2e6e68709 Mon Sep 17 00:00:00 2001 From: blckmn Date: Wed, 10 Aug 2016 20:54:26 +1000 Subject: [PATCH 2/5] Added missing delay for F4 to CLI --- src/main/io/serial_cli.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index 7eedf297a..215fc67b1 100644 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -2975,7 +2975,11 @@ static bool cliDumpPrintf(uint8_t dumpMask, bool equalsDefault, const char *form tfp_format(cliWriter, cliPutp, format, va); va_end(va); - return true; +#ifdef USE_SLOW_SERIAL_CLI + delay(1); +#endif + + return true; } return false; From 22a55ce313c2b19daaba54c5a8f89f0541cfdea7 Mon Sep 17 00:00:00 2001 From: KiteAnton Date: Wed, 10 Aug 2016 15:38:25 +0200 Subject: [PATCH 3/5] Fix issue with newline for MAC users --- src/main/io/serial_cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index 215fc67b1..3a14434be 100644 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -3209,7 +3209,7 @@ static void cliGet(char *cmdline) val = &valueTable[i]; cliPrintf("%s = ", valueTable[i].name); cliPrintVar(val, 0); - cliPrint("\n"); + cliPrint("\r\n"); cliPrintVarRange(val); cliPrint("\r\n"); From 511117d41c61f120560bf83de950cac0207c1fbd Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Thu, 11 Aug 2016 08:10:30 +1200 Subject: [PATCH 4/5] Fixed 'diff commented' CLI command. --- src/main/io/serial_cli.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index 3a14434be..e1abbbeca 100644 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -2305,16 +2305,18 @@ static void printConfig(char *cmdline, bool doDiff) dumpMask = DUMP_RATES; // only } else if ((options = checkCommand(cmdline, "all"))) { dumpMask = DUMP_ALL; // all profiles and rates + } else { + options = cmdline; } master_t defaultConfig; if (doDiff) { dumpMask = dumpMask | DO_DIFF; - createDefaultConfig(&defaultConfig); - } + createDefaultConfig(&defaultConfig); - if (checkCommand(options, "commented")) { - dumpMask = dumpMask | DIFF_COMMENTED; // add unchanged values as comments for diff + if (checkCommand(cmdline, "commented")) { + dumpMask = dumpMask | DIFF_COMMENTED; // add unchanged values as comments for diff + } } if ((dumpMask & DUMP_MASTER) || (dumpMask & DUMP_ALL)) { From 5f23efe70c237a0a07c2513b29080f3f4ac84c18 Mon Sep 17 00:00:00 2001 From: Gary Keeble Date: Thu, 11 Aug 2016 06:34:04 +0100 Subject: [PATCH 5/5] Update Log Header for Betaflight PID Parameters Add new betaflight PID controller parameters to log header and debug_mode (so we know what is being logged in the debug fields) --- src/main/blackbox/blackbox.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index 406ce05d3..09946a4ab 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -1210,18 +1210,34 @@ static bool blackboxWriteSysinfo() BLACKBOX_PRINT_HEADER_LINE("velPID:%d,%d,%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.P8[PIDVEL], masterConfig.profile[masterConfig.current_profile_index].pidProfile.I8[PIDVEL], masterConfig.profile[masterConfig.current_profile_index].pidProfile.D8[PIDVEL]); - BLACKBOX_PRINT_HEADER_LINE("yaw_p_limit:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.yaw_p_limit); - BLACKBOX_PRINT_HEADER_LINE("yaw_lpf_hz:%d", (int)(masterConfig.profile[masterConfig.current_profile_index].pidProfile.yaw_lpf_hz * 100.0f)); - BLACKBOX_PRINT_HEADER_LINE("dterm_average_count:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.dterm_average_count); - BLACKBOX_PRINT_HEADER_LINE("vbat_pid_compensation:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.vbatPidCompensation); - BLACKBOX_PRINT_HEADER_LINE("rollPitchItermIgnoreRate:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.rollPitchItermIgnoreRate); - BLACKBOX_PRINT_HEADER_LINE("yawItermIgnoreRate:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.yawItermIgnoreRate); + BLACKBOX_PRINT_HEADER_LINE("dterm_filter_type:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.dterm_filter_type); BLACKBOX_PRINT_HEADER_LINE("dterm_lpf_hz:%d", (int)(masterConfig.profile[masterConfig.current_profile_index].pidProfile.dterm_lpf_hz * 100.0f)); + BLACKBOX_PRINT_HEADER_LINE("yaw_lpf_hz:%d", (int)(masterConfig.profile[masterConfig.current_profile_index].pidProfile.yaw_lpf_hz * 100.0f)); BLACKBOX_PRINT_HEADER_LINE("dterm_notch_hz:%d", (int)(masterConfig.profile[masterConfig.current_profile_index].pidProfile.dterm_notch_hz * 100.0f)); BLACKBOX_PRINT_HEADER_LINE("dterm_notch_cutoff:%d", (int)(masterConfig.profile[masterConfig.current_profile_index].pidProfile.dterm_notch_cutoff * 100.0f)); + BLACKBOX_PRINT_HEADER_LINE("deltaMethod:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.deltaMethod); + BLACKBOX_PRINT_HEADER_LINE("rollPitchItermIgnoreRate:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.rollPitchItermIgnoreRate); + BLACKBOX_PRINT_HEADER_LINE("yawItermIgnoreRate:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.yawItermIgnoreRate); + BLACKBOX_PRINT_HEADER_LINE("yaw_p_limit:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.yaw_p_limit); + BLACKBOX_PRINT_HEADER_LINE("dterm_average_count:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.dterm_average_count); + BLACKBOX_PRINT_HEADER_LINE("vbat_pid_compensation:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.vbatPidCompensation); + BLACKBOX_PRINT_HEADER_LINE("pidAtMinThrottle:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.pidAtMinThrottle); + + // Betaflight PID controller parameters + BLACKBOX_PRINT_HEADER_LINE("toleranceBand:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.toleranceBand); + BLACKBOX_PRINT_HEADER_LINE("toleranceBandReduction:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.toleranceBandReduction); + BLACKBOX_PRINT_HEADER_LINE("zeroCrossAllowanceCount:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.zeroCrossAllowanceCount); + BLACKBOX_PRINT_HEADER_LINE("itermThrottleGain:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.itermThrottleGain); + BLACKBOX_PRINT_HEADER_LINE("ptermSetpointWeight:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.ptermSetpointWeight); + BLACKBOX_PRINT_HEADER_LINE("dtermSetpointWeight:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.dtermSetpointWeight); + BLACKBOX_PRINT_HEADER_LINE("yawRateAccelLimit:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.yawRateAccelLimit); + BLACKBOX_PRINT_HEADER_LINE("rateAccelLimit:%d", masterConfig.profile[masterConfig.current_profile_index].pidProfile.rateAccelLimit); + // End of Betaflight controller parameters + BLACKBOX_PRINT_HEADER_LINE("deadband:%d", masterConfig.rcControlsConfig.deadband); BLACKBOX_PRINT_HEADER_LINE("yaw_deadband:%d", masterConfig.rcControlsConfig.yaw_deadband); BLACKBOX_PRINT_HEADER_LINE("gyro_lpf:%d", masterConfig.gyro_lpf); + BLACKBOX_PRINT_HEADER_LINE("gyro_soft_type:%d", masterConfig.gyro_soft_type); BLACKBOX_PRINT_HEADER_LINE("gyro_lowpass_hz:%d", (int)(masterConfig.gyro_soft_lpf_hz * 100.0f)); BLACKBOX_PRINT_HEADER_LINE("gyro_notch_hz:%d", (int)(masterConfig.gyro_soft_notch_hz * 100.0f)); BLACKBOX_PRINT_HEADER_LINE("gyro_notch_cutoff:%d", (int)(masterConfig.gyro_soft_notch_cutoff * 100.0f)); @@ -1237,6 +1253,7 @@ static bool blackboxWriteSysinfo() BLACKBOX_PRINT_HEADER_LINE("unsynced_fast_pwm:%d", masterConfig.use_unsyncedPwm); BLACKBOX_PRINT_HEADER_LINE("fast_pwm_protocol:%d", masterConfig.motor_pwm_protocol); BLACKBOX_PRINT_HEADER_LINE("motor_pwm_rate:%d", masterConfig.motor_pwm_rate); + BLACKBOX_PRINT_HEADER_LINE("debug_mode:%d", masterConfig.debug_mode); BLACKBOX_PRINT_HEADER_LINE("features:%d", masterConfig.enabledFeatures); default: