[Taranis] Splash on SD. Various fixes.

This commit is contained in:
bsongis@gmail.com
2013-07-04 19:31:03 +00:00
parent a03c3a849d
commit b362bc7f9d
2 changed files with 19 additions and 7 deletions
+17 -5
View File
@@ -1568,7 +1568,9 @@ void doSplash()
#if defined(PCBSTD)
lcdSetContrast();
#elif !defined(PCBTARANIS)
#elif defined(PCBTARANIS)
bool secondSplash = false;
#else
tmr10ms_t curTime = get_tmr10ms() + 10;
uint8_t contrast = 10;
lcdSetRefVolt(contrast);
@@ -1579,8 +1581,7 @@ void doSplash()
uint16_t inacSum = stickMoveValue();
tmr10ms_t tgtime = get_tmr10ms() + SPLASH_TIMEOUT;
while (tgtime != get_tmr10ms())
{
while (tgtime != get_tmr10ms()) {
#if defined(SIMU)
SIMU_SLEEP(1);
#elif defined(CPUARM)
@@ -1598,7 +1599,17 @@ void doSplash()
if (pwrCheck()==e_power_off) return;
#if !defined(PCBSTD) && !defined(PCBTARANIS)
#if defined(PCBTARANIS)
if (!secondSplash && get_tmr10ms() >= tgtime-SPLASH_TIMEOUT/2) {
secondSplash = true;
static uint8_t sdSplash[2+4*(LCD_W*LCD_H/8)];
if (!bmpLoad(sdSplash, BITMAPS_PATH "/splash.bmp", LCD_W, LCD_H)) {
lcd_clear();
lcd_bmp(0, 0, sdSplash);
lcdRefresh();
}
}
#elif !defined(PCBSTD)
if (curTime < get_tmr10ms()) {
curTime += 10;
if (contrast < g_eeGeneral.contrast) {
@@ -1613,6 +1624,7 @@ void doSplash()
}
}
#else
#define Splash()
#define doSplash()
#endif
@@ -2413,7 +2425,7 @@ uint8_t fnSwitchDuration[NUM_CFN] = { 0 };
inline void playCustomFunctionFile(CustomFnData *sd, uint8_t id)
{
char filename[] = SOUNDS_PATH "/xxxxxx.wav";
char filename[sizeof(SOUNDS_PATH)+sizeof(sd->param.name)+sizeof(SOUNDS_EXT)] = SOUNDS_PATH "/";
strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
strncpy(filename+sizeof(SOUNDS_PATH), sd->param.name, sizeof(sd->param.name));
filename[sizeof(SOUNDS_PATH)+sizeof(sd->param.name)] = '\0';
+2 -2
View File
@@ -542,7 +542,7 @@ FRESULT f_unlink (const TCHAR*)
int f_putc (TCHAR c, FIL * fil)
{
if (fil->fs) fwrite(&c, 1, 1, (FILE*)fil->fs);
if (fil && fil->fs) fwrite(&c, 1, 1, (FILE*)fil->fs);
return FR_OK;
}
@@ -559,7 +559,7 @@ int f_printf (FIL *fil, const TCHAR * format, ...)
{
va_list arglist;
va_start(arglist, format);
if (fil->fs) vfprintf((FILE*)fil->fs, format, arglist);
if (fil && fil->fs) vfprintf((FILE*)fil->fs, format, arglist);
va_end(arglist);
return 0;
}