Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 441 → Rev 442

/QMK-Groundstation/branches/libMK/Forms/dlg_MotorMixer.cpp
71,6 → 71,7
void dlg_MotorMixer::set_Objects(Handler *handler, cSettings *t_Settings)
{
this->handler = handler;
this->data = handler->data;
o_Settings = t_Settings;
}
 
101,85 → 102,97
// Motordaten aus GUI übernehmen
void dlg_MotorMixer::get_MotorData()
{
//FIXME: add Function in handler to send data
sMotorData motorData;
 
char * mixerName = le_NAME->text().toAscii().data();
motorData.mixer_name = string(mixerName);
 
//TODO: use an array in Form
int motor[16][4] = {
sb_GAS_1->value(), sb_NICK_1->value(), sb_ROLL_1->value(), sb_GIER_1->value(),
sb_GAS_2->value(), sb_NICK_2->value(), sb_ROLL_2->value(), sb_GIER_2->value(),
sb_GAS_3->value(), sb_NICK_3->value(), sb_ROLL_3->value(), sb_GIER_3->value(),
sb_GAS_4->value(), sb_NICK_4->value(), sb_ROLL_4->value(), sb_GIER_4->value(),
sb_GAS_5->value(), sb_NICK_5->value(), sb_ROLL_5->value(), sb_GIER_5->value(),
sb_GAS_6->value(), sb_NICK_6->value(), sb_ROLL_6->value(), sb_GIER_6->value(),
sb_GAS_7->value(), sb_NICK_7->value(), sb_ROLL_7->value(), sb_GIER_7->value(),
sb_GAS_8->value(), sb_NICK_8->value(), sb_ROLL_8->value(), sb_GIER_8->value(),
sb_GAS_9->value(), sb_NICK_9->value(), sb_ROLL_9->value(), sb_GIER_9->value(),
sb_GAS_10->value(), sb_NICK_10->value(), sb_ROLL_10->value(), sb_GIER_10->value(),
sb_GAS_11->value(), sb_NICK_11->value(), sb_ROLL_11->value(), sb_GIER_11->value(),
sb_GAS_12->value(), sb_NICK_12->value(), sb_ROLL_12->value(), sb_GIER_12->value()
int gas[MAX_MOTORS] = {
sb_GAS_1->value(), sb_GAS_2->value(), sb_GAS_3->value(), sb_GAS_4->value(),
sb_GAS_5->value(), sb_GAS_6->value(), sb_GAS_7->value(), sb_GAS_8->value(),
sb_GAS_9->value(), sb_GAS_10->value(), sb_GAS_11->value(), sb_GAS_12->value()
};
int nick[MAX_MOTORS] = {
sb_NICK_1->value(), sb_NICK_2->value(), sb_NICK_3->value(), sb_NICK_4->value(),
sb_NICK_5->value(), sb_NICK_6->value(), sb_NICK_7->value(), sb_NICK_8->value(),
sb_NICK_9->value(), sb_NICK_10->value(), sb_NICK_11->value(), sb_NICK_12->value()
};
int roll[MAX_MOTORS] = {
sb_ROLL_1->value(), sb_ROLL_2->value(), sb_ROLL_3->value(), sb_ROLL_4->value(),
sb_ROLL_5->value(), sb_ROLL_6->value(), sb_ROLL_7->value(), sb_ROLL_8->value(),
sb_ROLL_9->value(), sb_ROLL_10->value(), sb_ROLL_11->value(), sb_ROLL_12->value()
};
int yaw[MAX_MOTORS] = {
sb_GIER_1->value(), sb_GIER_2->value(), sb_GIER_3->value(), sb_GIER_4->value(),
sb_GIER_5->value(), sb_GIER_6->value(), sb_GIER_7->value(), sb_GIER_8->value(),
sb_GIER_9->value(), sb_GIER_10->value(), sb_GIER_11->value(), sb_GIER_12->value()
};
for (int i = 0; i < MAX_MOTORS; i++) {
motorData.mixer_gas[i] = gas[i];
motorData.mixer_nick[i] = nick[i];
motorData.mixer_roll[i] = roll[i];
motorData.mixer_yaw[i] = yaw[i];
}
//FIXME: add Function in handler to send data
}
 
// Motordaten anzeigen
void dlg_MotorMixer::set_MotorData()
{
//FIXME: create special struct for mixer - KopterData
/*
le_NAME->setText(MixerName);
sMotorData motorData = handler->data->motor;
le_NAME->setText(motorData.mixer_name.c_str());
 
sb_GAS_1->setValue(Motor[0][0]);
sb_GAS_2->setValue(Motor[1][0]);
sb_GAS_3->setValue(Motor[2][0]);
sb_GAS_4->setValue(Motor[3][0]);
sb_GAS_5->setValue(Motor[4][0]);
sb_GAS_6->setValue(Motor[5][0]);
sb_GAS_7->setValue(Motor[6][0]);
sb_GAS_8->setValue(Motor[7][0]);
sb_GAS_9->setValue(Motor[8][0]);
sb_GAS_10->setValue(Motor[9][0]);
sb_GAS_11->setValue(Motor[10][0]);
sb_GAS_12->setValue(Motor[11][0]);
sb_GAS_1->setValue(motorData.mixer_gas[0]);
sb_GAS_2->setValue(motorData.mixer_gas[1]);
sb_GAS_3->setValue(motorData.mixer_gas[2]);
sb_GAS_4->setValue(motorData.mixer_gas[3]);
sb_GAS_5->setValue(motorData.mixer_gas[4]);
sb_GAS_6->setValue(motorData.mixer_gas[5]);
sb_GAS_7->setValue(motorData.mixer_gas[6]);
sb_GAS_8->setValue(motorData.mixer_gas[7]);
sb_GAS_9->setValue(motorData.mixer_gas[8]);
sb_GAS_10->setValue(motorData.mixer_gas[9]);
sb_GAS_11->setValue(motorData.mixer_gas[10]);
sb_GAS_12->setValue(motorData.mixer_gas[11]);
 
sb_NICK_1->setValue(Motor[0][1]);
sb_NICK_2->setValue(Motor[1][1]);
sb_NICK_3->setValue(Motor[2][1]);
sb_NICK_4->setValue(Motor[3][1]);
sb_NICK_5->setValue(Motor[4][1]);
sb_NICK_6->setValue(Motor[5][1]);
sb_NICK_7->setValue(Motor[6][1]);
sb_NICK_8->setValue(Motor[7][1]);
sb_NICK_9->setValue(Motor[8][1]);
sb_NICK_10->setValue(Motor[9][1]);
sb_NICK_11->setValue(Motor[10][1]);
sb_NICK_12->setValue(Motor[11][1]);
sb_NICK_1->setValue(motorData.mixer_nick[0]);
sb_NICK_2->setValue(motorData.mixer_nick[1]);
sb_NICK_3->setValue(motorData.mixer_nick[2]);
sb_NICK_4->setValue(motorData.mixer_nick[3]);
sb_NICK_5->setValue(motorData.mixer_nick[4]);
sb_NICK_6->setValue(motorData.mixer_nick[5]);
sb_NICK_7->setValue(motorData.mixer_nick[6]);
sb_NICK_8->setValue(motorData.mixer_nick[7]);
sb_NICK_9->setValue(motorData.mixer_nick[8]);
sb_NICK_10->setValue(motorData.mixer_nick[9]);
sb_NICK_11->setValue(motorData.mixer_nick[10]);
sb_NICK_12->setValue(motorData.mixer_nick[11]);
 
sb_ROLL_1->setValue(Motor[0][2]);
sb_ROLL_2->setValue(Motor[1][2]);
sb_ROLL_3->setValue(Motor[2][2]);
sb_ROLL_4->setValue(Motor[3][2]);
sb_ROLL_5->setValue(Motor[4][2]);
sb_ROLL_6->setValue(Motor[5][2]);
sb_ROLL_7->setValue(Motor[6][2]);
sb_ROLL_8->setValue(Motor[7][2]);
sb_ROLL_9->setValue(Motor[8][2]);
sb_ROLL_10->setValue(Motor[9][2]);
sb_ROLL_11->setValue(Motor[10][2]);
sb_ROLL_12->setValue(Motor[11][2]);
sb_ROLL_1->setValue(motorData.mixer_roll[0]);
sb_ROLL_2->setValue(motorData.mixer_roll[1]);
sb_ROLL_3->setValue(motorData.mixer_roll[2]);
sb_ROLL_4->setValue(motorData.mixer_roll[3]);
sb_ROLL_5->setValue(motorData.mixer_roll[4]);
sb_ROLL_6->setValue(motorData.mixer_roll[5]);
sb_ROLL_7->setValue(motorData.mixer_roll[6]);
sb_ROLL_8->setValue(motorData.mixer_roll[7]);
sb_ROLL_9->setValue(motorData.mixer_roll[8]);
sb_ROLL_10->setValue(motorData.mixer_roll[9]);
sb_ROLL_11->setValue(motorData.mixer_roll[10]);
sb_ROLL_12->setValue(motorData.mixer_roll[11]);
 
sb_GIER_1->setValue(Motor[0][3]);
sb_GIER_2->setValue(Motor[1][3]);
sb_GIER_3->setValue(Motor[2][3]);
sb_GIER_4->setValue(Motor[3][3]);
sb_GIER_5->setValue(Motor[4][3]);
sb_GIER_6->setValue(Motor[5][3]);
sb_GIER_7->setValue(Motor[6][3]);
sb_GIER_8->setValue(Motor[7][3]);
sb_GIER_9->setValue(Motor[8][3]);
sb_GIER_10->setValue(Motor[9][3]);
sb_GIER_11->setValue(Motor[10][3]);
sb_GIER_12->setValue(Motor[11][3]);
*/
sb_GIER_1->setValue(motorData.mixer_yaw[0]);
sb_GIER_2->setValue(motorData.mixer_yaw[1]);
sb_GIER_3->setValue(motorData.mixer_yaw[2]);
sb_GIER_4->setValue(motorData.mixer_yaw[3]);
sb_GIER_5->setValue(motorData.mixer_yaw[4]);
sb_GIER_6->setValue(motorData.mixer_yaw[5]);
sb_GIER_7->setValue(motorData.mixer_yaw[6]);
sb_GIER_8->setValue(motorData.mixer_yaw[7]);
sb_GIER_9->setValue(motorData.mixer_yaw[8]);
sb_GIER_10->setValue(motorData.mixer_yaw[9]);
sb_GIER_11->setValue(motorData.mixer_yaw[10]);
sb_GIER_12->setValue(motorData.mixer_yaw[11]);
}
 
// Prüfen auf vollstaändigkeit
187,14 → 200,20
{
Wert = Wert;
 
int NICK = sb_NICK_1->value() + sb_NICK_2->value() + sb_NICK_3->value() + sb_NICK_4->value() + sb_NICK_5->value() + sb_NICK_6->value() +
sb_NICK_7->value() + sb_NICK_8->value() + sb_NICK_9->value() + sb_NICK_10->value() + sb_NICK_11->value() + sb_NICK_12->value();
int NICK = sb_NICK_1->value() + sb_NICK_2->value() + sb_NICK_3->value() +
sb_NICK_4->value() + sb_NICK_5->value() + sb_NICK_6->value() +
sb_NICK_7->value() + sb_NICK_8->value() + sb_NICK_9->value() +
sb_NICK_10->value() + sb_NICK_11->value() + sb_NICK_12->value();
 
int ROLL = sb_ROLL_1->value() + sb_ROLL_2->value() + sb_ROLL_3->value() + sb_ROLL_4->value() + sb_ROLL_5->value() + sb_ROLL_6->value() +
sb_ROLL_7->value() + sb_ROLL_8->value() + sb_ROLL_9->value() + sb_ROLL_10->value() + sb_ROLL_11->value() + sb_ROLL_12->value();
int ROLL = sb_ROLL_1->value() + sb_ROLL_2->value() + sb_ROLL_3->value() +
sb_ROLL_4->value() + sb_ROLL_5->value() + sb_ROLL_6->value() +
sb_ROLL_7->value() + sb_ROLL_8->value() + sb_ROLL_9->value() +
sb_ROLL_10->value() + sb_ROLL_11->value() + sb_ROLL_12->value();
 
int GIER = sb_GIER_1->value() + sb_GIER_2->value() + sb_GIER_3->value() + sb_GIER_4->value() + sb_GIER_5->value() + sb_GIER_6->value() +
sb_GIER_7->value() + sb_GIER_8->value() + sb_GIER_9->value() + sb_GIER_10->value() + sb_GIER_11->value() + sb_GIER_12->value();
int GIER = sb_GIER_1->value() + sb_GIER_2->value() + sb_GIER_3->value() +
sb_GIER_4->value() + sb_GIER_5->value() + sb_GIER_6->value() +
sb_GIER_7->value() + sb_GIER_8->value() + sb_GIER_9->value() +
sb_GIER_10->value() + sb_GIER_11->value() + sb_GIER_12->value();
 
if (NICK == 0)
{
287,17 → 306,14
QSettings Setting(Filename, QSettings::IniFormat);
 
Setting.beginGroup("Info");
//FIXME: Add mixer-struct in kopter.h for kopterdata
// MixerName = Setting.value("Name", QString("--noname--")).toString();
// MixerVersion = Setting.value("Version", 0).toInt();
data->motor.mixer_name = Setting.value("Name", QString("--noname--")).toString().toAscii().data();
data->motor.mixer_version = Setting.value("Version", 0).toInt();
Setting.endGroup();
 
//FIXME: Add mixer-struct in kopter.h for kopterdata
/*
Setting.beginGroup("Gas");
for (int z = 0; z < MAXMOTOR; z++)
{
Motor[z][0] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt();
data->motor.mixer_gas[z] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt();
}
Setting.endGroup();
 
304,7 → 320,7
Setting.beginGroup("Nick");
for (int z = 0; z < MAXMOTOR; z++)
{
Motor[z][1] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt();
data->motor.mixer_nick[z] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt();
}
Setting.endGroup();
 
311,7 → 327,7
Setting.beginGroup("Roll");
for (int z = 0; z < MAXMOTOR; z++)
{
Motor[z][2] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt();
data->motor.mixer_roll[z] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt();
}
Setting.endGroup();
 
318,14 → 334,14
Setting.beginGroup("Yaw");
for (int z = 0; z < MAXMOTOR; z++)
{
Motor[z][3] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt();
data->motor.mixer_yaw[z] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt();
}
Setting.endGroup();
if (MixerVersion == VERSION_MIXER)
 
if (data->motor.mixer_version == VERSION_MIXER)
{
set_MotorData();
}
*/
}
}
 
345,16 → 361,14
QSettings Setting(Filename, QSettings::IniFormat);
 
Setting.beginGroup("Info");
//FIXME: Add mixer-struct in kopter.h for kopterdata - doppelter Code!!!
/*
Setting.setValue("Name", MixerName);
Setting.setValue("Version", VERSION_MIXER);
Setting.setValue("Name", data->motor.mixer_name.c_str());
Setting.setValue("Version", data->motor.mixer_version);
Setting.endGroup();
 
Setting.beginGroup("Gas");
for (int z = 0; z < MAXMOTOR; z++)
{
Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][0]);
Setting.setValue(QString("Motor%1").arg(z+1), data->motor.mixer_gas[z]);
}
Setting.endGroup();
 
361,7 → 375,7
Setting.beginGroup("Nick");
for (int z = 0; z < MAXMOTOR; z++)
{
Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][1]);
Setting.setValue(QString("Motor%1").arg(z+1), data->motor.mixer_nick[z]);
}
Setting.endGroup();
 
368,7 → 382,7
Setting.beginGroup("Roll");
for (int z = 0; z < MAXMOTOR; z++)
{
Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][2]);
Setting.setValue(QString("Motor%1").arg(z+1), data->motor.mixer_roll[z]);
}
Setting.endGroup();
 
375,9 → 389,8
Setting.beginGroup("Yaw");
for (int z = 0; z < MAXMOTOR; z++)
{
Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][3]);
Setting.setValue(QString("Motor%1").arg(z+1), data->motor.mixer_yaw[z]);
}
Setting.endGroup();
*/
}
}
/QMK-Groundstation/branches/libMK/Forms/dlg_MotorMixer.h
25,9 → 25,7
 
