Subversion Repositories Projects

Rev

Rev 440 | Rev 442 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 440 Rev 441
Line 205... Line 205...
205
 
205
 
206
    //create handler that handles incomming data
206
    //create handler that handles incomming data
Line 207... Line 207...
207
    handler = new Handler(com, data);
207
    handler = new Handler(com, data);
-
 
208
 
208
 
209
    // QTimer-Instanzen
Line 209... Line 210...
209
    // QTimer-Instanzen
210
    //FIXME: Move Ticker to libMK/QTCommunication.cpp
210
    Ticker = new QTimer(this);
211
    //Ticker = new QTimer(this);
Line 211... Line 212...
211
 
212
 
Line 304... Line 305...
304
 
305
 
305
    // CVS-Record starten / stoppen
306
    // CVS-Record starten / stoppen
Line 306... Line 307...
306
    connect(ac_RecordCSV,  SIGNAL(triggered()), this, SLOT(slot_RecordLog()));
307
    connect(ac_RecordCSV,  SIGNAL(triggered()), this, SLOT(slot_RecordLog()));
-
 
308
 
307
 
309
    // Timer-Events
Line 308... Line 310...
308
    // Timer-Events
310
    //FIXME: Move Ticker to libMK/QTCommunication.cpp
309
    connect(Ticker,   SIGNAL(timeout()),       SLOT(slot_Ticker()));
311
    //connect(Ticker,   SIGNAL(timeout()),       SLOT(slot_Ticker()));
310
 
312
 
311
    // Seitenwechsel
313
    // Seitenwechsel
Line 350... Line 352...
350
    lb_Analog[27] = lb_A_27;
352
    lb_Analog[27] = lb_A_27;
351
    lb_Analog[28] = lb_A_28;
353
    lb_Analog[28] = lb_A_28;
352
    lb_Analog[29] = lb_A_29;
354
    lb_Analog[29] = lb_A_29;
353
    lb_Analog[30] = lb_A_30;
355
    lb_Analog[30] = lb_A_30;
354
    lb_Analog[31] = lb_A_31;
356
    lb_Analog[31] = lb_A_31;
-
 
357
    le_Analog[0] = le_A_0;
-
 
358
    le_Analog[1] = le_A_1;
-
 
359
    le_Analog[2] = le_A_2;
-
 
360
    le_Analog[3] = le_A_3;
-
 
361
    le_Analog[4] = le_A_4;
-
 
362
    le_Analog[5] = le_A_5;
-
 
363
    le_Analog[6] = le_A_6;
-
 
364
    le_Analog[7] = le_A_7;
-
 
365
    le_Analog[8] = le_A_8;
-
 
366
    le_Analog[9] = le_A_9;
-
 
367
    le_Analog[10] = le_A_10;
-
 
368
    le_Analog[11] = le_A_11;
-
 
369
    le_Analog[12] = le_A_12;
-
 
370
    le_Analog[13] = le_A_13;
-
 
371
    le_Analog[14] = le_A_14;
-
 
372
    le_Analog[15] = le_A_15;
-
 
373
    le_Analog[16] = le_A_16;
-
 
374
    le_Analog[17] = le_A_17;
-
 
375
    le_Analog[18] = le_A_18;
-
 
376
    le_Analog[19] = le_A_19;
-
 
377
    le_Analog[20] = le_A_20;
-
 
378
    le_Analog[21] = le_A_21;
-
 
379
    le_Analog[22] = le_A_22;
-
 
380
    le_Analog[23] = le_A_23;
-
 
381
    le_Analog[24] = le_A_24;
-
 
382
    le_Analog[25] = le_A_25;
-
 
383
    le_Analog[26] = le_A_26;
-
 
384
    le_Analog[27] = le_A_27;
-
 
385
    le_Analog[28] = le_A_28;
-
 
386
    le_Analog[29] = le_A_29;
-
 
387
    le_Analog[30] = le_A_30;
-
 
388
    le_Analog[31] = le_A_31;
355
}
389
}
Line 356... Line 390...
356
 
390
 
