From 895bc26f77c7bca101fb2b333da56ccb73cf07b4 Mon Sep 17 00:00:00 2001 From: bsongis Date: Sat, 14 Feb 2015 18:26:08 +0100 Subject: [PATCH 1/5] Fixes #1925 --- companion/src/eeprominterface.cpp | 2 + companion/src/eeprominterface.h | 1 + .../src/firmwares/opentx/opentxeeprom.cpp | 2 + radio/src/bmp.cpp | 51 +++++++++++++++++++ radio/src/functions.cpp | 8 +++ radio/src/myeeprom.h | 3 ++ 6 files changed, 67 insertions(+) diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index 287e5df6f..7df295d20 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -869,6 +869,8 @@ QString CustomFunctionData::funcToString() return QObject::tr("Volume"); else if (func == FuncBacklight) return QObject::tr("Backlight"); + else if (func == FuncScreenshot) + return QObject::tr("Screenshot"); else if (func == FuncBackgroundMusic) return QObject::tr("Background Music"); else if (func == FuncBackgroundMusicPause) diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index a75f6e80b..4ef4bbc89 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -641,6 +641,7 @@ enum AssignFunc { FuncLogs, FuncVolume, FuncBacklight, + FuncScreenshot, FuncBackgroundMusic, FuncBackgroundMusicPause, FuncAdjustGV1, diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 40a429a43..b0040f5d0 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -1911,6 +1911,8 @@ class CustomFunctionsConversionTable: public ConversionTable { if (board == BOARD_GRUVIN9X || IS_ARM(board) ) addConversion(FuncLogs, val++); addConversion(FuncBacklight, val++); + if (IS_TARANIS(board)) + addConversion(FuncScreenshot, val++); } else { addConversion(FuncPlaySound, val++); diff --git a/radio/src/bmp.cpp b/radio/src/bmp.cpp index 94433ccad..b3f70d5bb 100644 --- a/radio/src/bmp.cpp +++ b/radio/src/bmp.cpp @@ -203,3 +203,54 @@ const pm_char * bmpLoad(uint8_t *bmp, const char *filename, const unsigned int w f_close(&bmpFile); return 0; } + +const uint8_t bmpHeader[] = { + 0x42, 0x4d, 0xF8, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x28, 0x00, + 0x00, 0x00, 212, 0x00, 0x00, 0x00, 64, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0xbc, 0x38, 0x00, 0x00, 0xbc, 0x38, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x00, 0x22, 0x22, + 0x22, 0x00, 0x33, 0x33, 0x33, 0x00, 0x44, 0x44, 0x44, 0x00, 0x55, 0x55, 0x55, 0x00, 0x66, 0x66, + 0x66, 0x00, 0x77, 0x77, 0x77, 0x00, 0x88, 0x88, 0x88, 0x00, 0x99, 0x99, 0x99, 0x00, 0xaa, 0xaa, + 0xaa, 0x00, 0xbb, 0xbb, 0xbb, 0x00, 0xcc, 0xcc, 0xcc, 0x00, 0xdd, 0xdd, 0xdd, 0x00, 0xee, 0xee, + 0xee, 0x00, 0xff, 0xff, 0xff, 0x00 +}; + +inline display_t getPixel(int x, int y) +{ + if (x>=LCD_W || y>=LCD_H) + return 0; + display_t * p = &displayBuf[y / 2 * LCD_W + x]; + return (y & 1) ? (*p >> 4) : (*p & 0x0F); +} + +const char *writeScreenshot(const char *filename) +{ + FIL bmpFile; + UINT written; + + FRESULT result = f_open(&bmpFile, filename, FA_CREATE_ALWAYS | FA_WRITE); + if (result != FR_OK) { + return SDCARD_ERROR(result); + } + + result = f_write(&bmpFile, bmpHeader, sizeof(bmpHeader), &written); + if (result != FR_OK || written != sizeof(bmpHeader)) { + f_close(&bmpFile); + return SDCARD_ERROR(result); + } + + for (int y=LCD_H-1; y>=0; y-=1) { + for (int x=0; x<8*((LCD_W+7)/8); x+=2) { + uint8_t byte = getPixel(x+1, y) + (getPixel(x, y) << 4); + f_write(&bmpFile, &byte, 1, &written); + if (result != FR_OK || written != 1) { + f_close(&bmpFile); + return SDCARD_ERROR(result); + } + } + } + + f_close(&bmpFile); + + return NULL; +} diff --git a/radio/src/functions.cpp b/radio/src/functions.cpp index d94329e52..05462e430 100644 --- a/radio/src/functions.cpp +++ b/radio/src/functions.cpp @@ -543,6 +543,14 @@ void evalFunctions() newActiveFunctions |= (1 << FUNCTION_BACKLIGHT); break; +#if defined(PCBTARANIS) + case FUNC_SCREENSHOT: + if (!(functionsContext.activeSwitches & switch_mask)) { + writeScreenshot("screenshot.bmp"); + } + break; +#endif + #if defined(DEBUG) case FUNC_TEST: testFunc(); diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index 55811e292..91c594b28 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -488,6 +488,9 @@ enum Functions { FUNC_LOGS, #endif FUNC_BACKLIGHT, +#if defined(PCBTARANIS) + FUNC_SCREENSHOT, +#endif #if defined(DEBUG) FUNC_TEST, // should remain the last before MAX as not added in companion9x #endif From c343a80b1b29ddd7c033d86d0381620cc8c690b3 Mon Sep 17 00:00:00 2001 From: bsongis Date: Sat, 14 Feb 2015 18:26:08 +0100 Subject: [PATCH 2/5] Fixes #1925 --- radio/src/gui/Taranis/lcd.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/radio/src/gui/Taranis/lcd.h b/radio/src/gui/Taranis/lcd.h index 62afed0e3..c467a33c1 100755 --- a/radio/src/gui/Taranis/lcd.h +++ b/radio/src/gui/Taranis/lcd.h @@ -238,7 +238,8 @@ void lcdOff(); #define LCD_REFRESH_DONT_WAIT #endif -const pm_char * bmpLoad(uint8_t *dest, const char *filename, const unsigned int width, const unsigned int height); +const char *bmpLoad(uint8_t *dest, const char *filename, const unsigned int width, const unsigned int height); +const char *writeScreenshot(const char *filename); #if defined(BOOT) #define BLINK_ON_PHASE (0) From 20f69fc2941a9856ffa44111d2c26fe12f24c35a Mon Sep 17 00:00:00 2001 From: bsongis Date: Sun, 15 Feb 2015 12:27:52 +0100 Subject: [PATCH 3/5] Missing translations --- radio/src/translations/cz.h.txt | 8 +++++++- radio/src/translations/de.h.txt | 8 +++++++- radio/src/translations/en.h.txt | 8 +++++++- radio/src/translations/es.h.txt | 8 +++++++- radio/src/translations/fi.h.txt | 8 +++++++- radio/src/translations/fr.h.txt | 8 +++++++- radio/src/translations/it.h.txt | 8 +++++++- radio/src/translations/pl.h.txt | 8 +++++++- radio/src/translations/pt.h.txt | 8 +++++++- radio/src/translations/se.h.txt | 8 +++++++- 10 files changed, 70 insertions(+), 10 deletions(-) diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index 408201d0c..66b6a25ab 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -270,10 +270,16 @@ #define TR_SF_SAFETY "---\0 " #endif +#if defined(PCBTARANIS) + #define TR_SF_SCREENSHOT "Screenshot" +#else + #define TR_SF_SCREENSHOT +#endif + #define TR_SF_RESERVE "[rezerva]\0 " #if defined(CPUARM) - #define TR_VFSWFUNC TR_SF_SAFETY "Trenér \0 ""Insta-Trim\0""Reset\0 ""Set \0 " TR_ADJUST_GVAR "Hlasitost\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Podsvětlení" TR_SF_TEST + #define TR_VFSWFUNC TR_SF_SAFETY "Trenér \0 ""Insta-Trim\0""Reset\0 ""Set \0 " TR_ADJUST_GVAR "Hlasitost\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Podsvětlení" TR_SF_SCREENSHOT TR_SF_TEST #elif defined(PCBGRUVIN9X) #define TR_VFSWFUNC TR_SF_SAFETY "Trenér \0 ""Insta-Trim\0""Reset\0 " TR_ADJUST_GVAR TR_SOUND TR_PLAY_TRACK TR_PLAY_BOTH TR_PLAY_VALUE TR_VVARIO TR_HAPTIC TR_SDCLOGS "Podsvětlení" TR_SF_TEST #else diff --git a/radio/src/translations/de.h.txt b/radio/src/translations/de.h.txt index 03fc5ef2f..170c1e04c 100644 --- a/radio/src/translations/de.h.txt +++ b/radio/src/translations/de.h.txt @@ -272,10 +272,16 @@ #define TR_SF_SAFETY "---\0 " #endif +#if defined(PCBTARANIS) + #define TR_SF_SCREENSHOT "Screenshot" +#else + #define TR_SF_SCREENSHOT +#endif + #define TR_SF_RESERVE "[Reserve]\0" #if defined(CPUARM) - #define TR_VFSWFUNC TR_SF_SAFETY "Lehrer \0 ""Inst. Trim""Rücksetz.\0""Setze \0 " TR_ADJUST_GVAR "Lautstr.\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "LCD Licht\0" TR_SF_TEST + #define TR_VFSWFUNC TR_SF_SAFETY "Lehrer \0 ""Inst. Trim""Rücksetz.\0""Setze \0 " TR_ADJUST_GVAR "Lautstr.\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "LCD Licht\0" TR_SF_SCREENSHOT TR_SF_TEST #elif defined(PCBGRUVIN9X) #define TR_VFSWFUNC TR_SF_SAFETY "Lehrer \0 ""Inst. Trim""Rücksetz.\0" TR_ADJUST_GVAR TR_SOUND TR_PLAY_TRACK TR_PLAY_BOTH TR_PLAY_VALUE TR_VVARIO TR_HAPTIC TR_SDCLOGS "LCD Licht\0" TR_SF_TEST #else diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index 93ff6db19..9528af66b 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -272,10 +272,16 @@ #define TR_SF_SAFETY "---\0 " #endif +#if defined(PCBTARANIS) + #define TR_SF_SCREENSHOT "Screenshot" +#else + #define TR_SF_SCREENSHOT +#endif + #define TR_SF_RESERVE "[reserve]\0" #if defined(CPUARM) - #define TR_VFSWFUNC TR_SF_SAFETY "Trainer\0 ""Inst. Trim""Reset\0 ""Set \0 " TR_ADJUST_GVAR "Volume\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Backlight\0" TR_SF_TEST + #define TR_VFSWFUNC TR_SF_SAFETY "Trainer\0 ""Inst. Trim""Reset\0 ""Set \0 " TR_ADJUST_GVAR "Volume\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Backlight\0" TR_SF_SCREENSHOT TR_SF_TEST #elif defined(PCBGRUVIN9X) #define TR_VFSWFUNC TR_SF_SAFETY "Trainer\0 ""Inst. Trim""Reset\0 " TR_ADJUST_GVAR TR_SOUND TR_PLAY_TRACK TR_PLAY_BOTH TR_PLAY_VALUE TR_VVARIO TR_HAPTIC TR_SDCLOGS "Backlight\0" TR_SF_TEST #else diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index 7cc9ba220..153a41261 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -270,10 +270,16 @@ #define TR_SF_SAFETY "---\0 " #endif +#if defined(PCBTARANIS) + #define TR_SF_SCREENSHOT "Screenshot" +#else + #define TR_SF_SCREENSHOT +#endif + #define TR_SF_RESERVE "[reserve]\0" #if defined(CPUARM) - #define TR_VFSWFUNC TR_SF_SAFETY "Aprendiz\0 ""Inst. Trim""Reset\0 ""Set \0 " TR_ADJUST_GVAR "Volumen\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Luz fondo\0" TR_SF_TEST + #define TR_VFSWFUNC TR_SF_SAFETY "Aprendiz\0 ""Inst. Trim""Reset\0 ""Set \0 " TR_ADJUST_GVAR "Volumen\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Luz fondo\0" TR_SF_SCREENSHOT TR_SF_TEST #elif defined(PCBGRUVIN9X) #define TR_VFSWFUNC TR_SF_SAFETY "Aprendiz\0 ""Inst. Trim""Reset\0 " TR_ADJUST_GVAR TR_SOUND TR_PLAY_TRACK TR_PLAY_BOTH TR_PLAY_VALUE TR_VVARIO TR_HAPTIC TR_SDCLOGS "Luz fondo\0" TR_SF_TEST #else diff --git a/radio/src/translations/fi.h.txt b/radio/src/translations/fi.h.txt index 5e5d45ad7..b3d061a84 100644 --- a/radio/src/translations/fi.h.txt +++ b/radio/src/translations/fi.h.txt @@ -270,10 +270,16 @@ #define TR_SF_SAFETY "---\0 " #endif +#if defined(PCBTARANIS) + #define TR_SF_SCREENSHOT "Screenshot" +#else + #define TR_SF_SCREENSHOT +#endif + #define TR_SF_RESERVE "[reserve]\0" #if defined(CPUARM) - #define TR_VFSWFUNC TR_SF_SAFETY "Trainer\0 ""Inst. Trim""Reset\0 ""Set \0 " TR_ADJUST_GVAR "Volume\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Backlight\0" TR_SF_TEST + #define TR_VFSWFUNC TR_SF_SAFETY "Trainer\0 ""Inst. Trim""Reset\0 ""Set \0 " TR_ADJUST_GVAR "Volume\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Backlight\0" TR_SF_SCREENSHOT TR_SF_TEST #elif defined(PCBGRUVIN9X) #define TR_VFSWFUNC TR_SF_SAFETY "Trainer\0 ""Inst. Trim""Reset\0 " TR_ADJUST_GVAR TR_SOUND TR_PLAY_TRACK TR_PLAY_BOTH TR_PLAY_VALUE TR_VVARIO TR_HAPTIC TR_SDCLOGS "Backlight\0" TR_SF_TEST #else diff --git a/radio/src/translations/fr.h.txt b/radio/src/translations/fr.h.txt index 62adc2d64..cc95c34f4 100644 --- a/radio/src/translations/fr.h.txt +++ b/radio/src/translations/fr.h.txt @@ -270,10 +270,16 @@ #define TR_SF_SAFETY "---\0 " #endif +#if defined(PCBTARANIS) + #define TR_SF_SCREENSHOT "PhotoEcran" +#else + #define TR_SF_SCREENSHOT +#endif + #define TR_SF_RESERVE "[reserve]\0 " #if defined(CPUARM) - #define TR_VFSWFUNC TR_SF_SAFETY "Ecolage\0 ""Trim instant.""Remise à 0\0 ""Déf.\0 " TR_ADJUST_GVAR "Volume\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Rétroécl.\0 " TR_SF_TEST + #define TR_VFSWFUNC TR_SF_SAFETY "Ecolage\0 ""Trim instant.""Remise à 0\0 ""Déf.\0 " TR_ADJUST_GVAR "Volume\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Rétroécl.\0 " TR_SF_SCREENSHOT TR_SF_TEST #elif defined(PCBGRUVIN9X) #define TR_VFSWFUNC TR_SF_SAFETY "Ecolage\0 ""Trim instant.""Remise à 0\0 " TR_ADJUST_GVAR TR_SOUND TR_PLAY_TRACK TR_PLAY_BOTH TR_PLAY_VALUE TR_VVARIO TR_HAPTIC TR_SDCLOGS "Rétroécl.\0 " TR_SF_TEST #else diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index f4d3020e2..4143dd60e 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -269,11 +269,17 @@ #else #define TR_SF_SAFETY "---\0 " #endif + +#if defined(PCBTARANIS) + #define TR_SF_SCREENSHOT "Screenshot" +#else + #define TR_SF_SCREENSHOT +#endif #define TR_SF_RESERVE "[riserva] \0" #if defined(CPUARM) - #define TR_VFSWFUNC TR_SF_SAFETY "Maestro \0 ""Trim Instant.""Azzera\0 ""Set \0 " TR_ADJUST_GVAR "Volume\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Retroillum.\0 " TR_SF_TEST + #define TR_VFSWFUNC TR_SF_SAFETY "Maestro \0 ""Trim Instant.""Azzera\0 ""Set \0 " TR_ADJUST_GVAR "Volume\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Retroillum.\0 " TR_SF_SCREENSHOT TR_SF_TEST #elif defined(PCBGRUVIN9X) #define TR_VFSWFUNC TR_SF_SAFETY "Maestro \0 ""Trim Instant.""Azzera\0 " TR_ADJUST_GVAR TR_SOUND TR_PLAY_TRACK TR_PLAY_BOTH TR_PLAY_VALUE TR_VVARIO TR_HAPTIC TR_SDCLOGS "Retroillum.\0 " TR_SF_TEST #else diff --git a/radio/src/translations/pl.h.txt b/radio/src/translations/pl.h.txt index 047af3491..a570d77d6 100644 --- a/radio/src/translations/pl.h.txt +++ b/radio/src/translations/pl.h.txt @@ -270,10 +270,16 @@ #define TR_SF_SAFETY "---\0 " #endif +#if defined(PCBTARANIS) + #define TR_SF_SCREENSHOT "Screenshot" +#else + #define TR_SF_SCREENSHOT +#endif + #define TR_SF_RESERVE "[rezerwa]\0" #if defined(CPUARM) - #define TR_VFSWFUNC TR_SF_SAFETY "Trener \0 ""Inst-Trim ""Resetuj\0 ""Ustaw\0 " TR_ADJUST_GVAR "Głośność\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Podświetl\0" TR_SF_TEST + #define TR_VFSWFUNC TR_SF_SAFETY "Trener \0 ""Inst-Trim ""Resetuj\0 ""Ustaw\0 " TR_ADJUST_GVAR "Głośność\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Podświetl\0" TR_SF_SCREENSHOT TR_SF_TEST #elif defined(PCBGRUVIN9X) #define TR_VFSWFUNC TR_SF_SAFETY "Trener \0 ""Inst-Trim ""Resetuj\0 " TR_ADJUST_GVAR TR_SOUND TR_PLAY_TRACK TR_PLAY_BOTH TR_PLAY_VALUE TR_VVARIO TR_HAPTIC TR_SDCLOGS "Podświetl\0" TR_SF_TEST #else diff --git a/radio/src/translations/pt.h.txt b/radio/src/translations/pt.h.txt index 100279a1c..fa2c82089 100644 --- a/radio/src/translations/pt.h.txt +++ b/radio/src/translations/pt.h.txt @@ -270,10 +270,16 @@ #define TR_SF_SAFETY "---\0 " #endif +#if defined(PCBTARANIS) + #define TR_SF_SCREENSHOT "Screenshot" +#else + #define TR_SF_SCREENSHOT +#endif + #define TR_SF_RESERVE "[reserve]\0 " #if defined(CPUARM) - #define TR_VFSWFUNC TR_SF_SAFETY "Aprendiz\0 ""Ajuste Rapido""Reset\0 ""Set \0 " TR_ADJUST_GVAR "Volume\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Backlight\0 " TR_SF_TEST + #define TR_VFSWFUNC TR_SF_SAFETY "Aprendiz\0 ""Ajuste Rapido""Reset\0 ""Set \0 " TR_ADJUST_GVAR "Volume\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Backlight\0 " TR_SF_SCREENSHOT TR_SF_TEST #elif defined(PCBGRUVIN9X) #define TR_VFSWFUNC TR_SF_SAFETY "Aprendiz\0 ""Ajuste Rapido""Reset\0 " TR_ADJUST_GVAR TR_SOUND TR_PLAY_TRACK TR_PLAY_BOTH TR_PLAY_VALUE TR_VVARIO TR_HAPTIC TR_SDCLOGS "Backlight\0 " TR_SF_TEST #else diff --git a/radio/src/translations/se.h.txt b/radio/src/translations/se.h.txt index 0b0970c05..713291f11 100644 --- a/radio/src/translations/se.h.txt +++ b/radio/src/translations/se.h.txt @@ -270,10 +270,16 @@ #define TR_SF_SAFETY "---\0 " #endif +#if defined(PCBTARANIS) + #define TR_SF_SCREENSHOT "Screenshot" +#else + #define TR_SF_SCREENSHOT +#endif + #define TR_SF_RESERVE "[reserve]\0" #if defined(CPUARM) - #define TR_VFSWFUNC TR_SF_SAFETY "Trainer\0 ""Sätt Trim\0""Nollställ\0""Sätt\0 " TR_ADJUST_GVAR "Volym\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Belysning\0" TR_SF_TEST + #define TR_VFSWFUNC TR_SF_SAFETY "Trainer\0 ""Sätt Trim\0""Nollställ\0""Sätt\0 " TR_ADJUST_GVAR "Volym\0 " TR_SF_RESERVE TR_SF_RESERVE TR_SF_RESERVE TR_SOUND TR_PLAY_TRACK TR_PLAY_VALUE TR_SF_RESERVE TR_SF_PLAY_SCRIPT TR_SF_RESERVE TR_SF_BG_MUSIC TR_VVARIO TR_HAPTIC TR_SDCLOGS "Belysning\0" TR_SF_SCREENSHOT TR_SF_TEST #elif defined(PCBGRUVIN9X) #define TR_VFSWFUNC TR_SF_SAFETY "Trainer \0 ""Sätt Trim\0""Nollställ\0" TR_ADJUST_GVAR TR_SOUND TR_PLAY_TRACK TR_PLAY_BOTH TR_PLAY_VALUE TR_VVARIO TR_HAPTIC TR_SDCLOGS "Belysning\0" TR_SF_TEST #else From 3c4a23a3c6e3d49d8242214e2bb8e2c122e52fc6 Mon Sep 17 00:00:00 2001 From: bsongis Date: Sun, 15 Feb 2015 12:33:39 +0100 Subject: [PATCH 4/5] Palette inverted --- radio/src/bmp.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/radio/src/bmp.cpp b/radio/src/bmp.cpp index b3f70d5bb..8d4518a7d 100644 --- a/radio/src/bmp.cpp +++ b/radio/src/bmp.cpp @@ -208,14 +208,14 @@ const uint8_t bmpHeader[] = { 0x42, 0x4d, 0xF8, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 212, 0x00, 0x00, 0x00, 64, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0xbc, 0x38, 0x00, 0x00, 0xbc, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x00, 0x22, 0x22, - 0x22, 0x00, 0x33, 0x33, 0x33, 0x00, 0x44, 0x44, 0x44, 0x00, 0x55, 0x55, 0x55, 0x00, 0x66, 0x66, - 0x66, 0x00, 0x77, 0x77, 0x77, 0x00, 0x88, 0x88, 0x88, 0x00, 0x99, 0x99, 0x99, 0x00, 0xaa, 0xaa, - 0xaa, 0x00, 0xbb, 0xbb, 0xbb, 0x00, 0xcc, 0xcc, 0xcc, 0x00, 0xdd, 0xdd, 0xdd, 0x00, 0xee, 0xee, - 0xee, 0x00, 0xff, 0xff, 0xff, 0x00 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xee, 0xee, 0xee, 0x00, 0xdd, 0xdd, + 0xdd, 0x00, 0xcc, 0xcc, 0xcc, 0x00, 0xbb, 0xbb, 0xbb, 0x00, 0xaa, 0xaa, 0xaa, 0x00, 0x99, 0x99, + 0x99, 0x00, 0x88, 0x88, 0x88, 0x00, 0x77, 0x77, 0x77, 0x00, 0x66, 0x66, 0x66, 0x00, 0x55, 0x55, + 0x55, 0x00, 0x44, 0x44, 0x44, 0x00, 0x33, 0x33, 0x33, 0x00, 0x22, 0x22, 0x22, 0x00, 0x11, 0x11, + 0x11, 0x00, 0x00, 0x00, 0x00, 0x00 }; -inline display_t getPixel(int x, int y) +inline display_t getPixel(unsigned int x, unsigned int y) { if (x>=LCD_W || y>=LCD_H) return 0; From 23c4712bbff5a6ff2b90cafbde09f314f170da4a Mon Sep 17 00:00:00 2001 From: bsongis Date: Sun, 15 Feb 2015 13:39:35 +0100 Subject: [PATCH 5/5] Date+Time append to screenshots filenames --- radio/src/bmp.cpp | 20 ++++++++++++++++++-- radio/src/functions.cpp | 2 +- radio/src/gui/Taranis/lcd.h | 2 +- radio/src/logs.cpp | 4 ++-- radio/src/sdcard.h | 9 +++++---- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/radio/src/bmp.cpp b/radio/src/bmp.cpp index 8d4518a7d..b72181c4e 100644 --- a/radio/src/bmp.cpp +++ b/radio/src/bmp.cpp @@ -223,12 +223,28 @@ inline display_t getPixel(unsigned int x, unsigned int y) return (y & 1) ? (*p >> 4) : (*p & 0x0F); } -const char *writeScreenshot(const char *filename) +const char *writeScreenshot() { FIL bmpFile; UINT written; + char filename[48]; // /SCREENSHOTS/screenshot-2013-01-01-12-35-40.bmp + DIR folder; - FRESULT result = f_open(&bmpFile, filename, FA_CREATE_ALWAYS | FA_WRITE); + // check and create folder here + strcpy_P(filename, SCREENSHOTS_PATH); + FRESULT result = f_opendir(&folder, filename); + if (result != FR_OK) { + if (result == FR_NO_PATH) + result = f_mkdir(filename); + if (result != FR_OK) + return SDCARD_ERROR(result); + } + + char *tmp = strAppend(&filename[sizeof(SCREENSHOTS_PATH)-1], "/screenshot"); + tmp = strAppendDate(tmp, true); + strcpy(tmp, BITMAPS_EXT); + + result = f_open(&bmpFile, filename, FA_CREATE_ALWAYS | FA_WRITE); if (result != FR_OK) { return SDCARD_ERROR(result); } diff --git a/radio/src/functions.cpp b/radio/src/functions.cpp index 05462e430..5ec076707 100644 --- a/radio/src/functions.cpp +++ b/radio/src/functions.cpp @@ -546,7 +546,7 @@ void evalFunctions() #if defined(PCBTARANIS) case FUNC_SCREENSHOT: if (!(functionsContext.activeSwitches & switch_mask)) { - writeScreenshot("screenshot.bmp"); + writeScreenshot(); } break; #endif diff --git a/radio/src/gui/Taranis/lcd.h b/radio/src/gui/Taranis/lcd.h index c467a33c1..a04e2dd82 100755 --- a/radio/src/gui/Taranis/lcd.h +++ b/radio/src/gui/Taranis/lcd.h @@ -239,7 +239,7 @@ void lcdOff(); #endif const char *bmpLoad(uint8_t *dest, const char *filename, const unsigned int width, const unsigned int height); -const char *writeScreenshot(const char *filename); +const char *writeScreenshot(); #if defined(BOOT) #define BLINK_ON_PHASE (0) diff --git a/radio/src/logs.cpp b/radio/src/logs.cpp index 9df6fac72..fd9a10220 100644 --- a/radio/src/logs.cpp +++ b/radio/src/logs.cpp @@ -49,7 +49,7 @@ uint8_t logDelay; #define get3PosState(sw) (switchState(SW_ ## sw ## 0) ? -1 : (switchState(SW_ ## sw ## 2) ? 1 : 0)) -const pm_char * openLogs() +const pm_char *openLogs() { // Determine and set log file filename FRESULT result; @@ -59,8 +59,8 @@ const pm_char * openLogs() if (!sdMounted()) return STR_NO_SDCARD; + // check and create folder here strcpy_P(filename, STR_LOGS_PATH); - result = f_opendir(&folder, filename); if (result != FR_OK) { if (result == FR_NO_PATH) diff --git a/radio/src/sdcard.h b/radio/src/sdcard.h index efe91da54..5363507ce 100644 --- a/radio/src/sdcard.h +++ b/radio/src/sdcard.h @@ -40,11 +40,12 @@ #include "FatFs/ff.h" #define ROOT_PATH "/" -#define MODELS_PATH ROOT_PATH "MODELS" -#define LOGS_PATH ROOT_PATH "LOGS" // no trailing slash = important -#define SOUNDS_PATH ROOT_PATH "SOUNDS/en" // no trailing slash = important +#define MODELS_PATH ROOT_PATH "MODELS" // no trailing slash = important +#define LOGS_PATH ROOT_PATH "LOGS" +#define SCREENSHOTS_PATH ROOT_PATH "SCREENSHOTS" +#define SOUNDS_PATH ROOT_PATH "SOUNDS/en" #define SOUNDS_PATH_LNG_OFS (sizeof(SOUNDS_PATH)-3) -#define SYSTEM_SUBDIR "SYSTEM" // no trailing slash = important +#define SYSTEM_SUBDIR "SYSTEM" #define BITMAPS_PATH ROOT_PATH "BMP" #define FIRMWARES_PATH ROOT_PATH "FIRMWARES" #define EEPROMS_PATH ROOT_PATH "EEPROMS"