Subversion Repositories Projects

Compare Revisions

Regard whitespace Rev 749 → Rev 750

/QMK-Groundstation/trunk/QMK-Settings/Dialogs/dlg_Main.cpp
31,12 → 31,13
 
o_Settings = new cSettings();
 
o_Input = new Input();
wg_Connection->set_Client(ID_SETTINGS, QA_NAME + " " + QA_VERSION, DataFields);
 
o_Timer = new QTimer();
o_Timer->setInterval(500);
 
f_MotorMixer = new dlg_MotorMixer(this);
f_MotorTest = new dlg_MotorTest(this);
 
init_Directorys();
init_GUI();
56,25 → 57,28
showMaximized();
}
 
for(int z = 0; z < o_Settings->SERVER.IP_MAX; z++)
wg_Connection->set_SelectVisible(false);
wg_Connection->set_IntervalVisible(false);
 
ac_Toolbar->setChecked(o_Settings->GUI.Toolbar);
 
if (ac_Toolbar->isChecked())
{
if (cb_Server->findText(o_Settings->SERVER.IP[z]) == -1)
wg_Connection->set_ButtonVisible(false);
}
else
{
cb_Server->addItem(o_Settings->SERVER.IP[z]);
ToolBar->setVisible(false);
}
}
 
cb_Server->setCurrentIndex(o_Settings->SERVER.IP_ID);
 
le_Password->setText(o_Settings->SERVER.Password);
}
 
// Signale mit Slots verbinden
void dlg_Main::init_Connections()
{
connect(o_Timer, SIGNAL(timeout()), this, SLOT(slot_Timer()));
 
connect(ac_Connect, SIGNAL(triggered()), this, SLOT(slot_ac_Connect()));
connect(ac_Connect, SIGNAL(triggered()), wg_Connection, SLOT(slot_btn_Connect()));
connect(ac_Toolbar, SIGNAL(triggered()), this, SLOT(slot_ac_Toolbar()));
 
connect(ac_Write, SIGNAL(triggered()), this, SLOT(slot_ac_Write()));
connect(ac_Read, SIGNAL(triggered()), this, SLOT(slot_ac_Read()));
82,11 → 86,23
connect(ac_Load, SIGNAL(triggered()), this, SLOT(slot_ac_Load()));
 
connect(ac_MotorMixer, SIGNAL(triggered()), this, SLOT(slot_ac_MotorMixer()));
connect(ac_MotorTest, SIGNAL(triggered()), this, SLOT(slot_ac_MotorTest()));
 
connect(f_MotorMixer, SIGNAL(sig_SendData(QString,int)), wg_Connection, SLOT(slot_send_Data(QString,int)));
connect(f_MotorTest, SIGNAL(sig_SendData(QString,int)), wg_Connection, SLOT(slot_send_Data(QString,int)));
 
// About QMK-Settings & About-QT Dialog einfügen
connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About()));
menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt()));
 
connect(wg_Connection, SIGNAL(sig_Status(int)), this, SLOT(slot_ConnectionStatus(int)));
connect(wg_Connection, SIGNAL(sig_MK_Version(s_Hardware)), this, SLOT(slot_MK_Version(s_Hardware)));
connect(wg_Connection, SIGNAL(sig_MK_ReadSettings(s_MK_Settings)), this, SLOT(slot_MK_ReadSettings(s_MK_Settings)));
connect(wg_Connection, SIGNAL(sig_MK_WriteSettings(int)), this, SLOT(slot_MK_WriteSettings(int)));
connect(wg_Connection, SIGNAL(sig_MK_ReadMotorMixer(s_MK_Mixer)), this, SLOT(slot_MK_ReadMotorMixer(s_MK_Mixer)));
connect(wg_Connection, SIGNAL(sig_MK_WriteMotorMixer(int)), this, SLOT(slot_MK_WriteMotorMixer(int)));
connect(wg_Connection, SIGNAL(sig_MK_PPMData(s_MK_PPM_Data)), this, SLOT(slot_MK_PPMData(s_MK_PPM_Data)));
 
connect(listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(slot_PageChange(int)));
 
// Settings - LED's J16
157,95 → 173,61
}
}
 
void dlg_Main::parse_IP_Data(QString t_Data)
{
QStringList Data;
Data = t_Data.split(":");
///////////
// Slots //
///////////
 
if (Data.count() > 1)
// About-Dialog
void dlg_Main::slot_ac_About()
{
int CMD = Data[2].toInt();
QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT);
}
 
