From 6e1c47cbe025c1837fba968aa74acb9c94cddd81 Mon Sep 17 00:00:00 2001 From: Scott Allen Date: Sun, 21 Jan 2018 15:25:42 -0500 Subject: [PATCH] Refactor idle() to reduce code size --- src/Arduboy2Core.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Arduboy2Core.cpp b/src/Arduboy2Core.cpp index 190ffd6..a9790da 100644 --- a/src/Arduboy2Core.cpp +++ b/src/Arduboy2Core.cpp @@ -261,8 +261,9 @@ void Arduboy2Core::safeMode() void Arduboy2Core::idle() { - set_sleep_mode(SLEEP_MODE_IDLE); - sleep_mode(); + SMCR = _BV(SE); // select idle mode and enable sleeping + sleep_cpu(); + SMCR = 0; // disable sleeping } void Arduboy2Core::bootPowerSaving()