From 6d8449cdaa7cc9bb197aac2372a762da64b3074d 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 bcb37bff41..46fa85df42 100644
--- a/usermodule/mp_hardware.c
+++ b/usermodule/mp_hardware.c
@@ -136,9 +136,7 @@ STATIC mp_obj_t mp_version(void) {
 STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_version_obj, mp_version);
 
 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