From d6b4ef38f6c070dc27577ae371d3b0b86d5aec3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Milants?= Date: Sat, 1 Oct 2022 21:03:28 +0200 Subject: [PATCH] Infineat & G7710 : always close files when they are not needed anymore. --- src/displayapp/screens/WatchFaceCasioStyleG7710.cpp | 3 +++ src/displayapp/screens/WatchFaceInfineat.cpp | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp index 4ef2839c..f9a01abd 100644 --- a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp +++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp @@ -36,14 +36,17 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(DisplayApp* app, lfs_file f = {}; if (filesystem.FileOpen(&f, "/fonts/lv_font_dots_40.bin", LFS_O_RDONLY) >= 0) { + filesystem.FileClose(&f); font_dot40 = lv_font_load("F:/fonts/lv_font_dots_40.bin"); } if (filesystem.FileOpen(&f, "/fonts/7segments_40.bin", LFS_O_RDONLY) >= 0) { + filesystem.FileClose(&f); font_segment40 = lv_font_load("F:/fonts/7segments_40.bin"); } if (filesystem.FileOpen(&f, "/fonts/7segments_115.bin", LFS_O_RDONLY) >= 0) { + filesystem.FileClose(&f); font_segment115 = lv_font_load("F:/fonts/7segments_115.bin"); } diff --git a/src/displayapp/screens/WatchFaceInfineat.cpp b/src/displayapp/screens/WatchFaceInfineat.cpp index e3ed1bf7..ae3f3dbb 100644 --- a/src/displayapp/screens/WatchFaceInfineat.cpp +++ b/src/displayapp/screens/WatchFaceInfineat.cpp @@ -27,7 +27,7 @@ WatchFaceInfineat::WatchFaceInfineat(DisplayApp* app, Controllers::NotificationManager& notificationManager, Controllers::Settings& settingsController, Controllers::MotionController& motionController, - Controllers::FS& fs) + Controllers::FS& filesystem) : Screen(app), currentDateTime {{}}, dateTimeController {dateTimeController}, @@ -37,11 +37,13 @@ WatchFaceInfineat::WatchFaceInfineat(DisplayApp* app, settingsController {settingsController}, motionController {motionController} { lfs_file f = {}; - if (fs.FileOpen(&f, "/fonts/teko.bin", LFS_O_RDONLY) >= 0) { + if (filesystem.FileOpen(&f, "/fonts/teko.bin", LFS_O_RDONLY) >= 0) { + filesystem.FileClose(&f); font_teko = lv_font_load("F:/fonts/teko.bin"); } - if (fs.FileOpen(&f, "/fonts/bebas.bin", LFS_O_RDONLY) >= 0) { + if (filesystem.FileOpen(&f, "/fonts/bebas.bin", LFS_O_RDONLY) >= 0) { + filesystem.FileClose(&f); font_bebas = lv_font_load("F:/fonts/bebas.bin"); }