1,3 → 1,21 |
/****************************************************************************************************************** |
V0.82b-Arthur-P 2010-12-18 |
------------------------------------------------------------------------------------------------------------------ |
Version includes only support for external HEF4017 for FC1.x hardware, NOT for Twi2Ppm converters for ESCs. |
|
2010-12-18 Transferred changes to v.0.82b-Arthur-P |
20100917: Transferred changes to v0.80g-Arthur-P. |
Arthur P. Modified to use several parameters for servo control: |
User_Parameter4: |
User_Parameter5: |
User_Parameter6: |
User_Parameter7: |
User_Parameter8: Use external HEF4017 if bit 8 is set (>127). The remaining 7 bits are used |
for the shutter cycle counter: the value is multiplied by 5 programmatically, |
resulting in steps of approx. 0.1sec. Minimum value to start using the |
interval timer is 10 (approx. 1 sec, or countervalue of 50). Note that this |
was originally done through user para 6. |
******************************************************************************************************************/ |
#include "main.h" |
#define MULTIPLYER 4 |
|
16,7 → 34,24 |
volatile int16_t ServoNickValue = 0; |
volatile int16_t ServoRollValue = 0; |
|
/****************************************************************************************************************** |
Arthur P: Added two variables for control of the shutter servo cycle. |
091114 Inserted same changes into v.0.76g code. |
091114 Inactivated the following two lines as the shutter interval funtion is not |
used at the moment. |
20100804 Reactivated to be able to choose slower shutter rate than normal for |
Panasonic FX150 in continuous mode. |
******************************************************************************************************************/ |
|
volatile static unsigned int CameraShutterCycleCounter = 0; |
volatile static unsigned int CameraShutterCycle = 0; |
volatile static unsigned int CameraShutterCycleOnCount = 20; // Leave the shutter on for at least |
// 20 cycles or approx. 0.2 seconds. |
/****************************************************************************************************************** |
Arthur P: End of changes to variables section of timer0.c. |
******************************************************************************************************************/ |
|
|
enum { |
STOP = 0, |
CK = 1, |
130,6 → 165,23 |
{ |
uint8_t sreg = SREG; |
|
/****************************************************************************************************************** |
Arthur P: Added initialization of the CameraShutterCycle value here as this routine is only |
called once. This retains all code changes in timer0.c. If (parameter 8 & 127) > 0 then the user |
has set a value for the cycle. CameraShuytterCycle == 5x (Para8 & 127) to get approx 0.1sec increments. |
090807: Arthur P.: Removed the shutter cycle parts as they may be impacting timing loops. |
20100804 Arthur P.: Reactivate shutter cycle counters. Modified to use the lower 7 bits of |
user parameter 8 (bit 8 is used for enabling the external HEF4017). |
CameraShutterCycle = Parameter_UserParam6; |
******************************************************************************************************************/ |
|
CameraShutterCycle = 5 * (Parameter_UserParam8 & 127); |
|
/****************************************************************************************************************** |
Arthur P: End of changes to Timer2 function. |
******************************************************************************************************************/ |
|
|
// disable all interrupts before reconfiguration |
cli(); |
|
271,7 → 323,21 |
static uint8_t ServoIndex = 0; |
|
|
if(PlatinenVersion < 20) |
/****************************************************************************************************************** |
Arthur P: Modified the code to check the value of parameter 8. If 128 or higher then a HEF4017 is |
expected and will be used. Else J7 and J9 are seen as separate normal outputs. |
if((PlatinenVersion < 20) |
091114. Inserted same changes into v.0.76g code. |
20100802 Inserted same changes into v.0.80d code. |
******************************************************************************************************************/ |
|
// if(PlatinenVersion < 20) |
|
if((PlatinenVersion < 20) && (Parameter_UserParam8 < 128 )) |
/****************************************************************************************************************** |
Arthur P: End of modification ot if statement. |
******************************************************************************************************************/ |
|
{ |
//--------------------------- |
// Nick servo state machine |
327,9 → 393,70 |
case 2: // Roll Compensation Servo |
RemainingPulse += ServoRollValue - (256 / 2) * MULTIPLYER; // shift ServoNickValue to center position |
break; |
/****************************************************************************************************************** |
Arthur P: Shutter Servo including interval control over parameter 5 and 6. |
091114 Inserted same modification into v.0.76g code, removing previously REM-ed out modified parts. |
20100802 Inserted same modification into v.0.76g code, removing previously REM-ed out modified parts. |
Modified to use lower 7 bits of user parameter 7. |
******************************************************************************************************************/ |
case 3: |
RemainingPulse += ((int16_t)Parameter_Servo3 * MULTIPLYER) - (256 / 2) * MULTIPLYER; |
// RemainingPulse += ((int16_t)Parameter_Servo3 * MULTIPLYER) - (256 / 2) * MULTIPLYER; |
// break; |
|
|
if(PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] < -32) |
{ |
// Set servo to null position, turning camera off. |
RemainingPulse = MINSERVOPULSE; |
} |
else |
{ |
// 090807: Arthur P.: Removed the shutter cycle parts as they may be impacting timing loops. |
// 20100804 Reactived shutter interval timer capability. |
if(PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] > 32) |
// Top position on a 3 position switch which runs from -127 to +127 |
{ |
|
RemainingPulse = MINSERVOPULSE + SERVORANGE; |
} |
else |
{ |
// Cycle shutter servo between 50% on and off depending upon CameraShutterCycleCounter |
// If CameraShutterCylce < 50 then default to continuous shoot. |
if(CameraShutterCycle < 50 ) // == 5x the minimum value of userpara8 lower 7 bits |
{ |
RemainingPulse = MINSERVOPULSE + SERVORANGE/2; |
} |
else |
{ |
if(CameraShutterCycleCounter == CameraShutterCycle) |
{ |
// Shutter on |
CameraShutterCycleCounter = 0; |
RemainingPulse = MINSERVOPULSE + SERVORANGE/2; |
} |
else |
{ |
// Leave on for at least 20 cycles or 0.2 seconds to allow |
// the camera to properly trigger, turn off if past 0.2 sec. |
// For now this is actually set via para5 to allow for a long enough |
// shutter pulse for different cameras. Once it is clear what value |
// works, this can be changed to a hardcoded value. |
CameraShutterCycleCounter++; |
if(CameraShutterCycleCounter == CameraShutterCycleOnCount) |
{ |
// Shutter off |
RemainingPulse = MINSERVOPULSE; |
} |
} |
} |
} |
} |
break; |
/****************************************************************************************************************** |
Arthur P: End of modified shutter servo control (via HEF4017) and of modifications to timer0.c. |
******************************************************************************************************************/ |
|
case 4: |
RemainingPulse += ((int16_t)Parameter_Servo4 * MULTIPLYER) - (256 / 2) * MULTIPLYER; |
break; |