Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Silicon8 for Thumby v2.0.0 #3

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open

Silicon8 for Thumby v2.0.0 #3

wants to merge 43 commits into from

Conversation

Timendus
Copy link
Owner

@Timendus Timendus commented Jan 5, 2022

Needs some love, and testing on actual hardware...

@Timendus
Copy link
Owner Author

This method doesn't work... I'm working on a small grayscale library now, that others may also be able to use for their Thumby games / programs. When that gets somewhat stable, I'll add it here.

@Timendus Timendus force-pushed the grayscale branch 2 times, most recently from c03be1b to 4bb9163 Compare May 19, 2022 11:01
@Timendus Timendus changed the title Add support for grayscale, I mean ugly flickering... ;) Add support for XO-CHIP grayscale May 23, 2022
@Timendus
Copy link
Owner Author

Technically works like a charm now. Issues left:

  • Colour mapping makes it a bit slow
  • I need (want) to get the grayscale calibration screen in there somewhere
  • The code size has grown, so now we can't allocate the required 64k of RAM for XO-CHIP 😕

That last point (and a bit of the first) is why half of this PR is spiralling into doing code optimizations 🙈

Also there's a memory leak somewhere which exacerbates the last issue. I could reset the Thumby on every CHIP-8 program start, just like the main Thumby menu does, that would contain the issue between program starts. But I'm having really random crashes sometimes, that look like we just happen to run out of memory at that point... that's a bit of a more serious problem.

Not entirely sure where to take this from here, so I'm sleeping on this for a bit. Maybe try precompiling some of the files to mpy files or something. Figure out what triggers memory leaks in MicroPython, those kinds of things.

@Timendus
Copy link
Owner Author

Timendus commented Aug 4, 2022

Done so far

  • Swapped the old grayscale library out for the new one, which gives a much more stable image
  • Run the entire interpreter on a single core so we have the whole second core for grayscale
  • Implemented soft resetting the Thumby on program start, so we have all memory available
  • MicroPython v1.19.1 allows us to compile for the armv6m target, so we now can compile nearly everything to .mpy
  • Stricter imports so we waste less memory

There's now only just enough memory left to allocate the full 64K 🤯

Issues left

  • It still crashes after a while (when running grayscale games), without raising any error. Just a black, unresponsive screen 🙄

@Timendus
Copy link
Owner Author

Timendus commented Aug 9, 2022

Rebased this on main, which messes up the order of things, but hey :)

Things seem to be quite stable now! Just a couple of things left to test and to iron out before this may turn into Silicon8 for Thumby version 2.0! 🎉

Copy link
Owner Author

@Timendus Timendus left a comment

Choose a reason for hiding this comment

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

Some reminders to myself

file.readinto(memory)
return size
except Exception as err:
print('Could not read CH8 file ' + filename + ':', err)
Copy link
Owner Author

Choose a reason for hiding this comment

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

This message isn't correct, plus we will want to throw this exception and handle it elsewhere

)
class Display:
def __init__(self):
self._colourMap = 0b00011011
Copy link
Owner Author

Choose a reason for hiding this comment

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

This makes no sense anymore

Comment on lines +100 to +103
if self._colourMap == "BWDL":
return chipDisp.frameBuffers[0], chipDisp.frameBuffers[1]
if self._colourMap == "BDWL":
return chipDisp.frameBuffers[1], chipDisp.frameBuffers[0]
Copy link
Owner Author

Choose a reason for hiding this comment

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

Maybe double check these?

@Timendus Timendus changed the title Add support for XO-CHIP grayscale Silicon8 for Thumby v2.0.0 Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant