Need Help to for custon firmware

Hello Guys, im new in the forum, but flying with Pixhawk for two years with several platforms both fixed and rotary wing.

Im very used to in the setup, but now i have a hardware problem that i now can be solved with a customized firmware, unluck i dont have program skills.

My gps port is bad, and need to connect the gps to serial 4/5 port. so i need to modify the firmware in order to pixhawk recognize the serial port 4/5 as main.

Some one could help me to do that? mmi firmware using is APM plane 3.1.1

uart b is main gps
uart e is 2nd gps

in the AP_serialmanager line need to be modify UART B for E

Best regards

It doesn’t help you fly two GPS’s but you can simply disable the serial port pointed at GPS1. Change serial 3 protocol to not be GPS, and change serial 4 to GPS to enable it instead.

The lowest numbered GPS serial port is selected as GPS1, so if serial 3 isn’t GPS anymore then serial 4 can be GPS1.

Or just only connect a GPS to serial 4 and then enable automatic swapping. Since there will only be 1 GPS it will never swap off of it. (But it will make most GCS’s displays look a bit funny)

Hello and thanks for the input.

I already tried disabling it via full parameters list, BUT mission planner never shows de HDOP of the serial 4 gps and in the hud always shows NO FIX.

I found in google same problem and fix, but i dont know how mod the code

THIS IS WHAT I FOUND but didnt know how to do

AP_SerialManager.cpp

file. Down about 1/2 way are some lines:

state[1].uart = hal.uartC; // serial1, uartC, normally telem1
state[2].uart=hal.uartD; // serial2, uartD, normally telem2
state[3].uart=hal.uartB; // serial3, uartB, normally 1st GPS
state[4].uart=hal.uartE; // serial4, uartE, normally 2nd GPS

All I did was swtch hal.uartB with hal.uartE so that uartB is the 2nd GPS and uartE is the 1st.

I think this whole cpp file is where the firmware sets what serial ports are doing what.