Support of current EEPROM inside Companion. Some more code around

EEPROMS export removed (needed to be fixed, so I preferred to remove in
the same commit).
This commit is contained in:
Bertrand Songis
2014-01-07 17:57:42 +01:00
parent 5d3c827488
commit 3b59d07724
48 changed files with 938 additions and 7439 deletions
+5 -47
View File
@@ -124,56 +124,20 @@ bool Th9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize,
int Th9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
{
EEPROMWarnings.clear();
std::cout << "NO!\n";
// TODO a warning
efile->EeFsCreate(eeprom, getEEpromSize(), BOARD_STOCK);
Th9xGeneral th9xGeneral(radioData.generalSettings);
int sz = efile->writeRlc2(FILE_GENERAL, FILE_TYP_GENERAL, (uint8_t*)&th9xGeneral, sizeof(Th9xGeneral));
if(sz != sizeof(Th9xGeneral)) {
return 0;
}
for (int i=0; i<getMaxModels(); i++) {
if (!radioData.models[i].isempty()) {
Th9xModelData th9xModel(radioData.models[i]);
sz = efile->writeRlc2(FILE_MODEL(i), FILE_TYP_MODEL, (uint8_t*)&th9xModel, sizeof(Th9xModelData));
if(sz != sizeof(Th9xModelData)) {
return 0;
}
}
}
return getEEpromSize();
return 0;
}
int Th9xInterface::getSize(ModelData &model)
{
if (model.isempty())
return 0;
uint8_t tmp[2*EESIZE_STOCK];
efile->EeFsCreate(tmp, getEEpromSize(), BOARD_STOCK);
Th9xModelData th9xModel(model);
int sz = efile->writeRlc2(0, FILE_TYP_MODEL, (uint8_t*)&th9xModel, sizeof(Th9xModelData));
if(sz != sizeof(Th9xModelData)) {
return -1;
}
return efile->size(0);
return 0;
}
int Th9xInterface::getSize(GeneralSettings &settings)
{
uint8_t tmp[2*EESIZE_STOCK];
efile->EeFsCreate(tmp, getEEpromSize(), BOARD_STOCK);
Th9xGeneral th9xGeneral(settings);
int sz = efile->writeRlc2(0, FILE_TYP_GENERAL, (uint8_t*)&th9xGeneral, sizeof(Th9xGeneral));
if(sz != sizeof(th9xGeneral)) {
return -1;
}
return efile->size(0);
return 0;
}
int Th9xInterface::getCapability(const Capability capability)
@@ -181,12 +145,6 @@ int Th9xInterface::getCapability(const Capability capability)
switch (capability) {
case Mixes:
return TH9X_MAX_MIXERS;
case NumCurves3:
return TH9X_MAX_CURVES3;
case NumCurves5:
return TH9X_MAX_CURVES5;
case NumCurves9:
return TH9X_MAX_CURVES9;
case OwnerName:
return 0;
case Timers: