5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
22 #include "conversions.h"
24 void convertRadioData(int version
)
26 TRACE("convertRadioData(%d)", version
);
28 #if EEPROM_CONVERSIONS < 217
31 convertRadioData_216_to_217(g_eeGeneral
);
35 #if EEPROM_CONVERSIONS < 218
38 convertRadioData_217_to_218(g_eeGeneral
);
42 #if EEPROM_CONVERSIONS < 219
45 convertRadioData_218_to_219(g_eeGeneral
);
50 void convertModelData(int version
)
52 TRACE("convertModelData(%d)", version
);
54 #if EEPROM_CONVERSIONS < 217
57 convertModelData_216_to_217(g_model
);
61 #if EEPROM_CONVERSIONS < 218
64 convertModelData_217_to_218(g_model
);
68 #if EEPROM_CONVERSIONS < 219
71 convertModelData_218_to_219(g_model
);
77 void eeConvertModel(int id
, int version
)
80 convertModelData(version
);
81 uint8_t currModel
= g_eeGeneral
.currModel
;
82 g_eeGeneral
.currModel
= id
;
83 storageDirty(EE_MODEL
);
85 g_eeGeneral
.currModel
= currModel
;
90 const char *msg
= NULL
;
92 switch (g_eeGeneral
.version
) {
94 msg
= "EEprom Data v216";
97 msg
= "EEprom Data v217";
100 msg
= "EEprom Data v218";
106 int conversionVersionStart
= g_eeGeneral
.version
;
108 // Information to the user and wait for key press
109 #if defined(PCBSKY9X)
110 g_eeGeneral
.optrexDisplay
= 0;
112 g_eeGeneral
.backlightMode
= e_backlight_mode_on
;
113 g_eeGeneral
.backlightBright
= 0;
114 g_eeGeneral
.contrast
= 25;
116 ALERT(STR_STORAGE_WARNING
, msg
, AU_BAD_RADIODATA
);
118 RAISE_ALERT(STR_STORAGE_WARNING
, STR_EEPROM_CONVERTING
, NULL
, AU_NONE
);
120 // General Settings conversion
121 eeLoadGeneralSettingsData();
122 int version
= conversionVersionStart
;
124 #if EEPROM_CONVERSIONS < 217
125 if (version
== 216) {
127 convertRadioData_216_to_217(g_eeGeneral
);
131 #if EEPROM_CONVERSIONS < 218
132 if (version
== 217) {
134 convertRadioData_217_to_218(g_eeGeneral
);
138 #if EEPROM_CONVERSIONS < 219
139 if (version
== 218) {
141 convertRadioData_218_to_219(g_eeGeneral
);
145 storageDirty(EE_GENERAL
);
148 #if defined(COLORLCD)
150 lcdDrawRect(60, 6*FH
+4, 132, 3);
152 lcdDrawRect(10, 6*FH
+4, 102, 3);
156 for (uint8_t id
=0; id
<MAX_MODELS
; id
++) {
157 #if defined(COLORLCD)
159 lcdDrawSolidHorizontalLine(61, 6*FH
+5, 10+id
*2, FORCE
);
161 lcdDrawSolidHorizontalLine(11, 6*FH
+5, 10+(id
*3)/2, FORCE
);
164 if (eeModelExists(id
)) {
165 eeConvertModel(id
, conversionVersionStart
);