Increase Heartbeat Message Sent Over Mavlink

I am looking for a way to send heartbeat messages over mavlink at a frequency of 5-10hz instead of 1hz.

Right now in plane 3.9.11, it appears that a heartbeat is sent every one second as the function ‘one_second_loop()’ is called. From arduplane.cpp in the 3.9.11 release:

void Plane::one_second_loop()
{
// send a heartbeat
gcs().send_message(MSG_HEARTBEAT);

If I were to take “gcs().send_message(MSG_HEARTBEAT);” put it into a new function and then schedule that function to run at 5hz in the scheduler, would that work?

Alex

Did you try updating to plane 4.0 and using https://mavlink.io/en/messages/common.html#MAV_CMD_SET_MESSAGE_INTERVAL ?