357
void MKTool::init_Plot()
391
void MKTool::init_Plot()
358
{
392
{
Line 414... Line 448...
414
        //le_TarLong->setText(ToolBox::get_Float((List[0].toDouble() * 10000000), 7));
448
        //le_TarLong->setText(ToolBox::get_Float((List[0].toDouble() * 10000000), 7));
415
        //le_TarLat->setText(ToolBox::get_Float((List[1].toDouble() * 10000000), 7));
449
        //le_TarLat->setText(ToolBox::get_Float((List[1].toDouble() * 10000000), 7));
416
    }
450
    }
417
}
451
}
Line 418... Line 452...
418
 
452
 
419
// Waypoint zur NC Senden.
-
 
420
//FIXME: put this in cpp/NaviCtrl.cpp?
453
// send waypoint to NaviCtrl.
421
void MKTool::slot_pb_SendTarget()
454
void MKTool::slot_pb_SendTarget()
422
{
455
{
423
    sNaviData navi = data->navi;
456
    sNaviData navi = data->navi;
424
    if ((navi.Current.Longitude == 0) && (navi.Current.Latitude == 0))
457
    if ((navi.Current.Longitude == 0) && (navi.Current.Latitude == 0))
Line 428... Line 461...
428
        msgB.setText(tr("Fehler: Es konnten keine GPS-Daten vom Mikrokopter empfangen werden"));
461
        msgB.setText(tr("Fehler: Es konnten keine GPS-Daten vom Mikrokopter empfangen werden"));
429
        msgB.exec();
462
        msgB.exec();
430
        return;
463
        return;
431
    }
464
    }
Line 432... Line 465...
432
 
465
 
433
    //erstelle einen Wegpunkt, den die NaviCtrl auswerten kann
466
    //create a waypoint that can be understood by NaviCtrl
434
    Waypoint_t desired_pos;
467
    Waypoint_t desired_pos;
Line 435... Line 468...
435
    bool ok_lat, ok_lon;
468
    bool ok_lat, ok_lon;
436
 
469
 
Line 437... Line 470...
437
    //eingegebene Daten holen
470
    //get data from QT-GUI
438
    double desired_long, desired_lat;
471
    double desired_long, desired_lat;
Line 444... Line 477...
444
        desired_long *= 10000000+0.5;
477
        desired_long *= 10000000+0.5;
Line 445... Line 478...
445
 
478
 
446
    if (ok_lat && desired_lat < 100)
479
    if (ok_lat && desired_lat < 100)
Line 447... Line 480...
447
        desired_lat *= 10000000+0.5;
480
        desired_lat *= 10000000+0.5;
448
 
481
 
449
    //fülle Wegpunkt-Daten
482
    //fill WayPoint struct
450
    desired_pos.Position.Altitude = 0;
483
    desired_pos.Position.Altitude = 0;
451
    desired_pos.Position.Longitude = int32_t(desired_long);
484
    desired_pos.Position.Longitude = int32_t(desired_long);
452
    desired_pos.Position.Latitude =  int32_t(desired_lat);
485
    desired_pos.Position.Latitude =  int32_t(desired_lat);
Line 458... Line 491...
458
    desired_pos.reserve[0] = 0; // reserve
491
    desired_pos.reserve[0] = 0; // reserve
459
    desired_pos.reserve[1] = 0; // reserve
492
    desired_pos.reserve[1] = 0; // reserve
460
    desired_pos.reserve[2] = 0; // reserve
493
    desired_pos.reserve[2] = 0; // reserve
461
    desired_pos.reserve[3] = 0; // reserve
494
    desired_pos.reserve[3] = 0; // reserve
Line 462... Line 495...
462
 
495
 
463
    //...und sende ihn an die NaviCtrl
496
    //...and send it to NaviCtrl
464
    int max_radius = 10000;
497
    int max_radius = 10000;
465
    if (ok_lat && ok_lon &&
498
    if (ok_lat && ok_lon &&
466
        abs((double)(navi.Current.Longitude - desired_pos.Position.Longitude)) < max_radius &&
499
        abs((double)(navi.Current.Longitude - desired_pos.Position.Longitude)) < max_radius &&
467
        abs((double)(navi.Current.Latitude  - desired_pos.Position.Latitude)) < max_radius)
500
        abs((double)(navi.Current.Latitude  - desired_pos.Position.Latitude)) < max_radius)
