Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/views/lora_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ bool LoraScreen::handleKey(uint32_t key)
if (!app_active_) return false;
if (help_view_ && !lv_obj_has_flag(help_view_, LV_OBJ_FLAG_HIDDEN)) {
if (key == LV_KEY_ESC) hide_help();
else if (help_content_ && (key == LV_KEY_UP || key == LV_KEY_DOWN || key == 'f' || key == 'F' ||
key == 'x' || key == 'X'))
lv_obj_scroll_by_bounded(help_content_, 0,
key == LV_KEY_UP || key == 'f' || key == 'F' ? lora_app_detail::kMessageScrollStep
: -lora_app_detail::kMessageScrollStep,
LV_ANIM_ON);
return true;
}
if (key == cap_gps::keyCommandValue(cap_gps::KeyCommand::Help)) {
Expand Down Expand Up @@ -446,6 +452,7 @@ void LoraScreen::show_help()
{
if (!help_view_) return;
clear_clipboard_notice();
if (help_content_) lv_obj_scroll_to_y(help_content_, 0, LV_ANIM_OFF);
set_visible(help_view_, true);
lv_obj_move_foreground(help_view_);
}
Expand Down
1 change: 1 addition & 0 deletions src/views/lora_screen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class LoraScreen {
ClipboardNotice clipboard_notice_ = ClipboardNotice::None;
lv_obj_t *page_root_ = nullptr;
lv_obj_t *help_view_ = nullptr;
lv_obj_t *help_content_ = nullptr;
lv_obj_t *messages_view_ = nullptr;
lv_obj_t *message_list_ = nullptr;
lv_obj_t *messages_title_ = nullptr;
Expand Down
38 changes: 30 additions & 8 deletions src/views/lora_screen_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,14 +612,33 @@ void LoraScreen::create_help_view()
lv_color_hex(0x000000), LV_OPA_COVER, 0);
if (!help_view_) return;
lv_obj_add_event_cb(help_view_, static_owned_obj_delete_cb, LV_EVENT_DELETE, this);
make_label(help_view_, "esc", 8, 4, 32, 14, &lv_font_montserrat_10, lv_color_hex(0xF2C94C),
make_label(help_view_, "ESC:Close", 8, 2, 130, 22, &lv_font_montserrat_14, lv_color_hex(0xF2C94C),
LV_TEXT_ALIGN_LEFT);
make_label(help_view_,
"Connect Cap LoRa-1262 to send and receive messages over LoRa, with support for group communication "
"between multiple devices.\n\nFeatures: nickname, message selection and replies, copy and paste, plus radio "
"and link details in Info.\n\nKeyboard: compose a message\nF / X / Z / C: switch between screens\n"
"Fn + F / X: select a message\nEnter: reply to selection\nCtrl + C / V: copy / paste",
8, 20, 304, 146, &lv_font_montserrat_10, lv_color_hex(0xE4E4E4), LV_TEXT_ALIGN_LEFT);
make_label(help_view_, "Help", 130, 2, 60, 22, &lv_font_montserrat_18, lv_color_hex(0x4778B8),
LV_TEXT_ALIGN_CENTER);
help_content_ = make_plain_container(help_view_, 0, 26, lora_app_detail::kScreenWidth,
lora_app_detail::kScreenHeight - 26);
if (!help_content_) return;
lv_obj_add_event_cb(help_content_, static_owned_obj_delete_cb, LV_EVENT_DELETE, this);
lv_obj_add_flag(help_content_, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_scroll_dir(help_content_, LV_DIR_VER);
lv_obj_set_scrollbar_mode(help_content_, LV_SCROLLBAR_MODE_ON);
lv_obj_set_style_width(help_content_, lora_app_detail::kInfoScrollbarWidth, LV_PART_SCROLLBAR);
lv_obj_set_style_bg_color(help_content_, lv_color_hex(0x4E5157), LV_PART_SCROLLBAR);
lv_obj_set_style_bg_opa(help_content_, LV_OPA_COVER, LV_PART_SCROLLBAR);
lv_obj_set_style_radius(help_content_, lora_app_detail::kInfoScrollbarWidth / 2, LV_PART_SCROLLBAR);
make_label(help_content_,
"Cap LoRa-1262 sends group messages over LoRa. Devices must use matching radio settings.\n\n"
"Chat\nType or Enter: new message\nZ / C: switch pages\n"
"F / X or Up / Down: select a message\nEsc: clear selection\nEnter: reply to selection\n"
"Ctrl + C: copy selected message\n\n"
"Editor\nEnter: send or save\nEsc: cancel\nFn + arrows: move cursor\nFn + N: end of text\n"
"Ctrl + V: paste copied text\n\n"
"Info\nView radio and link details. Up / Down: scroll. Enter: change nickname (10 bytes max).\n\n"
"Messages: 116 bytes max, or 107 bytes when replying.\n\n"
"Sending or failed messages can be copied, but not replied to.\n\n"
"Fn + H: open Help\nUp / Down: scroll Help",
8, 0, 296, LV_SIZE_CONTENT, &lv_font_montserrat_14, lv_color_hex(0xE4E4E4), LV_TEXT_ALIGN_LEFT);
set_visible(help_view_, false);
}

Expand Down Expand Up @@ -798,6 +817,7 @@ void LoraScreen::detach_delete_callbacks()
{
lv_obj_t *objects[] = {message_list_,
help_view_,
help_content_,
messages_view_,
empty_message_label_,
empty_message_hint_label_,
Expand Down Expand Up @@ -830,7 +850,8 @@ void LoraScreen::detach_delete_callbacks()
void LoraScreen::clear_deleted_handles(lv_obj_t *deleted)
{
if (!deleted) return;
if (deleted == help_view_) help_view_ = nullptr;
if (deleted == help_content_) help_content_ = nullptr;
if (deleted == help_view_) { help_view_ = nullptr; help_content_ = nullptr; }
if (deleted == messages_title_) {
lv_anim_del(deleted, &LoraScreen::message_title_anim_exec_cb);
messages_title_ = nullptr;
Expand Down Expand Up @@ -903,6 +924,7 @@ void LoraScreen::clear_deleted_handles(lv_obj_t *deleted)
if (deleted == page_root_) {
page_root_ = nullptr;
help_view_ = nullptr;
help_content_ = nullptr;
messages_view_ = nullptr;
message_list_ = nullptr;
empty_message_label_ = nullptr;
Expand Down
8 changes: 4 additions & 4 deletions tests/lora_page_ui_contract_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ constexpr unsigned kRadioOffColor = 0xD96C6C;
constexpr unsigned kReceivingColor = 0x69AD80;
constexpr unsigned kClipboardNoticeColor = 0x5BA7FF;

constexpr std::array<std::string_view, 33> kRequiredTexts = {
constexpr std::array<std::string_view, 36> kRequiredTexts = {
"No messages yet", "Type anything to send", "Initializing LoRa...", "LoRa unavailable; see Info",
"Messages", "LoRa Info", "CLIENT", "DEVICE", "RSSI", "SNR", "LINK", "New Message",
"ESC: Cancel", "Enter: Send", "LoRa is still initializing", "LoRa unavailable", "Message is empty",
"Send failed", "Unavailable", "Link configuration unavailable", "No diagnostics", "Reply Message", "Reply: ",
"copied", "pasted", "pasted (truncated)", "Connect Cap LoRa-1262", "Keyboard: compose a message",
"F / X / Z / C: switch between screens", "Features: nickname", "Fn + F / X: select a message",
"Ctrl + C / V: copy / paste", "esc",
"copied", "pasted", "pasted (truncated)", "Cap LoRa-1262 sends group messages", "Z / C: switch pages",
"Up / Down: scroll.", "F / X or Up / Down: select a message", "Ctrl + V: paste copied text", "ESC:Close", "Help",
"Fn + H: open Help", "Messages: 116 bytes max", "Sending or failed messages can be copied",
};

enum class RadioState { initializing, radio_off, sending, tx_mode, receiving };
Expand Down
Loading