Final minor cleanup before Feb release

This commit is contained in:
Josh Stewart 2017-03-03 12:51:19 +11:00
parent 7818d418d4
commit 5c5cc71d8f
2 changed files with 31 additions and 2 deletions

View File

@ -1392,9 +1392,9 @@ void triggerPri_Nissan360()
{
toothOneMinusOneTime = toothOneTime;
toothOneTime = curTime;
currentStatus.startRevolutions++; //2 complete crank revolutions
currentStatus.startRevolutions++;
}
else if ( toothCurrentCount == 361 )
else if ( toothCurrentCount == 361 ) //2 complete crank revolutions
{
toothCurrentCount = 1;
toothOneMinusOneTime = toothOneTime;

View File

@ -44,6 +44,7 @@ unsigned int tempReading;
#if defined(ANALOG_ISR)
//Analog ISR interrupt routine
/*
ISR(ADC_vect)
{
byte nChannel;
@ -74,6 +75,34 @@ ISR(ADC_vect)
//BIT_SET(ADCSRA, ADIE);
//ADCSRA = 0xEE; // ADC Interrupt Flag enabled
}
*/
ISR(ADC_vect)
{
byte nChannel = ADMUX & 0x07;
int result = ADCL | (ADCH << 8);
BIT_CLEAR(ADCSRA, ADEN); //Disable ADC for Changing Channel (see chapter 26.5 of datasheet)
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
if (nChannel==7) { ADMUX = 0x40; }
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
if(ADCSRB & 0x08) { nChannel += 8; } //8 to 15
if(nChannel == 15)
{
ADMUX = 0x40; //channel 0
ADCSRB = 0x00; //clear MUX5 bit
}
else if (nChannel == 7) //channel 7
{
ADMUX = 0x40;
ADCSRB = 0x08; //Set MUX5 bit
}
#endif
else { ADMUX++; }
AnChannel[nChannel] = result;
BIT_SET(ADCSRA, ADEN); //Enable ADC
}
#endif
#endif // SENSORS_H