CAMTRIG servo default state

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
User avatar
lot
Posts: 16
Joined: Mon Nov 18, 2013 7:36 pm

CAMTRIG servo default state

Post by lot »

Hi all,

I'm using the CAMTRIG servo to release a mechanism but when I connect the multiwii always the initiation activates the servo for a couple of seconds.
There is a way to don't activate the servo (keep 1020 pwm) in the initialization of the board?

Regards,

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: CAMTRIG servo default state

Post by PatrikE »

Look in output.cpp
Centering on init depending on the FC
for 328
volatile uint8_t atomicServo[8] = {125,125,125,125,125,125,125,125};
or for 2560
volatile uint16_t atomicServo[8] = {8000,8000,8000,8000,8000,8000,8000,8000};

User avatar
lot
Posts: 16
Joined: Mon Nov 18, 2013 7:36 pm

Re: CAMTRIG servo default state

Post by lot »

Thank you very much Patrick!

So if I understand well if I'm using a a32u4 board, the SERVO3 for CAMTRIG is this one:

#if defined(SERVO)
#if defined(HW_PWM_SERVOS)
// hw servo pwm does not need atomicServo[]
#elif defined(PROMINI) || (defined(PROMICRO) && defined(HWPWM6))
#if defined(AIRPLANE) || defined(HELICOPTER)
// To prevent motor to start at reset. atomicServo[7]=5 or 249 if reversed servo
volatile uint8_t atomicServo[8] = {125,125,125,125,125,125,125,5};
#else
====== (a32u4 board)==>>>> volatile uint8_t atomicServo[8] = {125,125,>>>125<<<<,125,125,125,125,125};
#endif

But why the initial value of the servo is 125? This value should be between 100 and 2000.
In the comment atomicServo[7]=5 means that is connected to channel 5 ?

I tried with atomicServo[3]=7 (my channel of camtrig) and atomicServo[3]=1024 (low pwm) but still activating the servo in the initialization.

Thank you very much for your help.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: CAMTRIG servo default state

Post by PatrikE »

The defines is In mwii.cpp

Code: Select all

int16_t servo[8] = {1500,1500,1500,1500,1500,1500,1500,1000};

atomicServo range is 0 - 250.
atomicServo[7]=5 should init servo 7 close to the endpoint.
In this case as motor off.

If you look further down in output.c

Code: Select all

atomicServo[i] = (servo[i]-1000)>>2
ex. (1500-1000 )/4 = 125
servo[i] is transfered to atomicServo[i].
This mean the true resolution on the servos seems to be 250 steps?

User avatar
lot
Posts: 16
Joined: Mon Nov 18, 2013 7:36 pm

Re: CAMTRIG servo default state

Post by lot »

Thanks Patrick,

Even modifing the init value for servo[8] array:

Code: Select all

int16_t servo[8] = {1500,1500,1000,1500,1500,1500,1500,1000};


And the atomicservo initialization:

Code: Select all

volatile uint8_t atomicServo[8] = {125,125,5,125,125,125,125,125};


Don't work :( Still activating CAMTRIG servo in the initialization.

I'm thinking now about the MEGA_HW_PWM_SERVOS by default I had activate this parameter even if my board is a 32u4.
If I activate A32U4_4_HW_PWM_SERVOS there is a compile error:
for your protection: A32U4_4_HW_PWM_SERVOS was not tested with your coptertype"


I don't know if this change something, like not using atomicServo array.

Thanks,

Post Reply