mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 17:58:53 +01:00
do not display battery untils values are ready
Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
This commit is contained in:
parent
260178ef44
commit
e7e4be0d11
@ -89,6 +89,7 @@ bool Battery::noBat_ = false;
|
||||
bool Battery::prevNoBat_ = false;
|
||||
float Battery::currentWaitTime_ = 0.0f;
|
||||
bool Battery::mustRender_ = false;
|
||||
bool Battery::valuesReady_ = false;
|
||||
|
||||
|
||||
Battery::Battery(Page &p, Configuration &config, float reloadPeriod, SDL_Color fontColor, float scaleX, float scaleY)
|
||||
@ -342,6 +343,8 @@ void Battery::update(float dt)
|
||||
noBat_ = !isBatConnected();
|
||||
charging_ = isUsbConnected();
|
||||
|
||||
valuesReady_ = true;
|
||||
|
||||
currentWaitTime_ = 0.0f;
|
||||
}
|
||||
|
||||
@ -379,7 +382,7 @@ void Battery::draw()
|
||||
|
||||
Component::draw();
|
||||
|
||||
if(texture_)
|
||||
if(texture_ && valuesReady_)
|
||||
{
|
||||
SDL_Rect rect;
|
||||
rect.x = static_cast<int>(baseViewInfo.XRelativeToOrigin());
|
||||
@ -418,7 +421,7 @@ bool Battery::mustRender( )
|
||||
{
|
||||
if ( Component::mustRender( ) ) return true;
|
||||
|
||||
if ( mustRender_ && baseViewInfo.Alpha > 0.0f )
|
||||
if ( mustRender_ && baseViewInfo.Alpha > 0.0f && valuesReady_ )
|
||||
{
|
||||
mustRender_ = false;
|
||||
return true;
|
||||
|
||||
@ -44,4 +44,5 @@ protected:
|
||||
static bool prevCharging_;
|
||||
static bool noBat_;
|
||||
static bool prevNoBat_;
|
||||
static bool valuesReady_;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user