Line 675... Line 708...
675
    dlg_Motortest *f_Motortest = new dlg_Motortest(this);
708
    dlg_Motortest *f_Motortest = new dlg_Motortest(this);
Line 676... Line 709...
676
 
709
 
677
//    connect(f_Motortest, SIGNAL(updateMotor(int, int, int, int)), this, SLOT(slot_Motortest(int, int, int, int)));
710
//    connect(f_Motortest, SIGNAL(updateMotor(int, int, int, int)), this, SLOT(slot_Motortest(int, int, int, int)));
Line 678... Line -...
678
    connect(f_Motortest, SIGNAL(updateMotor(sMotor)), this, SLOT(slot_Motortest(sMotor)));
-
 
-
 
711
    connect(f_Motortest, SIGNAL(updateMotor(sMotor)), this, SLOT(slot_Motortest(sMotor)));
679
 
712
 
680
 
713
//FIXME: Move Ticker to libMK/QTCommunication.cpp
Line 681... Line 714...
681
    Ticker->setInterval(500);
714
//    Ticker->setInterval(500);
682
    TickerEvent[4] = true;
715
//    TickerEvent[4] = true;
683
 
716
 
Line 684... Line 717...
684
    if (f_Motortest->exec()==QDialog::Accepted)
717
    if (f_Motortest->exec()==QDialog::Accepted)
Line 685... Line 718...
685
    {
718
    {
686
    }
-
 
-
 
719
    }
687
 
720
 
688
    disconnect(f_Motortest, 0,0,0);
721
    disconnect(f_Motortest, 0,0,0);
689
 
722
 
Line 690... Line 723...
690
    handler->reset_motor();
723
    handler->reset_motor();
691
 
724
//FIXME: Move Ticker to libMK/QTCommunication.cpp
692
    Ticker->setInterval(2000);
725
//    Ticker->setInterval(2000);
Line 718... Line 751...
718
        f_LCD = new dlg_LCD(this);
751
        f_LCD = new dlg_LCD(this);
Line 719... Line 752...
719
 
752
 
720
        // LCD auf / ab
753
        // LCD auf / ab
721
        connect(f_LCD->pb_LCDup,   SIGNAL(clicked()), this, SLOT(slot_LCD_UP()));
754
        connect(f_LCD->pb_LCDup,   SIGNAL(clicked()), this, SLOT(slot_LCD_UP()));
722
        connect(f_LCD->pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN()));
-
 
723
        //FIXME: put this in libMK/Handler.cpp
755
        connect(f_LCD->pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN()));
724
        f_LCD->show();
756
        f_LCD->show();
725
        handler->show_lcd();
757
        handler->show_lcd();
726
        //FIXME: replace ticker with something else???
758
        //FIXME: replace ticker with something else???
727
        Ticker->setInterval(500);
759
        //Ticker->setInterval(500);
728
        TickerEvent[2] = true;
760
        //TickerEvent[2] = true;
729
    }
761
    }
Line 730... Line 762...
730
}
762
}
731
 
763
 
