From 2f56ff36403cc1c52ac4b3269d61b5894ca01a1f Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Sat, 14 Sep 2019 23:12:24 +0200
Subject: [PATCH] fix(bhi160): Call bhy_mapping_matrix_set twice for the first
 time

Due to a known issue (#133) the first call to bhy_mapping_matrix_set
can fail. This is a quick fix.
---
 epicardium/modules/bhi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/epicardium/modules/bhi.c b/epicardium/modules/bhi.c
index 66f8bb7e..711d5fe7 100644
--- a/epicardium/modules/bhi.c
+++ b/epicardium/modules/bhi.c
@@ -460,6 +460,11 @@ void vBhi160Task(void *pvParameters)
 	}
 
 	/* Remap axes to match card10 layout */
+	/* Due to a known issue (#133) the first call to
+	 * bhy_mapping_matrix_set might fail. */
+	bhy_mapping_matrix_set(
+		PHYSICAL_SENSOR_INDEX_ACC, bhi160_mapping_matrix
+	);
 	bhy_mapping_matrix_set(
 		PHYSICAL_SENSOR_INDEX_ACC, bhi160_mapping_matrix
 	);
-- 
GitLab