Changeset 1804 for trunk/MagicSoft/Cosy
- Timestamp:
- 03/02/03 17:08:13 (22 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/candrv/nodedrv.cc
r1784 r1804 154 154 155 155 lout << hex << setfill('0'); 156 lout << "Node #" << (int)fId << ": Sdo="<< idx << "/" << (int)subidx << " set.";156 lout << "Node #" << dec << (int)fId << ": Sdo=" << hex << idx << "/" << (int)subidx << " set."; 157 157 lout << endl; 158 158 … … 500 500 fTimeout->SetTime(fGuardTime); 501 501 fTimeout->Reset(); 502 503 // Timer t; 504 // fTimeoutTime = t.Now() + (fGuardTime*fLifeTimeFactor/1000.); 505 502 506 fTimeout->TurnOn(); 503 507 //fTimeout->Start(fGuardTime, kTRUE); … … 576 580 if (now > fTimeoutTime) 577 581 { 582 cout << "==out==> " << fmod(now*1000, 10000)/10 << " > " << fmod(fTimeoutTime*10000, 10000)/10 << endl; 578 583 //cout << "ERROR - " << GetNodeName() << " didn't respond in timeout window." << endl; 579 584 //lout << "ERROR - " << GetNodeName() << " didn't respond in timeout window." << endl; -
trunk/MagicSoft/Cosy/candrv/vmodican.cc
r1757 r1804 147 147 switch (c) 148 148 { 149 //150 // Fast message (not used/working)151 //149 // 150 // Fast message (not used/working) 151 // 152 152 case FAST_QUEUE: 153 153 cout << "--> Fast Queue: " << flush; -
trunk/MagicSoft/Cosy/devdrv/macs.cc
r1758 r1804 31 31 : NodeDrv(nodeid, name, out), fMacId(2*nodeid+1), 32 32 fPos(0), fPosTime(0.0), fPdoPos(0), fPdoTime(0.0), 33 fPosActive(0), fRpmActive(0) 33 fPosActive(0), fRpmActive(0), fStatusPdo3(0xff) 34 34 { 35 35 // fTimeout = new TTimer(this, 100); //, kFALSE); // 100ms, asynchronous … … 57 57 58 58 case 0x2002: 59 cout << GetNodeName() << ": Actualvelocity: " << dec << val << endl;59 cout << GetNodeName() << ": Current velocity: " << dec << val << endl; 60 60 fVel = val; 61 61 return; … … 273 273 SetNoWait(TRUE); 274 274 275 StartGuarding(100, 2);276 StartHostGuarding();275 // StartGuarding(500, 2); 276 // StartHostGuarding(); 277 277 } 278 278 … … 300 300 SetPDO1On(FALSE); 301 301 302 lout << "- " << GetNodeName() << ": Motor off." << endl; 303 SendSDO(0x3000, string('o', 'f', 'f')); 304 WaitForSdo(0x3000); 302 /* 303 lout << "- " << GetNodeName() << ": Motor off." << endl; 304 SendSDO(0x3000, string('o', 'f', 'f')); 305 WaitForSdo(0x3000); 306 */ 305 307 306 308 /* … … 550 552 } 551 553 554 void Macs::HandlePDO3(BYTE_t *data, timeval_t *tv) 555 { 556 // 3 5 7 9 557 // 1100 1010 1110 1001 558 if (fStatusPdo3 == data[3]) 559 return; 560 561 lout << GetNodeName() << ": Status PDO3 = "; 562 const Bool_t ready = data[3]&0x01; 563 const Bool_t fuse = data[3]&0x02; 564 const Bool_t emcy = data[3]&0x04; 565 const Bool_t vltg = data[3]&0x08; 566 const Bool_t mode = data[3]&0x10; 567 const Bool_t rf = data[3]&0x20; 568 const Bool_t brake = data[3]&0x40; 569 if (ready) lout << "DKC-Ready "; 570 if (fuse) lout << "FuseOk "; 571 if (emcy) lout << "EmcyOk "; 572 if (vltg) lout << "OvervoltOk "; 573 if (mode) lout << "SwitchToManualMode "; 574 if (rf) lout << "RF "; 575 if (brake) lout << "BrakeOpen "; 576 lout << endl; 577 578 fStatusPdo3 = data[3]; 579 } 580 552 581 // FIXME? Handling of fIsZombie? 553 582 void Macs::HandleError() -
trunk/MagicSoft/Cosy/devdrv/macs.h
r1727 r1804 28 28 BYTE_t fStatus; 29 29 30 LWORD_t string(BYTE_t b0=0, BYTE_t b1=0, BYTE_t b2=0, BYTE_t b3=0) 31 { 32 return (LWORD_t)(b0<<24 | b1<<16 | b2<<8 | b3); 33 } 30 BYTE_t fStatusPdo3; 34 31 35 32 void Init(); … … 42 39 void HandlePDO1(BYTE_t *data, timeval_t *tv); 43 40 void HandlePDO2(BYTE_t *data, timeval_t *tv); 41 void HandlePDO3(BYTE_t *data, timeval_t *tv); 44 42 //void HandleNodeguard(timeval_t *tv); 45 43 … … 67 65 Macs(const BYTE_t nodeid, const char *name=NULL, MLog &out=gLog); 68 66 virtual ~Macs(); 67 68 static LWORD_t string(BYTE_t b0=0, BYTE_t b1=0, BYTE_t b2=0, BYTE_t b3=0) 69 { 70 return (LWORD_t)(b0<<24 | b1<<16 | b2<<8 | b3); 71 } 69 72 70 73 void SendMsg(BYTE_t data[6]); -
trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
r1758 r1804 252 252 253 253 // 254 // Request Lifetimefactor for unknown reason to make guarding 255 // working in SE/Az... (FIXME) 256 // 257 // lout << "- " << GetNodeName() << ": Requesting Lifetimefactor (Workaround, FIXME!) (SDO 0x100d)." << endl; 258 // RequestSDO(0x100c); 259 // WaitForSdo(0x100c); 260 // RequestSDO(0x100d); 261 // WaitForSdo(0x100d); 262 263 // 254 264 // Set logic ticks/revolution = physical ticks/revolution => scale factor = 1 255 265 // … … 291 301 SendNMT(kNMT_START); 292 302 293 StartGuarding(175, 2); 303 /* 304 cout << "---1---" << endl; 305 MTimeout t(1000); 306 while (!t.HasTimedOut()) 307 usleep(1); 308 cout << "---2---" << endl; 309 */ 310 311 // StartGuarding(175, 2); // 175 312 // StartGuarding(10*GetId(), 2); // 175 294 313 } 295 314 -
trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.cc
r1702 r1804 52 52 } 53 53 54 void MGEmbeddedCanvas::Resize(TGDimension size) 55 { 56 fWidth = size.fWidth; 57 fPix = 2.*fRange/size.fWidth; 58 TRootEmbeddedCanvas::Resize(size); 59 } 60 61 void MGEmbeddedCanvas::Resize(UInt_t w, UInt_t h) 62 { 63 fWidth = w; 64 fPix = 2.*fRange/w; 65 TRootEmbeddedCanvas::Resize(w, h); 66 } 67 68 void MGEmbeddedCanvas::MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h) 69 { 70 fWidth = w; 71 fPix = 2.*fRange/w; 72 TRootEmbeddedCanvas::MoveResize(x, y, w, h); 73 } 74 54 75 // ------------------------------------------------------------------------ 55 76 // -
trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.h
r1702 r1804 37 37 ~MGEmbeddedCanvas(); 38 38 39 void Resize(TGDimension size); 40 void Resize(UInt_t w, UInt_t h); 41 void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h); 42 39 43 void UpdateCanvas(); 40 44 -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
r1793 r1804 262 262 float y = c*zdaz.Zd()*kRad2Deg; // [deg] 263 263 264 if (x>95 || x<-95 || y>95 || y<-95) 265 { 266 if (arc->GetX1()==10 && arc->GetY1()==100) 267 return; 268 269 x=-100; 270 y= 100; 271 } 272 273 const int pixx = (int)(x/fPix); 274 const int pixy = (int)(y/fPix); 275 276 const int oldx = (int)(arc->GetX1()/fPix); 277 const int oldy = (int)(arc->GetY1()/fPix); 278 279 if (pixx==oldx && pixy==oldy) 280 return; 281 282 arc->SetX1(x); 283 arc->SetY1(y); 284 285 SetModified(); //***MEMORY LEAK!!!*** 264 SetDotRange(arc, x, y); 286 265 } 287 266 … … 393 372 } 394 373 374 bool MGSkyPosition::SetDotRange(TArc *arc, float &x, float &y) 375 { 376 if (!(x>-95 && x<95 && y>-95 && y<95)) 377 { 378 if (arc->GetX1()==-100 && arc->GetY1()==100) 379 return false; 380 381 x=-100; 382 y= 100; 383 } 384 385 const int pixx = (int)(x/fPix); 386 const int pixy = (int)(y/fPix); 387 388 const int oldx = (int)(arc->GetX1()/fPix); 389 const int oldy = (int)(arc->GetY1()/fPix); 390 391 if (pixx==oldx && pixy==oldy) 392 return false; 393 394 arc->SetX1(x); 395 arc->SetY1(y); 396 397 SetModified(); 398 399 return true; 400 } 401 395 402 void MGSkyPosition::UpdatePlanet(Int_t planet, TArc *arc) 396 403 { … … 400 407 fSlaPlanet->UpdatePlanetPos((ePlanets_t)planet); 401 408 402 ZdAz zdaz = fSlaPlanet->GetPlanetPos((ePlanets_t)planet);409 const ZdAz zdaz = fSlaPlanet->GetPlanetPos((ePlanets_t)planet); 403 410 404 411 // … … 413 420 float y = c*deg; 414 421 415 if (x>95 || x<-95 || y>95 || y<-95) 416 { 417 if (arc->GetX1()==10 && arc->GetY1()==100) 418 return; 419 420 x=-100; 421 y= 100; 422 } 423 424 const int pixx = (int)(x/fPix); 425 const int pixy = (int)(y/fPix); 426 427 const int oldx = (int)(arc->GetX1()/fPix); 428 const int oldy = (int)(arc->GetY1()/fPix); 429 430 if (oldx==pixx && oldy==pixy) 422 if (!SetDotRange(arc, x, y)) 431 423 return; 432 433 //434 // Set new position435 //436 arc->SetX1(x);437 arc->SetY1(y);438 439 SetModified();440 424 441 425 if (planet==kESaturn) -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.h
r1793 r1804 54 54 const MObservatory::LocationName_t fObservatory; 55 55 56 // Int_t fStarX[13]; 57 // Int_t fStarY[13]; 58 59 // Int_t fPlanetX[9]; 60 // Int_t fPlanetY[9]; 56 bool SetDotRange(TArc *arc, float &x, float &y); 61 57 62 58 void InitArc(TArc *arc, Int_t fillstyle, Int_t fillcolor, Int_t linecolor); -
trunk/MagicSoft/Cosy/gui/MGStarguider.cc
r1802 r1804 77 77 gVirtualX->GrabButton(fId, kButton2, 0, 0, 0, 0, kTRUE); 78 78 79 80 79 fList = new MGList; 81 80 … … 188 187 fList->Add(fCZdAz); 189 188 190 const Double_t pixsize = 23. 4;189 const Double_t pixsize = 23.5; 191 190 192 191 fSao->SetPixSize(pixsize/3600); … … 555 554 void MGStarguider::ProcessFrame(const unsigned long n, byte *img, struct timeval *tm) 556 555 { 556 static float myimg[768*576]; 557 558 for (int i=0; i<768*576; i++) 559 myimg[i] += img[i]; 560 561 if (n%fIntRate) 562 return; 563 564 cout << "Img: " << n << endl; 565 566 byte c[768*576]; 567 for (int i=0; i<768*576; i++) 568 c[i] = (byte)(myimg[i]/fIntRate+.5); 569 557 570 if (!fWrite->IsEntryEnabled(IDM_kStart) && 558 571 (!(n%fWrtRate) || fWriteType->IsEntryChecked(IDM_kOnce))) … … 563 576 char name[80]; 564 577 sprintf(name, "pix/file%04d.png", num++); 565 Writer::Png(name, img, tm);578 Writer::Png(name, c, tm); 566 579 } 567 580 … … 571 584 char name[80]; 572 585 sprintf(name, "pix/file%04d.ppm", num++); 573 Writer::Ppm(name, img);586 Writer::Ppm(name, c); 574 587 } 575 588 … … 578 591 } 579 592 580 static float myimg[768*576];581 582 for (int i=0; i<768*576; i++)583 myimg[i] += img[i];584 585 if (n%fIntRate)586 return;587 588 cout << "Img: " << n << endl;589 590 byte c[768*576];591 for (int i=0; i<768*576; i++)592 c[i] = (byte)(myimg[i]/fIntRate+.5);593 593 594 594 MStarList spots; -
trunk/MagicSoft/Cosy/videodev/PngReader.cc
r1803 r1804 94 94 // Write bitmap data 95 95 // 96 static int first = 0;97 96 for (unsigned int y=0; y<576; y++) 98 97 for (unsigned int x=0; x<768; x++) -
trunk/MagicSoft/Cosy/videodev/Writer.cc
r1111 r1804 21 21 FILE *fd = fopen(fname, "w"); 22 22 if (!fd) 23 { 24 cout << "Warning: Cannot open file for writing." << endl; 23 25 return; 26 } 24 27 25 28 // … … 78 81 // Write Time Chunks 79 82 // 83 /* 80 84 if (date) 81 85 { … … 87 91 sprintf(text,"*** %s %s %.1f %i ***", tzname[0], tzname[1], 1.0/3600*timezone, daylight); 88 92 png_write_chunk(fPng, (png_byte*)"ZONE", (png_byte*)text, strlen(text)); 89 } 93 } 94 */ 90 95 91 96 // … … 117 122 ofstream fout(fname); 118 123 if (!fout) 124 { 125 cout << "Warning: Cannot open file for writing." << endl; 119 126 return; 127 } 120 128 121 129 //
Note:
See TracChangeset
for help on using the changeset viewer.