diff --git a/radio/src/Makefile b/radio/src/Makefile index 02d848de0..0fbdec52f 100644 --- a/radio/src/Makefile +++ b/radio/src/Makefile @@ -341,6 +341,13 @@ LCD_DUAL_BUFFER = NO # Values = NO, YES TARANIS_INTERNAL_PPM = NO +# Enable disk IO simulation in simulator +# Simulator will use FatFs module and simulated IO layer that +# uses "./sdcard.image" file as image of SD card. +# This file must contain whole SD card from first to last sector +# Values = NO, YES +DISKIO_SIMU = NO + #------- END BUILD OPTIONS --------------------------- # Define programs and commands. @@ -1537,6 +1544,11 @@ FOXLIB=-L/usr/local/lib \ -lFOX-1.6 \ -Wl,-rpath,$(FOXPATH)/src/.libs +ifeq ($(DISKIO_SIMU), YES) + CPPDEFS += -DDISKIO_SIMU + CPPSRC += FatFs/ff.c FatFs/option/ccsbcs.c +endif + simu: $(LUADEP) stamp_header allsimusrc.cpp Makefile simu.cpp targets/simu/simpgmspace.cpp *.h tra lbm eeprom.bin g++ $(CPPFLAGS) $(INCFLAGS) simu.cpp allsimusrc.cpp $(LUASRC) targets/simu/simpgmspace.cpp -MD -DSIMU -DLUA_USE_APICHECK -O0 -o simu $(FOXINC) $(FOXLIB) -pthread -fexceptions diff --git a/radio/src/gui/9X/menu_general_sdmanager.cpp b/radio/src/gui/9X/menu_general_sdmanager.cpp index 42b3a0ccd..d8ea44a2f 100755 --- a/radio/src/gui/9X/menu_general_sdmanager.cpp +++ b/radio/src/gui/9X/menu_general_sdmanager.cpp @@ -44,11 +44,17 @@ void menuGeneralSdManagerInfo(uint8_t event) lcd_puts(10*FW, 2*FH, SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD); lcd_putsLeft(3*FH, STR_SD_SIZE); - lcd_outdezAtt(10*FW, 3*FH, SD_GET_SIZE_MB(), LEFT); + lcd_outdezAtt(10*FW, 3*FH, sdGetSize(), LEFT); lcd_putc(lcdLastPos, 3*FH, 'M'); lcd_putsLeft(4*FH, STR_SD_SECTORS); - lcd_outdezAtt(10*FW, 4*FH, SD_GET_BLOCKNR()/1000, LEFT); +#if defined(SD_GET_FREE_BLOCKNR) + lcd_outdezAtt(10*FW, 4*FH, SD_GET_FREE_BLOCKNR()/1000, LEFT); + lcd_putc(lcdLastPos, 4*FH, '/'); + lcd_outdezAtt(lcdLastPos+FW, 4*FH, sdGetNoSectors()/1000, LEFT); +#else + lcd_outdezAtt(10*FW, 4*FH, sdGetNoSectors()/1000, LEFT); +#endif lcd_putc(lcdLastPos, 4*FH, 'k'); lcd_putsLeft(5*FH, STR_SD_SPEED); diff --git a/radio/src/gui/Taranis/menu_general_sdmanager.cpp b/radio/src/gui/Taranis/menu_general_sdmanager.cpp index fd9ea112a..c36b5e847 100755 --- a/radio/src/gui/Taranis/menu_general_sdmanager.cpp +++ b/radio/src/gui/Taranis/menu_general_sdmanager.cpp @@ -46,11 +46,17 @@ void menuGeneralSdManagerInfo(uint8_t event) lcd_puts(10*FW, 2*FH, SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD); lcd_putsLeft(3*FH, STR_SD_SIZE); - lcd_outdezAtt(10*FW, 3*FH, SD_GET_SIZE_MB(), LEFT); + lcd_outdezAtt(10*FW, 3*FH, sdGetSize(), LEFT); lcd_putc(lcdLastPos, 3*FH, 'M'); lcd_putsLeft(4*FH, STR_SD_SECTORS); - lcd_outdezAtt(10*FW, 4*FH, SD_GET_BLOCKNR()/1000, LEFT); +#if defined(SD_GET_FREE_BLOCKNR) + lcd_outdezAtt(10*FW, 4*FH, SD_GET_FREE_BLOCKNR()/1000, LEFT); + lcd_putc(lcdLastPos, 4*FH, '/'); + lcd_outdezAtt(lcdLastPos+FW, 4*FH, sdGetNoSectors()/1000, LEFT); +#else + lcd_outdezAtt(10*FW, 4*FH, sdGetNoSectors()/1000, LEFT); +#endif lcd_putc(lcdLastPos, 4*FH, 'k'); lcd_putsLeft(5*FH, STR_SD_SPEED); @@ -242,7 +248,7 @@ void menuGeneralSdManager(uint8_t _event) case EVT_KEY_LONG(KEY_MENU): if (!READ_ONLY() && s_editMode == 0) { killEvents(_event); - // MENU_ADD_ITEM(STR_SD_INFO); TODO: Implement + MENU_ADD_ITEM(STR_SD_INFO); MENU_ADD_ITEM(STR_SD_FORMAT); menuHandler = onSdManagerMenu; } diff --git a/radio/src/logs.cpp b/radio/src/logs.cpp index fd9a10220..25cbbd71b 100644 --- a/radio/src/logs.cpp +++ b/radio/src/logs.cpp @@ -59,6 +59,9 @@ const pm_char *openLogs() if (!sdMounted()) return STR_NO_SDCARD; + if (sdGetFreeSectors() == 0) + return STR_SDCARD_FULL; + // check and create folder here strcpy_P(filename, STR_LOGS_PATH); result = f_opendir(&folder, filename); @@ -193,7 +196,6 @@ void writeHeader() #endif } -// TODO test when disk full void writeLogs() { static const pm_char * error_displayed = NULL; diff --git a/radio/src/sdcard.cpp b/radio/src/sdcard.cpp index 525386456..8e68ed1f5 100644 --- a/radio/src/sdcard.cpp +++ b/radio/src/sdcard.cpp @@ -1,3 +1,44 @@ +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include "../../FatFs/diskio.h" +#include "../../FatFs/ff.h" + + #define LIST_NONE_SD_FILE 1 bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen, const char *selection, uint8_t flags=0) @@ -142,6 +183,7 @@ bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen, return s_menu_count; } +#if defined(PCBTARANIS) const char *fileCopy(const char *filename, const char *srcDir, const char *destDir) { FIL srcFile; @@ -186,3 +228,49 @@ const char *fileCopy(const char *filename, const char *srcDir, const char *destD return NULL; } +#endif // #if defined(PCBTARANIS) + + +#if !defined(SIMU) || defined(DISKIO_SIMU) +uint32_t sdGetNoSectors() +{ + static DWORD noSectors = 0; + if (noSectors == 0 ) { + disk_ioctl(0, GET_SECTOR_COUNT, &noSectors); + } + return noSectors; +} + +uint32_t sdGetSize() +{ + return (sdGetNoSectors() * 512) / 1000000; +} + +uint32_t sdGetFreeSectors() +{ + DWORD nofree; + FATFS * fat; + if (f_getfree("", &nofree, &fat) != FR_OK) { + return 0; + } + return nofree * fat->csize; +} + +#else // #if !defined(SIMU) || defined(DISKIO_SIMU) + +uint32_t sdGetNoSectors() +{ + return 0; +} + +uint32_t sdGetSize() +{ + return 0; +} + +uint32_t sdGetFreeSectors() +{ + return 10; +} + +#endif // #if !defined(SIMU) || defined(DISKIO_SIMU) \ No newline at end of file diff --git a/radio/src/sdcard.h b/radio/src/sdcard.h index 5363507ce..5f43512b9 100644 --- a/radio/src/sdcard.h +++ b/radio/src/sdcard.h @@ -74,6 +74,10 @@ void writeHeader(); void closeLogs(); void writeLogs(); +uint32_t sdGetNoSectors(); +uint32_t sdGetSize(); +uint32_t sdGetFreeSectors(); + #if !defined(BOOT) inline const pm_char *SDCARD_ERROR(FRESULT result) { diff --git a/radio/src/targets/gruvin9x/board_gruvin9x.h b/radio/src/targets/gruvin9x/board_gruvin9x.h index 7d06f273a..1957cc46e 100644 --- a/radio/src/targets/gruvin9x/board_gruvin9x.h +++ b/radio/src/targets/gruvin9x/board_gruvin9x.h @@ -84,14 +84,12 @@ // SD driver #define sdDone() +#define SD_IS_HC() (0) +#define SD_GET_SPEED() (0) #if !defined(SIMU) bool sdMounted(); void sdMountPoll(); void sdPoll10ms(); -#define SD_IS_HC() (0) -#define SD_GET_BLOCKNR() (0) -#define SD_GET_SIZE_MB() (0) -#define SD_GET_SPEED() (0) #endif #define speakerOn() TCCR0A |= (1 << COM0A0) diff --git a/radio/src/targets/mega2560/board_mega2560.h b/radio/src/targets/mega2560/board_mega2560.h index 7fe168d32..88bb6f628 100644 --- a/radio/src/targets/mega2560/board_mega2560.h +++ b/radio/src/targets/mega2560/board_mega2560.h @@ -86,16 +86,14 @@ #define __BACKLIGHT_OFF PORTC &= ~(1< #endif +#if defined(DISKIO_SIMU) + FILE * diskImage = 0; +#endif + volatile uint8_t pina=0xff, pinb=0xff, pinc=0xff, pind, pine=0xff, pinf=0xff, ping=0xff, pinh=0xff, pinj=0xff, pinl=0; uint8_t portb, portc, porth=0, dummyport; uint16_t dummyport16; @@ -325,6 +329,12 @@ void *main_thread(void *) eeReadAll(); // load general setup and selected model +#if defined(DISKIO_SIMU) + f_mount(&g_FATFS_Obj, "", 1); + // call sdGetFreeSectors() now because f_getfree() takes a long time first time it's called + sdGetFreeSectors(); +#endif + #if defined(CPUARM) && defined(SDCARD) referenceSystemAudioFiles(); #endif @@ -365,6 +375,12 @@ void *main_thread(void *) } #endif +#if defined(DISKIO_SIMU) + if (diskImage) { + fclose(diskImage); + } +#endif + return NULL; } @@ -494,7 +510,7 @@ static void EeFsDump(){ } #endif -#if defined(SDCARD) +#if defined(SDCARD) && !defined(DISKIO_SIMU) namespace simu { #include } @@ -523,8 +539,14 @@ FRESULT f_stat (const TCHAR * name, FILINFO *) { char *path = convertSimuPath(name); struct stat tmp; - TRACE("f_stat(%s)", path); - return stat(path, &tmp) ? FR_INVALID_NAME : FR_OK; + if (stat(path, &tmp)) { + TRACE("f_stat(%s) = error %d (%s)", path, errno, strerror(errno)); + return FR_INVALID_NAME; + } + else { + TRACE("f_stat(%s) = OK", path); + return FR_OK; + } } FRESULT f_mount (FATFS* ,const TCHAR*, BYTE opt) @@ -535,17 +557,21 @@ FRESULT f_mount (FATFS* ,const TCHAR*, BYTE opt) FRESULT f_open (FIL * fil, const TCHAR *name, BYTE flag) { char *path = convertSimuPath(name); - - TRACE("f_open(%s)", path); - if (!(flag & FA_WRITE)) { struct stat tmp; - if (stat(path, &tmp)) + if (stat(path, &tmp)) { + TRACE("f_open(%s) = INVALID_NAME", path); return FR_INVALID_NAME; + } fil->fsize = tmp.st_size; } fil->fs = (FATFS*)fopen(path, (flag & FA_WRITE) ? "wb+" : "rb+"); - return FR_OK; + if ( fil->fs ) { + TRACE("f_open(%s) = OK", path); + return FR_OK; + } + TRACE("f_open(%s) = error %d (%s)", path, errno, strerror(errno)); + return FR_INVALID_NAME; } FRESULT f_read (FIL* fil, void* data, UINT size, UINT* read) @@ -590,9 +616,13 @@ FRESULT f_chdir (const TCHAR *name) FRESULT f_opendir (DIR * rep, const TCHAR * name) { char *path = convertSimuPath(name); - TRACE("f_opendir(%s)", path); rep->fs = (FATFS *)simu::opendir(path); - return FR_OK; + if ( rep->fs ) { + TRACE("f_opendir(%s) = OK", path); + return FR_OK; + } + TRACE("f_opendir(%s) = error %d (%s)", path, errno, strerror(errno)); + return FR_NO_PATH; } FRESULT f_closedir (DIR * rep) @@ -682,13 +712,206 @@ FRESULT f_getcwd (TCHAR *path, UINT sz_path) return FR_OK; } +FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs) +{ + // just fake that we always have some clusters free + *nclst = 10; + return FR_OK; +} + #if defined(PCBSKY9X) int32_t Card_state = SD_ST_MOUNTED; uint32_t Card_CSD[4]; // TODO elsewhere #endif +#endif // #if defined(SDCARD) && !defined(DISKIO_SIMU) + + +#if defined(DISKIO_SIMU) +#include "FatFs/diskio.h" +#include +#include + +#if defined(CPUARM) +FATFS g_FATFS_Obj = { 0}; #endif +int ff_cre_syncobj (BYTE vol, _SYNC_t* sobj) /* Create a sync object */ +{ + return 1; +} + +int ff_req_grant (_SYNC_t sobj) /* Lock sync object */ +{ + return 1; +} + +void ff_rel_grant (_SYNC_t sobj) /* Unlock sync object */ +{ + +} + +int ff_del_syncobj (_SYNC_t sobj) /* Delete a sync object */ +{ + return 1; +} + +DWORD get_fattime (void) +{ + time_t tim = time(0); + const struct tm * t = gmtime(&tim); + + /* Pack date and time into a DWORD variable */ + return ((DWORD)(t->tm_year - 80) << 25) + | ((uint32_t)(t->tm_mon+1) << 21) + | ((uint32_t)t->tm_mday << 16) + | ((uint32_t)t->tm_hour << 11) + | ((uint32_t)t->tm_min << 5) + | ((uint32_t)t->tm_sec >> 1); +} + +unsigned int noDiskStatus = 0; + +void traceDiskStatus() +{ + if (noDiskStatus > 0) { + TRACE("disk_status() called %d times", noDiskStatus); + noDiskStatus = 0; + } +} + +DSTATUS disk_initialize (BYTE pdrv) +{ + traceDiskStatus(); + TRACE("disk_initialize(%u)", pdrv); + diskImage = fopen("sdcard.image", "r+"); + return diskImage ? (DSTATUS)0 : (DSTATUS)STA_NODISK; +} + +DSTATUS disk_status (BYTE pdrv) +{ + ++noDiskStatus; + // TRACE("disk_status(%u)", pdrv); + return (DSTATUS)0; +} + +DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count) +{ + if (diskImage == 0) return RES_NOTRDY; + traceDiskStatus(); + TRACE("disk_read(%u, %p, %u, %u)", pdrv, buff, sector, count); + fseek(diskImage, sector*512, SEEK_SET); + fread(buff, count, 512, diskImage); + return RES_OK; +} + +DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count) +{ + if (diskImage == 0) return RES_NOTRDY; + traceDiskStatus(); + TRACE("disk_write(%u, %p, %u, %u)", pdrv, buff, sector, count); + fseek(diskImage, sector*512, SEEK_SET); + fwrite(buff, count, 512, diskImage); + return RES_OK; +} + +DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff) +{ + if (diskImage == 0) return RES_NOTRDY; + traceDiskStatus(); + TRACE("disk_ioctl(%u, %u, %p)", pdrv, cmd, buff); + if (pdrv) return RES_PARERR; + + DRESULT res; + BYTE *ptr = (BYTE *)buff; + + if (cmd == CTRL_POWER) { + switch (*ptr) { + case 0: /* Sub control code == 0 (POWER_OFF) */ + res = RES_OK; + break; + case 1: /* Sub control code == 1 (POWER_ON) */ + res = RES_OK; + break; + case 2: /* Sub control code == 2 (POWER_GET) */ + *(ptr+1) = (BYTE)1; /* fake powered */ + res = RES_OK; + break; + default : + res = RES_PARERR; + } + return res; + } + + switch(cmd) { +/* Generic command (Used by FatFs) */ + case CTRL_SYNC : /* Complete pending write process (needed at _FS_READONLY == 0) */ + break; + + case GET_SECTOR_COUNT: /* Get media size (needed at _USE_MKFS == 1) */ + { + struct stat buf; + if (stat("sdcard.image", &buf) == 0) { + DWORD noSectors = buf.st_size / 512; + *(DWORD*)buff = noSectors; + TRACE("disk_ioctl(GET_SECTOR_COUNT) = %u", noSectors); + return RES_OK; + } + return RES_ERROR; + } + + case GET_SECTOR_SIZE: /* Get sector size (needed at _MAX_SS != _MIN_SS) */ + TRACE("disk_ioctl(GET_SECTOR_SIZE) = 512"); + *(WORD*)buff = 512; + res = RES_OK; + break; + + case GET_BLOCK_SIZE : /* Get erase block size (needed at _USE_MKFS == 1) */ + *(WORD*)buff = 512 * 4; + res = RES_OK; + break; + + case CTRL_TRIM : /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */ + break; + +/* Generic command (Not used by FatFs) */ + case CTRL_LOCK : /* Lock/Unlock media removal */ + case CTRL_EJECT: /* Eject media */ + case CTRL_FORMAT: /* Create physical format on the media */ + return RES_PARERR; + + +/* MMC/SDC specific ioctl command */ + // case MMC_GET_TYPE 10 /* Get card type */ + // case MMC_GET_CSD 11 /* Get CSD */ + // case MMC_GET_CID 12 /* Get CID */ + // case MMC_GET_OCR 13 /* Get OCR */ + // case MMC_GET_SDSTAT 14 /* Get SD status */ + +/* ATA/CF specific ioctl command */ + // case ATA_GET_REV 20 /* Get F/W revision */ + // case ATA_GET_MODEL 21 /* Get model name */ + // case ATA_GET_SN 22 /* Get serial number */ + default: + return RES_PARERR; + } + return RES_OK; +} + +uint32_t sdIsHC() +{ + return sdGetSize() > 2000000; +} + +uint32_t sdGetSpeed() +{ + return 330000; +} + +#endif // #if defined(DISKIO_SIMU) + + + bool lcd_refresh = true; display_t lcd_buf[DISPLAY_BUF_SIZE]; @@ -760,5 +983,5 @@ void turnBacklightOff(void) } #endif -#endif +#endif // #if defined(PCBTARANIS) diff --git a/radio/src/targets/simu/simpgmspace.h b/radio/src/targets/simu/simpgmspace.h index 35cf7e5b4..84398bf21 100644 --- a/radio/src/targets/simu/simpgmspace.h +++ b/radio/src/targets/simu/simpgmspace.h @@ -424,10 +424,5 @@ extern char simuSdDirectory[1024]; #define sdPoll10ms() #define sd_card_ready() (true) #define sdMounted() (true) -#define SD_IS_HC() (0) -#define SD_GET_BLOCKNR() (0) -#define SD_GET_SIZE_MB() (0) -#define SD_GET_SPEED() (0) - #endif diff --git a/radio/src/targets/sky9x/board.h b/radio/src/targets/sky9x/board.h index ced2bbede..3434c126d 100644 --- a/radio/src/targets/sky9x/board.h +++ b/radio/src/targets/sky9x/board.h @@ -548,12 +548,13 @@ extern uint32_t transSpeed; #define SD_CSD_BLOCKNR_HC(pSd) ((SD_CSD_C_SIZE_HC(pSd) + 1) * 1024) #if !defined(SIMU) -#define SD_IS_HC() (Cmd_A41_resp & OCR_SD_CCS) -#define SD_GET_BLOCKNR() (SD_IS_HC() ? (SD_CSD_BLOCKNR_HC(Card_CSD)) : (SD_CSD_BLOCKNR(Card_CSD))) - -#define SD_GET_SPEED() (transSpeed) - -#define SD_GET_SIZE_MB() (SD_GET_BLOCKNR() / 2048) + #define SD_IS_HC() (Cmd_A41_resp & OCR_SD_CCS) + #define SD_GET_BLOCKNR() (SD_IS_HC() ? (SD_CSD_BLOCKNR_HC(Card_CSD)) : (SD_CSD_BLOCKNR(Card_CSD))) + #define SD_GET_SPEED() (transSpeed) +#else + #define SD_IS_HC() (0) + #define SD_GET_BLOCKNR() (0) + #define SD_GET_SPEED() (0) #endif //------------------------------------------------------------------------------ diff --git a/radio/src/targets/sky9x/diskio.cpp b/radio/src/targets/sky9x/diskio.cpp index 318c8050d..45aaa1068 100644 --- a/radio/src/targets/sky9x/diskio.cpp +++ b/radio/src/targets/sky9x/diskio.cpp @@ -1087,6 +1087,9 @@ void sdInit() Card_state = SD_ST_DATA; if (f_mount(&g_FATFS_Obj, "", 1) == FR_OK) { + // call sdGetFreeSectors() now because f_getfree() takes a long time first time it's called + sdGetFreeSectors(); + referenceSystemAudioFiles(); Card_state = SD_ST_MOUNTED; } diff --git a/radio/src/targets/taranis/board_taranis.h b/radio/src/targets/taranis/board_taranis.h index 2c874603a..4ae6bf574 100644 --- a/radio/src/targets/taranis/board_taranis.h +++ b/radio/src/targets/taranis/board_taranis.h @@ -122,14 +122,21 @@ void delay_01us(uint16_t nb); #endif // SD driver +#if !defined(SIMU) || defined(DISKIO_SIMU) + uint32_t sdIsHC(); + uint32_t sdGetSpeed(); + #define SD_IS_HC() (sdIsHC()) + #define SD_GET_SPEED() (sdGetSpeed()) + #define SD_GET_FREE_BLOCKNR() (sdGetFreeSectors()) +#else + #define SD_IS_HC() (0) + #define SD_GET_SPEED() (0) +#endif + #if defined(SIMU) #define sdInit() #define sdDone() #else - #define SD_IS_HC() (1) - #define SD_GET_SIZE_MB() (0) - #define SD_GET_BLOCKNR() (0) - #define SD_GET_SPEED() (0) void sdInit(void); void sdDone(void); void sdPoll10ms(void); diff --git a/radio/src/targets/taranis/diskio.cpp b/radio/src/targets/taranis/diskio.cpp index 4fe50bbef..08e76eb10 100644 --- a/radio/src/targets/taranis/diskio.cpp +++ b/radio/src/targets/taranis/diskio.cpp @@ -1031,6 +1031,9 @@ void sdInit(void) } if (f_mount(&g_FATFS_Obj, "", 1) == FR_OK) { + // call sdGetFreeSectors() now because f_getfree() takes a long time first time it's called + sdGetFreeSectors(); + referenceSystemAudioFiles(); #if defined(SPORT_FILE_LOG) @@ -1059,4 +1062,12 @@ uint32_t sdMounted() return g_FATFS_Obj.fs_type != 0; } +uint32_t sdIsHC() +{ + return (CardType & CT_BLOCK); +} +uint32_t sdGetSpeed() +{ + return 330000; +} diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index 4dbc4573e..f0641d7ac 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -156,8 +156,8 @@ const pm_char STR_CHECKTRIMS[] PROGMEM = TR_CHECKTRIMS; #ifdef HELI const pm_char STR_SWASHTYPE[] PROGMEM = TR_SWASHTYPE; const pm_char STR_COLLECTIVE[] PROGMEM = TR_COLLECTIVE; -const pm_char STR_AILERON[] PROGMEM = TR_AILERON; -const pm_char STR_ELEVATOR[] PROGMEM = TR_ELEVATOR; +const pm_char STR_AILERON[] PROGMEM = TR_AILERON; +const pm_char STR_ELEVATOR[] PROGMEM = TR_ELEVATOR; const pm_char STR_SWASHRING[] PROGMEM = TR_SWASHRING; const pm_char STR_ELEDIRECTION[] PROGMEM = TR_ELEDIRECTION; const pm_char STR_AILDIRECTION[] PROGMEM = TR_AILDIRECTION; @@ -415,6 +415,7 @@ const pm_char STR_BACKUP_MODEL[] PROGMEM = TR_BACKUP_MODEL; const pm_char STR_RESTORE_MODEL[] PROGMEM = TR_RESTORE_MODEL; const pm_char STR_SDCARD_ERROR[] PROGMEM = TR_SDCARD_ERROR; const pm_char STR_NO_SDCARD[] PROGMEM = TR_NO_SDCARD; +const pm_char STR_SDCARD_FULL[] PROGMEM = TR_SDCARD_FULL; const pm_char STR_INCOMPATIBLE[] PROGMEM = TR_INCOMPATIBLE; const pm_char STR_LOGS_PATH[] PROGMEM = LOGS_PATH; const pm_char STR_LOGS_EXT[] PROGMEM = LOGS_EXT; diff --git a/radio/src/translations.h b/radio/src/translations.h index 7ce9e412a..0827e19b8 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -579,6 +579,7 @@ extern const pm_char STR_RESET_BTN[]; extern const pm_char STR_RESTORE_MODEL[]; extern const pm_char STR_SDCARD_ERROR[]; extern const pm_char STR_NO_SDCARD[]; + extern const pm_char STR_SDCARD_FULL[]; extern const pm_char STR_INCOMPATIBLE[]; extern const pm_char STR_LOGS_PATH[]; extern const pm_char STR_LOGS_EXT[]; diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index 66b6a25ab..c744a42e3 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -731,6 +731,7 @@ #define TR_RESTORE_MODEL "Obnov model z SD" #define TR_SDCARD_ERROR "Chyba SD karty" #define TR_NO_SDCARD "Není SD karta" +#define TR_SDCARD_FULL "SD Card Full" #define TR_INCOMPATIBLE "Nekompatibilní" #define TR_WARNING "KONTROLA" #define TR_EEPROMWARN "EEPROM" diff --git a/radio/src/translations/de.h.txt b/radio/src/translations/de.h.txt index 170c1e04c..d791fc366 100644 --- a/radio/src/translations/de.h.txt +++ b/radio/src/translations/de.h.txt @@ -735,6 +735,7 @@ #define TR_RESTORE_MODEL "Modell Restore" #define TR_SDCARD_ERROR "SD-Kartenfehler" #define TR_NO_SDCARD "Keine SD-Karte" +#define TR_SDCARD_FULL "SD Card Full" #define TR_INCOMPATIBLE "Nicht kompatibel" #define TR_WARNING "WARNUNG" #define TR_EEPROMWARN "EEPROM" diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index 9528af66b..24000aa85 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -776,6 +776,7 @@ #define TR_RESTORE_MODEL "Restore Model" #define TR_SDCARD_ERROR "SD Card Error" #define TR_NO_SDCARD "No SD Card" +#define TR_SDCARD_FULL "SD Card Full" #define TR_INCOMPATIBLE "Incompatible" #define TR_WARNING "WARNING" #define TR_EEPROMWARN "EEPROM" diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index 153a41261..a49df11ef 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -728,6 +728,7 @@ #define TR_RESTORE_MODEL "Restaurar Modelo" #define TR_SDCARD_ERROR "SDCARD Error" #define TR_NO_SDCARD "No SDCARD" +#define TR_SDCARD_FULL "SD Card Full" #define TR_INCOMPATIBLE "Incompatible" #define TR_WARNING "AVISO" #define TR_EEPROMWARN "EEPROM" diff --git a/radio/src/translations/fi.h.txt b/radio/src/translations/fi.h.txt index b3d061a84..1cc1fda99 100644 --- a/radio/src/translations/fi.h.txt +++ b/radio/src/translations/fi.h.txt @@ -728,6 +728,7 @@ #define TR_RESTORE_MODEL "Restore Model" #define TR_SDCARD_ERROR "SDCARD Error" #define TR_NO_SDCARD "No SDCARD" +#define TR_SDCARD_FULL "SD Card Full" #define TR_INCOMPATIBLE "Incompatible" #define TR_WARNING "WARNING" #define TR_EEPROMWARN "FINSKA" diff --git a/radio/src/translations/fr.h.txt b/radio/src/translations/fr.h.txt index cc95c34f4..48479a461 100644 --- a/radio/src/translations/fr.h.txt +++ b/radio/src/translations/fr.h.txt @@ -728,6 +728,7 @@ #define TR_RESTORE_MODEL "Restaurer Modèle" #define TR_SDCARD_ERROR "Erreur carte SD" #define TR_NO_SDCARD "Carte SD indisponible" +#define TR_SDCARD_FULL "SD Card Full" #define TR_INCOMPATIBLE "Incompatible" #define TR_WARNING "ALERTE" #define TR_EEPROMWARN "EEPROM" diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index 4143dd60e..58719df10 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -728,6 +728,7 @@ #define TR_RESTORE_MODEL TR("Ripr. Modello","Ripristina Modello") #define TR_SDCARD_ERROR "Errore SD" #define TR_NO_SDCARD "No SDCARD" +#define TR_SDCARD_FULL "SD Card Full" #define TR_INCOMPATIBLE "Incompatibile" #define TR_WARNING "AVVISO" #define TR_EEPROMWARN "EEPROM" diff --git a/radio/src/translations/pl.h.txt b/radio/src/translations/pl.h.txt index a570d77d6..4c33c4877 100644 --- a/radio/src/translations/pl.h.txt +++ b/radio/src/translations/pl.h.txt @@ -726,6 +726,7 @@ #define TR_RESTORE_MODEL "Odtwórz model" #define TR_SDCARD_ERROR "Błąd karty SD" #define TR_NO_SDCARD "Brak karty SD" +#define TR_SDCARD_FULL "SD Card Full" #define TR_INCOMPATIBLE "Niekompatybilne" #define TR_WARNING "UWAGA" #define TR_EEPROMWARN "EEPROM" diff --git a/radio/src/translations/pt.h.txt b/radio/src/translations/pt.h.txt index fa2c82089..8a36f97b5 100644 --- a/radio/src/translations/pt.h.txt +++ b/radio/src/translations/pt.h.txt @@ -551,8 +551,8 @@ #define OFS_CHECKTRIMS (9*FW) #define TR_SWASHTYPE "Ciclico Tipo" #define TR_COLLECTIVE "Coletivo" -#define TR_AILERON "Aileron Source" -#define TR_ELEVATOR "Elevator Source" +#define TR_AILERON "Aileron Source" +#define TR_ELEVATOR "Elevator Source" #define TR_SWASHRING "Anel Coletivo" #define TR_ELEDIRECTION "PFD Sentido" #define TR_AILDIRECTION "AIL Sentido" @@ -728,6 +728,7 @@ #define TR_RESTORE_MODEL "Restaura Modelo" #define TR_SDCARD_ERROR "SDCARD Erro" #define TR_NO_SDCARD "Sem SDCARD" +#define TR_SDCARD_FULL "SD Card Full" #define TR_INCOMPATIBLE "Incompativel" #define TR_WARNING "AVISO" #define TR_EEPROMWARN "EEPROM" diff --git a/radio/src/translations/se.h.txt b/radio/src/translations/se.h.txt index 713291f11..3ab61a6ae 100644 --- a/radio/src/translations/se.h.txt +++ b/radio/src/translations/se.h.txt @@ -551,8 +551,8 @@ #define OFS_CHECKTRIMS CENTER_OFS+(9*FW) #define TR_SWASHTYPE "Swashtyp" #define TR_COLLECTIVE "Kollektiv" -#define TR_AILERON "Aileron Source" -#define TR_ELEVATOR "Elevator Source" +#define TR_AILERON "Aileron Source" +#define TR_ELEVATOR "Elevator Source" #define TR_SWASHRING "Swashring" #define TR_ELEDIRECTION "HöJD Riktning" #define TR_AILDIRECTION "SKEV Riktning" @@ -728,6 +728,7 @@ #define TR_RESTORE_MODEL "återställ Modell" #define TR_SDCARD_ERROR "SDCARD-fel" #define TR_NO_SDCARD "SDCARD saknas" +#define TR_SDCARD_FULL "SD Card Full" #define TR_INCOMPATIBLE "Inkompatibel" #define TR_WARNING "VARNING" #define TR_EEPROMWARN "EEPROM"