Subversion Repositories DIN Is Noise

Rev

Rev 1971 | Rev 1976 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1970 jag 1
/*
2
* autopause.cc
3
* DIN Is Noise is copyright (c) 2006-2022 Jagannathan Sampath
4
* DIN Is Noise is released under GNU Public License 2.0
5
* For more information, please visit https://dinisnoise.org/
6
*/
7
 
8
#include "chrono.h"
9
#include "autopause.h"
10
#include "defvelaccel.h"
11
#include "autorotator.h"
1971 jag 12
#include "console.h"
1970 jag 13
 
14
autopauset::autopauset (defvelaccel& d) {
15
  yes = d.autos.pause.yes;
16
  every = d.autos.pause.every ();
17
  f0r = d.autos.pause.f0r ();
1974 jag 18
  settrigt (0, every);
19
  settrigt (1, f0r);
1970 jag 20
  t[0] = &every;
21
  t[1] = &f0r;
1974 jag 22
  /*vt[0] = &d.autos.pause.every;
23
  vt[1] = &d.autos.pause.f0r; */
1970 jag 24
  a = 0;
25
}
26
 
1974 jag 27
void autopauset::settrigt (int i, double& d) {
28
  alarmt& ai = alm[i];
29
  ai.triggert = d;
30
}
31
 
1970 jag 32
void autopauset::operator() (autorotator& ar) {
33
  alarmt &aa = alm[a];
34
  if (aa(ui_clk())) {
35
    aa.stop ();
36
    a = !a;
37
    double& ta = *t[a];
1974 jag 38
    //ta = (*vt[a])();
1970 jag 39
    if (a) ar.yes = 0; else ar.yes = 1;
40
    alarmt& nxt = alm[a];
41
    nxt.triggert = ta;
42
    nxt.start ();
43
  }
44
}
45
 
46
void autopauset::go () {
47
  a = 0;
48
  alm[a].start ();
49
}
1974 jag 50
 
51
void autopauset::setyes (int y, autorotator& ar) {
52
  yes = y;
53
  if (!yes && a) ar.setyes (1);
54
}