olikraus / m2tklib

Automatically exported from code.google.com/p/m2tklib
Other
49 stars 11 forks source link

Real fast ramped auto repeat #138

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I was testing the auto repeat code example and I figured out that it works 
really well when setting small values like 1 to 10. I'm trying without much 
success to make it usable when setting larger values (1 to 999). I tried to 
replace auto_repeat_first_delay and auto_repeat_repeat_delay with lower values 
but still slow for adjusting larger numbers. Any idea on how to achieve this?

Since I'm using the AVR/U8G version, I had to create my millis() function using 
timers:

ISR(TIMER3_COMPA_vect)
{
    timer3_millis++;
}

unsigned long millis()
{
    unsigned long millis_return;
    millis_return = timer3_millis;
    return millis_return;
}

Original issue reported on code.google.com by will...@curitiba.org on 10 Jul 2014 at 12:02

GoogleCodeExporter commented 9 years ago
I think you are getting close to the time which is required for redraw. Calling 
checkKey() more often might help, but in principle, m2tk does not handle keys 
during redraw.

void loop() {
  m2.checkKey();
  m2.checkKey();
  if ( m2.handleKey() ) {
    u8g.firstPage();  
    do {
      m2.checkKey();
      draw();
    } while( u8g.nextPage() );
  }
}

Original comment by olikr...@gmail.com on 10 Jul 2014 at 4:12