Line 985... Line 1017...
985
void MKTool::slot_ac_NoDebug() // DONE 0.71g
1017
void MKTool::slot_ac_NoDebug() // DONE 0.71g
986
{
1018
{
987
    if (ac_NoDebug->isChecked())
1019
    if (ac_NoDebug->isChecked())
988
    {
1020
    {
989
        lb_Status->setText(tr("DebugDaten abstellen."));
1021
        lb_Status->setText(tr("DebugDaten abstellen."));
-
 
1022
//FIXME: Move Ticker to libMK/QTCommunication.cpp
990
        TickerEvent[3] = false;
1023
//        TickerEvent[3] = false;
991
        handler->stop_all_debug();
1024
        handler->stop_all_debug();
992
    }
1025
    }
993
    else
1026
    else
994
    {
1027
    {
995
        // Wenn MK3MAG dann andauernd Daten neu anfragen.
1028
        // Wenn MK3MAG dann andauernd Daten neu anfragen.
996
//FIXME: TickerEvent in Communication oder so
1029
//FIXME: Move Ticker to libMK/QTCommunication.cpp
997
/*        if (Mode.ID == ADDRESS_MK3MAG)
1030
/*        if (Mode.ID == ADDRESS_MK3MAG)
998
            TickerEvent[3] = true;*/
1031
            TickerEvent[3] = true;*/
Line 999... Line 1032...
999
 
1032
 
1000
        if (ac_FastDebug->isChecked())
1033
        if (ac_FastDebug->isChecked())
Line 1187... Line 1220...
1187
//FIXME: Do we really need the ppm-channels if we change the page?
1220
//FIXME: Do we really need the ppm-channels if we change the page?
1188
// maybe this is a bug or the description on 
1221
// maybe this is a bug or the description on 
1189
// http://www.mikrokopter.com/ucwiki/en/SerialCommands
1222
// http://www.mikrokopter.com/ucwiki/en/SerialCommands
1190
// is WRONG!
1223
// is WRONG!
1191
            handler->get_ppm_channels();
1224
            handler->get_ppm_channels();
1192
 
-
 
-
 
1225
//FIXME: Move Ticker to libMK/QTCommunication.cpp
1193
            Ticker->setInterval(500);
1226
//            Ticker->setInterval(500);
1194
            TickerEvent[1] = true;
1227
//            TickerEvent[1] = true;
1195
        }
1228
        }
1196
        else
1229
        else
1197
        {
1230
        {
-
 
1231
//FIXME: Move Ticker to libMK/QTCommunication.cpp
1198
            Ticker->setInterval(2000);
1232
//            Ticker->setInterval(2000);
1199
            TickerEvent[1] = false;
1233
//            TickerEvent[1] = false;
1200
        }
1234
        }
1201
    }
1235
    }
1202
}
1236
}
Line 1203... Line 1237...
1203
 
1237
 
Line 1255... Line 1289...
1255
    Settings->TTY.Port = le_Port->text();
1289
    Settings->TTY.Port = le_Port->text();
1256
}
1290
}
Line 1257... Line 1291...
1257
 
1291
 
1258
void MKTool::show_DebugData()
1292
void MKTool::show_DebugData()
1259
{
1293
{
1260
//FIXME: log analogdata in Communication
1294
//FIXME: log analogdata in libMK/Communication.h or libMK/Parser.h
1261
/*    if (logger->is_active())
1295
/*    if (logger->is_active())
Line 1262... Line 1296...
1262
        logger->write(AnalogData);*/
1296
        logger->write(AnalogData);*/
1263
 
1297
 
Line 1274... Line 1308...
1274
 
1308
 
1275
        if ((tab_Main->currentWidget()->objectName() == QString("Tab_1")))
1309
        if ((tab_Main->currentWidget()->objectName() == QString("Tab_1")))
1276
            update_Plot();
1310
            update_Plot();
Line 1277... Line 1311...
1277
    }
1311
    }
1278
 
-
 
1279
//FIXME: get analogdata from handler
-
 
