diff --git a/src/eeprom_arm.cpp b/src/eeprom_arm.cpp index b8fd997f2..3953776b5 100644 --- a/src/eeprom_arm.cpp +++ b/src/eeprom_arm.cpp @@ -931,9 +931,9 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc) buf[sizeof(MODELS_PATH)-1] = '/'; memcpy(&buf[sizeof(MODELS_PATH)], ModelNames[i_fileSrc], sizeof(g_model.name)); - buf[sizeof(MODELS_PATH)+FILENAME_MAXLEN] = '\0'; + buf[sizeof(MODELS_PATH)+sizeof(g_model.name)] = '\0'; - uint8_t i = sizeof(MODELS_PATH)+FILENAME_MAXLEN-1; + uint8_t i = sizeof(MODELS_PATH)+sizeof(g_model.name)-1; uint8_t len = 0; while (i>sizeof(MODELS_PATH)-1) { if (!len && buf[i]) @@ -1007,6 +1007,8 @@ const pm_char * eeRestoreModel(uint8_t i_fileDst, char *model_name) if (buf[0] != g_eeGeneral.myVers) { // TODO + f_close(&restoreFile); + return STR_INCOMPATIBLE; } if (eeModelExists(i_fileDst)) { diff --git a/src/eeprom_avr.cpp b/src/eeprom_avr.cpp index a560906c8..38bdee5b7 100644 --- a/src/eeprom_avr.cpp +++ b/src/eeprom_avr.cpp @@ -552,9 +552,9 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc) buf[sizeof(MODELS_PATH)-1] = '/'; eeLoadModelName(i_fileSrc, &buf[sizeof(MODELS_PATH)]); - buf[sizeof(MODELS_PATH)+FILENAME_MAXLEN] = '\0'; + buf[sizeof(MODELS_PATH)+sizeof(g_model.name)] = '\0'; - uint8_t i = sizeof(MODELS_PATH)+FILENAME_MAXLEN-1; + uint8_t i = sizeof(MODELS_PATH)+sizeof(g_model.name)-1; uint8_t len = 0; while (i>sizeof(MODELS_PATH)-1) { if (!len && buf[i]) @@ -630,6 +630,8 @@ const pm_char * eeRestoreModel(uint8_t i_fileDst, char *model_name) if (buf[0] != g_eeGeneral.myVers) { // TODO + f_close(&restoreFile); + return STR_INCOMPATIBLE; } if (eeModelExists(i_fileDst)) { diff --git a/src/ersky9x/diskio.c b/src/ersky9x/diskio.c index fb3cb81fc..1e1409e3f 100644 --- a/src/ersky9x/diskio.c +++ b/src/ersky9x/diskio.c @@ -34,7 +34,7 @@ /*-----------------------------------------------------------------------*/ /* MMCv3/SDv1/SDv2 (in SPI mode) control module (C)ChaN, 2010 */ /*-----------------------------------------------------------------------*/ -/* Only rcvr_spi(), xmit_spi(), disk_timerproc() and some macros */ +/* Only rcvr_spi(), xmit_spi(), sdPoll10mS() and some macros */ /* are platform dependent. */ /*-----------------------------------------------------------------------*/ diff --git a/src/gruvin9x/diskio.cpp b/src/gruvin9x/diskio.cpp index e6a280197..3e5a18c09 100644 --- a/src/gruvin9x/diskio.cpp +++ b/src/gruvin9x/diskio.cpp @@ -34,7 +34,7 @@ /*-----------------------------------------------------------------------*/ /* MMCv3/SDv1/SDv2 (in SPI mode) control module (C)ChaN, 2010 */ /*-----------------------------------------------------------------------*/ -/* Only rcvr_spi(), xmit_spi(), disk_timerproc() and some macros */ +/* Only rcvr_spi(), xmit_spi(), sdPoll10mS() and some macros */ /* are platform dependent. */ /*-----------------------------------------------------------------------*/ @@ -615,7 +615,7 @@ DRESULT disk_ioctl ( /*-----------------------------------------------------------------------*/ /* This function must be called in period of 10ms */ -void disk_timerproc (void) +void sdPoll10mS (void) { BYTE s; diff --git a/src/gruvin9x/logs.cpp b/src/gruvin9x/logs.cpp index 783275a8f..23954985f 100644 --- a/src/gruvin9x/logs.cpp +++ b/src/gruvin9x/logs.cpp @@ -66,9 +66,9 @@ const pm_char * openLogs() buf[sizeof(LOGS_PATH)-1] = '/'; memcpy(&buf[sizeof(LOGS_PATH)], g_model.name, sizeof(g_model.name)); - buf[sizeof(LOGS_PATH)+FILENAME_MAXLEN] = '\0'; + buf[sizeof(LOGS_PATH)+sizeof(g_model.name)] = '\0'; - uint8_t i = sizeof(LOGS_PATH)+FILENAME_MAXLEN-1; + uint8_t i = sizeof(LOGS_PATH)+sizeof(g_model.name)-1; uint8_t len = 0; while (i>sizeof(LOGS_PATH)-1) { if (!len && buf[i]) diff --git a/src/model_menus.cpp b/src/model_menus.cpp index ccfe3e967..36c966229 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -2208,7 +2208,7 @@ void menuProcCustomSwitches(uint8_t event) void menuProcFunctionSwitches(uint8_t event) { -#if defined(SDCARD) +#if defined(PCBARM) && defined(SDCARD) uint8_t _event = event; if (s_warning || s_menu_count) { event = 0; diff --git a/src/open9x.cpp b/src/open9x.cpp index fa484fe47..24c8f8fad 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -2565,7 +2565,7 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer per10ms(); #if defined (PCBV4) && defined(SDCARD) - disk_timerproc(); + sdPoll10mS(); #endif #if !defined(PCBV4) diff --git a/src/open9x.h b/src/open9x.h index 8c9f7f1b0..f1cc1ed3a 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -909,15 +909,17 @@ enum AUDIO_SOUNDS { #endif #if defined(SDCARD) -// TODO ailleurs -#define FILENAME_MAXLEN 8 -#include "gruvin9x/sdcard.h" +#include "sdcard.h" #endif #if defined(SOMO) #include "somo14d.h" #endif +#if defined(PCBV4) +#include "rtc.h" +#endif + // Re-useable byte array to save having multiple buffers #define SD_SCREEN_FILE_LENGTH (32) union ReusableBuffer diff --git a/src/pulses_arm.cpp b/src/pulses_arm.cpp index 598980408..956e41ef3 100644 --- a/src/pulses_arm.cpp +++ b/src/pulses_arm.cpp @@ -65,7 +65,6 @@ static void init_main_ppm( uint32_t period, uint32_t out_enable ) register Pio *pioptr ; register Pwm *pwmptr ; - // TODO ? perOut(g_chans512, 0) ; setupPulsesPPM() ; if ( out_enable ) diff --git a/src/gruvin9x/sdcard.h b/src/sdcard.h similarity index 88% rename from src/gruvin9x/sdcard.h rename to src/sdcard.h index d1e5b0f0f..51def9f21 100644 --- a/src/gruvin9x/sdcard.h +++ b/src/sdcard.h @@ -34,14 +34,8 @@ #ifndef sdcard_h #define sdcard_h -#include "../FatFs/ff.h" -#include "../FatFs/fattime.h" - -#if defined(PCBV4) -// TODO because this file is used for ersky9x -#include "rtc.h" -#endif - +#include "FatFs/ff.h" +#include "FatFs/fattime.h" #ifdef SIMU #define MODELS_PATH "." @@ -73,9 +67,7 @@ inline const pm_char *SDCARD_ERROR(FRESULT result) return STR_SDCARD_ERROR; } -// MM/SD card Disk IO Support -extern void disk_timerproc(void); -extern uint8_t g_ms100; +extern void sdPoll10mS(); #endif diff --git a/src/translations.cpp b/src/translations.cpp index eb8450473..d8775cda1 100644 --- a/src/translations.cpp +++ b/src/translations.cpp @@ -320,6 +320,7 @@ const pm_char STR_DELETE_MODEL[] PROGMEM = TR_DELETE_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_INCOMPATIBLE[] PROGMEM = TR_INCOMPATIBLE; const pm_char STR_LOGS_PATH[] PROGMEM = LOGS_PATH; const pm_char STR_LOGS_EXT[] PROGMEM = LOGS_EXT; const pm_char STR_MODELS_PATH[] PROGMEM = MODELS_PATH; diff --git a/src/translations.h b/src/translations.h index d3105356e..d094e4238 100644 --- a/src/translations.h +++ b/src/translations.h @@ -395,6 +395,7 @@ extern const pm_char STR_DELETE_MODEL[]; 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_INCOMPATIBLE[]; extern const pm_char STR_LOGS_PATH[]; extern const pm_char STR_LOGS_EXT[]; extern const pm_char STR_MODELS_PATH[]; diff --git a/src/translations/cz.h b/src/translations/cz.h index d7dda74af..fd810b858 100644 --- a/src/translations/cz.h +++ b/src/translations/cz.h @@ -417,6 +417,7 @@ #define TR_RESTORE_MODEL "Obnov Model" #define TR_SDCARD_ERROR "Chyba SDkarty" #define TR_NO_SDCARD "Nen\204 SDkarta" +#define TR_INCOMPATIBLE "Incompatible" #define TR_WARNING "KONTROLA" #define TR_EEPROMWARN "EEPROM" #define TR_THROTTLEWARN "PLYNU" diff --git a/src/translations/de.h b/src/translations/de.h index 0d50a089e..a0b922f21 100644 --- a/src/translations/de.h +++ b/src/translations/de.h @@ -416,7 +416,8 @@ #define TR_DELETE_MODEL "Modell L\203schen" // TODO merged into DELETEMODEL? #define TR_RESTORE_MODEL "Modell Restore" #define TR_SDCARD_ERROR "SDcard Error" -#define TR_NO_SDCARD "Keine SDcard" +#define TR_NO_SDCARD "Keine SDcard" +#define TR_INCOMPATIBLE "Incompatible" #define TR_WARNING "WARNUNG" #define TR_EEPROMWARN "EEPROM" #define TR_THROTTLEWARN "GAS" diff --git a/src/translations/en.h b/src/translations/en.h index 010a3e89e..87376ab31 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -418,9 +418,11 @@ #define TR_RESTORE_MODEL "Restore Model" #define TR_SDCARD_ERROR "SDCARD Error" #define TR_NO_SDCARD "No SDCARD" +#define TR_INCOMPATIBLE "Incompatible" #define TR_WARNING "WARNING" #define TR_EEPROMWARN "EEPROM" #define TR_THROTTLEWARN "THROTTLE" #define TR_ALARMSWARN "ALARMS" #define TR_SWITCHWARN "SWITCH" #define TR_INVERT_THR "Invert Thr?" +#define TR_INCOMPATIBLE_FILE diff --git a/src/translations/fr.h b/src/translations/fr.h index b44450687..dbd353555 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -416,6 +416,7 @@ #define TR_RESTORE_MODEL "R\200storer Mod\201le" #define TR_SDCARD_ERROR "SDCARD Error" #define TR_NO_SDCARD "No SDCARD" +#define TR_INCOMPATIBLE "Incompatible" #define TR_WARNING "ALERTE" #define TR_EEPROMWARN "EEPROM" #define TR_THROTTLEWARN "GAZ" diff --git a/src/translations/it.h b/src/translations/it.h index a3876185b..dc23edcbc 100644 --- a/src/translations/it.h +++ b/src/translations/it.h @@ -417,6 +417,7 @@ #define TR_RESTORE_MODEL "Ripr. Modello" #define TR_SDCARD_ERROR "Errore SD" #define TR_NO_SDCARD "No SDCARD" +#define TR_INCOMPATIBLE "Incompatible" #define TR_WARNING "AVVISO" #define TR_EEPROMWARN "EEPROM" #define TR_THROTTLEWARN "MOTORE" diff --git a/src/translations/se.h b/src/translations/se.h index df6f4bd2c..75abd79f5 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -415,6 +415,7 @@ #define TR_RESTORE_MODEL "\203terst\201ll Modell" #define TR_SDCARD_ERROR "SDCARD-fel" #define TR_NO_SDCARD "SDCARD saknas" +#define TR_INCOMPATIBLE "Incompatible" #define TR_WARNING "VARNING" #define TR_EEPROMWARN "EEPROM" #define TR_THROTTLEWARN "GAS"