Example #1
0
def main():
    initialized = False
    storage = None

    # Init the Concept2
    #
    #ErgStats.connectToErg()

    #this waits for workouts to start, then stores them into a SQLite DB
    print("Waiting for workout to start...")
    while True:
        try:
            isActive = ErgStats.isWorkoutActive()
        except:
            print("Connecting to Ergometer...")
            ErgStats.connectToErg()
            time.sleep(1)
            continue

        if not isActive:
            if initialized:  #this checks if workout was active before
                print("Workout ended...")
                ErgStats.resetStatistics()
                storage = None
                initialized = False
        else:
            if not initialized:
                print("Workout started...")
                storage = SQLiteStorage()
                initialized = True
            ErgStats.update()
            storage.storeState(ErgStats.time)
Example #2
0
 def __init__(self):
     self.boats = []
     self.position = 0.0
     self.storage = SQLiteStorage() #needed to store the current workout to file (needed for ghosting)
Example #3
0
 def __init__(self, name, filename, distance=0):
     super(BoatGhost, self).__init__(name, distance)
     self.storage = SQLiteStorage(filename)