BlueFruit Project: Added kill on too many start attempts

One of the perks of bench testing your newfangled autostart project is that you can start to see patterns of use that may lead to trouble. The other is that when you hook up a multi-meter to the relays with the diode audio turned on, you can listen to the hum of your machine!

IMG_20180424_122308

One such test, though, proved insightful. One would surmise that if you attempt to start the vehicle, that after the prescribed number of attempts, it would simply give up and stop. However, my code only stops it from cranking after the three failed attempts. That means the accessory/fuel pump relays are still on!

I realized this when the hum from the multi-meter didn’t stop. But it should have.

While you can check out the whole commit on my GitLab, but here is the relevant portion:

if (startTimer == 0 && startAttempts > 0) {
digitalWrite(11, LOW);
digitalWrite(15, HIGH);
crankTimer = 3;
startTimer = -1;
Serial.println (” crankTimer ON “);
} else if (startTimer == 0 && startAttempts == 0) {
// Turn everything off from to many attempts.
digitalWrite(16, LOW);
digitalWrite(15, LOW);
digitalWrite(7, HIGH);
digitalWrite(11, HIGH);
crankTimer = -1;
startTimer = -1;
runTimer = -1;
startAttempts = -1;
Serial.println(” Kill All – Too many attempts. “);
} else if (startTimer > 0) {
startTimer = startTimer -1;
Serial.print (” startTimer “); Serial.println(startTimer);
}

Before, if the startTimer reached zero, it would check if the startAttempts was greater than, or equal to zero, and then try to crank. Now, I have it only attempt to crank if the startAttempts is greater than 0. If it is 0, it will send the kill signal and stop all attempts.

Short and simple, but that’s usually the best kind of fix!

Linux – keep it simple.

One thought on “BlueFruit Project: Added kill on too many start attempts

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s