switch(CMD)
void dlg_Main::slot_ac_Toolbar()
{
case 101 :
if (ac_Toolbar->isChecked())
{
o_Input->send_Data(HandlerIP::make_Frame(ID_SETTINGS, 101, QA_NAME + " " + QA_VERSION));
wg_Connection->set_ButtonVisible(false);
ToolBar->setVisible(true);
}
break;
case 502 :
else
{
switch (Data[3].toInt())
{
case 105 :
{
QString s_MD5PW;
QByteArray a_MD5PW;
 
a_MD5PW = QCryptographicHash::hash(le_Password->text().toAscii(),QCryptographicHash::Md5);
 
s_MD5PW = QString(a_MD5PW.toHex().data());
 
o_Input->send_Data(HandlerIP::make_Frame(ID_SETTINGS, 105, s_MD5PW));
wg_Connection->set_ButtonVisible(true);
ToolBar->setVisible(false);
}
break;
case 106 :
{
o_Input->send_Data(HandlerIP::make_Frame(ID_SETTINGS, 106, DataFields));
}
break;
}
}
break;
case 505 :
 
void dlg_Main::slot_ConnectionStatus(int li_Status)
{
if (Data[3] == "OK")
if (li_Status)
{
ac_Connect->setChecked(true);
ac_Connect->setText(tr("Trennen"));
}
else
{
QMessageBox::warning(this, QA_NAME, trUtf8("Authentifizierung fehlgeschlagen. <br />Daten senden zum Mikrokopter nicht möglich."), QMessageBox::Ok);
ac_Connect->setChecked(false);
ac_Connect->setText(tr("Verbinden"));
}
}
break;
}
}
}
 
// Eingangsdaten verarbeiten
void dlg_Main::parse_MK_Data(QString t_Data)
void dlg_Main::slot_MK_Version(s_Hardware ls_Version)
{
unsigned char OutData[150];
char *InData = t_Data.toLatin1().data();
gs_Version = ls_Version;
setWindowTitle(QA_NAME + " " + QA_VERSION + " - " + ls_Version.Hardware + " " + ls_Version.Version);
 
if (HandlerMK::Decode_64(InData, t_Data.length(), OutData) != 0)
if (gs_Version.ID == ADDRESS_FC)
{
switch(InData[2])
{
case 'V' : // Versions-Info
{
o_Input->stop_Resend(DATA_VERSION);
VersionInfo = HandlerMK::parse_Version(OutData, InData[1] - 'a');
setWindowTitle(QA_NAME + " " + QA_VERSION + " - " + VersionInfo.Hardware + " " + VersionInfo.Version);
 
if (VersionInfo.ID == ADDRESS_FC)
{
// qDebug("get FC-Settings");
c_Data[0] = 0xff;
o_Input->send_Data(HandlerMK::make_Frame('q', ADDRESS_FC, c_Data, 1).toLatin1().data(), DATA_READ_SETTINGS);
wg_Connection->send_Data(HandlerMK::make_Frame('q', ADDRESS_FC, c_Data, 1).toLatin1().data(), DATA_READ_SETTINGS);
}
}
break;
case 'Q' : // Settings lesen
 
void dlg_Main::slot_MK_ReadSettings(s_MK_Settings ps_MK_Settings)
{
o_Input->stop_Resend(DATA_READ_SETTINGS);
if (OutData[1] == MK_VERSION_SETTINGS)
if (ps_MK_Settings.Version == MK_VERSION_SETTINGS)
{
s_MK_Settings MK_Set;
 
memcpy((unsigned char *)&MK_Set, (unsigned char *)&OutData, sizeof(MK_Set));
// qDebug(MK_Set.Name);
show_MK_Settings(MK_Set);
show_MK_Settings(ps_MK_Settings);
}
else
{
254,214 → 236,78
ac_Write->setEnabled(false);
}
}
break;
case 'S' : // Settings geschrieben
 
void dlg_Main::slot_MK_WriteSettings(int pi_ID)
{
o_Input->stop_Resend(DATA_WRITE_SETTINGS);
if (OutData[0] == 0)
if (pi_ID == 0)
{
QMessageBox::warning(this, QA_NAME, tr("Fehler beim Settings-Schreiben."), QMessageBox::Ok);
}
}
break;
case 'P' : // RC-Kanäle
else
{
int PPM_in[11];
 
memcpy((unsigned char *)&PPM_in, (unsigned char *)&OutData, sizeof(PPM_in));
pb_K1->setValue(PPM_in[0]);
pb_K2->setValue(PPM_in[1]);
pb_K3->setValue(PPM_in[2]);
pb_K4->setValue(PPM_in[3]);
pb_K5->setValue(PPM_in[4]);
pb_K6->setValue(PPM_in[5]);
pb_K7->setValue(PPM_in[6]);
pb_K8->setValue(PPM_in[7]);
QMessageBox::information(this, QA_NAME, tr("Setting geschrieben."), QMessageBox::Ok);
}
break;
case 'N' : // MotorMixer lesen
{
o_Input->stop_Resend(DATA_READ_MIXER);
 
s_MK_Mixer MK_Mixer;
 
memcpy((unsigned char *)&MK_Mixer, (unsigned char *)&OutData, sizeof(MK_Mixer));
 
if (MK_Mixer.Revision == MK_VERSION_MIXER)
{
f_MotorMixer->set_MotorConfig(MK_Mixer);
}
}
break;
case 'M' : // MotorMixer geschrieben
{
o_Input->stop_Resend(DATA_WRITE_MIXER);
 
if (OutData[0] == 0)
void dlg_Main::slot_MK_ReadMotorMixer(s_MK_Mixer ps_MK_MotorMixer)
{
QMessageBox::warning(this, QA_NAME, tr("Fehler beim MotorMixer-Schreiben."), QMessageBox::Ok);
}
}
break;
 
}
}
}
 