#include "ui_dlg_MotorMixer.h"
#include "../Classes/cSettings.h"
#include "../Classes/cConnection.h"
#include "../typedefs.h"
//#include "../Classes/ToolBox.h"
#include "../global.h"
#include "../libMK/Handler.h"
 
44,12 → 42,12
private:
//Handler for MK-Communication
Handler *handler;
 
KopterData * data;
cSettings *o_Settings;
 
void set_MotorData();
void get_MotorData();
 
void save_settings(QSettings * Setting);
private slots:
void slot_pb_READ();
void slot_pb_WRITE();
/QMK-Groundstation/branches/libMK/Forms/dlg_Motortest.cpp
26,37 → 26,38
 
void dlg_Motortest::slot_Motortest(int Wert)
{
sMotor Motor;
//TODO: use KopterData?
sMotorData Motor;
 
for (int z = 0; z < 12; z++)
{
Motor.Speed[z] = 0;
Motor.desired_speed[z] = 0;
}
 
if (cb_1->isChecked())
Motor.Speed[0] = Wert;
Motor.desired_speed[0] = Wert;
if (cb_2->isChecked())
Motor.Speed[1] = Wert;
Motor.desired_speed[1] = Wert;
if (cb_3->isChecked())
Motor.Speed[2] = Wert;
Motor.desired_speed[2] = Wert;
if (cb_4->isChecked())
Motor.Speed[3] = Wert;
Motor.desired_speed[3] = Wert;
if (cb_5->isChecked())
Motor.Speed[4] = Wert;
Motor.desired_speed[4] = Wert;
if (cb_6->isChecked())
Motor.Speed[5] = Wert;
Motor.desired_speed[5] = Wert;
if (cb_7->isChecked())
Motor.Speed[6] = Wert;
Motor.desired_speed[6] = Wert;
if (cb_8->isChecked())
Motor.Speed[7] = Wert;
Motor.desired_speed[7] = Wert;
if (cb_9->isChecked())
Motor.Speed[8] = Wert;
Motor.desired_speed[8] = Wert;
if (cb_10->isChecked())
Motor.Speed[9] = Wert;
Motor.desired_speed[9] = Wert;
if (cb_11->isChecked())
Motor.Speed[10] = Wert;
Motor.desired_speed[10] = Wert;
if (cb_12->isChecked())
Motor.Speed[11] = Wert;
Motor.desired_speed[11] = Wert;
 
emit updateMotor(Motor);
}
/QMK-Groundstation/branches/libMK/Forms/dlg_Motortest.h
36,7 → 36,7
void slot_Motortest(int Wert);
 
