Subversion Repositories Projects

Compare Revisions

Regard whitespace Rev 449 → Rev 448

/QMK-Groundstation/branches/libMK/libMK/Handler.cpp
82,7 → 82,7
}
 
/**
* send a waypoint to the NaviCtrl (the MikroKopter will fly to the position emidiately)
* send a waypoint to the NaviCtrl (the copter 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,37 → 189,43
/**
* receive data
*/
//Parser::decode64(data);
void Handler::receive_data(int hardwareID, int cmd, char * data) {
void Handler::receive_data(sRxData RX) {
//extract hardware ID from received Data
int hardwareID = RX.input[1] - 'a';
switch(hardwareID)
{
case ADDRESS_FC :
switch(cmd)
switch(RX.input[2])
{
// Motor-Mixer
case 'N' :
//if (Parser::decode64(RX))
//{
if (Parser::decode64(RX))
{
com->stop_resend();
//decoded data
if (data[0] == VERSION_MIXER)
 
if (RX.decode[0] == VERSION_MIXER)
{
//f_MotorMixer->set_MotorConfig(RX);
}
//}
}
break;
// Motor-Mixer Schreib-Bestätigung
case 'M' :
if (Parser::decode64(RX))
{
com->stop_resend();
 
if (data[0] == 1)
if (RX.decode[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));
228,14 → 234,17
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 (data[1] == VERSION_SETTINGS)
if (RX.decode[1] == VERSION_SETTINGS)
{
int Settings_ID = data[0];
int Settings_ID = RX.decode[0];
/*for (int a = 0; a < MaxParameter; a++)
{
FCSettings[a] = RX.decode[a + 2];
258,6 → 267,7
QMessageBox::warning(this, QA_NAME,
name, QMessageBox::Ok);*/
}
}
break;
// Settings written
case 'S' : // DONE 0.71g
267,20 → 277,25
}
 
case ADDRESS_NC :
switch(cmd)
switch(RX.input[2])
{
// Navigationsdaten
case 'O' : // NOT DONE 0.12h
if (Parser::decode64(RX))
{
//new_NaviData(RX);
}
break;
}
// case ADDRESS_MK3MAG :
 
default :
switch(cmd)
switch(RX.input[2])
{
// LCD-Anzeige
case 'L' : // DONE 0.71g
if (Parser::decode64(RX))
{
com->stop_resend();
 
/*int LCD[150];
291,13 → 306,17
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();
 
//check position
if (data[0] != 31) {
int Position = RX.decode[0];
if (Position != 31)
{
/*
Settings->Analog1.Label[Position] = ToolBox::dataToQString(RX.decode,1,17).trimmed();
if (Settings->Analog1.Label[Position] == "")
307,7 → 326,9
Position ++;
TX_Data[0] = Position;
o_Connection->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true);*/
} else {
}
if (Position == 31)
{
/*
for (int a = 0; a < MaxAnalog; a++)
{
317,16 → 338,23
Settings->write_Settings_AnalogLabels(HardwareID);
config_Plot();*/
}
}
break;
// Debug-Daten
case 'D' : // DONE 0.71g
for (int i = 0; i < MaxAnalog; i++) {
if (Parser::decode64(RX))
{
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;
434,6 → 462,7
lb_Analog[a]->setText(Settings->Analog1.Label[a]);
}
config_Plot();*/
}
break;
}
}