Git Product home page Git Product logo

pi-top-4-miniscreen's People

Contributors

angusjfw avatar benp44 avatar github-actions[bot] avatar itschoudhry avatar jcapona avatar lgtm-com[bot] avatar m-roberts avatar mikael-bark avatar olivierwilkinson avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pi-top-4-miniscreen's Issues

Battery page is slow to render first time

Common library's get_battery_capacity is not currently speaking directly with ZMQ.

More generally, there is a wider issue that some of common lib is used by device manager, some depends on device manager. We have no way of discerning from the outside which of these functions can be used by the device manager - this could lead to issues later on.

Fix animations in sys oled

The vnc and wifi page gif aren't shown correctly as they don't use the gif's worked out fps they use the hotspot's from which they are called fps which causes the animation to play incorrectly. (first frame isn't held long enough)

the speed of the animation is pretty slow.

A solution is to use ptoled libraries's playing gif metho which it shows the gif correctly.

Create classes for different template pages

These derived classes will be easy to use pages for users to make pages to show text or an animation or run a program. Each class will a derived of the base class Page.

The unit tests for these classes may vary depending on the the type of class it is.

The different pages we have in mind right now is.
TestPage
ImagePage
AnimationPage
ProgramPage

For these we will need to make template hotspots or components depending on how we decide on things.

Create OLEDController class

The responsibility of this class is to take a page and show it on screen and pass methods to the ButtonController class to be invoked when a button is pressed using the callback design pattern.

class OLEDController:
    data members:
        current_page : page # this data member will be updated every time show_page() is called this is how we keep track of what is on screen
        button_controller : ButtonController
        register_for_buttons : bool
        debug : bool
    methods:
        register(register_for_button_events : bool, debug : bool) # set the device if debug is True than a pygames frame to emulate the screen,
                                                                     if the bool is set to True the internal methods will be passed to the ButtonController
        show_page(Page) # this method will show the given page on the oled screen and set the current_page = the Page
        _on_up_button_pressed() # calls show_page(current_page.up_button_page) if up_button_page is set and calls current_page.on_up_button()
        _on_cancel_button_pressed() # calls show_page(current_page.cancel_button_page) if cancel_button_page is set and calls current_page.on_close_button()
        _on_select_button_pressed() # calls show_page(current_page.select_button_page) if select_button_page is set and calls current_page.on_select_button()
        _on_down_button_pressed() # calls show_page(current_page.down_button_page) if down_button_page is set and calls current_page.on_down_button()
        unregister() # this will need to be called at the end so the ButtonController stops listening for button presses (I think this could be done through signal handing on exit of the program call it)
Unit tests for this class
    # with every test create the matching if incorrectly done the issues is resolved tests
    test if a page is passed to it correctly that the correct thigns are set like current_page
    test if register sets the correct device
    test if register sets initializes ButtonController properly
    test if unregister stops the ButtonController listening for buttons

example

class OLEDController():

    self._button_controller
    self._current_page
    self._register_for_buttons

    def register(startup_page, register_for_button_events):

        self._current_page = startup_page
        self._register_for_buttons = register_for_button_events

        if self._register_for_buttons:

            self._button_controller = ButtonController()
            self._button_controller.register()
            self._button_controller.on_up_button_pressed(self._on_up_button_pressed)
            self._button_controller.on_down_button_pressed(self._on_down_button_pressed)
            self._button_controller.on_select_button_pressed(self._on_select_button_pressed)
            self._button_controller.on_cancel_button_pressed(self._on_cancel_button_pressed)

    def _on_up_button_pressed():

        if self._current_page.up_button_page is not None:
            self._current_page = self._current_page.up_button_page
        else self._current_page.on_up_button_pressed is not None:
             self._current_page.on_up_button_pressed()

    def _on_down_button_pressed():

        if self._current_page.down_button_page is not None:
            self._current_page = self._current_page.down_button_page
        else self._current_page.on_down_button_pressed is not None:
             self._current_page.on_down_button_pressed()

    def _on_select_button_pressed():

        if self._current_page.select_button_page is not None:
            self._current_page = self._current_page.select_button_page
        else self._current_page.on_select_button_pressed is not None:
             self._current_page.on_select_button_pressed()

    def _on_cancel_button_pressed():

        if self._current_page.cancel_button_page is not None:
            self._current_page = self._current_page.cancel_button_page
        else self._current_page.on_cancel_button_pressed is not None:
             self._current_page.on_cancel_button_pressed()


    def unregister():

        if self._register_for_buttons:
            self._button_controller.unregister()

system diagrams
https://www.draw.io/?state=%7B%22ids%22:%5B%221gjZftyYzl_iD9RBNotopUvowNFpCIIF0%22%5D,%22action%22:%22open%22,%22userId%22:%22100198992257498700876%22%7D#G1gjZftyYzl_iD9RBNotopUvowNFpCIIF0

Create Page class

The responsibility of this class is to build the page to be be shown on screen.

class Page:
    data members:
        page_name # page name can be used to identify the page
        contents # what the page will look like (either hot spot or a collection of components)
        up_button_page # pointer to another page
        down_button_page # pointer to another page
        select_button_page # pointer to another page
        cancel_button_page # pointer to another page
    methods:
    # these methods will be called in the OLEDController e.g. the OLEDController will show the page of 
    up_button_page if set then call the on_up_button()
        on_up_button()
        on_down_button()
        on_select_button()
        on_cancel_button()
        on_up_button()
Unit tests for this class
    # with every test create the matching if incorrectly done the issues is resolved tests
    test if the page object gets created properly
    test if the methods correctly choose between method or page
    test if the components/hotspot set to contents is correct

system diagrams
https://www.draw.io/?state=%7B%22ids%22:%5B%221gjZftyYzl_iD9RBNotopUvowNFpCIIF0%22%5D,%22action%22:%22open%22,%22userId%22:%22100198992257498700876%22%7D#G1gjZftyYzl_iD9RBNotopUvowNFpCIIF0

Discuss about issues regarding how the SSID is shown on the OLED

  1. What are we going to do and how important is it to sort out around the ssid being too long
    e.g.
    E7A0 Hyperoptic 1Gb Fibre 5Ghz
    E7A0 Hyperoptic 1Gb Fibre 2.4Ghz

The issue is on the oled you won't see the full name.

  1. The wifi page shows the SSID of the wireless connection not the Ethernet SSID which is a problem because it's an undefined behaviour if I'm connected to the WIFI and vnc/ethernet what do we want to show on the WIFI page and do we want to add another page so one for wireless connection the other for the wired connection ?

First-time-setup instruction screen

"As a user turning on my device for the first time, without a display, I would like to be given instructions on my OLED display on how to connect via VNC so I can go through the pi-top first time setup procedure"

  • Add “Waiting for onboarding” screen with instructions for how to connect via VNC
  • Once onboarding has been completed, this screen no longer shows

Remove scrolling viewport functionality

Screen disappears when position is updated when at end of viewport. Removing transitional page movement should avoid this issue. We can always look to add this later.

Select and cancel button to traverse menu doesn't always update screen.

When pressing up or down the screen is updated properly. But when select or cancel is pressed sometimes the screen isn't updated until up or down is pressed.

Steps to duplicate:
press select and cancel a few times and you'll notice the screen not update.
But if you press up or down it will be on the correct menu.

Add first-time setup page

Should this have an animation?
Need to get some design work done for this.

Minimum information for VNC connection:

  • IP
  • username
  • password

Initial ground work on the oled library

As per discussed we will make a oled library to build the menu system. This will be the library which we will release to users to work with the oled.

The initial design choice made is to forgo the viewpoint scrolling system for a "pages" event-based system where a page is like a node in a linked list and events are based on button presses.

Class page:
on_up_button_pressed = a page which is shown on screen when up in pressed.
on_down_button_pressed = a page which is shown on screen when down in pressed.
on_select_button_pressed = A method, a program starting or a new menu.
on_cancel_button_pressed = This button is to be used as a way to go back up a menu or stop a program running/ or break out of a method.

The library should be designed in a way to have a simple way to create pages, but not block users from creating custom pages allowing the user to choose how much they want to customise a page. Below is a idea we pseudo coded about the how the library should be used.

Simple

def play_sound():
    // play the sound

screen_control_client = ScreenControl.register_client()

page_sub = PageFactory.create_text_page("Sub Menu")
page_main = PageFactory.create_text_page("Main Menu", play_sound, )

page.next_page = page_sub
page.on_next_button = () => screen_control_client.display_page(page_sub)
page.on_select_button = () => play_sound()

screen_control_client.show_page(page)

Lower level

from pt-hardware-control import TextPage

class CustomTextPage(TextPage):

    on_next_button()
    {
        next_page = PageFactory.create_text_page("TGhe next page")
        ScreenControl.display_page(next_page)
    }

the pages default method of creation will use a factory method design pattern. So all standard pages/page template can be constructed from the same class. The factory may also have a constructor to call a builder class for a specific more complicated page.

The standard pages list as it stands
PageModel(base)
Image page
Animation page
Text page
Program page

For showing the page on screen we haven't decided, but you can see from the example code above we have the idea of a seperate class called "ScreenControl" to be the controller/driver for the pages to the screen.

Create ButtonController class

The responsibility of this class is to listen for button presses over zmq and invoke the methods passed to in. (callback pattern)

class ButtonController:
    data members:
    methods:
        register() # register to listen for button presses and pass in the methods
        on_up_button_pressed(fn) # this method will be invoked on up button press
        on_down_button_pressed(fn) # this method will be invoked on down button press
        on_select_button_pressed(fn) # this method will be invoked on select button press
        on_cancel_button_pressed(fn)  # this method will be invoked on cancel button press
        unregister() # unregister to stop listening for button presses
Unit tests for this class
    Test if the methods are invoked when a mocked button press happens

system diagrams
https://www.draw.io/?state=%7B%22ids%22:%5B%221gjZftyYzl_iD9RBNotopUvowNFpCIIF0%22%5D,%22action%22:%22open%22,%22userId%22:%22100198992257498700876%22%7D#G1gjZftyYzl_iD9RBNotopUvowNFpCIIF0

Battery page: add 'cable connected' logic

OLED battery icon not using 'cable connected' state for charging icon
If 'fully charged', will still show as charging, when it isn't
Should show if the power supply is detected

OLED buttons have poor responsiveness

This could be a hardware issue, and could be fixed in up-to-date hardware.

When pressing the up and down buttons, sometimes they just don't do anything. In particular this is noticeable when pressing several times is fairly quick succession.

Generate project pages when going into menu

Currently, all menus are generated on application start. This is a problem if a new project is added, or a project is removed. Therefore, everything should be dynamically handled.

Fix crash issue

Happens with two consecutive identical animated image widgets will cause a crash (not just the same image - the same hotspot! This includes if a menu only has one widget of this kind, due to infini-scrolling)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.