Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1609 → Rev 1610

/branches/V0.76g-FredericG/led.c
1,11 → 1,21
#include <inttypes.h>
#include "main.h"
 
#define PHOTO_MODE_DELAY 2000/10
#define PHOTO_MODE_TRIGGER_TIME 1000/10
#define PHOTO_MODE_TRIGGER_PERIOD 4000/10
 
uint16_t LED1_Timing = 0;
uint16_t LED2_Timing = 0;
unsigned char J16Blinkcount = 0, J16Mask = 1;
unsigned char J17Blinkcount = 0, J17Mask = 1;
 
uint8_t PhotoModeDelayCounter ;
uint16_t PhotoModelCounter;
 
 
 
 
// initializes the LED control outputs J16, J17
void LED_Init(void)
{
28,18 → 38,48
 
if (Parameter_J16Timing < 10)
{
// Low: select camera 1
J16_OFF;
J17_OFF;
}
else if (Parameter_J16Timing < 180)
{
// Middle: select camera 2, no trigger
J16_ON;
J17_OFF;
PhotoModeDelayCounter = PHOTO_MODE_DELAY;
PhotoModelCounter = 0;
}
else
{
// High: select camera 2 and trigger
J16_ON;
J17_ON;
 
if (PhotoModeDelayCounter)
{
// Not in photo-mode (yet)
PhotoModeDelayCounter--;
J17_ON;
}
else
{
PhotoModelCounter++;
 
// In photo-mode
if (PhotoModelCounter < PHOTO_MODE_TRIGGER_TIME)
{
J17_ON;
}
else if (PhotoModelCounter < PHOTO_MODE_TRIGGER_PERIOD-PHOTO_MODE_TRIGGER_TIME)
{
J17_OFF;
}
else
{
PhotoModelCounter = 0;
}
}
 
}
}
}