Subversion Repositories FlightCtrl

Rev

Rev 1868 | Rev 1908 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1868 Rev 1887
Line 51... Line 51...
51
#include <util/delay.h>
51
#include <util/delay.h>
52
#include <avr/eeprom.h>
52
#include <avr/eeprom.h>
53
#include <stddef.h>
53
#include <stddef.h>
54
#include "configuration.h"
54
#include "configuration.h"
55
#include "eeprom.h"
55
#include "eeprom.h"
56
#include "timer0.h"
-
 
Line 57... Line 56...
57
 
56
 
58
int16_t variables[8] = {0,0,0,0,0,0,0,0};
57
int16_t variables[8] = {0,0,0,0,0,0,0,0};
59
dynamicParam_t dynamicParams = {48,251,16,58,64,8,150,150,2,10,{0,0,0,0,0,0,0,0},100,70,90,65,64,100,0,0,0};
58
dynamicParam_t dynamicParams = {48,251,16,58,64,8,150,150,2,10,{0,0,0,0,0,0,0,0},100,70,90,65,64,100,0,0,0};
60
uint8_t CPUType = ATMEGA644;
59
uint8_t CPUType = ATMEGA644;
Line 232... Line 231...
232
  DDRB |= (1<<DDB1)|(1<<DDB0);
231
  DDRB |= (1<<DDB1)|(1<<DDB0);
233
  RED_ON;
232
  RED_ON;
234
  GRN_OFF;
233
  GRN_OFF;
235
  return BoardRelease;
234
  return BoardRelease;
236
}
235
}
237
 
-
 
238
void beep(uint16_t millis) {
-
 
239
  BeepTime = millis;
-
 
240
}
-
 
241
 
-
 
242
/*
-
 
243
 * Make [numbeeps] beeps.
-
 
244
 */
-
 
245
void beepNumber(uint8_t numbeeps) {
-
 
246
  while(numbeeps--) {
-
 
247
    if(MKFlags & MKFLAG_MOTOR_RUN) return; //auf keinen Fall bei laufenden Motoren!
-
 
248
    beep(100); // 0.1 second
-
 
249
    Delay_ms(250); // blocks 250 ms as pause to next beep,
-
 
250
    // this will block the flight control loop,
-
 
251
    // therefore do not use this function if motors are running
-
 
252
  }
-
 
253
}
-
 
254
 
-
 
255
/*
-
 
256
 * Beep the R/C alarm signal
-
 
257
 */
-
 
258
void beepRCAlarm(void) {
-
 
259
  if(BeepModulation == 0xFFFF) { // If not already beeping an alarm signal (?)
-
 
260
    BeepTime = 15000; // 1.5 seconds
-
 
261
    BeepModulation = 0x0C00;
-
 
262
  }
-
 
263
}
-
 
264
 
-
 
265
/*
-
 
266
 * Beep the I2C bus error signal
-
 
267
 */
-
 
268
void beepI2CAlarm(void) {
-
 
269
  if((BeepModulation == 0xFFFF) && (MKFlags & MKFLAG_MOTOR_RUN)) {
-
 
270
    BeepTime = 10000; // 1 second
-
 
271
    BeepModulation = 0x0080;
-
 
272
  }
-
 
273
}
-
 
274
 
-
 
275
/*
-
 
276
 * Beep the battery low alarm signal
-
 
277
 */
-
 
278
void beepBatteryAlarm(void) {
-
 
279
  BeepModulation = 0x0300;
-
 
280
  if(!BeepTime) {
-
 
281
    BeepTime = 6000; // 0.6 seconds
-
 
282
  }
-
 
283
}
-
 
284
 
-
 
285
/*
-
 
286
 * Beep the EEPROM checksum alarm
-
 
287
 */
-
 
288
void beepEEPROMAlarm(void) {
-
 
289
  BeepModulation = 0x0007;
-
 
290
  if(!BeepTime) {
-
 
291
    BeepTime = 6000; // 0.6 seconds
-
 
292
  }
-
 
293
}
-