///////////
// Slots //
///////////
 
// About-Dialog
void dlg_Main::slot_ac_About()
if (ps_MK_MotorMixer.Revision == MK_VERSION_MIXER)
{
QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT);
f_MotorMixer->set_MotorConfig(ps_MK_MotorMixer);
}
 
// Verbindung zum Server aufbauen
void dlg_Main::slot_ac_Connect()
{
if (!o_Input->IsOpen())
{
if (cb_Server->findText(cb_Server->currentText()) == -1)
{
cb_Server->addItem(cb_Server->currentText());
cb_Server->setCurrentIndex(cb_Server->findText(cb_Server->currentText()));
}
 
cb_Server->setEnabled(false);
le_Password->setEnabled(false);
 
if (cb_Server->currentText().startsWith('/'))
void dlg_Main::slot_MK_WriteMotorMixer(int pi_ID)
{
o_Input = new Input_TTY();
o_Input->Init();
 
set_Input s_Input;
s_Input.Main = cb_Server->currentText();
 
if (o_Input->Open(s_Input) == true)
if (pi_ID == 0)
{
ac_Connect->setText(tr("Trennen"));
connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString)));
 
o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION);
QMessageBox::warning(this, QA_NAME, tr("Fehler beim MotorMixer-Schreiben."), QMessageBox::Ok);
}
else
{
cb_Server->setEnabled(true);
le_Password->setEnabled(true);
QMessageBox::information(this, QA_NAME, tr("MotorMixer geschrieben."), QMessageBox::Ok);
}
 
}
else
{
o_Input = new Input_TCP();
o_Input->Init();
 
set_Input s_Input;
 
QStringList Server = cb_Server->currentText().split(":");
 
s_Input.Main = Server[0];
s_Input.Sub = Server[1];
 
if (o_Input->Open(s_Input) == true)
void dlg_Main::slot_MK_PPMData(s_MK_PPM_Data ps_PPMData)
{
connect(o_Input, SIGNAL(sig_Disconnected(int)), this, SLOT(slot_Input_Disconnected(int)));
connect(o_Input, SIGNAL(sig_Connected()), this, SLOT(slot_Input_Connected()));
}
}
}
else
{
cb_Server->setEnabled(true);
le_Password->setEnabled(true);
qDebug("PPM-Data");
 
ac_Connect->setText(tr("Verbinden"));
o_Input->Close();
disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0);
if (o_Input->Mode() == TCP)
{
disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0);
disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0);
}
}
}
// qDebug() << ps_PPMData.Data[1] << ", " << ps_PPMData.Data[2] << ", " << ps_PPMData.Data[3] << ", " << ps_PPMData.Data[4];
 
