Bootloader hack: Auto-start app after upload

I may be confused because I just woke up, but why not just call app_start() from within the Q command? Are you planning to trigger the watchdog reset in other ways?

you totally can but i like to use the WDT because its very 'clean': you know that when you reset you have a fresh slate so that no matter what the bootloader did it will not have any funky registers set when the program runs.

also... you can do this

    // Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
    if (! (ch &  _BV(EXTRF))) // if its a not an external reset...
      app_start();  // skip bootloader

which -only- bootloads on external reset. This means that if the power flickrs it will also not start the bootloader. might be a nice safety precaution: if the arduino is 'doing something' and the power turns off and then back on it wont accidentally go into the bootloader (if there's serial data being sent to it)

also...you could use the watchdog timer to get the micro out of the bootloader as it is a natural way to 'timeout'..instead of doing all that MAXERRORCOUNT/MAXTIMECOUNT stuff :slight_smile: