Gimbal Control through Mavlink Passthrough

Hi everyone,
I have a problem in controlling the gimbal of my quadcopter using the class MavlinkPassthrough. My gimbal is connected to the channel 7 of the RC and I would like to control it with the RC_channels_override mavlink message. I wrote the code below in which I use MavlinkPassthrough class to send the message:

void Gimbal(uint16_t gimbal_change)
char buff[256];

// pull from position target
mavlink_rc_channels_override_t pcc;
pcc.chan7_raw = gimbal_change;
colprint(clPrompt, "Reached checkpoint: 1\n");

// System parameters
int system_id = 1; //  = number of drones
pcc.target_system = system_id;
int autopilot_id = 1; // our system just has autopilet
pcc.target_component = autopilot_id;
mavlink_message_t message;
mavlink_msg_rc_channels_override_encode(255, 1, &message, &pcc);	

MavlinkPassthrough::Result gimbal_result = mavlink_pass->send_message(message);

if (gimbal_result != MavlinkPassthrough::Result::SUCCESS) {
	sprintf(buff, "Failed to change gimbal orientation\n");
	colprint(clFail, buff);
	colprint(clPass, "Successfully changed gimbal orientation\n");



If I use this function (passing a value of 1800 for example) as soon as the drone starts it works, but if I want to change again the value (for example to 1000) the gimbal doesn’t move anymore. Similarly, if I turn on the drone and move the gimbal with the RC and afterward I run this function, nothing moves. It is weird to me because the mavlinkpass->send_message gives a Successful return value, so it seems that the message is sent.

Thanks for your help,