diff --git a/epicardium/fs/filesystem_fat.c b/epicardium/fs/filesystem_fat.c
index 2f513b767167b2fb48f7ea0a3b03f3a6a0ede955..ccaec62157174cdfab14c957d157941b063acc64 100644
--- a/epicardium/fs/filesystem_fat.c
+++ b/epicardium/fs/filesystem_fat.c
@@ -25,7 +25,6 @@
 #include "modules/log.h"
 #include "modules/modules.h"
 #include "api/common.h"
-#include "core_cmFunc.h" //__get_IPSR()
 
 #define SSLOG_DEBUG(...) LOG_DEBUG("fatfs", __VA_ARGS__)
 #define SSLOG_INFO(...) LOG_INFO("fatfs", __VA_ARGS__)
@@ -169,11 +168,11 @@ int fatfs_attach()
 void fatfs_schedule_attach(void)
 {
 	//if we're running in thread context, cont't call the *FromISR version
-	if (__get_IPSR() == 0) {
+	if (xPortIsInsideInterrupt()) {
+		xTimerPendFunctionCallFromISR(cb_attachTimer, NULL, 0, NULL);
+	} else {
 		xTimerPendFunctionCall(
 			cb_attachTimer, NULL, 0, 1); //wait 1 tick
-	} else {
-		xTimerPendFunctionCallFromISR(cb_attachTimer, NULL, 0, NULL);
 	}
 }