Implementation of Loading Screen

Issue #253 new
Patryk Kubiak created an issue

Implementation reason

Currently during booting of the system, only messages from booting manager are printed. It is required to show some user-friendly screen.

Generic Description

The screen shows during start of the system. It uses oC_Boot_GetCurrentBootLevel to update progress bar with active loading status.

cgraphic_loading.png

#!c
typedef enum
{
    ScreenID_Loading ,
    ScreenID_Login ,
    ScreenID_SystemHandler ,

    ScreenID_NumberOfElements
} ScreenID_t;


typedef enum
{
    WidgetID_Loading_Logo = 0,
    WidgetID_Loading_LoadingString ,
    WidgetID_Loading_ProgressBar ,
    WidgetID_Loading_Terminal ,
    WidgetID_Loading_NumberOfElements ,

} WidgetID_t;

extern oC_WidgetScreen_ScreenId_t cgraphic_Loading_Prepare( oC_WidgetScreen_t Screen , oC_WidgetScreen_UserContext_t Context , oC_WidgetScreen_ScreenId_t ScreenID );
extern oC_WidgetScreen_ScreenId_t cgraphic_Loading_Handler( oC_WidgetScreen_t Screen , oC_WidgetScreen_UserContext_t Context , oC_WidgetScreen_ScreenId_t ScreenID );
extern const oC_WidgetScreen_WidgetDefinition_t cgraphic_Loading_Widgets[WidgetID_Loading_NumberOfElements];

oC_WidgetScreen_Value_t cgraphic_Loading_GetValueForProgressBar( oC_WidgetScreen_t Screen, oC_WidgetScreen_UserContext_t Context, oC_WidgetScreen_WidgetIndex_t Index );

const oC_WidgetScreen_WidgetDefinition_t cgraphic_Loading_Widgets[WidgetID_Loading_NumberOfElements] = {
    [ WidgetID_Loading_Logo ] = {
         .Type              = oC_WidgetScreen_WidgetType_Image,
         .Position          = {  } ,
         .Height            = 0 ,
         .Width             = 0 ,
         .ZPosition         = 1 ,
         .Palette           = cgraphics_WidgetOnWhitePalette,
         .DrawStyle         = cgraphic_DrawStyle_Default,
         .ImagePath         = "/flash/chocoos.png",
    } ,
    [ WidgetID_Loading_LoadingString ] = {
         .Type              = oC_WidgetScreen_WidgetType_TextBox,
         .Position          = {  } ,
         .Height            = 0 ,
         .Width             = 0 ,
         .ZPosition         = 1 ,
         .Palette           = cgraphics_WidgetOnWhitePalette,
         .DrawStyle         = cgraphic_DrawStyle_Default,
         .String            = {
               .DefaultString       = "Loading" ,
               .Font                = oC_Font_(Consolas8pt),
               .TextAlign           = oC_WidgetScreen_TextAlign_Left ,
               .VerticalTextAlign   = oC_WidgetScreen_VerticalTextAlign_Center ,
               .UpdateStringHandler = NULL,
         } ,
    } ,
    [ WidgetID_Loading_ProgressBar ] = {
         .Type              = oC_WidgetScreen_WidgetType_ProgressBar,
         .Position          = {  } ,
         .Height            = 0 ,
         .Width             = 0 ,
         .ZPosition         = 1 ,
         .Palette           = cgraphics_WidgetOnWhitePalette,
         .DrawStyle         = cgraphic_DrawStyle_Default,
         .GetValueHandler   = cgraphic_Loading_GetValueForProgressBar,
    } ,
    [ WidgetID_Loading_Terminal ] = {
         .Type              = oC_WidgetScreen_WidgetType_ProgressBar,
         .Position          = {  } ,
         .Height            = 0 ,
         .Width             = 0 ,
         .ZPosition         = 1 ,
         .Palette           = cgraphics_WidgetOnWhitePalette,
         .DrawStyle         = cgraphic_DrawStyle_Default,
    } ,
};

static const oC_WidgetScreen_ScreenDefinition_t Definitions[] = {
    [ ScreenID_Loading ] = {
      .Position                     = { 0, 0 } ,
      .Height                       = 480 ,
      .Width                        = 272 ,
      .BackgroundColor              = Color_White ,
      .ColorFormat                  = oC_ColorFormat_RGB888 ,
      .PrepareHandler               = cgraphic_Loading_Prepare ,
      .Handler                      = cgraphic_Loading_Handler ,
      .WidgetsDefinitions           = cgraphic_Loading_Widgets ,
      .NumberOfWidgetsDefinitions   = WidgetID_Loading_NumberOfElements ,
      .RefreshPeriod                = ms(250),
    } ,

Bitbucket

https://bitbucket.org/chocos/chocos/issues/253/implementation-of-loading-screen

Trello

https://trello.com/c/86Lks95E

Story

  • [ #240 ] - Preparation of the sample graphic program

List of requirements

  • [ #253 ] - cgraphic loading screen is implemented in file main.c
  • [ #253 ] - cgraphic loading screen prints progress bar updated with booting level
  • [ #253 ] - cgraphic loading screen shows ChocoOS logo
  • [ #253 ] - cgraphic loading screen has reserved place for stderr terminal

Comments (10)

  1. Log in to comment