Infineat & G7710 : always close files when they are not needed anymore.

This commit is contained in:
Jean-François Milants 2022-10-01 21:03:28 +02:00
parent d3363baf69
commit d6b4ef38f6
2 changed files with 8 additions and 3 deletions

View File

@ -36,14 +36,17 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(DisplayApp* app,
lfs_file f = {}; lfs_file f = {};
if (filesystem.FileOpen(&f, "/fonts/lv_font_dots_40.bin", LFS_O_RDONLY) >= 0) { 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"); font_dot40 = lv_font_load("F:/fonts/lv_font_dots_40.bin");
} }
if (filesystem.FileOpen(&f, "/fonts/7segments_40.bin", LFS_O_RDONLY) >= 0) { 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"); font_segment40 = lv_font_load("F:/fonts/7segments_40.bin");
} }
if (filesystem.FileOpen(&f, "/fonts/7segments_115.bin", LFS_O_RDONLY) >= 0) { 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"); font_segment115 = lv_font_load("F:/fonts/7segments_115.bin");
} }

View File

@ -27,7 +27,7 @@ WatchFaceInfineat::WatchFaceInfineat(DisplayApp* app,
Controllers::NotificationManager& notificationManager, Controllers::NotificationManager& notificationManager,
Controllers::Settings& settingsController, Controllers::Settings& settingsController,
Controllers::MotionController& motionController, Controllers::MotionController& motionController,
Controllers::FS& fs) Controllers::FS& filesystem)
: Screen(app), : Screen(app),
currentDateTime {{}}, currentDateTime {{}},
dateTimeController {dateTimeController}, dateTimeController {dateTimeController},
@ -37,11 +37,13 @@ WatchFaceInfineat::WatchFaceInfineat(DisplayApp* app,
settingsController {settingsController}, settingsController {settingsController},
motionController {motionController} { motionController {motionController} {
lfs_file f = {}; 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"); 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"); font_bebas = lv_font_load("F:/fonts/bebas.bin");
} }