aboutsummaryrefslogtreecommitdiff
path: root/funcGenerator.py
diff options
context:
space:
mode:
Diffstat (limited to 'funcGenerator.py')
-rw-r--r--funcGenerator.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/funcGenerator.py b/funcGenerator.py
index 54a3b1b..cd33f0b 100644
--- a/funcGenerator.py
+++ b/funcGenerator.py
@@ -72,6 +72,15 @@ class SawGen(RampGen):
if sweeper.getRelPos() < self.duty_cycle:
return self.start + sweeper.getRelPos()/self.duty_cycle*(self.stop - self.start)
return self.start + (1-sweeper.getRelPos())/(1-self.duty_cycle)*(self.stop - self.start)
+ def getSweepDirection(self, sweeper = None):
+ if sweeper is None and self.sweeper is None:
+ print("Error: generator needs sweeper")
+ return 0
+ if sweeper is None:
+ sweeper = self.sweeper
+ if sweeper.getRelPos() < self.duty_cycle:
+ return 1; # increasing value direction
+ return 0; # decreasing value direction
class TriangleGen(SawGen):
# monotonically goes from start to stop, once reaches stop goes back to start