Rev 304 | Rev 401 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 304 | Rev 395 | ||
---|---|---|---|
Line 58... | Line 58... | ||
58 | // number [0..5] |
58 | // number [0..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 = 5; |
61 | if (number > 5) number = 5; |
62 | eeprom_read_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * number], length); |
62 | eeprom_read_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * number], length); |
63 | - | ||
64 | } |
63 | } |
Line 65... | Line 64... | ||
65 | 64 | ||
66 | 65 | ||
67 | // -- Parametersatz ins EEPROM schreiben --- |
66 | // -- Parametersatz ins EEPROM schreiben --- |
68 | // number [0..5] |
67 | // number [0..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; |
- | |
72 | eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * number], length); |
70 | if(number > 5) number = 5; |
73 | 71 | eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * number], length); |
|
Line 74... | Line 72... | ||
74 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number); // diesen Parametersatz als aktuell merken |
72 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number); // diesen Parametersatz als aktuell merken |
75 | } |
73 | } |
Line 121... | Line 119... | ||
121 | Timer_Init(); |
119 | Timer_Init(); |
122 | UART_Init(); |
120 | UART_Init(); |
123 | rc_sum_init(); |
121 | rc_sum_init(); |
124 | ADC_Init(); |
122 | ADC_Init(); |
125 | i2c_init(); |
123 | i2c_init(); |
126 | SPI_MasterInit(); |
124 | // SPI_MasterInit(); |
Line 127... | Line 125... | ||
127 | 125 | ||
Line 128... | Line 126... | ||
128 | sei(); |
126 | sei(); |
129 | 127 | ||
Line 133... | Line 131... | ||
133 | 131 | ||
134 | printf("\n\rFlightControl\n\rHardware:%d.%d\n\rSoftware:V%d.%d%c ",PlatinenVersion/10,PlatinenVersion%10, VERSION_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX + 'a'); |
132 | printf("\n\rFlightControl\n\rHardware:%d.%d\n\rSoftware:V%d.%d%c ",PlatinenVersion/10,PlatinenVersion%10, VERSION_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX + 'a'); |
135 | printf("\n\r=============================="); |
133 | printf("\n\r=============================="); |
Line 136... | Line 134... | ||
136 | GRN_ON; |
134 | GRN_ON; |
137 | 135 | ||
138 | #define EE_DATENREVISION 62 // wird angepasst, wenn sich die EEPROM-Daten geändert haben |
136 | #define EE_DATENREVISION 66 // wird angepasst, wenn sich die EEPROM-Daten geändert haben |
139 | if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_VALID]) != EE_DATENREVISION) |
137 | if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_VALID]) != EE_DATENREVISION) |
140 | { |
138 | { |
141 | printf("\n\rInit. EEPROM: Generiere Default-Parameter..."); |
139 | printf("\n\rInit. EEPROM: Generiere Default-Parameter..."); |
142 | DefaultKonstanten1(); |
140 | DefaultKonstanten1(); |
143 | for (unsigned char i=0;i<6;i++) |
141 | for (unsigned char i=0;i<6;i++) |
- | 142 | { |
|
- | 143 | if(i==2) DefaultKonstanten2(); // Kamera |
|
144 | { |
144 | if(i==3) DefaultKonstanten3(); // Beginner |
145 | if(i==2) DefaultKonstanten2(); |
145 | if(i>3) DefaultKonstanten2(); // Kamera |
146 | WriteParameterSet(i, (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
146 | WriteParameterSet(i, (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
147 | } |
147 | } |
148 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], 2); |
148 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], 3); // default-Setting |
Line 149... | Line 149... | ||
149 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_VALID], EE_DATENREVISION); |
149 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_VALID], EE_DATENREVISION); |
150 | } |
150 | } |
Line 181... | Line 181... | ||
181 | I2CTimeout = 5000; |
181 | I2CTimeout = 5000; |
182 | while (1) |
182 | while (1) |
183 | { |
183 | { |
184 | if (UpdateMotor) // ReglerIntervall |
184 | if (UpdateMotor) // ReglerIntervall |
185 | { |
185 | { |
186 | SPI_TransmitByte(); |
186 | // SPI_TransmitByte(); |
187 | UpdateMotor=0; |
187 | UpdateMotor=0; |
188 | MotorRegler(); |
188 | MotorRegler(); |
189 | SendMotorData(); |
189 | SendMotorData(); |
190 | ROT_OFF; |
190 | ROT_OFF; |
191 | if(PcZugriff) PcZugriff--; |
191 | if(PcZugriff) PcZugriff--; |
Line 220... | Line 220... | ||
220 | { |
220 | { |
221 | beeptime = 6000; |
221 | beeptime = 6000; |
222 | BeepMuster = 0x0300; |
222 | BeepMuster = 0x0300; |
223 | } |
223 | } |
224 | } |
224 | } |
225 | SPI_StartTransmitPacket(); |
225 | // SPI_StartTransmitPacket(); |
226 | timer = SetDelay(100); |
226 | timer = SetDelay(100); |
227 | } |
227 | } |
228 | } |
228 | } |
229 | return (1); |
229 | return (1); |
230 | } |
230 | } |