Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infineat external resources #1324

Merged
merged 38 commits into from
Sep 27, 2022
Merged

Infineat external resources #1324

merged 38 commits into from
Sep 27, 2022

Conversation

JF002
Copy link
Collaborator

@JF002 JF002 commented Sep 11, 2022

This branch contains #1024 merged with develop. I've also added support for external resources.

@dmlls Would you like to have a look at those changes? If it's OK for you, I can add those commit to your PR and eventually merge it :)

# Conflicts:
#	src/displayapp/screens/Symbols.h
#	src/displayapp/screens/settings/SettingWatchFace.cpp
#	src/displayapp/screens/settings/SettingWatchFace.h
@dmlls
Copy link
Contributor

dmlls commented Sep 15, 2022

@JF002 looks good!

Maybe a stupid question, but should the Actions build run as is on the PineTime? I've tried it but it crashes. There's probably something obvious I'm missing :)

Also, just as a note, the case when the fonts are not loaded and falls back to the system fonts will cause misalignments. But this is probably fine, since at that point there is already something not working properly.

@JF002
Copy link
Collaborator Author

JF002 commented Sep 17, 2022

@dmlls Thanks for the review!

Maybe a stupid question, but should the Actions build run as is on the PineTime? I've tried it but it crashes. There's probably something obvious I'm missing :)

I don't think you're missing anything obvious... I've just tried the DFU from the CI build (https://github.com/InfiniTimeOrg/InfiniTime/actions/runs/3032845417) and it works fine on my setup, even if the resources are not loaded yet. What happens when "it crashes" ? It boots and resets a few seconds later?

EDIT : note that both files from the CI build are intended to be run with the bootloader. Most of the companion apps support the DFU ZIP file, and Amazfish needs the MCUBoot image (Amazfish implemented the support for the zip file recently, so it should be available soon!). If you want to flash it via SWD, you need to flash the MCUBoot image at offset 0x8000 (and the bootloader at 0x00).

Also, just as a note, the case when the fonts are not loaded and falls back to the system fonts will cause misalignments. But this is probably fine, since at that point there is already something not working properly.

I implemented this fallback mode to ensure that the watch wouldn't crash if the resources are not installed when running this code. And I confirm, the alignment is not perfect with the system font. That's something we can improve if we want the fallback mode to look good, indeed!

@dmlls
Copy link
Contributor

dmlls commented Sep 20, 2022

@JF002 not sure what I was doing wrong, but installing the DFU via Gadgetbdrige worked neatly ;) Thanks!


I implemented this fallback mode to ensure that the watch wouldn't crash if the resources are not installed when running this code.

Makes total sense!


And I confirm, the alignment is not perfect with the system font. That's something we can improve if we want the fallback mode to look good, indeed!

In the original PR I fixed the alignment (see 2ad51e6). Only the date and BLE icon needed to be adjusted, resulting in:

pinetime-classic


However this fix cannot be applied directly here as there were some small naming and layout changes. Nothing too complicated to implement, but this and next week will be super busy, so I don't want to block the PR.

What if we leave it like this for now and I'll come back to it later? :)

Copy link
Contributor

@NeroBurner NeroBurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a complete review, I ran out of time

@@ -2,6 +2,7 @@
#include <FreeRTOS.h>
#include <task.h>
#include <libraries/log/nrf_log.h>
#include <components/fs/FS.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

including our headers should be done with "", excluding other libs (like lvgl, nrf, std-lib) should be done with <>

Suggested change
#include <components/fs/FS.h>
#include "components/fs/FS.h"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

#include "displayapp/Apps.h"
#include "components/settings/Settings.h"

#define MAXLISTITEMS 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could make this define into a constexpr size_t and move it from the global namespace into the private CheckboxList one

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! However, since this constant is also used in the ctor(), I added it as a public field of the class.

uint8_t (Controllers::Settings::*GetOptionIndex)() const;
std::array<const char*, MAXLISTITEMS> options;

lv_obj_t* cbOption[MAXLISTITEMS];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could use a std::array here as well

Suggested change
lv_obj_t* cbOption[MAXLISTITEMS];
std::array<lv_obj_t*, MAXLISTITEMS> cbOption;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 42 to 43
lv_point_t pageIndicatorBasePoints[2];
lv_point_t pageIndicatorPoints[2];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although more to type I like std::array 😁

Suggested change
lv_point_t pageIndicatorBasePoints[2];
lv_point_t pageIndicatorPoints[2];
std::array<lv_point_t, 2> pageIndicatorBasePoints;
std::array<lv_point_t, 2> pageIndicatorPoints;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -42,12 +43,14 @@ namespace Pinetime {
Controllers::Settings& settingsController;
Controllers::HeartRateController& heartRateController;
Controllers::MotionController& motionController;
Controllers::FS& fs;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional suggestion: we could rename it to filesystem to be more explicit

see comment (far) above

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -24,7 +25,8 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
Pinetime::Controllers::TimerController& timerController,
Pinetime::Controllers::AlarmController& alarmController,
Pinetime::Controllers::BrightnessController& brightnessController,
Pinetime::Controllers::TouchHandler& touchHandler)
Pinetime::Controllers::TouchHandler& touchHandler,
Pinetime::Controllers::FS& filesystem)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're using fs for the filesystem controller everywhere else (I think). I like the explicitness of filesystem

would you suggest to use filesystem instead of fs in the future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree with you, filesystem is more explicit!

@@ -0,0 +1,144 @@
#pragma once

#include <lvgl/src/lv_core/lv_obj.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're using lvgl.h directly, instead of including from the internals of the lvgl library

Suggested change
#include <lvgl/src/lv_core/lv_obj.h>
#include <lvgl/lvgl.h>

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

…tem, use std::array instead of raw array,...
@JF002
Copy link
Collaborator Author

JF002 commented Sep 27, 2022

@dmlls Thanks for your feedback! I'll (try to) merge those changes in your PR so that you get credits for this new watchface, and then merge it in develop, as I need those changes to merge the G7710 watchface!
We'll still be able to improve the fallback display when you (or someone else) have the time to work on it!

JF002 added a commit to InfiniTimeOrg/InfiniSim that referenced this pull request Sep 27, 2022
…finiTime#1024) DisplayApp needs the FileSystem as parameter to the constructor.
@JF002
Copy link
Collaborator Author

JF002 commented Sep 27, 2022

Merged in #1024

@NeroBurner NeroBurner deleted the infineat-external-resources branch September 27, 2022 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants