Pressure sensor glow plug monitoring

Hi.

My goal is to read inside cylinder pressure values in a diesel engine.

For that i installed a piezoresistive pressure sensor glow plug in the first cylinder of engine and an external inductive sensor (sine wave output sensor allready converted to square wave to arduino with lm393) that reads a tooth wheel (60 teeth with two missing, so in reality 58) atached to the cranckshaft pulley.

The 2 tooth gap passes in front of the sensor when the first cylinder is aproximatelly 60 degrees before top dead center or 10 falling edges from tooth wheel.

The sketch i will atach is intended to:

  1. Read the pressure value every time a falling edge is detected with and ISR routine and store values to a 2x58 array.

  2. When the gap is detected, and that is the point i am strugling right now, store value 10 to the array, at corresponding cylinder pressure.

  3. When the ISR reaches 57 consecutive falling edges, it will print the 57 pressure values in the serial monitor.

Then i will count then values from the number 10 stored in the array and i will know the aproximate location of top deade center and corresponding pressure value and if i want i can do a pressure vs cranckshaft angle plot in excel.

I would like you guys to see the sketch and tell me your opinion mainly about the gap detection, and other things if you find something wrong or not apropriate.

Thanks a lot.

                  // PSG variables\\

float psg;

                 //SIGNAL pick up variables\\

volatile float npulse=0;
volatile float delta_t=0;
volatile int count_pulses_1=0;
volatile int count_pulses_2=0;

float array_t [2];
float array_psg_indutive [2][58]; //The first value of both arrays will be random because it will just start to store values when count_pulses 1 and 2 are 1, so to speak in column 1\\


void setup(){
  
  Serial.begin(9600);
  while(!Serial){;};

  pinMode(2,INPUT);

  digitalWrite(2,HIGH);

  attachInterrupt(1,react,FALLING);  
}

void loop ()
{
 
  psg=analogRead(A0);
  
  array_psg_indutive[0][count_pulses_2]=psg;
  
  array_t[count_pulses_1]=delta_t;
  
 //Following if will only be satisfied if delta_t is at least 10% bigger than stored value in the array\\
 
 if (delta_t>1.1*array_t[1]) 
  
  {
  array_psg_indutive[1][count_pulses_2]=10; 
  }
  else
  
 {
   array_psg_indutive[1][count_pulses_2]=0;
 }

count_pulses_1++;
count_pulses_2++;

if (count_pulses_2>57)

{
  for (count_pulses_2=0; count_pulses_2 <=57; count_pulses_2++)
{
Serial.print(array_psg_indutive[0][count_pulses_2]);
Serial.print('-->');
Serial.print(array_psg_indutive[1][count_pulses_2]);
Serial.println();

}
count_pulses_2=0;
count_pulses_1=0;
}
}
/////////////////////////////////////////////////////////

void react()
{
  volatile float n2pulse = micros();
 

  /////////////////////////////////////////////////////////  

 delta_t=(n2pulse-npulse);

 npulse = n2pulse;

}

///////////////////////////////////////////////////////////////