The problem with emulation is that you need to be sure that what you're emulating really is equivalent to the real thing.
Up till now, I've been powering the unit from a bench power supply rather than the one installed in the unit. This is so that I can keep a watch on current levels while testing, and also stop the shutdown from actually shutting things down - in case I'd got it wrong and it tried to shutdown while the Pi was running full tilt.
to be working fine. That was until I watched the current demand while it was going through the emulated shutdown. The power control module was supposed to wait 7 seconds after the Pi itself had gone into standby before disconnecting the supply, but was actually doing so about a second afterwards - and not always quite the same time! I was using one of the GPIO lines to trigger shutdown, setting it 'high' in the knowledge it had to go low when the Pi had stopped - and this had worked perfectly every time when my emulated Pi stopped.
It turns out that the GPIO lines 'disconnect' a long (and variable) time before the Pi completes its tidying up
However, the good news is that in the process, I discovered that the internal 3.3V supply does
drop when the Pi goes into standby, reliably at that exact point. The result is my nice new PCB is no longer quite so pristine as it was before
It all does work correctly now. The red power light comes on immediately the start button is pressed, and the green 'ready' light only comes on once the desktop is showing. When shutting down, the green light goes off immediately the process starts. Actual power off is 7 seconds after the Pi is completely dormant - at which point the red light goes out.
This delay is to ensure that the Pi and any attachments are all completely settled before being robbed of power.
It's all software from here on. In order to keep background services to the absolute minimum, automounting USB drives is not enabled, nor is networking. However I'm setting up a couple of basic Apps, to enable these when needed.
Being in a metal box, wireless and bluetooth wouldn't work anyway.!