From 9ac4be8b759bb2cedeb999ce5e87d983261beded Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Thu, 8 Apr 2021 20:07:24 +0200 Subject: TwiMaster is now based on the NRFX TWI driver, as it handles more edge cases and workarounds for errors on the bus. Reset the TWI bus after the soft-reset of the motion sensor to workaround issues on the TWI bus. --- src/systemtask/SystemTask.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/systemtask') diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 4605ba95..6163c105 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -84,10 +84,14 @@ void SystemTask::Work() { touchPanel.Init(); batteryController.Init(); motorController.Init(); - motionSensor.Init(); + motionSensor.SoftReset(); - settingsController.Init(); + // Reset the TWI device because the motion sensor chip most probably crashed it... + twiMaster.Sleep(); + twiMaster.Init(); + motionSensor.Init(); + settingsController.Init(); displayApp = std::make_unique(lcd, lvgl, touchPanel, batteryController, bleController, dateTimeController, watchdogView, *this, notificationManager, -- cgit v1.2.3-70-g09d2