Changeset 695 for BAORadio/libindi/libindi/BAOcontrol/baoqt.cpp
- Timestamp:
- Sep 28, 2012, 2:14:03 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BAORadio/libindi/libindi/BAOcontrol/baoqt.cpp
r693 r695 10 10 ui(new Ui::BAOqt) 11 11 { 12 13 QPoint pointPos;12 13 QPoint pointPos; 14 14 15 15 RechercheOptimisation = false; … … 95 95 96 96 #ifdef JOYSTICK 97 97 98 98 joystick = new Joystick(); 99 99 100 100 if (joystick) 101 101 { 102 if (!joystick->init())103 {104 105 106 107 108 109 }110 } 111 102 if (!joystick->init()) 103 { 104 delete joystick; 105 106 joystick = NULL; 107 108 QMessageBox::information(this, tr("Jostick"), tr("Joystick inaccessible. Verifiez que le recepteur est bien branche sur un port USB.")); 109 } 110 } 111 112 112 #endif 113 113 114 //ui->lineEditIP->setText("127.0.0.1");115 ui->lineEditIP->setText("134.158.88.199");116 114 ui->lineEditIP->setText("127.0.0.1"); 115 //ui->lineEditIP->setText("134.158.88.199"); 116 117 117 ui->lineEdit_2->setText((QString("BAORadio, LAL, version ").append(VERSION)).toStdString().c_str()); 118 118 … … 126 126 127 127 ui->pushButton1x->setDown(false); 128 128 129 129 ui->pushButton10x->setDown(true); 130 130 … … 292 292 293 293 #ifdef JOYSTICK 294 294 295 295 joy++; 296 296 … … 576 576 void BAOqt::on_pushButton1pt_clicked() 577 577 { 578 static int etape = 1; 579 580 RechercheOptimisation = false; 581 582 switch (etape) 583 { 584 case 1: 585 { 586 etape=2; 587 588 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Choisissez un objet facile a pointer")); 589 590 on_pushButtonGoto_clicked(); 591 592 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Attendez la fin du pointage. Centrez l'objet dans le viseur et rappuyez sur le bouton 'alignement 1pt' pour terminer.")); 593 594 }; 595 break; 596 597 case 2: 598 { 599 etape=1; 600 601 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Annulation du mouvement en cours.")); 602 603 bao->Abort(); 604 605 sleep(1); 606 607 string str = bao->DecodageEntreesUtilisateur("send X"); 608 609 string str2; 610 611 int x = 0; 612 int y = 0; 613 614 char a1='b'; 615 char a2='b'; 616 617 size_t pos = str.find("/"); 618 619 if (pos != string::npos) 620 { 621 str2 = str.substr(pos + 1); 622 623 pos = str2.find("/"); 624 625 if (pos != string::npos) 626 { 627 x = atol( str2.substr(0, pos).c_str() ); 628 629 y = atol( str2.substr(pos + 1).c_str() ); 630 } 631 } 632 633 sleep(1); 634 635 str = bao->DecodageEntreesUtilisateur("send D"); 636 637 int dx = 0; 638 int dy = 0; 639 640 pos = str.find("/"); 641 642 if (pos != string::npos) 643 { 644 str2 = str.substr(pos + 1); 645 646 pos = str2.find("/"); 647 648 if (pos != string::npos) 649 { 650 dx = atol( str2.substr(0, pos).c_str() ); 651 652 x -= dx; 653 654 dy = atol( str2.substr(pos + 1).c_str() ); 655 656 y -= dy; 657 658 if ( x < 0 ) { 659 a1 = 'f'; 660 x = -x; 661 } 662 663 if ( y < 0 ) { 664 a2 = 'f'; 665 y = -y; 666 } 667 668 char chaine[100]; 669 670 sprintf(chaine, "send g%c%04df0000", a1, x); 671 672 str = bao->DecodageEntreesUtilisateur(string(chaine)); 673 674 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Attendez la fin du mouvement avant de cliquer sur OK.")); 675 676 677 sprintf(chaine, "send gf0000%c%04d", a2, y); 678 679 str = bao->DecodageEntreesUtilisateur(string(chaine)); 680 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Appuyez sur les deux boutons places dans la boite de l'antenne.")); 681 682 QMessageBox::StandardButton reply; 683 684 reply = QMessageBox::question(this, tr("Alignement 1pt de l antenne"), 685 "Voulez-vous reinitialiser les codeurs de l'antenne en envoyant la c ommande Park ?", 686 QMessageBox::Yes | QMessageBox::No ); 687 688 if (reply == QMessageBox::Yes) 689 { 690 691 str = bao->DecodageEntreesUtilisateur("send z"); 692 693 sleep(1); 694 695 str = bao->DecodageEntreesUtilisateur("send p"); 696 } 697 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Fin de la procedure.")); 698 } 699 } 700 } 701 break; 702 } 578 RechercheOptimisation = false; 579 580 bao->DecodageEntreesUtilisateur("send r"); 581 582 583 /* 584 static int etape = 1; 585 586 RechercheOptimisation = false; 587 588 switch (etape) 589 { 590 case 1: 591 { 592 etape=2; 593 594 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Choisissez un objet facile a pointer")); 595 596 on_pushButtonGoto_clicked(); 597 598 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Attendez la fin du pointage. Centrez l'objet dans le viseur et rappuyez sur le bouton 'alignement 1pt' pour terminer.")); 599 600 }; 601 break; 602 603 case 2: 604 { 605 etape=1; 606 607 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Annulation du mouvement en cours.")); 608 609 bao->Abort(); 610 611 sleep(1); 612 613 string str = bao->DecodageEntreesUtilisateur("send X"); 614 615 string str2; 616 617 int x = 0; 618 int y = 0; 619 620 char a1='b'; 621 char a2='b'; 622 623 size_t pos = str.find("/"); 624 625 if (pos != string::npos) 626 { 627 str2 = str.substr(pos + 1); 628 629 pos = str2.find("/"); 630 631 if (pos != string::npos) 632 { 633 x = atol( str2.substr(0, pos).c_str() ); 634 635 y = atol( str2.substr(pos + 1).c_str() ); 636 } 637 } 638 639 sleep(1); 640 641 str = bao->DecodageEntreesUtilisateur("send D"); 642 643 int dx = 0; 644 int dy = 0; 645 646 pos = str.find("/"); 647 648 if (pos != string::npos) 649 { 650 str2 = str.substr(pos + 1); 651 652 pos = str2.find("/"); 653 654 if (pos != string::npos) 655 { 656 dx = atol( str2.substr(0, pos).c_str() ); 657 658 x -= dx; 659 660 dy = atol( str2.substr(pos + 1).c_str() ); 661 662 y -= dy; 663 664 if ( x < 0 ) { 665 a1 = 'f'; 666 x = -x; 667 } 668 669 if ( y < 0 ) { 670 a2 = 'f'; 671 y = -y; 672 } 673 674 char chaine[100]; 675 676 sprintf(chaine, "send g%c%04df0000", a1, x); 677 678 str = bao->DecodageEntreesUtilisateur(string(chaine)); 679 680 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Attendez la fin du mouvement avant de cliquer sur OK.")); 681 682 683 sprintf(chaine, "send gf0000%c%04d", a2, y); 684 685 str = bao->DecodageEntreesUtilisateur(string(chaine)); 686 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Appuyez sur les deux boutons places dans la boite de l'antenne.")); 687 688 QMessageBox::StandardButton reply; 689 690 reply = QMessageBox::question(this, tr("Alignement 1pt de l antenne"), 691 "Voulez-vous reinitialiser les codeurs de l'antenne en envoyant la c ommande Park ?", 692 QMessageBox::Yes | QMessageBox::No ); 693 694 if (reply == QMessageBox::Yes) 695 { 696 697 str = bao->DecodageEntreesUtilisateur("send z"); 698 699 sleep(1); 700 701 str = bao->DecodageEntreesUtilisateur("send p"); 702 } 703 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Fin de la procedure.")); 704 } 705 } 706 } 707 break; 708 } 709 710 711 */ 703 712 } 704 713 … … 786 795 void BAOqt::on_pushButtonRetryGoto_clicked() 787 796 { 788 RechercheOptimisation = true;789 790 797 RechercheOptimisation = false; 791 798
Note: See TracChangeset
for help on using the changeset viewer.