From 95f738f8992a10b5ad059e55790ce579a90b68d2 Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Sat, 5 Oct 2019 23:06:59 +0200
Subject: [PATCH] fix(pmic): Return to sync logging before sleep to not block

---
 epicardium/modules/pmic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/epicardium/modules/pmic.c b/epicardium/modules/pmic.c
index 921923c9..6c95fa46 100644
--- a/epicardium/modules/pmic.c
+++ b/epicardium/modules/pmic.c
@@ -184,8 +184,6 @@ __attribute__((noreturn)) static void pmic_die(float u_batt)
 	/* TODO: Wake-up when USB is attached again */
 	sleep_deepsleep();
 	card10_reset();
-	while (1)
-		;
 }
 
 /*
@@ -368,6 +366,7 @@ void vPmicTask(void *pvParameters)
 				if (duration >= pdMS_TO_TICKS(1000)) {
 					if (epic_buttons_read(
 						    BUTTON_RIGHT_TOP)) {
+						serial_return_to_synchronous();
 						LOG_WARN(
 							"pmic",
 							"Resetting ..."
@@ -386,6 +385,7 @@ void vPmicTask(void *pvParameters)
 					}
 
 					if (duration > pdMS_TO_TICKS(1000)) {
+						serial_return_to_synchronous();
 						LOG_WARN("pmic", "Poweroff");
 						sleep_deepsleep();
 						card10_reset();
-- 
GitLab