increase timeout time for screensaver
Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
@@ -121,7 +121,7 @@ void ScreenSaver::trySpawnVehicle()
|
|||||||
newVehicle.direction = direction;
|
newVehicle.direction = direction;
|
||||||
newVehicle.speed = MIN_SPEED + (static_cast<float>(random()) / RAND_MAX) * (MAX_SPEED - MIN_SPEED);
|
newVehicle.speed = MIN_SPEED + (static_cast<float>(random()) / RAND_MAX) * (MAX_SPEED - MIN_SPEED);
|
||||||
|
|
||||||
// Set Y position based on direction (simulate opposing traffic lanes)
|
// Set Y position based on a direction (simulate opposing traffic lanes)
|
||||||
const int halfHeight = u8g2->height / 2;
|
const int halfHeight = u8g2->height / 2;
|
||||||
if (direction == Direction::RIGHT)
|
if (direction == Direction::RIGHT)
|
||||||
{
|
{
|
||||||
@@ -136,7 +136,7 @@ void ScreenSaver::trySpawnVehicle()
|
|||||||
m_leftVehicleCount++;
|
m_leftVehicleCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set starting X position based on direction
|
// Set the starting X position based on the direction
|
||||||
if (direction == Direction::LEFT)
|
if (direction == Direction::LEFT)
|
||||||
{
|
{
|
||||||
// Vehicles going LEFT (from right to left) start from RIGHT side of screen
|
// Vehicles going LEFT (from right to left) start from RIGHT side of screen
|
||||||
@@ -145,7 +145,7 @@ void ScreenSaver::trySpawnVehicle()
|
|||||||
else // Direction::RIGHT
|
else // Direction::RIGHT
|
||||||
{
|
{
|
||||||
// Vehicles going RIGHT (from left to right) start from LEFT side of screen
|
// Vehicles going RIGHT (from left to right) start from LEFT side of screen
|
||||||
newVehicle.x = -32; // Account for largest vehicle width
|
newVehicle.x = -32; // Account for the largest vehicle width
|
||||||
}
|
}
|
||||||
|
|
||||||
newVehicle.active = true;
|
newVehicle.active = true;
|
||||||
@@ -186,7 +186,7 @@ void ScreenSaver::render()
|
|||||||
// Calculate offsets
|
// Calculate offsets
|
||||||
const int roadOffset = (m_animationCounter / 100) % road_horizontal_width;
|
const int roadOffset = (m_animationCounter / 100) % road_horizontal_width;
|
||||||
|
|
||||||
// Draw all active vehicles with scene offset
|
// Draw all active vehicles with a scene offset
|
||||||
for (const auto &vehicle : m_vehicles)
|
for (const auto &vehicle : m_vehicles)
|
||||||
{
|
{
|
||||||
if (vehicle.active)
|
if (vehicle.active)
|
||||||
|
@@ -88,7 +88,7 @@ Device::Device(void *appstate) : UIWidget(appstate)
|
|||||||
options.persistenceManager->Load();
|
options.persistenceManager->Load();
|
||||||
|
|
||||||
m_widget = std::make_shared<SplashScreen>(&options);
|
m_widget = std::make_shared<SplashScreen>(&options);
|
||||||
m_inactivityTracker = std::make_unique<InactivityTracker>(6000, []() {
|
m_inactivityTracker = std::make_unique<InactivityTracker>(60000, []() {
|
||||||
const auto screensaver = std::make_shared<ScreenSaver>(&options);
|
const auto screensaver = std::make_shared<ScreenSaver>(&options);
|
||||||
options.pushScreen(screensaver);
|
options.pushScreen(screensaver);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user