Changeset 455 in flair-src for trunk


Ignore:
Timestamp:
Oct 4, 2021, 10:03:51 AM (3 years ago)
Author:
Sanahuja Guillaume
Message:

gcs: add compatibility with programs without nb_buffering

Location:
trunk/tools/FlairGCS/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/FlairGCS/src/DataRemote.cpp

    r444 r455  
    1616  receivesize = 0;
    1717  refresh_rate = (double)period / 1000.;
    18   this->nb_buffering=nb_buffering;
     18   
     19   //flair programs without nb buffering have nb_buffering=0, set it to 1 for compatibility
     20    if(nb_buffering==0) {
     21        this->nb_buffering=1;
     22        nbBufferingCompatible=false;
     23    } else {
     24        this->nb_buffering=nb_buffering;
     25        nbBufferingCompatible=true;
     26    }
     27 
    1928 
    2029  connectionLayout()->addDataRemote(this);
     
    3746  setRefreshRate->setEnabled(auto_refresh);
    3847 
    39   menu->addSeparator();
    40   setNbBuffering = menu->addAction(QString("set nb buffering (%1)").arg(nb_buffering));
     48  //flair programs without nb buffering have nb_buffering=0
     49  if(nbBufferingCompatible) {
     50      menu->addSeparator();
     51      setNbBuffering = menu->addAction(QString("set nb buffering (%1)").arg(nb_buffering));
     52  }
    4153 
    4254/*  menu->addSeparator();
     
    5264
    5365  action = menu->exec(point);
    54 
     66    if(action==NULL) return action;//setNbBuffering can also be null if in compatibility mode
     67   
    5568  if (action == SetAutoRefresh) {
    5669    SendPeriod(RefreshRate_ms(), SetAutoRefresh->isChecked());
     
    113126void DataRemote::XmlSetup(QDomElement *dom) {
    114127  refresh_rate = dom->attribute("period").toUShort() / 1000.;
    115   nb_buffering = dom->attribute("nb_buf").toUShort();
     128  if(nbBufferingCompatible) nb_buffering = dom->attribute("nb_buf").toUShort();
     129 
    116130  if (dom->attribute("enabled") == "1")
    117131    auto_refresh = true;
  • trunk/tools/FlairGCS/src/DataRemote.h

    r444 r455  
    3838  uint16_t nb_buffering;
    3939  QAction *SetAutoRefresh, *setRefreshRate,*setNbBuffering;
     40  bool nbBufferingCompatible;
    4041  //QAction **log;//todo implement this feature (log directly in gcs, in case of uav program crash)
    4142};
  • trunk/tools/FlairGCS/src/Layout.cpp

    r437 r455  
    160160    uint16_t period = dom->attribute("period").toUShort();
    161161    uint16_t nb_buffering = dom->attribute("nb_buf").toUShort();
     162    if(period==0) period=100;
    162163    if (enabled == 1) {
    163164      widget = new DataPlot1D(this, row, col, name, ymin, ymax, true, period,nb_buffering);
    164165    } else {
    165       widget = new DataPlot1D(this, row, col, name, ymin, ymax, false, 100,nb_buffering);
     166      widget = new DataPlot1D(this, row, col, name, ymin, ymax, false, period,nb_buffering);
    166167    }
    167168  }
     
    176177    uint16_t period = dom->attribute("period").toUShort();
    177178    uint16_t nb_buffering = dom->attribute("nb_buf").toUShort();
     179    if(period==0) period=100;
    178180    if (enabled == 1) {
    179181      widget = new DataPlot2D(this, row, col, name, x_name, y_name, xmin, xmax,
     
    181183    } else {
    182184      widget = new DataPlot2D(this, row, col, name, x_name, y_name, xmin, xmax,
    183                               ymin, ymax, false, 100,nb_buffering);
     185                              ymin, ymax, false, period,nb_buffering);
    184186    }
    185187  }
     
    192194    QString type = dom->attribute("type");
    193195    int samples = dom->attribute("samples").toInt();
     196    if(period==0) period=100;
    194197    if (enabled == 1) {
    195198      widget = new UsSensorPlot(this, row, col, name, y_name,
     
    197200    } else {
    198201      widget = new UsSensorPlot(this, row, col, name,  y_name,
    199                               ymin, ymax, samples,type,false, 100);
     202                              ymin, ymax, samples,type,false, period);
    200203    }
    201204  }
     
    220223      invert_axis_bool = true;
    221224    }
     225    if(period==0) period=100;
    222226    if (enabled == 1) {
    223227      widget =
     
    229233          new RangeFinderPlot(this, row, col, name, x_name, y_name, xmin, xmax,
    230234                              ymin, ymax, start_angle, end_angle, nb_samples,
    231                               data_type, invert_axis, false, 100);
     235                              data_type, invert_axis, false, period);
    232236    }
    233237  }
     
    237241    int enabled = dom->attribute("enabled").toInt();
    238242    uint16_t period = dom->attribute("period").toUShort();
     243    if(period==0) period=100;
    239244    if (enabled == 1) {
    240245      widget = new Picture(this, row, col, name, width, height, true, period);
     
    257262      i++;
    258263    }
    259 
     264    if(period==0) period=100;
    260265    if (enabled == 1) {
    261266      widget = new Map(this, row, col, name, coordinates, true, period);
Note: See TracChangeset for help on using the changeset viewer.