Hi,
I had an "accident" with my Ardupilot mega which resulted in the dipswitch getting lost. I have now resoldered the wires so that the dipswitches show the following configuration:
test] dipswitches
Hit Enter to exit.
Mix:elevons rev elev:-1, rev ch1:-1, rev ch2:-1
Seems like the dipswitches have the following config if I understand it correctly:
elevon mixing: on
elevon reverse: reversed
ch1 elevon: reversed
ch2 elevon: normal
So I have a few questions:
1. What dipswitch would fit the ardupilot mega? Which dipswitch model is used originally? I probably need to order one and solder it back on to get the dipswitches working.
2. Can the dipswitch configuration be altered by programming the board? Can I set the dipswitch positions in the Ardupilot code so that I don't have to order and resolder a new dipswitch or just so that I can set the dipswitches in the code while I find and order a new dipswitch?
The throttle can be reversed by modifying the following in the APM_Config.h:
# define THROTTLE_REVERSE ENABLED
Is there a similar function for the dipswitch functions?
Best regards, Kim Halavakoski
|
Replies
Here are a few pics of the broken IMU and missing dipswitch. I had a friend help me solder the wires in instead of the dipswitch. He soldered them in allright but seems like he did it in "reversed" mode so that now all dipswitches are on by default and hence all channels are reversed and elevon mixing is on. But now with the fix in the code it doesn't matter!
broken_IMU_1.JPG
broken_IMU_3.JPG
broken_IMU_fixed.jpg
Got some good advice on the chat from Darren, thanks Darren.
The file that needs to be hacked is the control_modes.pde file.
The dipswitch settings are controlled by the following lines:
mix_mode = (PINL & 128) ? 0 : 1;
if (mix_mode == 0) {
reverse_roll = (PINE & 128) ? true : false;
reverse_pitch = (PINE & 64) ? true : false;
reverse_rudder = (PINL & 64) ? true : false;
} else {
reverse_elevons = (PINE & 128) ? -1 : 1;
reverse_ch1_elevon = (PINE & 64) ? -1 : 1;
reverse_ch2_elevon = (PINL & 64) ? -1 : 1;
}
Where the mix_mode = (PINL & 128) ? 0 : 1; sets the elevon mixing dip. Set this to 0 : 1 for no elevon mixing and 1 : 0 for elevon mixing(Elevon mixing is for flying wings and vtails...)
Then set the reverse_roll, reverse_pitch and reverse_rudder lines to your needs.
Check the settings from the APM cli using the test and dipswitches command which shows the current dipswitch configuration.