![](/media/cache/profiles/4b0986230d9d7aded7f0c24033d221d4.jpg.50x50_q85.jpg)
Programme de contrôle de l'octopode 4DOF, Theraphosa-Salconi.
CtrlBridge
- fonction quelquonque pour communiquer avec les module
- fonction quelquonque pour faire des recherche dans les module dispo
- autre fonction pour jouer avec MemRegistre
Version 1.2.0
- Ajout d'un mode de simulation pour tester le code avec seulement un contrôleur stm32
source/Task/TTaskCritique.cpp@31:ed23647fd16e, 2015-08-31 (annotated)
- Committer:
- salco
- Date:
- Mon Aug 31 13:36:39 2015 +0000
- Revision:
- 31:ed23647fd16e
- Parent:
- 29:51308764fdd0
- Child:
- 39:34d7802e8d15
reduc the #ifdef in TTaskCritique
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
salco | 3:e0d6e081a9d3 | 1 | |
salco | 7:dcfd81d7f93f | 2 | #include "TTaskCritique.h" |
salco | 3:e0d6e081a9d3 | 3 | |
salco | 7:dcfd81d7f93f | 4 | TTaskCritique::TTaskCritique(int priority):TTask(priority) |
salco | 3:e0d6e081a9d3 | 5 | { |
salco | 28:ac5c6350ed9a | 6 | debug(DEBUG_INIT_TASKCRITT, "\n\r Debut init"); |
salco | 19:0ac80045ba4c | 7 | //m_CtrlBridge = m_CtrlBridge->getInstance(); |
salco | 31:ed23647fd16e | 8 | |
salco | 31:ed23647fd16e | 9 | |
salco | 29:51308764fdd0 | 10 | m_CtrlBridge->initCom(); |
salco | 31:ed23647fd16e | 11 | /*#ifdef*/#ifndef DGB_FORCE_INIT |
salco | 31:ed23647fd16e | 12 | //m_CtrlBridge->initCom(); |
salco | 31:ed23647fd16e | 13 | //#else |
salco | 28:ac5c6350ed9a | 14 | do{ |
salco | 31:ed23647fd16e | 15 | //m_CtrlBridge->initCom(); |
salco | 15:91b3c572d9df | 16 | m_ListDesModules = m_CtrlBridge->findModule(0,0,0,0); //get all modules |
salco | 29:51308764fdd0 | 17 | |
salco | 29:51308764fdd0 | 18 | if(m_ListDesModules.size() != 11) //its a patch we need to delete it. |
salco | 29:51308764fdd0 | 19 | { |
salco | 29:51308764fdd0 | 20 | debug(DEBUG_INIT_TASKCRITT, "\n\r Init Fail"); |
salco | 29:51308764fdd0 | 21 | forceShutDown(false); |
salco | 29:51308764fdd0 | 22 | wait(1); |
salco | 29:51308764fdd0 | 23 | m_CtrlBridge->clearALL(); |
salco | 29:51308764fdd0 | 24 | forceShutDown(true); |
salco | 28:ac5c6350ed9a | 25 | } |
salco | 28:ac5c6350ed9a | 26 | }while(m_ListDesModules.size() != 11); |
salco | 29:51308764fdd0 | 27 | #endif |
salco | 15:91b3c572d9df | 28 | tymy=true; |
salco | 28:ac5c6350ed9a | 29 | debug(DEBUG_INIT_TASKCRITT, "\n\r Init Reussi"); |
salco | 3:e0d6e081a9d3 | 30 | } |
salco | 3:e0d6e081a9d3 | 31 | |
salco | 7:dcfd81d7f93f | 32 | TTaskCritique::~TTaskCritique() |
salco | 3:e0d6e081a9d3 | 33 | { |
salco | 15:91b3c572d9df | 34 | |
salco | 15:91b3c572d9df | 35 | // return; |
salco | 3:e0d6e081a9d3 | 36 | } |
salco | 15:91b3c572d9df | 37 | |
salco | 15:91b3c572d9df | 38 | void TTaskCritique::forceShutDown(bool offON) |
salco | 15:91b3c572d9df | 39 | { |
salco | 28:ac5c6350ed9a | 40 | DigitalOut pinA(PB_8); |
salco | 28:ac5c6350ed9a | 41 | DigitalOut pinB(PB_9); |
salco | 15:91b3c572d9df | 42 | |
salco | 15:91b3c572d9df | 43 | if(offON) { |
salco | 15:91b3c572d9df | 44 | pinA=1; |
salco | 28:ac5c6350ed9a | 45 | wait(1); |
salco | 15:91b3c572d9df | 46 | pinB=0; |
salco | 15:91b3c572d9df | 47 | } else { |
salco | 15:91b3c572d9df | 48 | pinA=0; |
salco | 28:ac5c6350ed9a | 49 | wait(1); |
salco | 15:91b3c572d9df | 50 | pinB=1; |
salco | 15:91b3c572d9df | 51 | } |
salco | 15:91b3c572d9df | 52 | } |
salco | 15:91b3c572d9df | 53 | |
salco | 15:91b3c572d9df | 54 | void TTaskCritique::criticalTreatment(char adresse) |
salco | 15:91b3c572d9df | 55 | { |
salco | 31:ed23647fd16e | 56 | debug("jello"); |
salco | 15:91b3c572d9df | 57 | //ici on debug et on traite le problemme// |
salco | 15:91b3c572d9df | 58 | forceShutDown(tymy); |
salco | 15:91b3c572d9df | 59 | tymy = !tymy; |
salco | 15:91b3c572d9df | 60 | } |
salco | 15:91b3c572d9df | 61 | |
salco | 7:dcfd81d7f93f | 62 | void TTaskCritique::task(void) |
salco | 3:e0d6e081a9d3 | 63 | { |
salco | 31:ed23647fd16e | 64 | |
salco | 31:ed23647fd16e | 65 | |
salco | 15:91b3c572d9df | 66 | //pas sur que c'Est tout ce qui doit etre ici mais je vois pas quoi d'autre pour le moment. |
salco | 15:91b3c572d9df | 67 | string flag,data; |
salco | 11:496453b45e25 | 68 | |
salco | 16:5ea4337d785f | 69 | flag.append(1,0);//0x02); |
salco | 15:91b3c572d9df | 70 | for(int i=0; i<m_ListDesModules.length(); ++i) |
salco | 15:91b3c572d9df | 71 | { |
salco | 27:ea60d12dccdf | 72 | wait_us(300); |
salco | 18:3f113f8441b2 | 73 | flag.clear(); |
salco | 27:ea60d12dccdf | 74 | flag.append(1,7); |
salco | 18:3f113f8441b2 | 75 | data.clear(); |
salco | 28:ac5c6350ed9a | 76 | debug(DEBUG_TASKCRITT,"\n\r result: %d",m_CtrlBridge->send(m_ListDesModules.at(i),flag,data)); |
salco | 15:91b3c572d9df | 77 | if(flag[0]== 0x02) |
salco | 18:3f113f8441b2 | 78 | criticalTreatment(m_ListDesModules.at(i)); |
salco | 15:91b3c572d9df | 79 | } |
salco | 15:91b3c572d9df | 80 | |
salco | 3:e0d6e081a9d3 | 81 | } |