// Neue Daten empfangen.
void dlg_Main::slot_Input_Data(QString t_Data)
{
if ((t_Data[0] == '#'))
{
if ((HandlerMK::Check_CRC(t_Data.toLatin1().data(), t_Data.length() - 1)) || ((o_Input->Mode() == TTY) && (HandlerMK::Check_CRC(t_Data.toLatin1().data(), t_Data.length()))))
{
parse_MK_Data(t_Data);
pb_K1->setValue(ps_PPMData.Data[1]);
pb_K2->setValue(ps_PPMData.Data[2]);
pb_K3->setValue(ps_PPMData.Data[3]);
pb_K4->setValue(ps_PPMData.Data[4]);
pb_K5->setValue(ps_PPMData.Data[5]);
pb_K6->setValue(ps_PPMData.Data[6]);
pb_K7->setValue(ps_PPMData.Data[7]);
pb_K8->setValue(ps_PPMData.Data[8]);
pb_K9->setValue(ps_PPMData.Data[9]);
pb_K10->setValue(ps_PPMData.Data[10]);
pb_K11->setValue(ps_PPMData.Data[11]);
pb_K12->setValue(ps_PPMData.Data[12]);
pb_K1_2->setValue(ps_PPMData.Data[13]);
pb_K2_2->setValue(ps_PPMData.Data[14]);
pb_K3_2->setValue(ps_PPMData.Data[15]);
pb_K4_2->setValue(ps_PPMData.Data[16]);
pb_K5_2->setValue(ps_PPMData.Data[17]);
pb_K6_2->setValue(ps_PPMData.Data[18]);
pb_K7_2->setValue(ps_PPMData.Data[19]);
pb_K8_2->setValue(ps_PPMData.Data[20]);
pb_K9_2->setValue(ps_PPMData.Data[21]);
pb_K10_2->setValue(ps_PPMData.Data[22]);
pb_K11_2->setValue(ps_PPMData.Data[23]);
pb_K12_2->setValue(ps_PPMData.Data[24]);
}
else
{
// qDebug(QString("CRC-Error - " + t_Data).toLatin1().data());
}
}
else if (o_Input->Mode() == TCP)
{
parse_IP_Data(t_Data);
}
}
 
void dlg_Main::slot_Input_Disconnected(int Error)
{
cb_Server->setEnabled(true);
le_Password->setEnabled(true);
 
disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0);
disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0);
disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0);
 
ac_Connect->setChecked(false);
ac_Connect->setText(tr("Verbinden"));
 
switch (Error)
{
case REMOTECLOSED :
{
// lb_Status->setText(tr("Verbindung vom Server beendet."));
QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Verbindung wurde vom Server beendet."), QMessageBox::Ok);
}
break;
case REFUSED :
{
// lb_Status->setText(tr("Server nicht gefunden."));
QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Kann nicht zum Server verbinden."), QMessageBox::Ok);
}
break;
case 3 :
{
// lb_Status->setText(tr("Serververbindung getrennt. Logindaten falsch."));
QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Loginname oder Password falsch."), QMessageBox::Ok);
}
break;
default :
{
// lb_Status->setText(tr("Getrennt vom QMK-Datenserver."));
}
break;
}
 
}
 
void dlg_Main::slot_Input_Connected()
{
connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString)));
 
o_Input->send_Data(HandlerMK::make_Frame('v', ADDRESS_ALL, c_Data, 0).toLatin1().data(), DATA_VERSION);
ac_Connect->setText(tr("Trennen"));
}
 
///////////////////////////////////////////////////////////////////
// QMK-Settings //
///////////////////////////////////////////////////////////////////
 
 
void dlg_Main::slot_PageChange(int Page)
{
if (Page == 1)
472,12 → 318,12
 
void dlg_Main::slot_Timer()
{
o_Input->send_Data(HandlerMK::make_Frame('p', ADDRESS_FC, c_Data, 0).toLatin1().data(), 0);
wg_Connection->send_Data(HandlerMK::make_Frame('p', ADDRESS_FC, c_Data, 0).toLatin1().data(), 0);
}
 
void dlg_Main::slot_ac_MotorMixer()
{
f_MotorMixer->set_Objects(o_Input, o_Settings, s_Dir);
f_MotorMixer->set_Objects(o_Settings, s_Dir);
f_MotorMixer->read_Mixer();
 
if (f_MotorMixer->exec()==QDialog::Accepted)
485,6 → 331,18
}
}
 