1280
/*
-
 
1281
    le_A_0->setText(QString("%1").arg(AnalogData[0]));
1312
 
1282
    le_A_1->setText(QString("%1").arg(AnalogData[1]));
-
 
1283
    le_A_2->setText(QString("%1").arg(AnalogData[2]));
-
 
1284
    le_A_3->setText(QString("%1").arg(AnalogData[3]));
-
 
1285
    le_A_4->setText(QString("%1").arg(AnalogData[4]));
-
 
1286
    le_A_5->setText(QString("%1").arg(AnalogData[5]));
-
 
1287
    le_A_6->setText(QString("%1").arg(AnalogData[6]));
1313
    //fill labels with analog values from data
1288
    le_A_7->setText(QString("%1").arg(AnalogData[7]));
1314
    for (int i = 0; i < 32; i++) {
1289
    le_A_8->setText(QString("%1").arg(AnalogData[8]));
-
 
1290
    le_A_9->setText(QString("%1").arg(AnalogData[9]));
-
 
1291
    le_A_10->setText(QString("%1").arg(AnalogData[10]));
-
 
1292
    le_A_11->setText(QString("%1").arg(AnalogData[11]));
-
 
1293
    le_A_12->setText(QString("%1").arg(AnalogData[12]));
-
 
1294
    le_A_13->setText(QString("%1").arg(AnalogData[13]));
-
 
1295
    le_A_14->setText(QString("%1").arg(AnalogData[14]));
-
 
1296
    le_A_15->setText(QString("%1").arg(AnalogData[15]));
-
 
1297
    le_A_16->setText(QString("%1").arg(AnalogData[16]));
-
 
1298
    le_A_17->setText(QString("%1").arg(AnalogData[17]));
-
 
1299
    le_A_18->setText(QString("%1").arg(AnalogData[18]));
-
 
1300
    le_A_19->setText(QString("%1").arg(AnalogData[19]));
-
 
1301
    le_A_20->setText(QString("%1").arg(AnalogData[20]));
-
 
1302
    le_A_21->setText(QString("%1").arg(AnalogData[21]));
-
 
1303
    le_A_22->setText(QString("%1").arg(AnalogData[22]));
-
 
1304
    le_A_23->setText(QString("%1").arg(AnalogData[23]));
-
 
1305
    le_A_24->setText(QString("%1").arg(AnalogData[24]));
-
 
1306
    le_A_25->setText(QString("%1").arg(AnalogData[25]));
-
 
1307
    le_A_26->setText(QString("%1").arg(AnalogData[26]));
-
 
1308
    le_A_27->setText(QString("%1").arg(AnalogData[27]));
-
 
1309
    le_A_28->setText(QString("%1").arg(AnalogData[28]));
-
 
1310
    le_A_29->setText(QString("%1").arg(AnalogData[29]));
-
 
1311
    le_A_30->setText(QString("%1").arg(AnalogData[30]));
1315
        le_Analog[i]->setText(QString("%1").arg(data->analogData[i]));
1312
    le_A_31->setText(QString("%1").arg(AnalogData[31]));
1316
    }
1313
 
1317
 
-
 
1318
    if ((data->mode.ID == ADDRESS_FC) && (FCSettings[P_GYRO_ACC_FAKTOR] > 0))
-
 
1319
    {
1314
    if ((Mode.ID == ADDRESS_FC) && (FCSettings[P_GYRO_ACC_FAKTOR] > 0))
1320
        //set battery
-
 
1321
        //TODO: save battery, compas and link quality directly in data (data->battery)
1315
    {
1322
        bar_UBAT->setValue(data->analogData[9]);
1316
        bar_UBAT->setValue(AnalogData[9]);
1323
        //link quality
1317
        bar_RX->setValue(AnalogData[10]);
1324
        bar_RX->setValue(data->analogData[10]);
Line 1318... Line 1325...
1318
 
1325
        //compas
1319
        Compass->setValue(AnalogData[8]);
1326
        Compass->setValue(data->analogData[8]);
Line 1320... Line 1327...
1320
 
1327
 
1321
        int Roll = (AnalogData[1] * FCSettings[P_GYRO_ACC_FAKTOR]) / 1024;
1328
        int Roll = (data->analogData[1] * FCSettings[P_GYRO_ACC_FAKTOR]) / 1024;
Line 1322... Line 1329...
1322
        int Nick = (AnalogData[0] * FCSettings[P_GYRO_ACC_FAKTOR]) / 1024;
1329
        int Nick = (data->analogData[0] * FCSettings[P_GYRO_ACC_FAKTOR]) / 1024;
1323
 
1330
 
Line 1324... Line 1331...
1324
        if (Roll > 128)
1331
        if (Roll > 128)
1325
            Roll = Roll - 255;
1332
            Roll = Roll - 255;
1326
 
1333
 
1327
        if (Nick > 128)
-
 
1328
            Nick = Nick - 255;
1334
        if (Nick > 128)
Line 1329... Line 1335...
1329
 
1335
            Nick = Nick - 255;
1330
        Attitude->setAngle(Roll);
1336
 
1331
        Attitude->setGradient(double(double(Nick) / 100.0));
1337
        Attitude->setAngle(Roll);