DIGITAL_IN_WAKEUP doubt

for the following code
<
function reboot()
{
//re boot functionality
server_log(1,“reset button wakeup”)
main();
};

// main();
hardware.pin1.configure(DIGITAL_IN_WAKEUP, reboot)

upon pressing the reset button which is connected to pin1
I see “reset button wakeup” being printed in the log, but when I uncomment main(), I do not see it in log, so my assumption is it doesn’t enter reboot function

another problem that I see is when i long press the reset button, it doesn’t enter the reboot function unless I release the button.

Again, you are not posting complete code, or how the button is connected to pin 1 (does it have a pull-up or pull-down? where does it short to when the switch is pressed?) so hard to help here.

When the imp goes to deep sleep, the Squirrel program stops running and all its variables are forgotten. When it wakes up from deep sleep, whether on pin1 or from a timer, then the code starts again from the top (not in your “reboot” function). To distinguish pin1 wake-ups from power-cycles, timer wake-ups etc., use hardware.wakereason(): so, the top of your code might look like this:
if (hardware.wakereason() == WAKEREASON_PIN1) { reboot(); }

Peter