void T_TX_InterfaceSerPIC::putBackIntoCfg (SimpleXMLTransfer *config)/*{{{*/
{
#if DEBUG_TX_INTERFACE > 0
  std::cout << "T_TX_InterfaceSerPIC::putBackIntoCfg(SimpleXMLTransfer *config)" << std::endl;
#endif

  // Store the port settings
  T_TX_InterfaceSerial::putBackIntoCfg(config);

  // Store additional settings
  SimpleXMLTransfer *port = config->getChild(getXmlChildName() + ".port", true);
  port->setAttributeOverwrite ("sync", ucSyncByte);
  port->setAttributeOverwrite ("button_channel", iSPIC_ButtonChannel);
}
Beispiel #2
0
void T_Calibration::putBackIntoCfg(SimpleXMLTransfer* cfgfile)
{
#if DEBUG_TX_INTERFACE > 0
  printf("T_Calibration::putBackIntoCfg(cfg)\n");
  printf(" --> %s\n", child_in_cfg.c_str());
#endif
  int size;
  SimpleXMLTransfer* item;
  SimpleXMLTransfer* group;
  SimpleXMLTransfer* item2;

  item = cfgfile->getChild(child_in_cfg);
  group = item->getChild("calibration");
  group->setAttributeOverwrite("version", "2");

  // clean list
  size = group->getChildCount();
  for (int n = 0; n < size; n++)
  {
    item2 = group->getChildAt(0);
    group->removeChildAt(0);
    delete item2;
  }
  // create new list
  for (int n = 0; n < TX_MAXAXIS; n++)
  {
    item2 = new SimpleXMLTransfer();
    item2->setName("axis");
    item2->addAttribute("val_min", doubleToString(val_min[n]));
    item2->addAttribute("val_mid", doubleToString(val_mid[n]));
    item2->addAttribute("val_max", doubleToString(val_max[n]));
    group->addChild(item2);
  }
}
Beispiel #3
0
/** \brief Transfers all settings back to the config file.
 *
 *  The mixer settings will be stored in the same branch of the config
 *  file that they were read from on initialization.
 *
 *  \param config Pointer to the config file's SimpleXMLTransfer.
 */
void T_TX_Mixer::putBackIntoCfg(SimpleXMLTransfer* config)
{
#if DEBUG_TX_INTERFACE > 0
  printf("T_TX_Mixer::putBackIntoCfg(SimpleXMLTransfer* config)\n");
  printf(" --> %s\n", child_in_cfg.c_str());
#endif

  SimpleXMLTransfer* inter = config->getChild(child_in_cfg);
  SimpleXMLTransfer* mixer = inter->getChild("mixer");
  SimpleXMLTransfer* item;

  mixer->setAttributeOverwrite("enabled", enabled);
  mixer->setAttributeOverwrite("dr_enabled", dr_enabled);

  item = mixer->getChild(Global::inputDev->AxisStringsXML[T_AxisMapper::AILERON], true);
  item->setAttributeOverwrite("trim",  doubleToString(trim_val[T_AxisMapper::AILERON]));
  item->setAttributeOverwrite("nrate", doubleToString(nrate_val[T_AxisMapper::AILERON]));
  item->setAttributeOverwrite("srate", doubleToString(srate_val[T_AxisMapper::AILERON]));
  item->setAttributeOverwrite("exp",   doubleToString(exp_val[T_AxisMapper::AILERON]));

  item = mixer->getChild(Global::inputDev->AxisStringsXML[T_AxisMapper::ELEVATOR], true);
  item->setAttributeOverwrite("trim",  doubleToString(trim_val[T_AxisMapper::ELEVATOR]));
  item->setAttributeOverwrite("nrate", doubleToString(nrate_val[T_AxisMapper::ELEVATOR]));
  item->setAttributeOverwrite("srate", doubleToString(srate_val[T_AxisMapper::ELEVATOR]));
  item->setAttributeOverwrite("exp",   doubleToString(exp_val[T_AxisMapper::ELEVATOR]));

  item = mixer->getChild(Global::inputDev->AxisStringsXML[T_AxisMapper::RUDDER], true);
  item->setAttributeOverwrite("trim",  doubleToString(trim_val[T_AxisMapper::RUDDER]));
  item->setAttributeOverwrite("nrate", doubleToString(nrate_val[T_AxisMapper::RUDDER]));
  item->setAttributeOverwrite("srate", doubleToString(srate_val[T_AxisMapper::RUDDER]));
  item->setAttributeOverwrite("exp",   doubleToString(exp_val[T_AxisMapper::RUDDER]));

  item = mixer->getChild(Global::inputDev->AxisStringsXML[T_AxisMapper::FLAP], true);
  item->setAttributeOverwrite("trim",    doubleToString(trim_val[T_AxisMapper::FLAP]));
  item->setAttributeOverwrite("mtravel", doubleToString(mtravel_val[T_AxisMapper::FLAP]));
  item->setAttributeOverwrite("ptravel", doubleToString(ptravel_val[T_AxisMapper::FLAP]));
  
  for (int i = 0; i < T_TX_Mixer::NUM_MIXERS; i++)
  {
    item = mixer->getChild(Global::inputDev->MixerStringsXML[i], true);
    item->setAttributeOverwrite("enabled", mixer_enabled[i]);
    item->setAttributeOverwrite("src", mixer_src[i]);
    item->setAttributeOverwrite("dst", mixer_dst[i]);
    item->setAttributeOverwrite("val", doubleToString(mixer_val[i]));
  }
}