Correct secl sanity counter function

This commit is contained in:
Josh Stewart 2014-05-08 20:46:38 +10:00
parent 876849ff29
commit 781c6b72dc
4 changed files with 6 additions and 2 deletions

View File

@ -83,7 +83,7 @@ void sendValues(int length)
byte packetSize = 26;
byte response[packetSize];
response[0] = currentStatus.runSecs; //rtc.sec;
response[0] = currentStatus.secl; //secl is simply a counter that increments each second. Used to track unexpected resets (Which will reset this count to 0)
response[1] = currentStatus.squirt; //Squirt Bitfield
response[2] = currentStatus.engine; //Engine Status Bitfield - NOT YET WORKING
response[3] = 0x00; //baro

View File

@ -45,7 +45,8 @@ struct statuses {
volatile byte squirt;
byte engine;
unsigned long PW; //In uS
byte runSecs;
volatile byte runSecs; //Counter of seconds since cranking commenced (overflows at 255 obviously)
volatile byte secl; //Continous
volatile int loopsPerSecond;
//Helpful bitwise operations:

View File

@ -118,6 +118,7 @@ void setup()
currentStatus.RPM = 0;
currentStatus.hasSync = false;
currentStatus.runSecs = 0;
currentStatus.secl = 0;
switch (pinTrigger) {

View File

@ -52,6 +52,8 @@ ISR(TIMER2_OVF_vect)
currentStatus.loopsPerSecond = mainLoopCount;
mainLoopCount = 0;
//**************************************************************************************************************************************************
//increament secl (secl is simply a counter that increments every second and is used to track whether the system has unexpectedly reset
currentStatus.secl++;
}