Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
diff --git a/src/main/drivers/bus_i2c_hal.c b/src/main/drivers/bus_i2c_hal.c index e3bc13da9..97e6ba9ec 100644 --- a/src/main/drivers/bus_i2c_hal.c +++ b/src/main/drivers/bus_i2c_hal.c @@ -32,7 +32,7 @@ #include "drivers/bus_i2c.h" #include "drivers/bus_i2c_impl.h" -#define CLOCKSPEED 800000 // i2c clockspeed 400kHz default (conform specs), 800kHz and 1200kHz (Betaflight default) +#define CLOCKSPEED 400000 // i2c clockspeed 400kHz default (conform specs), 800kHz and 1200kHz (Betaflight default) // Number of bits in I2C protocol phase #define LEN_ADDR 7 @@ -261,9 +261,9 @@ void i2cInit(I2CDevice device) if (pDev->overClock) { // 800khz Maximum speed tested on various boards without issues - pHandle->Init.Timing = 0x00500D1D; + pHandle->Init.Timing = 0x00401B1B; } else { - pHandle->Init.Timing = 0x00500C6F; + pHandle->Init.Timing = 0x00A01B5B; } pHandle->Init.OwnAddress1 = 0x0; diff --git a/src/main/drivers/bus_i2c_impl.h b/src/main/drivers/bus_i2c_impl.h index 42cb32751..372b28a14 100644 --- a/src/main/drivers/bus_i2c_impl.h +++ b/src/main/drivers/bus_i2c_impl.h @@ -24,7 +24,7 @@ #define I2C_SHORT_TIMEOUT ((uint32_t)0x1000) #define I2C_LONG_TIMEOUT ((uint32_t)(10 * I2C_SHORT_TIMEOUT)) -#define I2C_DEFAULT_TIMEOUT I2C_SHORT_TIMEOUT +#define I2C_DEFAULT_TIMEOUT I2C_LONG_TIMEOUT #define I2C_PIN_SEL_MAX 4 diff --git a/src/main/drivers/compass/compass_hmc5883l.c b/src/main/drivers/compass/compass_hmc5883l.c index 1a074a658..91461ea05 100644 --- a/src/main/drivers/compass/compass_hmc5883l.c +++ b/src/main/drivers/compass/compass_hmc5883l.c @@ -198,11 +201,6 @@ static void hmc5883SpiInit(busDevice_t *busdev) } #endif -static int16_t parseMag(uint8_t *raw, int16_t gain) { - int ret = (int16_t)(raw[0] << 8 | raw[1]) * gain / 256; - return constrain(ret, INT16_MIN, INT16_MAX); -} - static bool hmc5883lRead(magDev_t *mag, int16_t *magData) { uint8_t buf[6]; @@ -214,94 +211,27 @@ static bool hmc5883lRead(magDev_t *mag, int16_t *magData) if (!ack) { return false; } - // During calibration, magGain is 1.0, so the read returns normal non-calibrated values. - // After calibration is done, magGain is set to calculated gain values. - magData[X] = parseMag(buf + 0, mag->magGain[X]); - magData[Z] = parseMag(buf + 2, mag->magGain[Z]); - magData[Y] = parseMag(buf + 4, mag->magGain[Y]); + magData[X] = (int16_t)(buf[0] << 8 | buf[1]); + magData[Z] = (int16_t)(buf[2] << 8 | buf[3]); + magData[Y] = (int16_t)(buf[4] << 8 | buf[5]); return true; } static bool hmc5883lInit(magDev_t *mag) { - enum { - polPos, - polNeg - }; busDevice_t *busdev = &mag->busdev; - int16_t magADC[3]; - int i; - int32_t xyz_total[3] = { 0, 0, 0 }; // 32 bit totals so they won't overflow. - bool bret = true; // Error indicator - - mag->magGain[X] = 256; - mag->magGain[Y] = 256; - mag->magGain[Z] = 256; - - delay(50); - - busWriteRegister(busdev, HMC58X3_REG_CONFA, HMC_CONFA_DOR_15HZ | HMC_CONFA_POS_BIAS); // Reg A DOR = 0x010 + MS1, MS0 set to pos bias - - // Note that the very first measurement after a gain change maintains the same gain as the previous setting. - // The new gain setting is effective from the second measurement and on. - - busWriteRegister(busdev, HMC58X3_REG_CONFB, HMC_CONFB_GAIN_2_5GA); // Set the Gain to 2.5Ga (7:5->011) - - delay(100); - - hmc5883lRead(mag, magADC); - - for (int polarity = polPos; polarity <= polNeg; polarity++) { - switch(polarity) { - case polPos: - busWriteRegister(busdev, HMC58X3_REG_CONFA, HMC_CONFA_DOR_15HZ | HMC_CONFA_POS_BIAS); // Reg A DOR = 0x010 + MS1, MS0 set to pos bias - break; - case polNeg: - busWriteRegister(busdev, HMC58X3_REG_CONFA, HMC_CONFA_DOR_15HZ | HMC_CONFA_NEG_BIAS); // Reg A DOR = 0x010 + MS1, MS0 set to negative bias. - break; - } - for (i = 0; i < 10; i++) { // Collect 10 samples - busWriteRegister(busdev, HMC58X3_REG_MODE, HMC_MODE_SINGLE); - delay(20); - hmc5883lRead(mag, magADC); // Get the raw values in case the scales have already been changed. - - // Since the measurements are noisy, they should be averaged rather than taking the max. - - xyz_total[X] += ((polarity == polPos) ? 1 : -1) * magADC[X]; - xyz_total[Y] += ((polarity == polPos) ? 1 : -1) * magADC[Y]; - xyz_total[Z] += ((polarity == polPos) ? 1 : -1) * magADC[Z]; - - // Detect saturation. - if (-4096 >= MIN(magADC[X], MIN(magADC[Y], magADC[Z]))) { - bret = false; - break; // Breaks out of the for loop. No sense in continuing if we saturated. - } - LED1_TOGGLE; - } - } - - mag->magGain[X] = (int)(660.0f * HMC58X3_X_SELF_TEST_GAUSS * 2.0f * 10.0f * 256.0f) / xyz_total[X]; - mag->magGain[Y] = (int)(660.0f * HMC58X3_Y_SELF_TEST_GAUSS * 2.0f * 10.0f * 256.0f) / xyz_total[Y]; - mag->magGain[Z] = (int)(660.0f * HMC58X3_Z_SELF_TEST_GAUSS * 2.0f * 10.0f * 256.0f) / xyz_total[Z]; // leave test mode - busWriteRegister(busdev, HMC58X3_REG_CONFA, HMC_CONFA_8_SAMLES | HMC_CONFA_DOR_15HZ | HMC_CONFA_NORMAL); // Configuration Register A -- 0 11 100 00 num samples: 8 ; output rate: 15Hz ; normal measurement mode busWriteRegister(busdev, HMC58X3_REG_CONFB, HMC_CONFB_GAIN_1_3GA); // Configuration Register B -- 001 00000 configuration gain 1.3Ga busWriteRegister(busdev, HMC58X3_REG_MODE, HMC_MODE_CONTINOUS); // Mode register -- 000000 00 continuous Conversion Mode delay(100); - if (!bret) { // Something went wrong so get a best guess - mag->magGain[X] = 256; - mag->magGain[Y] = 256; - mag->magGain[Z] = 256; - } - hmc5883lConfigureDataReadyInterruptHandling(mag); return true; } diff --git a/src/main/target/OMNIBUSF7/target.c b/src/main/target/OMNIBUSF7/target.c index e559da763..2e3941d90 100644 --- a/src/main/target/OMNIBUSF7/target.c +++ b/src/main/target/OMNIBUSF7/target.c @@ -43,7 +43,6 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { DEF_TIM(TIM8, CH2, PC7, TIM_USE_NONE, 0, 0 ), // UART6_RX DEF_TIM(TIM2, CH4, PA3, TIM_USE_PPM, 0, 0 ), // UART2_RX, joined with PE13 - // For ESC serial - DEF_TIM(TIM9, CH1, PA2, TIM_USE_NONE, 0, 0 ), // UART2_TX (unwired) - + // SmartPort on Softserial + DEF_TIM(TIM9, CH2, PE6, TIM_USE_NONE, 0, 0 ), // MOSI -> Softserial }; diff --git a/src/main/target/common_fc_pre.h b/src/main/target/common_fc_pre.h index 7ca03d37a..428ab5735 100644 --- a/src/main/target/common_fc_pre.h +++ b/src/main/target/common_fc_pre.h @@ -28,8 +28,8 @@ //#define SCHEDULER_DEBUG // define this to use scheduler debug[] values. Undefined by default for performance reasons #define DEBUG_MODE DEBUG_NONE // change this to change initial debug mode -#define I2C1_OVERCLOCK true -#define I2C2_OVERCLOCK true +#define I2C1_OVERCLOCK false +#define I2C2_OVERCLOCK false #ifdef STM32F1 #define MINIMAL_CLI @@ -47,7 +47,7 @@ #ifdef STM32F4 #define USE_DSHOT #define USE_ESC_SENSOR -#define I2C3_OVERCLOCK true +#define I2C3_OVERCLOCK false #define USE_GYRO_DATA_ANALYSE #define USE_ADC #define USE_ADC_INTERNAL @@ -64,8 +64,8 @@ #ifdef STM32F7 #define USE_DSHOT #define USE_ESC_SENSOR -#define I2C3_OVERCLOCK true -#define I2C4_OVERCLOCK true +#define I2C3_OVERCLOCK false +#define I2C4_OVERCLOCK false #define USE_GYRO_DATA_ANALYSE #endif
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
⭐ Free ETH Method ⭐ R
JavaScript | 10 sec ago | 0.31 KB
✅ MAKE $9OO INSTANTLY E
JavaScript | 19 sec ago | 0.31 KB
✅ Exploit 5OO$ in 15 Minutes Q
JavaScript | 37 sec ago | 0.31 KB
⭐ Instant Profit Method ⭐ A
JavaScript | 51 sec ago | 0.31 KB
✅ MAKE $5OO IN 15 MIN L
JavaScript | 1 min ago | 0.31 KB
✅ MAKE $9OO INSTANTLY E
JavaScript | 1 min ago | 0.31 KB
⭐Crypto Exchange Profit Method⭐ P
JavaScript | 1 min ago | 0.31 KB
⭐ChangeNOW Bug (Get more on BTC swaps) 8
JavaScript | 1 min ago | 0.31 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!