Subversion Repositories Projects

Compare Revisions

Regard whitespace Rev 448 → Rev 449

/QMK-Groundstation/branches/libMK/libMK/Handler.cpp
82,7 → 82,7
}
 
/**
* send a waypoint to the NaviCtrl (the copter will fly to the position emidiately)
* send a waypoint to the NaviCtrl (the MikroKopter will fly to the position emidiately)
*/
void Handler::send_waypoint(Waypoint_t desired_pos) {
com->send_cmd('s', ADDRESS_NC, (char *)&desired_pos, sizeof(desired_pos), false);
189,43 → 189,37
/**
* receive data
*/
void Handler::receive_data(sRxData RX) {
//extract hardware ID from received Data
int hardwareID = RX.input[1] - 'a';
//Parser::decode64(data);
void Handler::receive_data(int hardwareID, int cmd, char * data) {
switch(hardwareID)
{
case ADDRESS_FC :
switch(RX.input[2])
switch(cmd)
{
// Motor-Mixer
case 'N' :
if (Parser::decode64(RX))
{
//if (Parser::decode64(RX))
//{
com->stop_resend();
 
if (RX.decode[0] == VERSION_MIXER)
//decoded data
if (data[0] == VERSION_MIXER)
{
//f_MotorMixer->set_MotorConfig(RX);
}
}
//}
break;
// Motor-Mixer Schreib-Bestätigung
case 'M' :
if (Parser::decode64(RX))
{
com->stop_resend();
 
if (RX.decode[0] == 1)
if (data[0] == 1)
{
//lb_Status->setText(tr("MotorMixer-Daten in FC geschrieben."));
}
}
break;
 
// Stick-Belegung der Fernsteuerung
case 'P' : // DONE 0.71g
if (Parser::decode64(RX))
{
/*f_Settings->pb_K1->setValue(Parser::dataToInt(RX.decode, 2,true));
f_Settings->pb_K2->setValue(Parser::dataToInt(RX.decode, 4,true));
f_Settings->pb_K3->setValue(Parser::dataToInt(RX.decode, 6,true));
234,17 → 228,14
f_Settings->pb_K6->setValue(Parser::dataToInt(RX.decode, 12,true));
f_Settings->pb_K7->setValue(Parser::dataToInt(RX.decode, 14,true));
f_Settings->pb_K8->setValue(Parser::dataToInt(RX.decode, 16,true));*/
}
break;
// Settings lesen
case 'Q' : // DONE 0.71g
if (Parser::decode64(RX))
{
com->stop_resend();
 
if (RX.decode[1] == VERSION_SETTINGS)
if (data[1] == VERSION_SETTINGS)
{
int Settings_ID = RX.decode[0];
int Settings_ID = data[0];
/*for (int a = 0; a < MaxParameter; a++)
{
FCSettings[a] = RX.decode[a + 2];
267,7 → 258,6
QMessageBox::warning(this, QA_NAME,
name, QMessageBox::Ok);*/
}
}
break;
// Settings written
case 'S' : // DONE 0.71g
277,25 → 267,20
}
 
case ADDRESS_NC :
switch(RX.input[2])
switch(cmd)
{
// Navigationsdaten
case 'O' : // NOT DONE 0.12h
if (Parser::decode64(RX))
{
//new_NaviData(RX);
}
break;
}
// case ADDRESS_MK3MAG :
 
default :
switch(RX.input[2])
switch(cmd)
{
// LCD-Anzeige
case 'L' : // DONE 0.71g
if (Parser::decode64(RX))
{
com->stop_resend();
 
/*int LCD[150];
306,17 → 291,13
LCD_Page = RX.decode[0];
LCD_MAX_Page = RX.decode[1];
*/
}
break;
// Analoglabels
case 'A' : // DONE 0.71g
if (Parser::decode64(RX))
{
com->stop_resend();
 
int Position = RX.decode[0];
if (Position != 31)
{
//check position
if (data[0] != 31) {
/*
Settings->Analog1.Label[Position] = ToolBox::dataToQString(RX.decode,1,17).trimmed();
if (Settings->Analog1.Label[Position] == "")
326,9 → 307,7
Position ++;
TX_Data[0] = Position;
o_Connection->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true);*/
}
if (Position == 31)
{
} else {
/*
for (int a = 0; a < MaxAnalog; a++)
{
338,23 → 317,16
Settings->write_Settings_AnalogLabels(HardwareID);
config_Plot();*/
}
}
break;
// Debug-Daten
case 'D' : // DONE 0.71g
if (Parser::decode64(RX))
{
for (int i = 0; i < MaxAnalog; i++)
{
for (int i = 0; i < MaxAnalog; i++) {
//AnalogData[i] = Parser::dataToInt(RX.decode, (i * 2) + 2);
}
//show_DebugData();
}
break;
// Version
case 'V' : // DONE 0.71h
if (Parser::decode64(RX))
{
com->stop_resend();
/*
Mode.ID = HardwareID;
462,7 → 434,6
lb_Analog[a]->setText(Settings->Analog1.Label[a]);
}
config_Plot();*/
}
break;
}
}