k323r / flugkatze Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
In the file "flugkatze/flightcontroller/v2_stm32/IMU.cpp", in the function "IMU::update()", there are two Wire.endTransmission() after each other. The second one is a Wire.endTransmission() on its own, and that is not allowed.
The function "IMU::getAddedRegisters()" is very complex, but all that timeout code is not needed. There is no such thing as a timeout after a Wire.requestFrom().
Explanation: Common-mistakes#1
When shifing 8 bits to the left, I prefer to do that with a 16 bits variable.
If the Wire.available() tells that there are enough data bytes available, they can be read and will be valid (they will be 0...255). Only in case there is no data, then the Wire.read() will return -1.
uint16_t IMU::getAddedRegisters() {
uint16_t reg1, reg2;
if (Wire.available() >= 2) { // still enough data in the buffer ?
reg1 = (uint16_t) Wire.read();
reg2 = (uint16_t) Wire.read();
} else {
return 0; // return zero in case of a I2C bus error
}
return (reg1 << 8 |reg2);
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.