Gtld recorder: различия между версиями

Материал из GTL-wiki
Перейти к навигации Перейти к поиску
Нет описания правки
Нет описания правки
 
(не показаны 2 промежуточные версии этого же участника)
Строка 1: Строка 1:
<code>
<pre>
let recorder = gtl.add_recorder(
let recorder = gtl.add_recorder(
{
{
Строка 6: Строка 6:
     gtl.analog_inputs[1]
     gtl.analog_inputs[1]
   ],
   ],
  "time" : 1,
   "prehistory" : 15.5,
   "prehistory" : 0.5,
 
  "comment" : "no comments",
  "dir" : "d:/",
  "file_name" : "record from script"
}
}
);
);


if(!recorder.is_success())
 
  gtl.diagnostic.stop();
 


recorder.finished.connect(
recorder.finished.connect(
Строка 25: Строка 22:
     gtl.free(recorder);
     gtl.free(recorder);


    gtl.diagnostic.stop();
    gtl.diagnostic.stop();
   }
   }
);
);




Строка 34: Строка 32:
function diagnose()
function diagnose()
{
{
  if(gtl.diagnostic.time > 2)
    recorder.start();


   else if(gtl.diagnostic.time > 5)
   gtl.log.info("time", recorder.time());
 
  if(gtl.diagnostic.time > 8 && !recorder.is_writing())
  {
    if(!recorder.start(10, "no comments", "E:/data/gtl", "record from script"))
      gtl.log.error("file", "error writing file");
 
  }
 
 
 
  if(gtl.diagnostic.time > 20)
   {
   {
     gtl.log.info("diagnostic", "stop");
     gtl.log.info("diagnostic", "stop");
    gtl.free(recorder);
     gtl.diagnostic.stop();
     gtl.diagnostic.stop();
   }
   }
}
}
</code>
</pre>

Текущая версия от 14:34, 16 января 2024

let recorder = gtl.add_recorder(
{
  "src":[
    gtl.analog_inputs[0],
    gtl.analog_inputs[1]
  ],
  "prehistory" : 15.5,

}
);




recorder.finished.connect(
  function()
  {

    gtl.log.info("file", "finished");

    gtl.free(recorder);

     gtl.diagnostic.stop();
  }
);



gtl.diagnostic.interval = .1;

function diagnose()
{

  gtl.log.info("time", recorder.time());

  if(gtl.diagnostic.time > 8 && !recorder.is_writing())
  {
    if(!recorder.start(10, "no comments", "E:/data/gtl", "record from script"))
      gtl.log.error("file", "error writing file");

  }



  if(gtl.diagnostic.time > 20)
  {
    gtl.log.info("diagnostic", "stop");

    gtl.free(recorder);

    gtl.diagnostic.stop();
  }



}