This is a very simple program that puts the Uzebox into a low power state. It uses the ATmega's sleep mode, using an external interrupt to wake it up.
I made this because I keep my Uzebox in my TV stand, and it can be inconvenient to reach back to plug it in. And I wanted to see if I could make the "power" button a real power button.
How to use it: just flash the uze file from the bootloader, and after a few seconds it goes into sleep mode. To wake it up, just press the power button, or the reset button. (But if you use the reset button, you won't see the Uzebox logo when it wakes up)
Note: if you have the bootloader set to auto boot to game, it will reset right back into the sleep utility. Either set the bootloader to Menu, or hold a controller button while waking it up.
I don't know if you guys will find this program useful or not, but I thought I'd still upload it here anyways.
It only works on real hardware, not in emulators!
Source: https://github.com/ry755/Sleep
Sleep - a simple sleep/low power utility
Sleep - a simple sleep/low power utility
Last edited by ry755 on Tue Jan 12, 2021 7:39 am, edited 1 time in total.
Re: Sleep - a simple sleep/low power utility
This, I think, would be the most useful in the bootloader so you don't age the ATMega just for going to sleep, and it is a logical, accessible place for the function (after playing, you could return to the bootloader, and ask it for sleep or just leave it there and it timed out to sleep).
The problem is that I don't think this could be ever implemented, I guess it needed at least 30 - 40 instructions (by looking at the C code), which is just too much to fit. Anyway, I will keep it in mind.
The problem is that I don't think this could be ever implemented, I guess it needed at least 30 - 40 instructions (by looking at the C code), which is just too much to fit. Anyway, I will keep it in mind.
Re: Sleep - a simple sleep/low power utility
Yeah, that's what I originally wanted to do, but I didn't know how to fit it in the current bootloader and I certainly didn't want to have to use the old bootloader.
I guess it is a pretty bad idea to do it this way. I'm going to look around the bootloader code and see if I can squeeze it in somehow. It probably won't work, but it doesn't hurt to look I guess.
I guess it is a pretty bad idea to do it this way. I'm going to look around the bootloader code and see if I can squeeze it in somehow. It probably won't work, but it doesn't hurt to look I guess.
Re: Sleep - a simple sleep/low power utility
I don't think it is possible, at least not without removing something else. Currently there are 4 instructions (8 bytes) free in the bootloader space (V.5.0.10), and I already invested a lot into minimizing code.
Re: Sleep - a simple sleep/low power utility
4 instructions?! I knew it was low on space, but I didn't know it was that low on space. It's definitely not possible to fit the code there.
Re: Sleep - a simple sleep/low power utility
It was like that ever since the first published version (V.5.0.00), so adding everything since then involved crazy size optimizations to make space for the improvements. That's why I think there is actually very little room there (that it is very unlikely you could add, say, 10 instructions worth of new code without removing something, no matter what you tried). FAT32 + SDHC + Fragmentation support is big (and even the latter can't be dropped as no matter what you do, you will still have the root directory fragmented on FAT32, even if it could be dropped, I would score it more important than the capability of sleeping).
The only realistic drop would likely be ditching lower case support, but that would have quite deteriorating effect on the look, and may not even return that much space like excepted (new code would have to be added to convert strings to uppercase, properly constraining them into the available character set).
Re: Sleep - a simple sleep/low power utility
I like the sleep idea however it could work. Even costing a couple extra flashes, I think this is a nice utility to have. Beats digging the Uzebox out of it's spot and pulling the power! So I have to say this is quite nice.
- nicksen782
- Posts: 714
- Joined: Wed Feb 01, 2012 8:23 pm
- Location: Detroit, United States
- Contact:
Re: Sleep - a simple sleep/low power utility
I use this:
https://www.amazon.com/gp/product/B00G6GNREI/
It is an inline switch. That is how I turn my Uzebox on and off.
https://www.amazon.com/gp/product/B00G6GNREI/
It is an inline switch. That is how I turn my Uzebox on and off.