From fd7d32774f5f7f1c20710cc7316f08e805abafb6 Mon Sep 17 00:00:00 2001 From: Joshua Saxby <joshua.a.saxby@gmail.com> Date: Sun, 9 Feb 2020 16:13:40 +0000 Subject: [PATCH] Put debug test into separate function --- source/main.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/source/main.cpp b/source/main.cpp index 3ea1739..dd9c875 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -163,6 +163,25 @@ MicroBitImage Block::image() const { } +void debug_test() { + // XXX: simple debug test to check my FLASH images were stored correctly + while (true) { + // scroll random blocks down the screen + Block block; // make a new random Block + // starting positions: + int x = 1; + int y = -3; + // print image until scrolled down off the screen + while (y < 6) { + UBIT.display.clear(); + UBIT.display.print(block.image(), x, y); + y++; + UBIT.sleep(350); // 350ms sleep for 2.85 FPS + } + } +} + + int main() { // Initialise the micro:bit runtime. UBIT.init(); @@ -179,21 +198,7 @@ int main() { UBIT.display.scroll("BLOCKS!"); - // XXX: simple debug test to check my FLASH images were stored correctly - while (true) { - // scroll random blocks down the screen - Block block; // make a new random Block - // starting positions: - int x = 1; - int y = -3; - // print image until scrolled down off the screen - while (y < 6) { - UBIT.display.clear(); - UBIT.display.print(block.image(), x, y); - y++; - UBIT.sleep(350); // 350ms sleep for 2.85 FPS - } - } + debug_test(); // TODO: potentially remove this call, if clarified that it is not required. // If main exits, there may still be other fibers running or registered event handlers etc. -- GitLab