Question about: Battery use / ConsoleView / TextLabelView



  • Hi,
    I have three questions for you.

    1. Is it show how possible to visual battery usage somhow ? (in percentage or ....)
    2. How does the mono::ui::ConsoleView works ?, can you provide some sample code ?
    3. Is it possible to have multilines in TextLabelView ?

    Ola



  • Hi, sorry about the delayed response.

    @ogj said in Question about: Battery use / ConsoleView / TextLabelView:

    Is it show how possible to visual battery usage somhow ? (in percentage or ....)

    Not really. Estimating battery usage and remaining charge is not straight forward. It requires a circuit that monitors the current flow from the battery. What you can do is to get a reading of the batterys voltage level using the ADC with a Fixed Voltage Reference. However, this will not give you any estimate of how much juice is left on the battery.

    Li-Ion discharge curve

    As you can see, a Li-Ion battery does not have a linear relationship between voltage and remaining charge.

    I guess my point is, that you should properly revisit this topic later :-)

    A quick note: Mono includes routines to automatically put mono into sleep mode, when battery voltage becomes critically low. This feature is part of the software framework, and and is implemented as part of the PowerManager API

    How does the mono::ui::ConsoleView works ?, can you provide some sample code ?

    Yes, of course. This class was one of the first I wrote - so bear with me - it does not follow the design concept I use for later Mono classes and interfaces.

    This example creates a ConsoleView at the entire screen, and write lines to it on reset, sleep and wake up.

    app_controller.h:

    #include <mono.h>
    
    class AppController : public mono::IApplication {
    public:
    
        mono::ui::ConsoleView<176, 220> console;
    
        AppController();
    
        void monoWakeFromReset();
        void monoWillGotoSleep();
        void monoWakeFromSleep();
    
    };
    

    app_controller.cpp

    AppController::AppController()
    {
        console.show();
    }
    
    void AppController::monoWakeFromReset()
    {
        console.WriteLine("Wake from reset!");
    }
    
    void AppController::monoWillGotoSleep()
    {
        console.WriteLine("Go to sleep.. zzzz!");
    }
    
    void AppController::monoWakeFromSleep()
    {
        console.WriteLine("Wake from sleep");
    }
    

    Is it possible to have multilines in TextLabelView ?

    Not really at the moment, but I am currently working on it - see the adafont branch on Github.

    If you wish to do multiline text, use the TextRender class. Use the TextRender inside the repaint() function in your own View class.


Log in to reply