 	}
 	rpm = (60 * RPM_SMOOTHING_LENGTH) / (revolution_time_sum / 1000000.0);
 	float angular_freq_dependent_pre_ignition = (float)pre_ignition_slope / PRE_IGITION_SLOPE_DIVISOR;
-	float ang_freq = 3600.0 / ((float)revolution_time_history[0] / 1000000.0);
-//	float ang_freq = rpm * 6;
+//	float ang_freq = 3600.0 / ((float)revolution_time_history[0] / 1000000.0);
+	float ang_freq = rpm * 60;
 	dwell_start_angle = 3600.0 - (pre_ignition_bias * 10) -
 		ang_freq * (dwell_time + angular_freq_dependent_pre_ignition);
 	ignition_angle = 3600.0 - (pre_ignition_bias * 10) -

			{
				if (current_magnet == 0)
				{
					for (int i = RPM_SMOOTHING_LENGTH - 1; i > 0; i--)
					{
						revolution_time_history[i] = revolution_time_history[i - 1];
					}
					revolution_time_history[0] = now - revolution_time;
					revolution_time = now;
				}
				angle_delta = estimated_crank_angle - (true_crank_angle[current_magnet] * 10);
				estimated_crank_angle = true_crank_angle[current_magnet] * 10;

	}
	if (pin_state == HIGH)
	{
		//if (current_magnet >= 0)
		//{
		//	magnet_passed = true;
		//}
		magnet_passed = true;
		current_magnet++;
		current_magnet %= NR_OF_MAGNETS;
		low_time_history[0] = now - magnet_start_time;
	}
}

