I suggest to remove the lines:
  for (int i = 0; i <= 5; ++i) {
    pinMode(i, INPUT);
  }
  // pins 6-11 are used for the SPI flash interface
  for (int i = 12; i <= 16; ++i) {
    pinMode(i, INPUT);
  }
in:
or maybe check the reset reason and only init the pins if resetInfo.reason == REASON_DEFAULT_RST ?
opinions?