From e3aa6461f2d8ef5bb7103754f73c51a9a05ec326 Mon Sep 17 00:00:00 2001
From: Arist <aristkojevnikov@gmail.com>
Date: Sat, 8 Feb 2020 20:52:39 +0100
Subject: [PATCH] fix(max86150): avoid stack overflow in pycardium by using
 smaller buf

---
 pycardium/modules/max86150.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pycardium/modules/max86150.c b/pycardium/modules/max86150.c
index 511bfa2b1..e02617ebf 100644
--- a/pycardium/modules/max86150.c
+++ b/pycardium/modules/max86150.c
@@ -28,7 +28,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(
 
 STATIC mp_obj_t mp_max86150_read_sensor(mp_obj_t stream_id_in)
 {
-	struct max86150_sensor_data buf[256];
+	// do not use too big buf
+	// 256*12 is close to stack size of 4096, reduced to 64
+	struct max86150_sensor_data buf[64];
 	int stream_id = mp_obj_get_int(stream_id_in);
 
 	int n = epic_stream_read(stream_id, buf, sizeof(buf));
-- 
GitLab