Rev 1058 | Rev 1111 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1058 | Rev 1063 | ||
---|---|---|---|
Line 57... | Line 57... | ||
57 | // -- Parametersatz aus EEPROM lesen --- |
57 | // -- Parametersatz aus EEPROM lesen --- |
58 | // number [1..5] |
58 | // number [1..5] |
59 | void ReadParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) |
59 | void ReadParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) |
60 | { |
60 | { |
61 | if((number > 5)||(number < 1)) number = 3; |
61 | if((number > 5)||(number < 1)) number = 3; |
62 | number--; |
- | |
63 | eeprom_read_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * number], length); |
62 | eeprom_read_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * (number - 1)], length); |
64 | LED_Init(); |
63 | LED_Init(); |
65 | } |
64 | } |
Line 66... | Line 65... | ||
66 | 65 | ||
67 | // -- Parametersatz ins EEPROM schreiben --- |
66 | // -- Parametersatz ins EEPROM schreiben --- |
68 | // number [1..5] |
67 | // number [1..5] |
69 | void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) |
68 | void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) |
70 | { |
69 | { |
71 | if(number > 5) number = 5; |
70 | if(number > 5) number = 5; |
72 | if(number < 1) return; |
- | |
73 | number--; |
71 | if(number < 1) return; |
74 | eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * number], length); |
72 | eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * (number - 1)], length); |
75 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number); // diesen Parametersatz als aktuell merken |
73 | SetActiveParamSetNumber(number); |
76 | LED_Init(); |
74 | LED_Init(); |
Line 77... | Line 75... | ||
77 | } |
75 | } |
78 | 76 | ||
79 | unsigned char GetActiveParamSetNumber(void) |
77 | unsigned char GetActiveParamSetNumber(void) |
80 | { |
78 | { |
81 | unsigned char set; |
79 | unsigned char set; |
82 | set = eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET]); |
80 | set = eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET]); |
83 | if(set > 5) |
81 | if((set > 5) || (set < 1)) |
84 | { |
82 | { |
85 | set = 2; |
83 | set = 3; |
86 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], set); // diesen Parametersatz als aktuell merken |
84 | SetActiveParamSetNumber(set); // diesen Parametersatz als aktuell merken |
87 | } |
85 | } |
Line -... | Line 86... | ||
- | 86 | return(set); |
|
- | 87 | } |
|
- | 88 | ||
- | 89 | ||
- | 90 | void SetActiveParamSetNumber(unsigned char number) |
|
- | 91 | { |
|
- | 92 | if(number > 5) number = 5; |
|
- | 93 | if(number < 1) return; |
|
- | 94 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number); // diesen Parametersatz als aktuell merken |
|
88 | return(set); |
95 | } |
89 | } |
96 | |
90 | 97 | ||
Line 91... | Line 98... | ||
91 | void CalMk3Mag(void) |
98 | void CalMk3Mag(void) |
Line 162... | Line 169... | ||
162 | printf("\n\r=============================="); |
169 | printf("\n\r=============================="); |
Line 163... | Line 170... | ||
163 | 170 | ||
Line 164... | Line 171... | ||
164 | GRN_ON; |
171 | GRN_ON; |
165 | 172 | ||
166 | 173 | ||
167 | ReadParameterSet(0, (unsigned char *) &EE_Parameter.Kanalbelegung[0], 9); // read only the first bytes |
174 | ReadParameterSet(3, (unsigned char *) &EE_Parameter.Kanalbelegung[0], 9); // read only the first bytes |
168 | // valid Stick-Settings? |
175 | // valid Stick-Settings? |
169 | if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_VALID]) == 255 || eeprom_read_byte(&EEPromArray[EEPROM_ADR_VALID]) < EE_DATENREVISION || |
176 | if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_VALID]) == 255 || eeprom_read_byte(&EEPromArray[EEPROM_ADR_VALID]) < EE_DATENREVISION || |
Line 182... | Line 189... | ||
182 | if(i==2) DefaultKonstanten2(); // Kamera |
189 | if(i==2) DefaultKonstanten2(); // Kamera |
183 | if(i==3) DefaultKonstanten3(); // Beginner |
190 | if(i==3) DefaultKonstanten3(); // Beginner |
184 | if(i>3) DefaultKonstanten2(); // Kamera |
191 | if(i>3) DefaultKonstanten2(); // Kamera |
185 | WriteParameterSet(i, (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
192 | WriteParameterSet(i, (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
186 | } |
193 | } |
187 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], 3); // default-Setting |
194 | SetActiveParamSetNumber(3); // default-Setting |
188 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_VALID], EE_DATENREVISION); |
195 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_VALID], EE_DATENREVISION); |
189 | } |
196 | } |
Line 190... | Line 197... | ||
190 | 197 | ||
191 | if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_NICK]) > 4) |
198 | if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_NICK]) > 4) |