Skip to content

Commit a36cb24

Browse files
committed
added retard on tilt after shake
1 parent 808614f commit a36cb24

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Arduino_AlvikCarrier.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Arduino_AlvikCarrier::Arduino_AlvikCarrier(){
7878
yh = 0;
7979
zl = 0;
8080
zh = 0;
81+
tilt_time = 0;
8182

8283
// version
8384
version_high = VERSION_BYTE_HIGH;
@@ -702,9 +703,10 @@ void Arduino_AlvikCarrier::updateImu(){
702703
}
703704
if (is_shaking && (millis()-shake_time_sig>1000)){
704705
is_shaking = false;
706+
tilt_time = millis();
705707
}
706708

707-
if (!is_shaking){
709+
if ((!is_shaking) && (millis()-tilt_time>1000)){
708710
imu->Get_6D_Orientation_XL(&xl);
709711
imu->Get_6D_Orientation_XH(&xh);
710712
imu->Get_6D_Orientation_YL(&yl);

src/Arduino_AlvikCarrier.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class Arduino_AlvikCarrier{
7272
uint16_t shake_counter;
7373
uint8_t tilt_status;
7474
uint8_t xl, xh, yl, yh, zl, zh;
75+
unsigned long tilt_time;
7576

7677
uint8_t version_high;
7778
uint8_t version_mid;

0 commit comments

Comments
 (0)