Changeset 2384 for trunk/MagicSoft/Cosy/main
- Timestamp:
- 10/15/03 17:28:35 (21 years ago)
- Location:
- trunk/MagicSoft/Cosy/main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/main/MCosy.cc
r2278 r2384 18 18 19 19 #include "MGCosy.h" 20 #include "MDriveCom.h" 20 21 #include "MStarguider.h" 21 22 #include "SlaStars.h" … … 52 53 53 54 #define EXPERT 55 //#undef EXPERT 54 56 55 57 double MCosy::Rad2SE(double rad) const … … 296 298 return; 297 299 298 SetStatus(M Cosy::kMoving);300 SetStatus(MDriveCom::kMoving); 299 301 300 302 if (axe1) fMac2->StartRelPos(rd.Zd()); … … 364 366 if (!HasError()) 365 367 { 366 SetStatus(M Cosy::kStopped);368 SetStatus(MDriveCom::kStopped); 367 369 return; 368 370 } … … 371 373 // If there is an error, the error status is set to Error. 372 374 // 373 SetStatus(M Cosy::kError);375 SetStatus(MDriveCom::kError); 374 376 375 377 /* … … 391 393 // Set motor status to stopped 392 394 // 393 SetStatus(M Cosy::kStopped);395 SetStatus(MDriveCom::kStopped); 394 396 */ 395 397 } … … 471 473 472 474 int i; 473 for (i=0; i< 10&& !(Break() || HasError() || HasZombie()); i++)475 for (i=0; i<(track?1:10) && !(Break() || HasError() || HasZombie()); i++) 474 476 { 475 477 … … 511 513 t.Now(); 512 514 lout << t << " - Positioning done in " << i << (i==1?" step.":" steps.") << endl; 513 SetStatus(M Cosy::kStopped);515 SetStatus(MDriveCom::kStopped); 514 516 return TRUE; 515 517 } … … 560 562 fMac2->SetAcceleration(0.4*vr);// 0.4 561 563 fMac2->SetDeceleration(0.4*vr);// 0.4 562 SetPosVelocity(fabs(rd.Ratio()), 0.2); // 0.175564 SetPosVelocity(fabs(rd.Ratio()), 0.2); // fast: 0.6, slow: 0.2 563 565 #else 564 566 fMac2->SetAcceleration(0.2*vr); … … 592 594 StopMovement(); 593 595 else 594 SetStatus(M Cosy::kStopped);596 SetStatus(MDriveCom::kStopped); 595 597 596 598 t.Now(); … … 662 664 return false; 663 665 664 SetStatus(M Cosy::kMoving | MCosy::kTracking);666 SetStatus(MDriveCom::kMoving | MDriveCom::kTracking); 665 667 666 668 fMac2->SetRpmMode(TRUE); … … 1042 1044 // Set status to Stopping 1043 1045 // 1044 SetStatus(M Cosy::kStopping);1046 SetStatus(MDriveCom::kStopping); 1045 1047 1046 1048 // … … 1095 1097 // Set status to Stopping 1096 1098 // 1097 SetStatus(M Cosy::kStopping);1099 SetStatus(MDriveCom::kStopping); 1098 1100 1099 1101 // … … 1281 1283 return (void*)0x7777; 1282 1284 1285 case WM_POSITION1: 1286 cout << "WM_Position1: start." << endl; 1287 { 1288 if (!CheckNetwork()) 1289 return (void*)0xebb0; 1290 1291 ZdAz dest = *((ZdAz*)mp); 1292 SetPosition(dest*kDeg2Rad, kTRUE); 1293 } 1294 cout << "WM_Position: done. (return 0x7777)" << endl; 1295 return (void*)0x7777; 1296 1283 1297 case WM_TESTSE: 1284 1298 cout << "WM_TestSe: start." << endl; … … 1341 1355 TEnv env(".cosyrc"); 1342 1356 1343 SetStatus(M Cosy::kMoving);1357 SetStatus(MDriveCom::kMoving); 1344 1358 1345 1359 fMac1->SetHome(250000, env.GetValue("Az_MaxTime2ReachHome[s]", 100)); … … 1348 1362 lout << "SETHOME DONE" << endl; 1349 1363 1350 SetStatus(HasError() ? M Cosy::kError : MCosy::kStopped);1364 SetStatus(HasError() ? MDriveCom::kError : MDriveCom::kStopped); 1351 1365 1352 1366 fAz->SetPreset(); … … 1833 1847 1834 1848 if (HasError()) 1835 SetStatus(M Cosy::kError);1849 SetStatus(MDriveCom::kError); 1836 1850 1837 1851 lout.UpdateGui(); … … 1849 1863 DisplayHistGear(!trigger); 1850 1864 1865 // FIXME: Not thread safe! 1866 static int i=0; 1867 if (i++==8) 1868 { 1869 fCom->SendReport(fStatus, fRaDec, fZdAzSoll, bendist, fTrackingError); 1870 i=0; 1871 } 1851 1872 return kTRUE; 1852 1873 } … … 2103 2124 2104 2125 MCosy::MCosy(int mode, const char *dev, const int baud, MLog &out) 2105 : Network(dev, baud, out), fObservatory(MObservatory::kMagic1), fStarguider(NULL), fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), fMac3(0), fBackground(kBgdNone), fStatus( kStopped)2126 : Network(dev, baud, out), fObservatory(MObservatory::kMagic1), fStarguider(NULL), fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), fMac3(0), fBackground(kBgdNone), fStatus(MDriveCom::kStopped) 2106 2127 { 2107 2128 TEnv env(".cosyrc"); … … 2158 2179 *tpout << /*"20 1013.25 300 0.5 0.55 0.0065" <<*/ endl; 2159 2180 // temp(°C) pressure(mB) height(m) humidity(1) wavelength(microm) troplapserate(K/m) 2181 2182 fCom = new MDriveCom(out); 2183 fCom->Start(); 2160 2184 } 2161 2185 … … 2189 2213 2190 2214 delete fUpdateGui; 2215 delete fCom; 2191 2216 2192 2217 cout << "Deleting Nodes." << endl; -
trunk/MagicSoft/Cosy/main/MCosy.h
r2278 r2384 30 30 #define WM_DISPLAY 0x100d 31 31 #define WM_TRACKPOS 0x100e 32 #define WM_POSITION1 0x100f 32 33 33 34 class ShaftEncoder; … … 37 38 class TH1; 38 39 class MStarguider; 40 class MDriveCom; 39 41 40 42 class MTTalk : public MThread … … 61 63 62 64 private: 63 enum64 {65 kError = 0x01,66 kMoving = 0x02,67 kTracking = 0x04,68 kStopping = 0x08,69 kStopped = 0x1070 };71 72 65 const MObservatory::LocationName_t fObservatory; 73 66 … … 82 75 Macs *fMac3; 83 76 84 MGCosy *fWin; 77 MGCosy *fWin; 78 MDriveCom *fCom; 85 79 86 80 TTimer *fUpdateGui; -
trunk/MagicSoft/Cosy/main/Makefile
r2278 r2384 21 21 22 22 INCLUDES = -I. -I../base -I.. -I../gui -I../catalog -I../devdrv \ 23 -I../candrv -I../incl -I../videodev -I../caos 23 -I../candrv -I../incl -I../videodev -I../caos -I../tcpip 24 24 25 25 # @code
Note:
See TracChangeset
for help on using the changeset viewer.