@@ -13,6 +13,9 @@ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Publ
1313Version 1-1-2016
1414Version 14-1-2016 sample0_us
1515Version 10-2-2017 1, 2, 3, 4 channels
16+ Version 10-2-2017 sampleA sampleB sampleABC sampleABCD to avoid mistakes
17+ all unsigned int -> int
18+ added stop()
1619
1720start ___|____________________________________|________
1821
@@ -44,6 +47,10 @@ void Scope::start(byte _channels, int _preSamples, unsigned int _recordLenght)
4447 if (abs (_preSamples) <= recordLenght) preSamples = _preSamples;
4548}
4649
50+ void Scope::stop ()
51+ { stopPtr = calcPtr (ptr+1 );
52+ }
53+
4754void Scope::show ()
4855{ unsigned long stop_us = micros (); // to avoid delay, start with this
4956 unsigned long usPerDiv = samples > 1 ? (stop_us - sample0_us)/(samples-1 ) : 0 ;
@@ -64,22 +71,22 @@ void Scope::show()
6471 stopPtr = 32767 ;
6572}
6673
67- void Scope::sample (int valueA) // 1 channel
74+ void Scope::sampleA (int valueA) // 1 channel
6875{ if (samplingOn)
6976 { ringBuffer.chA [ptr] = valueA;
7077 sampleControl ();
7178 }
7279}
7380
74- void Scope::sample (int valueA, int valueB) // 2 channels
81+ void Scope::sampleAB (int valueA, int valueB) // 2 channels
7582{ if (samplingOn)
7683 { ringBuffer.chAB [ptr][0 ] = valueA;
7784 ringBuffer.chAB [ptr][1 ] = valueB;
7885 sampleControl ();
7986 }
8087}
8188
82- void Scope::sample (int valueA, int valueB, int valueC) // 3 channels
89+ void Scope::sampleABC (int valueA, int valueB, int valueC) // 3 channels
8390{ if (samplingOn)
8491 { ringBuffer.chABC [ptr][0 ] = valueA;
8592 ringBuffer.chABC [ptr][1 ] = valueB;
@@ -88,7 +95,7 @@ void Scope::sample(int valueA, int valueB, int valueC) // 3 channels
8895 }
8996}
9097
91- void Scope::sample (int valueA, int valueB, int valueC, int valueD) // 4 channels
98+ void Scope::sampleABCD (int valueA, int valueB, int valueC, int valueD) // 4 channels
9299{ if (samplingOn)
93100 { ringBuffer.chABCD [ptr][0 ] = valueA;
94101 ringBuffer.chABCD [ptr][1 ] = valueB;
@@ -99,7 +106,7 @@ void Scope::sample(int valueA, int valueB, int valueC, int valueD) // 4 channels
99106}
100107
101108void Scope::sampleControl ()
102- { if (samples == 0 ) sample0_us = micros (); // doen werkt niet als er meerdere testen lopen
109+ { if (samples == 0 ) sample0_us = micros ();
103110 samples++;
104111 ptr = calcPtr (ptr+1 );
105112 if (ptr==stopPtr) show ();
@@ -123,7 +130,7 @@ void Scope::testBuffer()
123130{ start (1 );
124131 for (int i=0 ; i<25000 ; i++)
125132 { if (i==0 ) trigger ();
126- sample (i);
133+ sampleA (i);
127134 }
128135}
129136
0 commit comments