void dlg_Main::slot_ac_MotorTest()
{
// f_MotorMixer->set_Objects(wg_Connection->o_Input, o_Settings, s_Dir);
// f_MotorMixer->read_Mixer();
 
if (f_MotorTest->exec()==QDialog::Accepted)
{
}
 
f_MotorTest->Stop();
}
 
// Settings-Funktionen
void dlg_Main::slot_ac_Write()
{
494,18 → 352,18
 
memcpy((unsigned char *)&c_Data, (unsigned char *)&t_Set, sizeof(t_Set));
 
o_Input->send_Data(HandlerMK::make_Frame('s', ADDRESS_FC, c_Data, sizeof(t_Set)).toLatin1().data(), DATA_WRITE_SETTINGS);
wg_Connection->send_Data(HandlerMK::make_Frame('s', ADDRESS_FC, c_Data, sizeof(t_Set)).toLatin1().data(), DATA_WRITE_SETTINGS);
}
 
void dlg_Main::slot_ac_Read()
{
c_Data[0] = sb_Set->value();
o_Input->send_Data(HandlerMK::make_Frame('q', ADDRESS_FC, c_Data, 1).toLatin1().data(), DATA_READ_SETTINGS);
wg_Connection->send_Data(HandlerMK::make_Frame('q', ADDRESS_FC, c_Data, 1).toLatin1().data(), DATA_READ_SETTINGS);
}
 
