From d9c2688b77dcdf90d11cfa520bbd56ad73863e53 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 27 Feb 2016 16:45:29 +0100 Subject: disable animation switcher when storage is empty (closes #1) --- src/storage.cc | 1 - src/system.cc | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/storage.cc b/src/storage.cc index 517fedf..d1c2ee1 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -248,7 +248,6 @@ bool Storage::hasData() return num_anims; } -// TODO support multi-page reads void Storage::load(uint8_t idx, uint8_t *data) { uint8_t page_offset; diff --git a/src/system.cc b/src/system.cc index fdf3e4d..d8c27ab 100644 --- a/src/system.cc +++ b/src/system.cc @@ -90,6 +90,9 @@ void System::initialize() void System::loadPattern(uint8_t anim_no) { + if (!storage.hasData()) + return; + storage.load(anim_no, disp_buf); active_anim.type = (AnimationType)(disp_buf[0] >> 4); -- cgit v1.2.3