diff --git a/firmware/basic/basic.h b/firmware/basic/basic.h index aa0e5c4..0493eaa 100644 --- a/firmware/basic/basic.h +++ b/firmware/basic/basic.h @@ -152,6 +152,7 @@ char isNight(void); uint8_t getInput(void); uint8_t getInputRaw(void); uint8_t getInputWait(void); +uint8_t getInputWaitRepeat(void); uint8_t getInputWaitTimeout(int timeout); void getInputWaitRelease(void); diff --git a/firmware/basic/keyin.c b/firmware/basic/keyin.c index 2a8562d..e12f306 100644 --- a/firmware/basic/keyin.c +++ b/firmware/basic/keyin.c @@ -62,6 +62,39 @@ uint8_t getInputWaitTimeout(int timeout) { return key; }; +uint8_t getInputWaitRepeat(void) { + static uint8_t oldkey=BTN_NONE; + static int repeatctr=0; + uint8_t key=getInputRaw(); + + if (key != BTN_NONE && key==oldkey){ + int dtime; + if(!repeatctr) + dtime=600; + else if(repeatctr<5) + dtime=250; + else if(repeatctr<30) + dtime=150; + else + dtime=80; + repeatctr++; + int end=_timectr+(dtime/SYSTICKSPEED); + while(_timectr