void dlg_Main::slot_ac_Save()
{
QString Filename = QFileDialog::getSaveFileName(this, "Mikrokopter Parameter speichern", s_Dir.Settings + "/" + VersionInfo.VersionShort + "_" + le_SetName->text() + ".mkp", "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)");
QString Filename = QFileDialog::getSaveFileName(this, "Mikrokopter Parameter speichern", s_Dir.Settings + "/" + gs_Version.VersionShort + "_" + le_SetName->text() + ".mkp", "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)");
 
if (!Filename.isEmpty())
{
534,6 → 392,11
Setting.setValue("Poti_2", t_Set.Kanalbelegung[5]);
Setting.setValue("Poti_3", t_Set.Kanalbelegung[6]);
Setting.setValue("Poti_4", t_Set.Kanalbelegung[7]);
Setting.setValue("Poti_5", t_Set.Kanalbelegung[8]);
Setting.setValue("Poti_6", t_Set.Kanalbelegung[9]);
Setting.setValue("Poti_7", t_Set.Kanalbelegung[10]);
Setting.setValue("Poti_8", t_Set.Kanalbelegung[11]);
Setting.setValue("Receiver", t_Set.Receiver);
Setting.endGroup();
 
Setting.beginGroup("Stick");
581,6 → 444,10
 
Setting.setValue("ServoInvert", t_Set.ServoCompInvert);
Setting.setValue("ServoNickRefreshRate", t_Set.ServoNickRefresh);
 
Setting.setValue("Servo3", t_Set.Servo3);
Setting.setValue("Servo4", t_Set.Servo4);
Setting.setValue("Servo5", t_Set.Servo5);
Setting.endGroup();
 
Setting.beginGroup("Others");
678,6 → 545,11
t_Set.Kanalbelegung[5] = Setting.value("Poti_2", 6).toInt();
t_Set.Kanalbelegung[6] = Setting.value("Poti_3", 7).toInt();
t_Set.Kanalbelegung[7] = Setting.value("Poti_4", 8).toInt();
t_Set.Kanalbelegung[8] = Setting.value("Poti_5", 9).toInt();
t_Set.Kanalbelegung[9] = Setting.value("Poti_6", 10).toInt();
t_Set.Kanalbelegung[10] = Setting.value("Poti_7", 11).toInt();
t_Set.Kanalbelegung[11] = Setting.value("Poti_8", 12).toInt();
t_Set.Receiver = Setting.value("Receiver", 0).toInt();
Setting.endGroup();
 
Setting.beginGroup("Stick");
725,6 → 597,10
 
t_Set.ServoCompInvert = Setting.value("ServoInvert", 0).toInt();
t_Set.ServoNickRefresh = Setting.value("ServoNickRefreshRate", 3).toInt();
 
t_Set.Servo3 = Setting.value("Servo3", 0).toInt();
t_Set.Servo4 = Setting.value("Servo4", 0).toInt();
t_Set.Servo5 = Setting.value("Servo5", 0).toInt();
Setting.endGroup();
 
Setting.beginGroup("Others");
812,14 → 688,19
}
// Seite 2
{
sb_2_1->setValue(t_Set.Kanalbelegung[2]);
sb_2_2->setValue(t_Set.Kanalbelegung[3]);
sb_2_3->setValue(t_Set.Kanalbelegung[0]);
sb_2_4->setValue(t_Set.Kanalbelegung[1]);
sb_2_5->setValue(t_Set.Kanalbelegung[4]);
sb_2_6->setValue(t_Set.Kanalbelegung[5]);
sb_2_7->setValue(t_Set.Kanalbelegung[6]);
sb_2_8->setValue(t_Set.Kanalbelegung[7]);
cb_2_1->setCurrentIndex(t_Set.Kanalbelegung[2] - 1);
cb_2_2->setCurrentIndex(t_Set.Kanalbelegung[3] - 1);
cb_2_3->setCurrentIndex(t_Set.Kanalbelegung[0] - 1);
cb_2_4->setCurrentIndex(t_Set.Kanalbelegung[1] - 1);
cb_2_5->setCurrentIndex(t_Set.Kanalbelegung[4] - 1);
cb_2_6->setCurrentIndex(t_Set.Kanalbelegung[5] - 1);
cb_2_7->setCurrentIndex(t_Set.Kanalbelegung[6] - 1);
cb_2_8->setCurrentIndex(t_Set.Kanalbelegung[7] - 1);
cb_2_9->setCurrentIndex(t_Set.Kanalbelegung[8] - 1);
cb_2_10->setCurrentIndex(t_Set.Kanalbelegung[9] - 1);
cb_2_11->setCurrentIndex(t_Set.Kanalbelegung[10] - 1);
cb_2_12->setCurrentIndex(t_Set.Kanalbelegung[11] - 1);
s_2_13_cb->setCurrentIndex(t_Set.Receiver);
}
// Seite 3
{
830,11 → 711,17
}
// Seite 4
{
if (t_Set.ExtraConfig & CFG2_HEIGHT_LIMIT) {
// s_4_2_rb->setChecked(t_Set.ExtraConfig & CFG2_HEIGHT_LIMIT);
if (t_Set.ExtraConfig & CFG2_HEIGHT_LIMIT)
{
s_4_2_rb->setChecked(true);
} else {
}
else
{
s_4_3_rb->setChecked(true);
}
s_4_5_cb->setChecked(t_Set.ExtraConfig & CFG2_VARIO_BEEP);
s_4_4_cb->setChecked(t_Set.GlobalConfig & CFG_HOEHEN_SCHALTER);
 
877,6 → 764,11
cb_6_9->setChecked(t_Set.ServoCompInvert & 0x02);
 
sb_6_5->setValue(t_Set.ServoNickRefresh);
 
cb_6_12 = setCombo(cb_6_12, t_Set.Servo3);
cb_6_13 = setCombo(cb_6_13, t_Set.Servo4);
cb_6_14 = setCombo(cb_6_14, t_Set.Servo5);
 
}
// Seite 7
{
966,8 → 858,16
sb_11_5->setValue(t_Set.WARN_J16_Bitmask);
sb_11_6->setValue(t_Set.WARN_J17_Bitmask);
cb_11_7->setChecked(t_Set.BitConfig & CFG_MOTOR_BLINK);
J16_8->setChecked(t_Set.BitConfig & CFG_MOTOR_OFF_LED1);
J17_8->setChecked(t_Set.BitConfig & CFG_MOTOR_OFF_LED2);
 
if (t_Set.WARN_J16_Bitmask != 0)
s_11_7_cb->setChecked(true);
else
s_11_7_cb->setChecked(false);
 
if (t_Set.WARN_J17_Bitmask != 0)
s_11_8_cb->setChecked(true);
else
s_11_8_cb->setChecked(false);
}
// Seite 12
{
1025,14 → 925,19
}
// Seite 2
{
t_Set.Kanalbelegung[2] = sb_2_1->value();
t_Set.Kanalbelegung[3] = sb_2_2->value();
t_Set.Kanalbelegung[0] = sb_2_3->value();
t_Set.Kanalbelegung[1] = sb_2_4->value();
t_Set.Kanalbelegung[4] = sb_2_5->value();
t_Set.Kanalbelegung[5] = sb_2_6->value();
t_Set.Kanalbelegung[6] = sb_2_7->value();
t_Set.Kanalbelegung[7] = sb_2_8->value();
t_Set.Kanalbelegung[2] = cb_2_1->currentIndex() + 1;
t_Set.Kanalbelegung[3] = cb_2_2->currentIndex() + 1;
t_Set.Kanalbelegung[0] = cb_2_3->currentIndex() + 1;
t_Set.Kanalbelegung[1] = cb_2_4->currentIndex() + 1;
t_Set.Kanalbelegung[4] = cb_2_5->currentIndex() + 1;
t_Set.Kanalbelegung[5] = cb_2_6->currentIndex() + 1;
t_Set.Kanalbelegung[6] = cb_2_7->currentIndex() + 1;
t_Set.Kanalbelegung[7] = cb_2_8->currentIndex() + 1;
t_Set.Kanalbelegung[8] = cb_2_9->currentIndex() + 1;
t_Set.Kanalbelegung[9] = cb_2_10->currentIndex() + 1;
t_Set.Kanalbelegung[10] = cb_2_11->currentIndex() + 1;
t_Set.Kanalbelegung[11] = cb_2_12->currentIndex() + 1;
t_Set.Receiver = s_2_13_cb->currentIndex();
}
// Seite 3
{
1087,6 → 992,10
 
t_Set.ServoNickRefresh = sb_6_5->value();
 
t_Set.Servo3 = get_Value(cb_6_12);
t_Set.Servo4 = get_Value(cb_6_13);
t_Set.Servo5 = get_Value(cb_6_14);
 
if (cb_6_6->isChecked())
t_Set.ServoCompInvert = t_Set.ServoCompInvert | 0x01;
if (cb_6_9->isChecked())
1148,10 → 1057,12
 
if (cb_11_7->isChecked())
t_Set.BitConfig = t_Set.BitConfig | CFG_MOTOR_BLINK;
if (J16_8->isChecked())
t_Set.BitConfig = t_Set.BitConfig | CFG_MOTOR_OFF_LED1;
if (J17_8->isChecked())
t_Set.BitConfig = t_Set.BitConfig | CFG_MOTOR_OFF_LED2;
 
if (!s_11_7_cb->isChecked())
t_Set.WARN_J16_Bitmask = 0;
if (!s_11_8_cb->isChecked())
t_Set.WARN_J17_Bitmask = 0;
 
}
// Seite 12
{
1182,26 → 1093,34
int dlg_Main::get_Value(QComboBox *Combo)
{
if (Combo->currentText() == QString("Poti 1"))
return 251;
return 255;
if (Combo->currentText() == QString("Poti 2"))
return 252;
return 254;
if (Combo->currentText() == QString("Poti 3"))
return 253;
if (Combo->currentText() == QString("Poti 4"))
return 254;
return 252;
if (Combo->currentText() == QString("Poti 5"))
return 251;
if (Combo->currentText() == QString("Poti 6"))
return 250;
if (Combo->currentText() == QString("Poti 7"))
return 249;
if (Combo->currentText() == QString("Poti 8"))
return 248;
return Combo->currentText().toInt();
}
 
QComboBox *dlg_Main::setCombo(QComboBox *Combo, int Wert)
{
if (Wert <= 250)
if (Wert <= 245)
{
Combo->setItemText(4, QString("%1").arg(Wert));
Combo->setCurrentIndex(4);
Combo->setItemText(8, QString("%1").arg(Wert));
Combo->setCurrentIndex(8);
}
else
{
Combo->setCurrentIndex(Wert - 251);
Combo->setCurrentIndex(255 - Wert);
}
return Combo;
}
1407,19 → 1326,8
o_Settings->GUI.isMax = isMaximized();
o_Settings->GUI.Size = size();
o_Settings->GUI.Point = pos();
o_Settings->GUI.Toolbar = ac_Toolbar->isChecked();
 
o_Settings->SERVER.Password = le_Password->text();
o_Settings->SERVER.IP_MAX = cb_Server->count();
o_Settings->SERVER.IP_ID = cb_Server->currentIndex();
 
for (int z = 0; z < cb_Server->count(); z++)
{
if (z < 10)
{
o_Settings->SERVER.IP[z] = cb_Server->itemText(z);
}
}
 
o_Settings->write_Settings();
// qDebug("Ende.");
}