onebutton library combined with sleep mode on attiny85

I'm using power saving functions and onebutton library together

My issue is that I can wake my attiny85 from sleep with a double click but not a button hold.

Can anyone shade light on this for me?

EDIT: So i changed the click times and this now works, but can anyone still explain it? This has stumped me for a while.

#include <OneButton.h>
#include <avr/sleep.h>    // Sleep Modes
#include <avr/power.h>    // Power management
#include <avr/wdt.h>      // Watchdog timer

//int emitter = 0;
int starterDelay = 1450; //1392 time between the starter signal being send and the actual data signal
int interPulsedelay = 20; //delay between the data pulses milliseconds
unsigned long int sleepTimer = 0;
int scoreIncrease = 0;

boolean clickFound = false;
int deepSleep = 0;

OneButton button(2, false);

ISR (PCINT0_vect) 
 {
 // do something interesting here
 }

void setup() 
{ 
  
  resetWatchdog ();
 //PORTB = 0;
  
  pinMode(0, OUTPUT);
  button.attachDoubleClick(doubleClick);
  button.attachPress(held);

  button.setClickTicks(300);
  button.setPressTicks(800);
 
   DDRB =  0b00000011;		// set PB1 (= OCR1A) to be an output
   setFrequency(38000);
   
  PCMSK  |= bit (PCINT2);  // want pin D4 / pin 3
  GIFR   |= bit (PCIF);    // clear any outstanding interrupts
  GIMSK  |= bit (PCIE);    // enable pin change interrupts 
}

void loop() 
{
  button.tick();
  
  
     //sleepModeA(); 
  sleepTimer++;
  
  if(sleepTimer > 24000)
  {
   sleepTimer = 0;
   //deepSleep++;
   //clickFound = false;
   sleepModeA(); 
  }

}

//**************************************************************************************************************

void doubleClick()
{ 
  int bubs = random(0,7);
   if(bubs > 3)
   {
      for (int x = 0; x < 3; x++)
      {
      three();
      delay(interPulsedelay);
      }
   }
   else
   {
      for (int x = 0; x < 3; x++)
      {
      four();
      delay(interPulsedelay);
      }
   }
  
  //checker light
   for(int a =0; a < 6;)
  {
    digitalWrite(0, HIGH);
  delay(50);
  digitalWrite(0,LOW);
  delay(50);
  a++;
  }
  
  clickFound = true;
  sleepTimer = 0;
}

void held()
{
  int bubs = random(0,7);
   if(bubs > 3)
   {
      for (int x = 0; x < 3; x++)
      {
      nine();
      delay(interPulsedelay);
      }
   }
   else
   {
           for (int x = 0; x < 3; x++)
      {
      ten();
      delay(interPulsedelay);
      }
   }
  
  //checker light
  for(int a =0; a < 3;)
  {
  digitalWrite(0, HIGH);
  delay(100);
  digitalWrite(0,LOW);
  delay(100);
  a++;
  }
  
  clickFound = true;
  sleepTimer = 0;
}


ISR (WDT_vect) 
{
   wdt_disable();  // disable watchdog
}  // end of WDT_vect

void resetWatchdog ()
  {
  // clear various "reset" flags
  MCUSR = 0;     
  // allow changes, disable reset, clear existing interrupt
  WDTCR = bit (WDCE) | bit (WDE) | bit (WDIF);
  // set interrupt mode and an interval (WDE must be changed from 1 to 0 here)
  WDTCR = bit (WDIE) | bit (WDP3) | bit (WDP0);    // set WDIE, and 8 seconds delay
  // pat the dog
  wdt_reset();  
  }  // end of resetWatchdog
  
void sleepModeA ()
  {
    oneOgma();
  set_sleep_mode (SLEEP_MODE_PWR_DOWN);
  ADCSRA = 0;            // turn off ADC
  power_all_disable ();  // power off ADC, Timer 0 and 1, serial interface
  noInterrupts ();       // timed sequence coming up
  resetWatchdog ();      // get watchdog ready
  sleep_enable ();       // ready to sleep
  interrupts ();         // interrupts are required now
  sleep_cpu ();          // sleep                
  sleep_disable ();      // precaution
  power_all_enable ();   // power everything back on
  }  // end of sleepModeA

Thanks, GMcG

Hi,gmcglinn
you solved this problem? If yes, how?