Ignore:
Timestamp:
07/26/16 17:28:43 (7 years ago)
Author:
Thomas Fuhrmann
Message:

Waypoints add and remove is working in GUI

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/mavlink/tools/Controller/Mavlink/src/Mavlink_test.cpp

    r47 r50  
    6565  add_wptGroupBox = new GroupBox(settingsTab->NewRow(), "Add waypoint");
    6666  latField = new DoubleSpinBox(add_wptGroupBox->NewRow(), "Latitude",
    67                                 -90, 90, 0.0001, 4, 3);
     67                                -90, 90, 0.001, 3, 3);
    6868  lonField = new DoubleSpinBox(add_wptGroupBox->LastRowLastCol(), "Longitude",
    69                                 -180, 180, 0.0001, 4, 3);
     69                                -180, 180, 0.001, 3, 3);
    7070  btn_add_mission_wpt = new PushButton(add_wptGroupBox->NewRow(), "Add mission wpt");
    7171  btn_add_entrance_wpt = new PushButton(add_wptGroupBox->LastRowLastCol(), "Add entrance wpt");
     
    135135  while (!ToBeStopped()) {
    136136    // Thread::Info("Debug: Mavlink acquisition loop\n");
    137     Thread::SleepMS(1000);
     137    Thread::SleepMS(500);
    138138    // latValue = latField->Value();
    139139    // lonValue = lonField->Value();
    140140       
    141         // Check the values of the buttons
    142         // First tab
    143141        if (btn_initialize->Clicked()) {
    144142                MissionInitialize();
     
    153151                MissionKill();
    154152    }
    155         // Second tab
    156153        if (btn_add_mission_wpt->Clicked()) {
    157       std::ostringstream stringStream;
    158       stringStream.precision(3);
    159       stringStream << fixed;
    160       stringStream << latField->Value() << " - " << lonField->Value();
    161                 list_mission_wpt->AddItem(stringStream.str());
     154                list_mission_wpt->AddItem(GetWptLatLon());
    162155    }
    163156        if (btn_add_entrance_wpt->Clicked()) {
    164                 EntranceWptAdd();
     157                list_entrance_wpt->AddItem(GetWptLatLon());
    165158    }
    166159        if (btn_add_exit_wpt->Clicked()) {
    167                 ExitWptAdd();
     160                list_exit_wpt->AddItem(GetWptLatLon());
    168161    }
    169162    if (btn_remove_mission_wpt->Clicked()) {
     
    275268  }
    276269  Thread::Info("Debug: end of decode loop\n");
     270}
     271
     272std::string Mavlink::GetWptLatLon() {
     273  std::ostringstream stringStream;
     274  stringStream.precision(3);
     275  stringStream << fixed;
     276  stringStream << latField->Value() << " - " << lonField->Value();
     277  return stringStream.str();
    277278}
    278279
Note: See TracChangeset for help on using the changeset viewer.