Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 441 → Rev 442

/QMK-Groundstation/branches/libMK/libMK/Handler.cpp
27,23 → 27,22
/**
* test one or more motors
*/
void Handler::motor_test(sMotor motor) {
char tx_data[12];
for (int z = 0; z<12; z++)
void Handler::motor_test(sMotorData motor) {
char tx_data[MAX_MOTORS];
for (int z = 0; z<MAX_MOTORS; z++)
{
tx_data[z] = motor.Speed[z];
tx_data[z] = motor.desired_speed[z];
}
com->send_cmd('t', ADDRESS_FC, tx_data, 12, false);
com->send_cmd('t', ADDRESS_FC, tx_data, MAX_MOTORS, false);
}
 
void Handler::reset_motor() {
sMotor motor;
for (int z = 0; z<12; z++)
for (int z = 0; z<MAX_MOTORS; z++)
{
motor.Speed[z] = 0;
data->motor.desired_speed[z] = 0;
}
 
motor_test(motor);
motor_test(data->motor);
}
 
/**
/QMK-Groundstation/branches/libMK/libMK/Handler.h
16,15 → 16,14
private:
Communication * com;
 
KopterData * data;
sRxData rxData;
public:
 
KopterData * data;
Handler(Communication * com, KopterData * data);
//FlightCtrl commands
void get_flightctrl_settings(int index);
void set_flightctrl_settings(char * tx_data);
void motor_test(sMotor motor);
void motor_test(sMotorData motor);
void reset_motor();
void read_motor_mixer();
void write_motor_mixer(char * tx_data, int length);
/QMK-Groundstation/branches/libMK/libMK/Kopter.h
9,17 → 9,20
*/
 
// version information for the serial connection
static const int VERSION_SERIAL_MAJOR = 10;
static const int VERSION_SERIAL_MINOR = 0;
#define VERSION_SERIAL_MAJOR 10
#define VERSION_SERIAL_MINOR 0
 
// Basis-Adresses for different Hardware components
static const int ADDRESS_ALL = 0;
static const int ADDRESS_FC = 1;
static const int ADDRESS_NC = 2;
static const int ADDRESS_MK3MAG = 3;
// Basis-Adresses for different hardware components
#define ADDRESS_ALL 0
#define ADDRESS_FC 1
#define ADDRESS_NC 2
#define ADDRESS_MK3MAG 3
 
//maximum amount of motors
#define MAX_MOTORS 12
 
// settings ID
static const int SETTINGS_ID = 2;
#define SETTINGS_ID 2
 
static const string HardwareType[] = {"Default", "FlightCtrl", "NaviCtrl", "MK3Mag"};
 
30,28 → 33,27
 
static const int MaxNaviPos = 2000;
 
struct sMotor
struct sMotorData
{
int Speed[12];
int mixer_gas[MAX_MOTORS];
int mixer_nick[MAX_MOTORS];
int mixer_roll[MAX_MOTORS];
int mixer_yaw[MAX_MOTORS];
int desired_speed[MAX_MOTORS];
string mixer_name;
int mixer_version;
};
 
struct MotorData
{
int motor[16][4];
string mixerName;
int mixerVersion;
};
 
struct sMode
{
int ID;
int VERSION_MAJOR;
int VERSION_MINOR;
int VERSION_PATCH;
int VERSION_SERIAL_MAJOR;
int VERSION_SERIAL_MINOR;
string Hardware;
string Version;
int id;
int version_major;
int version_minor;
int version_patch;
int version_serial_major;
int version_serial_minor;
string hardware;
string version;
};
 
struct sGPS_Pos
88,7 → 90,7
public:
sMode mode;
sNaviData navi;
sMotor motor;
sMotorData motor;
int analogData[MaxAnalog];
// current LCD page
int lcd_cur;