signals:
void updateMotor(sMotor Motor);
void updateMotor(sMotorData Motor);
};
 
#endif
/QMK-Groundstation/branches/libMK/Forms/mktool.cpp
210,9 → 210,6
//FIXME: Move Ticker to libMK/QTCommunication.cpp
//Ticker = new QTimer(this);
 
// Verbindungsobject
//o_Connection = new cConnection();
 
// Logger
logger = new Logger(Settings, data);
 
445,8 → 442,8
 
le_TarLong->setText( QString::number( list[0].toDouble() ) );
le_TarLat->setText( QString::number( list[1].toDouble() ) );
//le_TarLong->setText(ToolBox::get_Float((List[0].toDouble() * 10000000), 7));
//le_TarLat->setText(ToolBox::get_Float((List[1].toDouble() * 10000000), 7));
//le_TarLong->setText(ToolBox::get_Float((List[0] * 10000000), 7));
//le_TarLat->setText(ToolBox::get_Float((List[1] * 10000000), 7));
}
}
 
534,7 → 531,7
// Hardware Auswahl und umschalten
void MKTool::slot_rb_Hardware()
{
if ((rb_SelNC->isChecked() == false) && (data->mode.ID != ADDRESS_NC))
if ((rb_SelNC->isChecked() == false) && (data->mode.id != ADDRESS_NC))
{
lb_Status->setText(tr("Schalte um auf NaviCtrl."));
handler->switch_navictrl();
565,12 → 562,13
handler->get_version();
}
 
//FIXME: Put this somewhere in libMK/QTCommunication.cpp
// Ticker-Event
///////////////
void MKTool::slot_Ticker()
/*void MKTool::slot_Ticker()
{
//FIXME: Put this somewhere in libMK/QTCommunication.cpp
/*
 
 
if (TickerDiv)
TickerDiv = false;
else
627,10 → 625,10
}
}
}
}
*/
}
 
