Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove 300ms delay before logoless boot #24

Merged
merged 4 commits into from
Oct 20, 2021

Conversation

Fordi
Copy link
Contributor

@Fordi Fordi commented Oct 19, 2021

Tested on hardware, removing the delay clears up the boot noise problem in issue #9

@Fordi Fordi marked this pull request as draft October 19, 2021 22:28
@Fordi
Copy link
Contributor Author

Fordi commented Oct 19, 2021

This PR eliminates all pre-boot screen noise for games with disable_startup_logo.

Findings:

Removing the delay mostly resolves it on hardware - though there's still a nigh-imperceptible one-frame flash of randomness..

I'm a little confused: Hoisting the pen(0, 0, 0); clear(); out of the #ifdef NO_STARTUP_LOGO (so it hits both branches) does not resolve the issue, even though it should, in theory.

Moving the backlight(75); into its own #ifdef NO_STARTUP_LOGO branch after the sleep(300);, also mostly resolves it, though with the same one-frame flash.

I was not able to get rid of the flash despite experimentation, and this is the simplest change that (mostly) succeeded, so I'm pulling this PR out of draft.

The missing piece was to flip the screen buffer in the NO_STARTUP_LOGO branch, then wait for the transfer to finish and vsync to settle out before flipping on the backlight.

@Fordi Fordi marked this pull request as ready for review October 19, 2021 23:34
@Fordi Fordi marked this pull request as draft October 20, 2021 00:08
@Fordi
Copy link
Contributor Author

Fordi commented Oct 20, 2021

Pulling back to draft; I think what's going on is that the screen buffers aren't getting initialized.

@Fordi
Copy link
Contributor Author

Fordi commented Oct 20, 2021

Ok. Clearing the screen and flipping twice did it, but only after making it wait for the flips.

@Fordi Fordi marked this pull request as ready for review October 20, 2021 00:42
@Fordi Fordi marked this pull request as draft October 20, 2021 00:48
@Fordi
Copy link
Contributor Author

Fordi commented Oct 20, 2021

I keep pulling back to draft, but it occurs to me there might be An Easier Way™.

@Fordi Fordi marked this pull request as ready for review October 20, 2021 01:08
@Fordi
Copy link
Contributor Author

Fordi commented Oct 20, 2021

Final one.

Incidentally, the program used for testing is just:

#include "picosystem.hpp"
using namespace picosystem;

void init() {
    // Whatever's on screen stays on screen for a second
    sleep(1000);
    // Called once at the start, this is an ideal place to do any setup for your project.
}

void update(uint32_t tick) {
    // Called at a fixed rate - by default every 10ms. Perform any tasks that update the
    // game world state. Because it is called at a fixed rate you can easily time movement
    //  and events. tick is the number of update() calls since the game started.
}


void draw() {
    // Called as often as possible, aiming for 60 fps
}

@@ -20,11 +20,11 @@ namespace picosystem {

#ifndef DYNAMIC_BUFFER
#ifdef PIXEL_DOUBLE
color_t _fb[120 * 120];
color_t _fb[120 * 120] = { };
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An empty initializer initializes to 0's. No initializer leaves it randomized.

while (_is_flipping());
// wait for the screen to update
_wait_vsync();
_wait_vsync();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one leaves The Flash™, two leaves it out.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it does! We'll probably dig deeper into this. Thank you!

@Gadgetoid Gadgetoid merged commit f2d839d into pimoroni:main Oct 20, 2021
@Gadgetoid
Copy link
Member

Thank you!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants