CNCBASHER / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

Flight mode channel #152

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
flight_mode_channel         = FLIGHT_MODE_CHANNEL - 1;
 in file Setup.pde will result in the improper flight mode channel being stored when using the CH_5 CH_6 CH_7 constants as they are already Channel - 1.

Original issue reported on code.google.com by logan.gr...@gmail.com on 29 Sep 2010 at 6:14

GoogleCodeExporter commented 9 years ago
The documented usage of FLIGHT_MODE_CHANNEL is with an integer in the range 1-8 
inclusive.

From APM_Config.h.example:

// ATTENTION: Some ArduPilot Mega boards have radio channels marked 0-7, and
// others have them marked the standard 1-8.  The FLIGHT_MODE_CHANNEL option
// uses channel numbers 1-8 (and defaults to 8).
...
//#define FLIGHT_MODE_CHANNEL   8

From config.h:

// FLIGHT_MODE_CHANNEL
//
#ifndef FLIGHT_MODE_CHANNEL
# define FLIGHT_MODE_CHANNEL    8
#endif

Original comment by DrZip...@gmail.com on 30 Sep 2010 at 3:37

GoogleCodeExporter commented 9 years ago
Yes, I realized this. I was using CH_X for FLIGHT_MODE which are used in 
defines. I actually submitted a bug for this:

http://code.google.com/p/ardupilot-mega/issues/detail?id=118&can=1&start=100

The CH_X defines are 0 indexed. So anyone using them is going to have an issue 
with the new FLIGHT_MODE_CHANNEL since the write on setup_factory does a - 1 on 
the value. (setup.pde line 169).

Original comment by logan.gr...@gmail.com on 1 Oct 2010 at 1:16