Skip to content

Commit

Permalink
Fix for passkey screen scramble
Browse files Browse the repository at this point in the history
When a passkey is displayed, screen on or off, and another
passkey is displayed the screen may become scrambled. Fix
the issue by insuring the whole screen is drawn every time.
  • Loading branch information
evergreen22 committed Nov 1, 2021
1 parent 097f150 commit 13a6fbf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ void DisplayApp::Refresh() {
} else {
LoadApp(Apps::Alarm, DisplayApp::FullRefreshDirections::None);
}
case Messages::ShowPairingKey:
LoadApp(Apps::PassKey, DisplayApp::FullRefreshDirections::Up);
break;
case Messages::TouchEvent: {
if (state != States::Running) {
break;
Expand Down Expand Up @@ -269,9 +272,6 @@ void DisplayApp::Refresh() {
// Added to remove warning
// What should happen here?
break;
case Messages::ShowPairingKey:
LoadApp(Apps::PassKey, DisplayApp::FullRefreshDirections::Up);
break;
}
}

Expand Down
17 changes: 12 additions & 5 deletions src/displayapp/screens/PassKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@
using namespace Pinetime::Applications::Screens;

PassKey::PassKey(Pinetime::Applications::DisplayApp* app, uint32_t key) : Screen(app) {
lpasskey = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(lpasskey, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFF00));
lv_obj_set_style_local_text_font(lpasskey, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
lv_label_set_text_fmt(lpasskey, "%06u", key);
lv_obj_align(lpasskey, nullptr, LV_ALIGN_CENTER, 0, -20);
passkeyLabel = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFF00));
lv_obj_set_style_local_text_font(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
lv_label_set_text_fmt(passkeyLabel, "%06u", key);
lv_obj_align(passkeyLabel, nullptr, LV_ALIGN_CENTER, 0, -20);

backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_click(backgroundLabel, true);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
lv_label_set_text(backgroundLabel, "");
}

PassKey::~PassKey() {
Expand Down
3 changes: 2 additions & 1 deletion src/displayapp/screens/PassKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ namespace Pinetime {
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;

private:
lv_obj_t* lpasskey;
lv_obj_t* passkeyLabel;
lv_obj_t* backgroundLabel;
};
}
}
Expand Down

0 comments on commit 13a6fbf

Please sign in to comment.