[all] Mixer bugs fixed (slow / delays)

[stock] Flash saving
[stock] PWM backlight fix
[stock] NAVIGATION=STICKS pulled from er9x, thanks Mike!
[Taranis] Telemetry logs in DEBUG mode correctly opened / closed (not tested)
This commit is contained in:
bsongis@gmail.com
2013-05-31 19:33:20 +00:00
parent 7e7b1914ff
commit c9171c6d79
15 changed files with 311 additions and 169 deletions
+17 -9
View File
@@ -122,17 +122,19 @@ inline void boardInit()
#if defined(AUDIO) || defined(VOICE)
SET_TIMER_AUDIO_CTRL();
#if !defined(CPUM2561)
TIMSK |= (1<<OCIE0) | (1<<TOIE0) | (1<<TOIE2); // Enable Output-Compare and Overflow interrrupts
#endif
#elif defined(PWM_BACKLIGHT)
/** Smartieparts LED Backlight is connected to PORTB/pin7, which can be used as pwm output of timer2 **/
#if defined(SP22)
TCCR2 = (0b011 << CS20)|(1<<WGM20)|(1<<COM21)|(1<<COM20); // inv. pwm mode, clk/64
#else
TCCR2 = (0b011 << CS20)|(1<<WGM20)|(1<<COM21); // pwm mode, clk/64
#endif
#endif
#if !defined(CPUM2561)
TIMSK |= (1<<OCIE0) | (1<<TOIE0) | (1<<TOIE2); // Enable Output-Compare and Overflow interrrupts
#if defined(SP22)
TCCR2 = (0b011 << CS20)|(1<<WGM20)|(1<<COM21)|(1<<COM20); // inv. pwm mode, clk/64
#else
TCCR2 = (0b011 << CS20)|(1<<WGM20)|(1<<COM21); // pwm mode, clk/64
#endif
#if !defined(CPUM2561)
TIMSK |= (1<<OCIE0) | (1<<TOIE0); // Enable Output-Compare and Overflow interrrupts
#endif
#endif
}
#endif
@@ -268,6 +270,12 @@ void readKeysAndTrims()
#if defined(ROTARY_ENCODER_NAVIGATION)
keys[enuk].input(ROTENC_DOWN(), (EnumKeys)enuk); // Rotary Enc. Switch
#endif
#if defined(NAVIGATION_STICKS)
if (~PINB & 0x7E) {
StickScrollTimer = STICK_SCROLL_TIMEOUT ;
}
#endif
}
bool checkSlaveMode()
+1
View File
@@ -104,6 +104,7 @@ void delay_01us(uint16_t nb);
#define SD_GET_BLOCKNR() (0)
#define SD_GET_SPEED() (0)
void sdInit();
void sdDone();
void sdPoll10ms();
#define sdMountPoll()
uint32_t sdMounted();
+22 -1
View File
@@ -959,12 +959,33 @@ void sdPoll10ms()
}
}
// TODO everything here should not be in the driver layer ...
FATFS g_FATFS_Obj;
#if defined(DEBUG)
FIL g_telemetryFile = {0};
#endif
void sdInit()
{
if (f_mount(0, &g_FATFS_Obj) == FR_OK)
if (f_mount(0, &g_FATFS_Obj) == FR_OK) {
refreshSystemAudioFiles();
#if defined(DEBUG)
f_open(&g_telemetryFile, LOGS_PATH "/sport.log", FA_CREATE_ALWAYS | FA_WRITE);
#endif
}
}
void sdDone()
{
if (sdMounted()) {
audioQueue.stopSD();
closeLogs();
#if defined(DEBUG)
f_close(&g_telemetryFile);
#endif
f_mount(0, 0); // unmount SD
}
}
uint32_t sdMounted()
+1 -6
View File
@@ -107,12 +107,7 @@ void USBD_USR_DeviceResumed(void)
*/
void USBD_USR_DeviceConnected (void)
{
if (sdMounted()) {
audioQueue.stopSD();
closeLogs();
f_mount(0, 0); // unmount SD
}
sdDone();
eeCheck(true);
usbState = USB_CONNECTED;
}