Remove unnecessary comments, clean up code
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
LSM6DS3 imu(I2C_MODE, 0x6A);
|
||||
|
||||
// ─── I2C helpers ──────────────────────────────────────────────────────────────
|
||||
// I2C helpers
|
||||
void imuWriteReg(uint8_t reg, uint8_t val) {
|
||||
// LSM6DS3 is on Wire1 (internal I2C, SDA=P0.17, SCL=P0.16), NOT Wire (external pins 4/5)
|
||||
Wire1.beginTransmission(0x6A); Wire1.write(reg); Wire1.write(val); Wire1.endTransmission();
|
||||
@@ -16,13 +16,13 @@ uint8_t imuReadReg(uint8_t reg) {
|
||||
return Wire1.available() ? Wire1.read() : 0;
|
||||
}
|
||||
|
||||
// ─── Temperature ──────────────────────────────────────────────────────────────
|
||||
// Temperature
|
||||
float readIMUTemp() {
|
||||
int16_t raw = (int16_t)((imuReadReg(REG_OUT_TEMP_H) << 8) | imuReadReg(REG_OUT_TEMP_L));
|
||||
return 25.0f + (float)raw / 256.0f;
|
||||
}
|
||||
|
||||
// ─── Calibration ──────────────────────────────────────────────────────────────
|
||||
// Calibration
|
||||
void calibrateGyroBias() {
|
||||
Serial.println("[CAL] Hold still...");
|
||||
double sx=0, sy=0, sz=0;
|
||||
@@ -51,7 +51,7 @@ void calibrateGyroBias() {
|
||||
Serial.print(","); Serial.println(biasGZ,4);
|
||||
}
|
||||
|
||||
// ─── Motion curve ─────────────────────────────────────────────────────────────
|
||||
// Motion curve
|
||||
float applyCurve(float v) {
|
||||
switch (cfg.curve) {
|
||||
case CURVE_SQUARE: return (v >= 0 ? 1.f : -1.f) * v * v;
|
||||
|
||||
Reference in New Issue
Block a user