From 589755326587ec66c513c25fee9371cab289ae13 Mon Sep 17 00:00:00 2001 From: bsongis Date: Wed, 28 Sep 2011 21:32:10 +0000 Subject: [PATCH] Avoids splash + checks at startup on wdt reboot --- src/gruvin9x.cpp | 55 +++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/src/gruvin9x.cpp b/src/gruvin9x.cpp index c1a3b9974..b7e067a2b 100644 --- a/src/gruvin9x.cpp +++ b/src/gruvin9x.cpp @@ -523,7 +523,7 @@ void doSplash() } } -void checkMem() +void checkLowEEPROM() { if(g_eeGeneral.disableMemoryWarning) return; if(EeFsGetFree() < 200) @@ -845,25 +845,33 @@ void getADC_bandgap() { #if defined(PCBSTD) ADMUX=0x1E|ADC_VREF_TYPE; // Switch MUX to internal 1.22V reference - _delay_us(5); // short delay to stablise reference voltage + _delay_us(10); // short delay to stablise reference voltage + ADCSRA|=0x40; while ((ADCSRA & 0x10)==0); ADCSRA|=0x10; // grab a sample ADCSRA|=0x40; while ((ADCSRA & 0x10)==0); ADCSRA|=0x10; // grab a sample - ADCSRA|=0x40; while ((ADCSRA & 0x10)==0); ADCSRA|=0x10; // again becasue first one is usually inaccurate BandGap=ADCW; -#else - //BandGap=225; // gruvin: 1.1V internal Vref doesn't seem to work on the ATmega2561. :/ Weird. - // See http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=847208#847208 - // In the end, simply using a longer delay (presumably to account for the higher - // impedance Vbg internal source) solved the problem. NOTE: Does NOT adversely affect PPM_out latency. -#if defined (PCBV4) +#elif defined (PCBV4) + // For PCB V4, use our own 1.2V, external reference (connected to ADC3) ADCSRB &= ~(1<