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

Put on-screen messages in a queue, display them one at a time #51

Merged
merged 7 commits into from
Apr 28, 2021
Merged

Put on-screen messages in a queue, display them one at a time #51

merged 7 commits into from
Apr 28, 2021

Conversation

ba58smith
Copy link
Collaborator

@ba58smith ba58smith commented Apr 27, 2021

FIXED: It's crashing when the msg_btn_cb() function is called. It's supposed to display the next message in the pending_messages_ std::list, but it crashes as soon as any element of gui is accessed. See the detailed notes on the most recent commit.

pending_messages should contain no duplicates, and always have the time of the most recent message, and the count of each specific message.
It works for the first message, but crashes when you tap "OK" on the first message to clear it from the screen. It fails in Gui::msg_box_cb() when it tries to call gui->set_display_next_pending_message(true);.
If I comment out that line, then it fails on gui->display_next_message();
I copied Gui::lv_mainbar_callback exactly (I think), but it still crashes.
Forgot `mbox1->user_data = this;` in Gui::display_message()
Still want to see if I can update the currently-displayed message's time and count.
@ba58smith
Copy link
Collaborator Author

ba58smith commented Apr 27, 2021

@JohnySeven, I think it has all the functionality that I wanted:

  • Messages are queued and displayed one at a time, rather than just making a "stack" of them on the screen.
  • Messages show the time they were generated, the number of times they've been generated since last cleared, and the number of other messages there are waiting to be displayed.
  • Every time a message comes in, its timestamp and count are updated: in the queue, and also on the screen.
  • The number of unread messages is updated on the screen each time a new one comes into the queue.
  • A "long" vibration happens when the first message is displayed, and a shorter vibration happens as each new message is added to the queue.

The display of the messages might be made prettier, but I think that's for another PR. Please review this one for my coding - I know it works, but I'm not sure I've done everything as efficiently as I could.

After this is merged and we've both used it for a while, I will go back and remove all the logging messages.

@ba58smith ba58smith changed the title DRAFT: Put on-screen messages in a queue, display them one at a time Put on-screen messages in a queue, display them one at a time Apr 27, 2021
@JohnySeven
Copy link
Owner

I've tested it and it really works very good! Tested it with my notifications sender script that I'm using and I like it! :-) Merging it.

@JohnySeven JohnySeven merged commit 8f65704 into JohnySeven:master Apr 28, 2021
@ba58smith
Copy link
Collaborator Author

You have a "notifications sender script"? Something that can simulate notifications coming to the watch from SK?

@JohnySeven
Copy link
Owner

I'm sorry I've missed your comment, yes I do have it, it's in C# and it basically sends UDP packet to server to update notifications.{anyname} data. If you want I can make simple Console app that you can run for testing.

@ba58smith
Copy link
Collaborator Author

No thanks - I don't need it anymore. And I really didn't need it all that much when I was testing. With a small butane cigar lighter I could make one of my temperature sensors get hot enough to throw an "alarm" whenever I needed one, and if I disabled my solar panels for just a few minutes, the battery voltage would drop low enough to throw a low voltage alarm. And if I needed 3 different alarms, I just turned off my wifi, which triggered that alarm.

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.

2 participants