Ejemplo n.º 1
0
void initScreens(void)
{
    static bool needToSetup = true;

    if(needToSetup)
    {
        memcpy((void *)ARM11_PARAMETERS_ADDRESS, fbs, sizeof(fbs));
        invokeArm11Function(SETUP_FRAMEBUFFERS);

        if(!ARESCREENSINITIALIZED)
        {
            *(vu32 *)ARM11_PARAMETERS_ADDRESS = brightness[MULTICONFIG(BRIGHTNESS)];
            invokeArm11Function(INIT_SCREENS);

            //Turn on backlight
            i2cWriteRegister(I2C_DEV_MCU, 0x22, 0x2A);
        }
        else updateBrightness(MULTICONFIG(BRIGHTNESS));

        clearScreens(true);
        needToSetup = false;
    }

    clearScreens(false);
    swapFramebuffers(false);
}
Ejemplo n.º 2
0
bool loadSplash(void)
{
    const char *topSplashFile = "splash.bin",
               *bottomSplashFile = "splashbottom.bin";

    bool isTopSplashValid = getFileSize(topSplashFile) == SCREEN_TOP_FBSIZE,
         isBottomSplashValid = getFileSize(bottomSplashFile) == SCREEN_BOTTOM_FBSIZE,
         ret;

    //Don't delay boot nor init the screens if no splash images or invalid splash images are on the SD
    if(!isTopSplashValid && !isBottomSplashValid) ret = false;
    else
    {
        initScreens();
        clearScreens(true, true, true);

        if(isTopSplashValid) isTopSplashValid = fileRead(fbs[1].top_left, topSplashFile, SCREEN_TOP_FBSIZE) == SCREEN_TOP_FBSIZE;
        if(isBottomSplashValid) isBottomSplashValid = fileRead(fbs[1].bottom, bottomSplashFile, SCREEN_BOTTOM_FBSIZE) == SCREEN_BOTTOM_FBSIZE;

        if(!isTopSplashValid && !isBottomSplashValid) ret = false;
        else
        {
            swapFramebuffers(true);

            chrono(3);

            ret = true;
        }
    }

    return ret;
}
Ejemplo n.º 3
0
void ScreenManager::proccesRequests()
{
	if (!pendingRequests.empty())
	{
		for (auto itr = pendingRequests.begin(); itr != pendingRequests.end(); itr++)
		{
			switch (itr->action)
			{
				case Action::Push:
					handlePush(itr->screenID);
					break;

				case Action::Pop:
					popScreen();
					break;

				case Action::Clear:
					clearScreens();
					break;
			}
		}

		pendingRequests.clear();
	}
}
Ejemplo n.º 4
0
void Weather::setupPage()
{
    m_srcMan->stopTimers();
    m_nextpage_Timer->stop();
    m_srcMan->clearSources();
    m_srcMan->findScripts();

    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();

    ScreenSetup *ssetup = new ScreenSetup(mainStack, "weatherscreensetup",
                                            m_srcMan);

    connect(ssetup, SIGNAL(Exiting()), this, SLOT(setupScreens()));

    if (ssetup->Create())
    {
        clearScreens();
        mainStack->AddScreen(ssetup);
    }
    else
    {
    	delete ssetup;
    }

    m_firstRun = true;
}
Ejemplo n.º 5
0
void mcuPowerOff(void)
{
    if(!isFirmlaunch && ARESCREENSINITIALIZED) clearScreens(false);

    //Ensure that all memory transfers have completed and that the data cache has been flushed
    flushEntireDCache();

    i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 0);
    while(true);
}
Ejemplo n.º 6
0
Weather::~Weather()
{
    if (m_createdSrcMan)
        delete m_srcMan;

    clearScreens();

    if (m_weatherStack)
        GetMythMainWindow()->PopScreenStack();
}
Ejemplo n.º 7
0
void mcuReboot(void)
{
    if(!isFirmlaunch && PDN_GPU_CNT != 1) clearScreens(true, true, false);

    //Ensure that all memory transfers have completed and that the data cache has been flushed
    flushEntireDCache();

    i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 1);
    while(true);
}
Ejemplo n.º 8
0
void error(const char *message)
{
    initScreens();
    clearScreens();

    drawString("An error has occurred:", 10, 10, COLOR_RED);
    int posY = drawString(message, 10, 30, COLOR_WHITE);
    drawString("Press any button to shutdown", 10, posY + 2 * SPACING_Y, COLOR_WHITE);

    waitInput();
    mcuPowerOff();
}
Ejemplo n.º 9
0
bool Weather::SetupScreens()
{
    // Delete any existing screens
    clearScreens();

    m_paused = false;
    m_pauseText->Hide();

    // Refresh sources
    m_srcMan->clearSources();
    m_srcMan->findScriptsDB();
    m_srcMan->setupSources();

    MSqlQuery db(MSqlQuery::InitCon());
    QString query =
            "SELECT screen_id, container, units, draworder FROM weatherscreens "
            " WHERE hostname = :HOST ORDER BY draworder;";
    db.prepare(query);
    db.bindValue(":HOST", gCoreContext->GetHostName());
    if (!db.exec())
    {
        MythDB::DBError("Selecting weather screens.", db);
        return false;
    }

    if (!db.size())
    {
        if (m_firstSetup)
        {
            // If no screens exist, run the setup
            MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();

            ScreenSetup *ssetup = new ScreenSetup(mainStack, "weatherscreensetup",
                                                  m_srcMan);

            connect(ssetup, SIGNAL(Exiting()), this, SLOT(setupScreens()));

            if (ssetup->Create())
            {
                mainStack->AddScreen(ssetup);
            }
            else
            {
                delete ssetup;
            }

            m_firstSetup = false;
        }
        else
        {
            Close();
        }
    }
    else
    {
        while (db.next())
        {
            int id = db.value(0).toInt();
            QString container = db.value(1).toString();
            units_t units = db.value(2).toUInt();
            uint draworder = db.value(3).toUInt();

            ScreenListInfo &screenListInfo = m_allScreens[container];

            WeatherScreen *ws = WeatherScreen::loadScreen(m_weatherStack, &screenListInfo, id);
            if (!ws->Create())
            {
                delete ws;
                continue;
            }

            ws->setUnits(units);
            ws->setInUse(true);
            m_screens.insert(draworder, ws);
            connect(ws, SIGNAL(screenReady(WeatherScreen *)), this,
                    SLOT(screenReady(WeatherScreen *)));
            m_srcMan->connectScreen(id, ws);
        }

        if( m_screens.empty() )
        {
            // We rejected every screen...  sit on this and rotate.
            LOG(VB_GENERAL, LOG_ERR, "No weather screens left, aborting.");
            m_nextpage_Timer->stop();
            if( m_updatedText )
            {
                m_updatedText->SetText(tr("None of the configured screens are complete in this theme (missing copyright information)."));
                m_updatedText->Show();
                return true;
            }
            return false;
        }

        m_srcMan->startTimers();
        m_srcMan->doUpdate(true);
    }

    return true;
}