adapted default threshold for shakedetection

This commit is contained in:
hhaupt 2024-06-12 13:21:47 +02:00
parent 4a6a58e35f
commit bc2aef650d
2 changed files with 3 additions and 5 deletions

View File

@ -64,9 +64,8 @@ int8_t MotionDetection::getWhoAmI(){
};
bool MotionDetection::isShaken(uint32_t threshold ,uint8_t axis){
IMUResult measurment1 = this->getAcceleration();
delayMicroseconds(10);
IMUResult measurment2 = this->getAcceleration();
IMUResult measurment1;
IMUResult measurment2;
uint count = 0;
for(uint i = 0;i<20;i++){
measurment1 = this->getAcceleration();
@ -80,7 +79,6 @@ bool MotionDetection::isShaken(uint32_t threshold ,uint8_t axis){
}
delayMicroseconds(15);
}
Serial.println(count);
return (count > 6);
};

View File

@ -67,7 +67,7 @@ protected:
static const uint8_t WHO_AM_I = 0x75;
static const uint frequency = 10000000;
static const uint16_t defaultShakeThreshold = 1000;
static const uint16_t defaultShakeThreshold = 500;
uint16_t cmdRead(uint8_t regHigh,uint8_t regLow);
uint16_t cmdWrite(uint8_t regHigh,uint8_t regLow);