Page 1 of 1

Power Button Uzebox v1.2

Posted: Mon Feb 01, 2016 5:11 am
by ccm_1052_tacks
I just finished assembly on my uzebox v1.2 and everything works as expected except for the power button. This seems to have no function as the unit starts automatically on being plugged in and does not seem to turn the unit off once powered either. Is this normal?

Re: Power Button Uzebox v1.2

Posted: Mon Feb 01, 2016 5:34 am
by D3thAdd3r
Yes it is normal as the kernel doesn't yet do anything with the power button. It is funny after all these years that detail only had attention a couple times.

I'd assume it would be rather small and trivial to add something that runs around the time game pads are read(where it checks for the button combination for softreset). A bit too lazy to check which pins to write the real code and all that, should probably be in assembly anyway. So as pseudocode I would say

Code: Select all

    if(PowerButtonDown()){
        while(PowerButtonDown());//wait for release
        SetLedOff();//turn off LED
        TurnAD725Off();//turn off display
        TurnSDOff();//don't let SD drain too much power
        TurnESP8266Off();//this module drinks the power
        TurnSPIRamOff();//low power the expansion ram

        //essentially the machine is as low power as can be and looks turned off now
        while(!PowerButtonDown());//pushed again
        while(PowerButtonDown());//released
        SoftReset();//reset the machine to appear as a cold boot
    }
gives us power button functionality as we would expect.

Re: Power Button Uzebox v1.2

Posted: Mon Feb 01, 2016 5:57 am
by D3thAdd3r
Eh, naturally throw in some debounce delay in there since it is a physical contact button.

Re: Power Button Uzebox v1.2

Posted: Tue Feb 02, 2016 6:16 am
by ccm_1052_tacks
Thanks D3thAdd3r!