@@ -226,7 +226,7 @@ def __init__(self):
226
226
#acc_config = 0x17
227
227
#self.imu.write_byte(bma423.BMA4_ACCEL_CONFIG_ADDR, acc_config)
228
228
#print("int1 imu:", self.imu.read_byte(bma423.BMA4_INT1_IO_CTRL_ADDR))
229
- self .imu .map_int (0 , bma423 .BMA423_WAKEUP_INT | bma423 . BMA423_ANY_NO_MOTION_INT )
229
+ self .imu .map_int (0 , bma423 .BMA423_WAKEUP_INT )
230
230
self .imu .map_int (1 , 0 )
231
231
feat_data = self .imu .read_data (bma423 .BMA4_FEATURE_CONFIG_ADDR , bma423 .BMA423_FEATURE_SIZE )
232
232
feat_data [bma423 .BMA423_WAKEUP_OFFSET ] = 0x03 # enable and sensitivity 2/7
@@ -254,6 +254,7 @@ def __init__(self):
254
254
255
255
if self .WatchVersion == WATCHV1 or self .WatchVersion == WATCHV3 :
256
256
self .vibrator = machine .Pin (4 , machine .Pin .OUT )
257
+ self .vibration_controller = None
257
258
else :
258
259
self .vibration_controller = adafruit_drv2605 .DRV2605 (sensor_i2c )
259
260
self .vibration_controller ._write_u8 (0x01 , 0b10000000 ) # reset
@@ -349,23 +350,23 @@ def blit_buffer_rgb565(self, array):
349
350
def feedback1 (self , _ = None ):
350
351
if self .vibrator :
351
352
self .vibrator .on ()
352
- machine .Timer (- 1 , mode = machine .Timer .ONE_SHOT , period = 20 , callback = self .feedback_frame )
353
+ _thread .stack_size (64 ) # just a small thread bro i swear it's my last one bro
354
+ _thread .start_new_thread (self .feedback_frame , (20 ,))
353
355
elif self .vibration_controller :
354
356
self .vibration_controller .sequence [0 ] = adafruit_drv2605 .Effect (2 )
355
357
self .vibration_controller .play ()
356
358
357
-
358
-
359
-
360
359
def feedback2 (self , _ = None ):
361
360
if self .vibrator :
362
361
self .vibrator .on ()
363
- machine .Timer (- 1 , mode = machine .Timer .ONE_SHOT , period = 50 , callback = self .feedback_frame )
362
+ _thread .stack_size (64 )
363
+ _thread .start_new_thread (self .feedback_frame , (50 ,))
364
364
elif self .vibration_controller :
365
365
self .vibration_controller .sequence [0 ] = adafruit_drv2605 .Effect (1 )
366
366
self .vibration_controller .play ()
367
367
368
- def feedback_frame (self , _ ):
368
+ def feedback_frame (self , tm ):
369
+ time .sleep_ms (tm )
369
370
if self .vibrator :
370
371
self .vibrator .off ()
371
372
@@ -475,7 +476,6 @@ def irq_touch_process(self, pin):
475
476
Single .Kernel .event (Events .GestureEvent (3 ))
476
477
477
478
Single .Kernel .event (Events .ReleaseEvent (float (x ) / float (Hardware .DISPLAY_WIDTH ), float (y ) / float (Hardware .DISPLAY_HEIGHT )))
478
- #micropython.schedule(self.feedback1(), "bruh") # why? idk. It's giving recursion errors where it shouldnt
479
479
self .feedback1 ()
480
480
481
481
def fucky_wucky (self , e ): # try to print exception to display
0 commit comments