// Zum QMK-Datenserver verbinden
// connect to QMK dataserver
void MKTool::slot_QMKS_Connect()
{
if (ac_QMKServer->isChecked())
726,7 → 724,7
// TickerEvent[4] = false;
}
 
void MKTool::slot_Motortest(sMotor p_Motor)
void MKTool::slot_Motortest(sMotorData p_Motor)
{
handler->motor_test(p_Motor);
}
837,12 → 835,12
Old_Analog1 = Settings->Analog1;
 
dlg_Config *f_Config = new dlg_Config(this);
f_Config->set_Settings(Settings, data->mode.ID);
f_Config->set_Settings(Settings, data->mode.id);
 
if (f_Config->exec()==QDialog::Accepted)
{
Settings = f_Config->get_Settings();
Settings->write_Settings_Analog(data->mode.ID);
Settings->write_Settings_Analog(data->mode.id);
 
// Plotter neu einrichten
if (Old_Analog1.PlotView != Settings->Analog1.PlotView)
1315,7 → 1313,7
le_Analog[i]->setText(QString("%1").arg(data->analogData[i]));
}
 
if ((data->mode.ID == ADDRESS_FC) && (FCSettings[P_GYRO_ACC_FAKTOR] > 0))
if ((data->mode.id == ADDRESS_FC) && (FCSettings[P_GYRO_ACC_FAKTOR] > 0))
{
//set battery
//TODO: save battery, compas and link quality directly in data (data->battery)
/QMK-Groundstation/branches/libMK/Forms/mktool.h
43,7 → 43,6
#include "dlg_Map.h"
#include "dlg_MotorMixer.h"
 
#include "../Classes/cConnection.h"
#include "../Classes/cSettings.h"
#include "../Classes/cKML_Server.h"
#include "../Classes/cQMK_Server.h"
68,36 → 67,37
~MKTool();
 
private:
// Object für Kopter-Verbindung
//cConnection *o_Connection;
// data-exchange from the MK
KopterData * data;
 
// data-handler to send commands to MK
Handler *handler;
 
// connect to MK/disconnect from MK
Communication *com;
 
// Settings-Object (Programmeinstellungen)
// settings object (program configuration)
cSettings *Settings;
 
// Settings-Widget (FC-Settings)
// settings widget (FC settings)
wdg_Settings *f_Settings;
 
// HTTP-Server-Object für KML-Files
// HTTP server object for KML files
cKML_Server *KML_Server;
 
// QMK-Serverobjekt
// QMK-serverobjekt
cQMK_Server *QMK_Server;
 
// LCD-Dialog
// LCD dialog
dlg_LCD *f_LCD;
 
// MotorMixer-Dialog
// MotorMixer dialog
dlg_MotorMixer *f_MotorMixer;
 
// Map-Dialog
// Map dialog
dlg_Map *f_Map;
 
//TCP-Socket
//TCP socket - needed by QMK server
QTcpSocket *TcpSocket;
 
//FIXME: replace ticker with something else
129,16 → 129,16
//bool TickerEvent[MaxTickerEvents];
//bool TickerDiv;
 
//Logger für CVS und andere
// logger for CVS, MySQL and others
Logger * logger;
 
// Softwareupdate
// software update
QProcess *Update;
 
// FC-Settings
int FCSettings[MaxParameter];
 
// Programm Initialisieren
// initialize program
void init_GUI();
void init_Objects();
void init_Connections();
146,7 → 146,7
void init_Plot();
void init_Cockpit();
 
// Daten-Plotter
// plot data
void update_Plot();
void config_Plot();
 
153,11 → 153,11
void new_NaviData(sRxData RX);
void parse_TargetKML();
 
// Debugdaten anzeigen und speichern.
// show and save debug/log
void show_DebugData();
void update_Log();
 
// Programmeinstellungen speichern
// save program settings
void set_Preferences();
 
private slots:
199,13 → 199,14
void slot_pb_SendTarget();
 
// Default-Ticker
void slot_Ticker();
//FIXME: put this in libMK/QTCommunication.cpp
//void slot_Ticker();
 
// LCD-Seite vor / zurück
// LCD page up / down
void slot_LCD_UP();
void slot_LCD_DOWN();
 
void slot_Motortest(sMotor p_Motor);
void slot_Motortest(sMotorData p_Motor);
 
// Firmeware-Update
void slot_pb_Update();
/QMK-Groundstation/branches/libMK/Logger/CSVLogger.cpp
51,7 → 51,7
{
if (!csvfile->isOpen())
{
QString mode_name = QString(data->mode.Hardware.c_str());
QString mode_name = QString(data->mode.hardware.c_str());
 
if (mode_name.size() == 0)
{
/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;
/QMK-Groundstation/branches/libMK/global.h
45,11 → 45,12
#endif
 
// sleep time - time to wait until next command is received
// FIXME: delete this / rewrite to use interrupts, mutex or something elsebetter than timeouts
// FIXME: delete this / rewrite to use interrupts, mutex or
// something else better than timeouts
static const int SLEEP = 500000;
 
static const QString QA_NAME = "QMK-Groundstation";
static const QString QA_VERSION_NR = "0.8.7 - own light lib";
static const QString QA_VERSION_NR = "0.8.7 - libMK";
 
#ifdef _BETA_
static const QString QA_VERSION = QA_VERSION_NR + " (BETA)";