Rev 1648 | Rev 1654 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1648 | Rev 1652 | ||
---|---|---|---|
Line 143... | Line 143... | ||
143 | HEF4017R_ON; |
143 | HEF4017R_ON; |
144 | MCUSR &=~(1<<WDRF); |
144 | MCUSR &=~(1<<WDRF); |
145 | WDTCSR |= (1<<WDCE)|(1<<WDE); |
145 | WDTCSR |= (1<<WDCE)|(1<<WDE); |
146 | WDTCSR = 0; |
146 | WDTCSR = 0; |
Line 147... | Line 147... | ||
147 | 147 | ||
148 | beeptime = 2000; |
148 | beeptime = 2500; |
149 | StickGier = 0; PPM_in[K_GAS] = 0;StickRoll = 0; StickNick = 0; |
149 | StickGier = 0; PPM_in[K_GAS] = 0;StickRoll = 0; StickNick = 0; |
150 | if(PlatinenVersion >= 20) GIER_GRAD_FAKTOR = 1160; else GIER_GRAD_FAKTOR = 1291; // unterschiedlich für ME und ENC |
150 | if(PlatinenVersion >= 20) GIER_GRAD_FAKTOR = 1160; else GIER_GRAD_FAKTOR = 1291; // unterschiedlich für ME und ENC |
Line 151... | Line 151... | ||
151 | ROT_OFF; |
151 | ROT_OFF; |
Line 168... | Line 168... | ||
168 | // + Check connected BL-Ctrls |
168 | // + Check connected BL-Ctrls |
169 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
169 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
170 | // Check connected BL-Ctrls |
170 | // Check connected BL-Ctrls |
171 | BLFlags |= BLFLAG_READ_VERSION; |
171 | BLFlags |= BLFLAG_READ_VERSION; |
172 | UpdateMotor = 0; |
172 | UpdateMotor = 0; |
- | 173 | motorread = 0; |
|
173 | SendMotorData(); |
174 | SendMotorData(); |
174 | while(!UpdateMotor); |
175 | while(!UpdateMotor); |
175 | motorread = 0; |
- | |
176 | printf("\n\rFound BL-Ctrl: "); |
176 | printf("\n\rFound BL-Ctrl: "); |
177 | timer = SetDelay(4000); |
177 | timer = SetDelay(4000); |
178 | for(i=0; i < MAX_MOTORS; i++) |
178 | for(i=0; i < MAX_MOTORS; i++) |
179 | { |
179 | { |
180 | UpdateMotor = 0; |
180 | UpdateMotor = 0; |
Line 190... | Line 190... | ||
190 | } |
190 | } |
191 | } |
191 | } |
192 | if(Motor[i].State & MOTOR_STATE_PRESENT_MASK) |
192 | if(Motor[i].State & MOTOR_STATE_PRESENT_MASK) |
193 | { |
193 | { |
194 | printf("%d",i+1); |
194 | printf("%d",i+1); |
195 | if(Motor[i].Version & MOTOR_STATE_NEW_PROTOCOL_MASK) printf("(new) "); |
195 | // if(Motor[i].Version & MOTOR_STATE_NEW_PROTOCOL_MASK) printf("(new) "); |
196 | else printf(" "); |
196 | // else printf(" "); |
197 | } |
197 | } |
198 | } |
198 | } |
199 | for(i=0; i < MAX_MOTORS; i++) |
199 | for(i=0; i < MAX_MOTORS; i++) |
200 | { |
200 | { |
201 | if(!(Motor[i].State & MOTOR_STATE_PRESENT_MASK) && Mixer.Motor[i][0] > 0) |
201 | if(!(Motor[i].State & MOTOR_STATE_PRESENT_MASK) && Mixer.Motor[i][0] > 0) |
Line 224... | Line 224... | ||
224 | 224 | ||
225 | beeptime = 2000; |
225 | beeptime = 2000; |
Line 226... | Line 226... | ||
226 | ExternControl.Digital[0] = 0x55; |
226 | ExternControl.Digital[0] = 0x55; |
- | 227 | ||
227 | 228 | ||
Line 228... | Line 229... | ||
228 | 229 | FlugMinuten = (unsigned int)GetParamByte(PID_FLIGHT_MINUTES) * 256 + (unsigned int)GetParamByte(PID_FLIGHT_MINUTES + 1); |
|
229 | FlugMinuten = GetParamWord(PID_FLIGHT_MINUTES); |
230 | FlugMinutenGesamt = (unsigned int)GetParamByte(PID_FLIGHT_MINUTES_TOTAL) * 256 + (unsigned int)GetParamByte(PID_FLIGHT_MINUTES_TOTAL + 1); |
230 | FlugMinutenGesamt = GetParamWord(PID_FLIGHT_MINUTES_TOTAL); |
231 | // FlugMinutenGesamt = GetParamWord(PID_FLIGHT_MINUTES_TOTAL); |
231 | 232 | ||
Line 261... | Line 262... | ||
261 | timerPolling = SetDelay(100); |
262 | timerPolling = SetDelay(100); |
262 | LIBFC_Polling(); |
263 | LIBFC_Polling(); |
263 | } |
264 | } |
264 | if(UpdateMotor && AdReady) // ReglerIntervall |
265 | if(UpdateMotor && AdReady) // ReglerIntervall |
265 | { |
266 | { |
266 | J3High; |
- | |
267 | UpdateMotor=0; |
267 | UpdateMotor=0; |
268 | if(WinkelOut.CalcState) CalMk3Mag(); |
268 | if(WinkelOut.CalcState) CalMk3Mag(); |
269 | else MotorRegler(); |
269 | else MotorRegler(); |
270 | SendMotorData(); |
270 | SendMotorData(); |
271 | J3Low; |
- | |
272 | if(UpdateMotor) DebugOut.Analog[17]++; |
- | |
273 | ROT_OFF; |
271 | ROT_OFF; |
274 | if(SenderOkay) SenderOkay--; |
272 | if(SenderOkay) SenderOkay--; |
275 | else |
273 | else |
276 | { |
274 | { |
277 | TIMSK1 |= _BV(ICIE1); // enable PPM-Input |
275 | TIMSK1 |= _BV(ICIE1); // enable PPM-Input |
Line 357... | Line 355... | ||
357 | if(++timer2 == 2930) // eine Minute |
355 | if(++timer2 == 2930) // eine Minute |
358 | { |
356 | { |
359 | timer2 = 0; |
357 | timer2 = 0; |
360 | FlugMinuten++; |
358 | FlugMinuten++; |
361 | FlugMinutenGesamt++; |
359 | FlugMinutenGesamt++; |
362 | SetParamWord(PID_FLIGHT_MINUTES_TOTAL, FlugMinutenGesamt); |
360 | SetParamByte(PID_FLIGHT_MINUTES,FlugMinuten / 256); |
363 | SetParamWord(PID_FLIGHT_MINUTES, FlugMinuten); |
361 | SetParamByte(PID_FLIGHT_MINUTES+1,FlugMinuten % 256); |
- | 362 | SetParamByte(PID_FLIGHT_MINUTES_TOTAL,FlugMinutenGesamt / 256); |
|
- | 363 | SetParamByte(PID_FLIGHT_MINUTES_TOTAL+1,FlugMinutenGesamt % 256); |
|
364 | timer = SetDelay(20); // falls "timer += 20;" mal nicht geht |
364 | timer = SetDelay(20); // falls "timer += 20;" mal nicht geht |
365 | } |
365 | } |
366 | } |
366 | } |
367 | LED_Update(); |
367 | LED_Update(); |
368 | Capacity_Update(); |
368 | Capacity_Update(); |