Custom Messages working on SITL, but not on Hardware

Hi,
I want to send and receive a custom message via mavlink telemetry link. I defined the message definition in the ardupilotmega.xml file, added a handler in GCS_Mavlink.cpp, and ran a few tests in SITL. I was able to send the message via pymavlink using the following code:

master = mavutil.mavlink_connection('udp:127.0.0.1:14550')
master.mav.send(
            mavutil.mavlink.MAVLink_thumbnail_message(
                Packet = f"{packet_num}".encode(),
                Data = msg.encode(),
            )
        )

Also, I was able to read this message on a remote system using the following code:

master = mavutil.mavlink_connection('udp:127.0.0.1:14552')
msg = master.recv_msg()
        if msg:
            msg = msg.to_dict()
            # print(msg)
            if msg["mavpackettype"] == "
                print("**********************************")
                print("Packet Found!")
                print("**********************************")
                print(msg)

Then I compiled the code for CubeOrange using:

./waf configure --board CubeOrange

and

./waf copter

Then uploaded the firmware to the board and tested the same. The message is not being received by the remote system. Even it stopped working in SITL ;(

I checked the GCM_Mavlink library in the build>CubeOrange>libraries directory, it contains the message deffinintions (mavlink_message_thumbnail.h) file as well.

Any help would be appreciated.
Thanks

For additional info:

Changes in ardupilotmega.xml file:

Changes in …/ArduCopter/GCS_Mavlink.h:
image

Changes in …/ArduCopter/GCS_Mavlink.cpp:
image