OPTICAL CHRONOGRAPH 2

here i am going to make shooting chronograph with a nano.
i will update the topic when i finish it off.
if you have any advice in this project please give your reply bellow.
all credit to AlexGyver

chron_disp2.1.ino (13.7 KB)

void start() 
{
  if (gap1 == 0) {// if the measurement has not yet been performed
    gap1 = micros (); // get the operating time of the arduino from the moment it is turned on until the first bullet flies  
  }  

}
void finish() 
{
  if (gap2 == 0) {// if the measurement has not yet been performed
    gap2 = micros (); // get the operating time of the arduino from the moment it is turned on until the second bullet flies  
  }
  sleep = 0; // do not sleep!
  sleep_timer = millis (); // reset the sleep counter
}

Why not use the input capture hardware?
This is the sort of thing it was designed for.

It looks to me like you could make good use of the F() macro to free up RAM

  case '0': mode = 0; flagmass = 0; rapidflag = 0; initial = 0; break; // if accepted 0 then select 0 mode
    case '1': mode = 1; break; // if accepted 1 then start mode 1
    case '2': mode = 2; break; // if accepted 2 then start mode 2
    case '3': mode = 3; break; // if accepted 3 then run mode 3
    case '4': mode = 4; break; // if accepted 4 then run mode 4
    case '5': mode = 5; break; // if accepted 5 then run mode 5

Don’t make it harder to read than it needs to be

if (digitalRead (8) == 1 && state == 0) Remind me; what is pin 8?

project is not mine sir, and i have a few knowledge about it.
main coder is a Russian.

here is the vdo?>Как сделать хронограф своими руками - YouTube
and here is code and details >? http://alexgyver.ru/source_chron_2/

pinMode (8, INPUT); // button connected here you see in the vdo e