Changeset 38 in flair-src for trunk/lib/FlairSensorActuator/src
- Timestamp:
- Jun 23, 2016, 10:15:30 AM (9 years ago)
- Location:
- trunk/lib/FlairSensorActuator/src
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSensorActuator/src/TargetController.cpp
r15 r38 34 34 namespace sensor { 35 35 36 TargetController::TargetController(const FrameworkManager *parent, string name,37 uint8_t priority)38 : Thread(parent, name, priority), IODevice(parent, name) {39 main_tab = new Tab(getFrameworkManager()->GetTabWidget(),name);40 TabWidget *tab = new TabWidget(main_tab->NewRow(), name);41 setup_tab = new Tab(tab, "Reglages");36 TargetController::TargetController(const FrameworkManager* parent,string name,uint8_t priority) : 37 Thread(parent,name,priority),IODevice(parent,name) { 38 main_tab=new Tab(getFrameworkManager()->GetTabWidget(),name); 39 TabWidget* tab=new TabWidget(main_tab->NewRow(),name); 40 setup_tab=new Tab(tab,"Reglages"); 41 SetPeriodMS(20);; //50Hz 42 42 } 43 43 … … 150 150 } 151 151 } 152 } else {153 // Thread::Info("Debug: relax...\n");154 usleep(20000); // 20ms155 152 } 153 WaitPeriod(); 156 154 } 157 155 } -
trunk/lib/FlairSensorActuator/src/TargetEthController.cpp
r15 r38 80 80 bool fullDatagramReceived = false; 81 81 82 do {83 received =84 dataSocket->RecvMessage(receiveFrameBuffer + receiveCurrentPosition,85 bytesToReceive, TIME_NONBLOCK);86 if (received > 0) {87 bytesToReceive -= received;88 if (bytesToReceive == 0) {89 // a full datagram has been read in receiveFrameBuffer90 fullDatagramReceived = true;91 receiveCurrentPosition = 0;92 // we swap the data and reception buffers to avoid copy93 char *swapFrameBuffer = dataFrameBuffer;94 dataFrameBuffer = receiveFrameBuffer;95 receiveFrameBuffer = swapFrameBuffer;96 }97 }98 } while (!received < 0);82 do { 83 received=dataSocket->RecvMessage(receiveFrameBuffer+receiveCurrentPosition,bytesToReceive,TIME_NONBLOCK); 84 if (received>0) { 85 receiveCurrentPosition+=received; 86 bytesToReceive-=received; 87 if (bytesToReceive==0) { 88 //a full datagram has been read in receiveFrameBuffer 89 fullDatagramReceived=true; 90 //we swap the data and reception buffers to avoid copy 91 char *swapFrameBuffer=dataFrameBuffer; 92 dataFrameBuffer=receiveFrameBuffer; 93 receiveFrameBuffer=swapFrameBuffer; 94 receiveCurrentPosition=0; 95 bytesToReceive=dataFrameSize; 96 } 97 } 98 } while (!(received<0)); 99 99 100 100 return fullDatagramReceived;
Note:
See TracChangeset
for help on using the changeset viewer.