Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente | |||
apnee-outils [2019-02-21T19:09] oranginarouge remplacement du contenu par le bon + ajout application android |
— (Version actuelle) | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | Application externe | ||
- | =================== | ||
- | Il existe une application Android « [Apnea Lite](https://play.google.com/store/apps/details?id=ru.megazlo.apnea&hl=en_US) » qui propose des tables hypoxiques et hypercapniques ainsi que des tables carrées. Pour chaque table, il y a un décompte possible et la possibilité de la configurer : | ||
- | - Max perso, et pourcentage de ce max à prendre en compte pour fixer le max des exercices, | ||
- | - Durée des paliers fixes, | ||
- | - Temps des paliers variables au début et à la fin de l'exercice, | ||
- | - Durée totale de l'exercice, | ||
- | - Configuration de toutes les phases du carré, | ||
- | - Activation/désactivation des différents décomptes, | ||
- | - … | ||
- | Application personnel | ||
- | ===================== | ||
- | |||
- | N'ayant pas trouvé de chrono qui me satisfait, j'ai codé un petit script python qui fait ça. Vous pouvez même le lancer sur le téléphone avec [Qpython](http://www.qpython.com/). | ||
- | |||
- | #!/usr/bin/python3 | ||
- | #-*- coding: utf-8 -*- | ||
- | | ||
- | import time | ||
- | | ||
- | # configuration apnée | ||
- | cycles = 10 | ||
- | insp = 4 | ||
- | plein = 3 | ||
- | exp = 8 | ||
- | vide = 3 | ||
- | # configuration script | ||
- | tempo = 1 | ||
- | terminal = "d" #d=desktop, m=mobile, u=ubuntu | ||
- | | ||
- | # import selon terminal | ||
- | if terminal == "m": | ||
- | # https://github.com/qpython-android/qpython3/releases | ||
- | import androidhelper | ||
- | droid = androidhelper.Android() | ||
- | if terminal == "u": | ||
- | # https://pypi.org/project/progress/ | ||
- | import sys | ||
- | sys.path.append("/usr/local/lib/python2.7/dist-packages") | ||
- | from progress.bar import Bar | ||
- | | ||
- | # fonction d'affichage compteur selon terminal | ||
- | def progression(message, duree): | ||
- | if terminal == "d": | ||
- | print("\n-------------") | ||
- | print(message, duree, "\t", end='') | ||
- | for temps in range(duree): | ||
- | print(temps +1, " ", end='', flush=True) | ||
- | time.sleep(tempo) | ||
- | if terminal == "m": | ||
- | droid.vibrate(duration=200) | ||
- | print("\n-------------") | ||
- | print(message, duree, "\t") | ||
- | for temps in range(duree): | ||
- | print(temps +1) | ||
- | time.sleep(tempo) | ||
- | if terminal == "u": | ||
- | bar = Bar(message, max=duree) | ||
- | for i in range(duree): | ||
- | time.sleep(tempo) | ||
- | bar.next() | ||
- | bar.finish() | ||
- | | ||
- | # fonction d'affichage de la configuration | ||
- | def configuration(): | ||
- | print("________________________", | ||
- | "\nConfiguration actuelle :", | ||
- | "\n", cycles, "cycles", | ||
- | "\n inspiration :", insp, | ||
- | "- plein :", plein, | ||
- | "\n expiration :", exp, | ||
- | "- vide :", vide) | ||
- | print("Temps total :", | ||
- | cycles*(insp+plein+exp+vide)*tempo) | ||
- | | ||
- | # bandeau présentation | ||
- | print( | ||
- | " O ‘'’ O \n" | ||
- | "/¯\ |¯| |\| |¯ /¯\ ¯|¯ | |\/| |¯ |¯| o o o \n" | ||
- | "|¯| |¯ | | |¯ |¯| | | | | |¯ |¯\ ° ° ° \n" | ||
- | " ¯ ¯ ° : ° \n" ) | ||
- | | ||
- | # présentation configuration et démarrage | ||
- | configuration() | ||
- | reponse = input(">>> Démarrer ? <<< " | ||
- | "Ou indiquer 5 nombres pour changer la configuration.\n") | ||
- | if reponse: | ||
- | # conversion chaine de caractere en liste | ||
- | reponse = reponse.replace("."," ").replace(","," ").split() | ||
- | # conversion liste de chaine en liste d'entier | ||
- | reponse = [int(i) for i in reponse] | ||
- | if len(reponse) == 5: | ||
- | cycles = reponse[0] | ||
- | insp = reponse[1] | ||
- | plein = reponse[2] | ||
- | exp = reponse[3] | ||
- | vide = reponse[4] | ||
- | configuration() | ||
- | else: | ||
- | print("Mauvaise entrée. Conservation configuration par défaut.") | ||
- | | ||
- | # lancement cycles | ||
- | for cycle in range(cycles): | ||
- | print("\n=============\nCycle", cycle+1, "sur", cycles, end='') | ||
- | if terminal == "m": | ||
- | droid.vibrate(duration=400) | ||
- | progression("Inspiration ", insp) | ||
- | if plein: | ||
- | progression("Plein ", plein) | ||
- | progression("Expiration ", exp) | ||
- | if vide: | ||
- | progression("Vide ", vide) | ||
- | | ||
- | # licence | ||
- | """ | ||
- | LICENCE PUBLIQUE RIEN À BRANLER | ||
- | Version 1, mars 2009 | ||
- | | ||
- | Copyright (C) 2009 Sam Hocevar | ||
- | 14 rue de Plaisance, 75014 Paris, France | ||
- | | ||
- | La copie et la distribution de copies exactes de cette licence sont | ||
- | autorisées, et toute modification est permise à condition de changer | ||
- | le nom de la licence. | ||
- | | ||
- | CONDITIONS DE COPIE, DISTRIBUTON ET MODIFICATION | ||
- | DE LA LICENCE PUBLIQUE RIEN À BRANLER | ||
- | | ||
- | 0. Faites ce que vous voulez, j’en ai RIEN À BRANLER. | ||
- | """ | ||
- | | ||
- | # auteur | ||
- | """ | ||
- | Créateur initial : Orangina Rouge | ||
- | http://orangina-rouge.org | ||
- | """ |