Skip to content

Commit

Permalink
added retard on tilt after shake
Browse files Browse the repository at this point in the history
  • Loading branch information
gbr1 committed Jul 30, 2024
1 parent 808614f commit a36cb24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Arduino_AlvikCarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Arduino_AlvikCarrier::Arduino_AlvikCarrier(){
yh = 0;
zl = 0;
zh = 0;
tilt_time = 0;

// version
version_high = VERSION_BYTE_HIGH;
Expand Down Expand Up @@ -702,9 +703,10 @@ void Arduino_AlvikCarrier::updateImu(){
}
if (is_shaking && (millis()-shake_time_sig>1000)){
is_shaking = false;
tilt_time = millis();
}

if (!is_shaking){
if ((!is_shaking) && (millis()-tilt_time>1000)){
imu->Get_6D_Orientation_XL(&xl);
imu->Get_6D_Orientation_XH(&xh);
imu->Get_6D_Orientation_YL(&yl);
Expand Down
1 change: 1 addition & 0 deletions src/Arduino_AlvikCarrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class Arduino_AlvikCarrier{
uint16_t shake_counter;
uint8_t tilt_status;
uint8_t xl, xh, yl, yh, zl, zh;
unsigned long tilt_time;

uint8_t version_high;
uint8_t version_mid;
Expand Down

0 comments on commit a36cb24

Please sign in to comment.