Rev 2164 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2164 | Rev 2189 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef EEMEM |
1 | #ifndef EEMEM |
2 | #define EEMEM __attribute__ ((section (".eeprom"))) |
2 | #define EEMEM __attribute__ ((section (".eeprom"))) |
3 | #endif |
3 | #endif |
Line 4... | Line 4... | ||
4 | 4 | ||
5 | #include "eeprom.h" |
- | |
6 | #include "printf_P.h" |
5 | #include "eeprom.h" |
7 | #include "output.h" |
6 | //#include "output.h" |
- | 7 | #include "configuration.h" |
|
8 | #include "configuration.h" |
8 | #include "analog.h" |
9 | #include <avr/wdt.h> |
9 | #include <avr/wdt.h> |
10 | #include <avr/eeprom.h> |
10 | #include <avr/eeprom.h> |
- | 11 | #include <avr/interrupt.h> |
|
Line 11... | Line 12... | ||
11 | #include <avr/interrupt.h> |
12 | #include <stdio.h> |
12 | 13 | ||
Line 13... | Line 14... | ||
13 | // byte array in eeprom |
14 | // byte array in eeprom |
Line 150... | Line 151... | ||
150 | } |
151 | } |
Line 151... | Line 152... | ||
151 | 152 | ||
152 | /***************************************************/ |
153 | /***************************************************/ |
153 | /* MixerTable */ |
154 | /* MixerTable */ |
154 | /***************************************************/ |
155 | /***************************************************/ |
155 | void motorMixer_writeToEEProm(void) { |
156 | void outputMixer_writeToEEProm(void) { |
156 | writeChecksummedBlock(EEMIXER_REVISION, (uint8_t*)&motorMixer, EEPROM_ADR_MIXER_TABLE, sizeof(MotorMixer_t)); |
157 | writeChecksummedBlock(EEMIXER_REVISION, (uint8_t*)&outputMixer, EEPROM_ADR_MIXER_TABLE, sizeof(OutputMixer_t)); |
Line 157... | Line 158... | ||
157 | } |
158 | } |
158 | 159 | ||
159 | void motorMixer_readOrDefault(void) { |
160 | void outputMixer_readOrDefault(void) { |
160 | // load mixer table |
161 | // load mixer table |
161 | if (readChecksummedBlock(EEMIXER_REVISION, (uint8_t*)&motorMixer, EEPROM_ADR_MIXER_TABLE, sizeof(MotorMixer_t))) { |
162 | if (readChecksummedBlock(EEMIXER_REVISION, (uint8_t*)&outputMixer, EEPROM_ADR_MIXER_TABLE, sizeof(OutputMixer_t))) { |
162 | printf("\n\rwriting default motor mixer"); |
163 | printf("\n\rwriting default motor mixer"); |
163 | motorMixer_default(); // Quadro |
164 | outputMixer_default(); // Quadro |
164 | motorMixer_writeToEEProm(); |
- | |
165 | } |
- | |
166 | // determine motornumber |
- | |
167 | requiredMotors = 0; |
- | |
168 | for (uint8_t i=0; i<MAX_MOTORS; i++) { |
- | |
169 | if (motorMixer.matrix[i][MIX_THROTTLE]) |
- | |
170 | requiredMotors++; |
- | |
171 | } |
- | |
172 | - | ||
173 | printf("\n\rMixer-Config: '%s' (%u Motors)", motorMixer.name, requiredMotors); |
165 | outputMixer_writeToEEProm(); |
Line 174... | Line 166... | ||
174 | printf("\n\r==================================="); |
166 | } |
175 | } |
167 | } |
176 | 168 | ||
Line 207... | Line 199... | ||
207 | 199 | ||
208 | void gyroOffset_writeToEEProm(void) { |
200 | void gyroOffset_writeToEEProm(void) { |
209 | writeChecksummedBlock(SENSOROFFSET_REVISION, (uint8_t*)&gyroOffset, EEPROM_ADR_GYROOFFSET, sizeof(sensorOffset_t)); |
201 | writeChecksummedBlock(SENSOROFFSET_REVISION, (uint8_t*)&gyroOffset, EEPROM_ADR_GYROOFFSET, sizeof(sensorOffset_t)); |
Line 210... | Line 202... | ||
210 | } |
202 | } |
211 | 203 | ||
212 | uint8_t accOffset_readFromEEProm(void) { |
204 | uint8_t accelOffset_readFromEEProm(void) { |
Line 213... | Line 205... | ||
213 | return readChecksummedBlock(SENSOROFFSET_REVISION, (uint8_t*)&accOffset, EEPROM_ADR_ACCOFFSET, sizeof(sensorOffset_t)); |
205 | return readChecksummedBlock(SENSOROFFSET_REVISION, (uint8_t*)&accelOffset, EEPROM_ADR_ACCELOFFSET, sizeof(sensorOffset_t)); |
214 | } |
206 | } |
215 | 207 | ||
Line 216... | Line 208... | ||
216 | void accOffset_writeToEEProm(void) { |
208 | void accelOffset_writeToEEProm(void) { |
217 | writeChecksummedBlock(SENSOROFFSET_REVISION, (uint8_t*)&accOffset, EEPROM_ADR_ACCOFFSET, sizeof(sensorOffset_t)); |
209 | writeChecksummedBlock(SENSOROFFSET_REVISION, (uint8_t*)&accelOffset, EEPROM_ADR_ACCELOFFSET, sizeof(sensorOffset_t)); |
218 | } |
210 | } |