From d2e5ecdb876e16665e01674e48e75dc9a123637b Mon Sep 17 00:00:00 2001
From: iggy <iggy@muc.ccc.de>
Date: Mon, 22 May 2023 09:20:48 +0200
Subject: [PATCH] FIX: get the global ctx for every mpy call, otherwise it does
 not work after a soft reboot

---
 usermodule/mp_hardware.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/usermodule/mp_hardware.c b/usermodule/mp_hardware.c
index 9e3b0a75bc..bcdcc81429 100644
--- a/usermodule/mp_hardware.c
+++ b/usermodule/mp_hardware.c
@@ -123,9 +123,7 @@ STATIC mp_obj_t mp_update_leds(size_t n_args, const mp_obj_t *args) {
 STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_update_leds_obj, 0, 2, mp_update_leds);
 
 STATIC mp_obj_t mp_get_ctx(size_t n_args, const mp_obj_t *args) {
-    if (mp_ctx == NULL) {
-        mp_ctx = mp_ctx_from_ctx(the_ctx);
-    }
+    mp_ctx = mp_ctx_from_ctx(the_ctx);
     return mp_ctx;
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_get_ctx_obj, 0, 0, mp_get_ctx);
-- 
GitLab