From e4718fcb954236e98c31b8ab3488d63db5e30cf5 Mon Sep 17 00:00:00 2001 From: Yaya-Cout Date: Sat, 21 May 2022 17:38:26 +0200 Subject: [PATCH] [apps/external] Add simulator support (#238) --- Makefile | 11 ++++------- apps/external/extapp_api.cpp | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index dae92cf99..c42ed081a 100644 --- a/Makefile +++ b/Makefile @@ -31,14 +31,11 @@ ifeq ($(filter reader,$(apps_list)),) HAS_READER := 1 endif -ifeq (${MODEL}, n0110) - apps_list = ${EPSILON_APPS} -else - ifeq (${MODEL},bootloader) - apps_list = ${EPSILON_APPS} - else +# Remove the external apps for the n0100 +ifeq (${MODEL}, n0100) apps_list = $(foreach i, ${EPSILON_APPS}, $(if $(filter external, $(i)),,$(i))) - endif +else + apps_list = ${EPSILON_APPS} endif ifdef FORCE_EXTERNAL diff --git a/apps/external/extapp_api.cpp b/apps/external/extapp_api.cpp index 6bc548da4..23254ab91 100644 --- a/apps/external/extapp_api.cpp +++ b/apps/external/extapp_api.cpp @@ -37,18 +37,30 @@ void extapp_pushRect(int16_t x, int16_t y, uint16_t w, uint16_t h, const uint16_ KDRect rect(x, y, w, h); Ion::Display::pushRect(rect, reinterpret_cast(pixels)); + #ifndef DEVICE + // Refresh the display. + Ion::Keyboard::scan(); + #endif } void extapp_pushRectUniform(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t color) { KDRect rect(x, y, w, h); Ion::Display::pushRectUniform(rect, KDColor::RGB16(color)); + #ifndef DEVICE + // Refresh the display. + Ion::Keyboard::scan(); + #endif } void extapp_pullRect(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t * pixels) { KDRect rect(x, y, w, h); Ion::Display::pullRect(rect, (KDColor *)pixels); + #ifndef DEVICE + // Refresh the display. + Ion::Keyboard::scan(); + #endif } int16_t extapp_drawTextLarge(const char * text, int16_t x, int16_t y, uint16_t fg, uint16_t bg, bool fake) { @@ -59,6 +71,11 @@ int16_t extapp_drawTextLarge(const char * text, int16_t x, int16_t y, uint16_t f ctx->setOrigin(KDPoint(0, 0)); point = ctx->drawString(text, point, KDFont::LargeFont, KDColor::RGB16(fg), KDColor::RGB16(bg)); + #ifndef DEVICE + // Refresh the display. + Ion::Keyboard::scan(); + #endif + return point.x(); } @@ -70,6 +87,11 @@ int16_t extapp_drawTextSmall(const char * text, int16_t x, int16_t y, uint16_t f ctx->setOrigin(KDPoint(0, 0)); point = ctx->drawString(text, point, KDFont::SmallFont, KDColor::RGB16(fg), KDColor::RGB16(bg)); + #ifndef DEVICE + // Refresh the display. + Ion::Keyboard::scan(); + #endif + return point.x(); }