This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added extrapolation of the last received stackmat signal. Released
fskube-android 0.0.4.
- Loading branch information
Showing
9 changed files
with
1,094 additions
and
757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import time | ||
import unittest | ||
|
||
import fskube | ||
import FskTest | ||
|
||
SAMPLE_RATE = 8000 | ||
|
||
class ExtrapolationTest(FskTest.FskTest): | ||
def test(self): | ||
stackmatSythesizer = fskube.StackmatSynthesizer() | ||
|
||
rs232Synthesizer = fskube.Rs232Synthesizer() | ||
|
||
analogizer = fskube.Analogizer() | ||
analogizer.setSamplesPerSecond(SAMPLE_RATE) | ||
analogizer.setBitsPerSecond(1200) | ||
|
||
sampler = self.createCapturer(fskube.doubleReceiver) | ||
|
||
stackmatSythesizer.connect(rs232Synthesizer) | ||
rs232Synthesizer.connect(analogizer) | ||
analogizer.connect(sampler) | ||
|
||
fskube.fskube_initialize(SAMPLE_RATE) | ||
|
||
# Send two states with incrementing times to simulate a running stackmat. | ||
# We only extrapolate the signal when we think that the timer is running. | ||
state = fskube.StackmatState() | ||
state.millis = 40 | ||
stackmatSythesizer.receive(state) | ||
state.millis = 500 | ||
stackmatSythesizer.receive(state) | ||
for sample in sampler.data: | ||
fskube.fskube_addSample(sample) | ||
|
||
# Stop sending signals. Wait a little while, and verify that the signal | ||
# is extrapolated. | ||
lastSignalMillis = fskube.fskube_getState().millis | ||
sleepSecs = 1 | ||
time.sleep(sleepSecs) | ||
currentSignalMillis = fskube.fskube_getState().millis | ||
self.assertGreaterEqual(currentSignalMillis, lastSignalMillis + sleepSecs*1000) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |