Changeset 4473 for trunk/MagicSoft/AMC
- Timestamp:
- 08/04/04 16:19:36 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/activemirrorcontrol.cpp
r4171 r4473 17 17 18 18 #include "activemirrorcontrol.h" 19 #include "amcdefs.h" 19 20 #include "adjustmirrordlg.h" 20 21 #include "amccmdserversocket.h" … … 24 25 #include "amcreportsocket.h" 25 26 #include "amcstate.h" 27 #include "amccmdstate.h" 26 28 #include "heatstate.h" 27 29 #include "calibratelasermovementdialog.h" … … 37 39 #include <qpushbutton.h> 38 40 #include <qspinbox.h> 41 #include <qstring.h> 39 42 #include <stdio.h> 40 43 #include <math.h> 41 44 42 extern AMCState* g_pAMCState; 43 extern HEATState* g_pHEATState; 44 extern AMCLog* g_pLog; 45 extern AMCState* g_pAMCState; 46 extern HEATState* g_pHEATState; 47 extern AMCCmdState* g_pAMCCmdState; 48 extern AMCLog* g_pLog; 45 49 46 50 47 51 ActiveMirrorControl::ActiveMirrorControl(QWidget *parent, const char *name) : ActiveMirrorControlBase(parent, name) 48 52 { 53 VersionLabel->setText( AMC_VERSION ); 54 VersionDateLabel->setText( __DATE__ ); 55 VersionTimeLabel->setText( __TIME__ ); 56 49 57 m_zCCMode = true; 50 58 qDebug("Connecting AMCState signal"); … … 52 60 qDebug("Connecting HEATState signal"); 53 61 connect( g_pHEATState, SIGNAL( stateChanged( int, int ) ), SLOT( heatStateChangedSlot( int, int))); 62 qDebug("Connecting HEATState signal"); 63 connect( g_pAMCCmdState, SIGNAL( stateChanged( int, int ) ), SLOT( cmdStateChangedSlot( int, int))); 54 64 qDebug("Setting AMCState"); 55 65 g_pAMCState->setState( AMC_STATE_NOT_AVAILABLE ); 66 qDebug("Setting AMCCMDState"); 67 g_pAMCCmdState->setState( AMC_CMD_STATE_NOCMD ); 56 68 qDebug("Setting HEATState"); 57 69 g_pHEATState->setState( HEAT_STATE_NOT_AVAILABLE ); … … 110 122 CommandTime->setText( dateString ); 111 123 CommandLabel->setText( m_qsCmd ); 124 g_pAMCCmdState->setCmd( m_qsCmd, rcvTime ); 112 125 logMessage( m_qsCmd ); 113 126 … … 115 128 QString qsCommand; 116 129 qts >> qsCommand; 130 117 131 if ( qsCommand == "INAMC" ) 118 132 { 133 g_pAMCCmdState->setState(AMC_CMD_STATE_ACKNOWLEDGED); 119 134 qDebug("FIX ME: INAMC"); 135 g_pAMCCmdState->setState(AMC_CMD_STATE_COMPLETED); 120 136 } 121 137 if ( qsCommand == "ADJST" ) 122 138 { 139 g_pAMCCmdState->setState(AMC_CMD_STATE_ACKNOWLEDGED); 140 g_pAMCCmdState->setState(AMC_CMD_STATE_INVALID); 123 141 qDebug("FIX ME: ADJST"); 124 } 125 if ( qsCommand == "INAMC" ) 142 g_pAMCCmdState->setState(AMC_CMD_STATE_COMPLETED); 143 } 144 if ( qsCommand == "LSADJ" ) 126 145 { 146 g_pAMCCmdState->setState(AMC_CMD_STATE_ACKNOWLEDGED); 147 g_pAMCCmdState->setState(AMC_CMD_STATE_INVALID); 127 148 qDebug("FIX ME: LSADJ"); 149 g_pAMCCmdState->setState(AMC_CMD_STATE_COMPLETED); 128 150 } 129 151 if ( qsCommand == "BREAK" ) 130 152 { 131 153 qDebug("FIX ME: BREAK"); 154 g_pAMCCmdState->setState(AMC_CMD_STATE_ABORTED); 132 155 } 133 156 if ( qsCommand == "SHUTD" ) 134 157 { 158 g_pAMCCmdState->setState(AMC_CMD_STATE_ACKNOWLEDGED); 135 159 qDebug("FIX ME: SHUTD"); 136 } 160 g_pAMCCmdState->setState(AMC_CMD_STATE_COMPLETED); 161 } 162 else 163 g_pAMCCmdState->setState(AMC_CMD_STATE_NOTACKNOWLEDGED); 137 164 138 165 } … … 165 192 qts >> iStateDAQ >> iStateCAOS >> iStateDrive >> iStateStarGuider; 166 193 int iStateCaCo, iStateCalib, iStateSentinel, iStateHVPS, iStateLid; 167 int iStateLV, iStateCool, iStateHV, iStateDC, iState LEDs;168 int iStateFADCFans, iStateCalCan, iStateCalIO, iStateCalLV ;194 int iStateLV, iStateCool, iStateHV, iStateDC, iStateCaosLEDs; 195 int iStateFADCFans, iStateCalCan, iStateCalIO, iStateCalLV, iStateAMCLEDs; 169 196 qts >> iStateCaCo >> iStateCalib >> iStateSentinel >> iStateHVPS >> iStateLid; 170 qts >> iStateLV >> iStateCool >> iStateHV >> iStateDC >> iState LEDs;171 qts >> iStateFADCFans >> iStateCalCan >> iStateCalIO >> iStateCalLV ;197 qts >> iStateLV >> iStateCool >> iStateHV >> iStateDC >> iStateCaosLEDs; 198 qts >> iStateFADCFans >> iStateCalCan >> iStateCalIO >> iStateCalLV >> iStateAMCLEDs; 172 199 int iStateAMC, iStateHEAT; 173 200 qts >> iStateAMC >> iStateHEAT; … … 214 241 qsLID.sprintf("Unknown"); 215 242 } 216 switch (iState LEDs)243 switch (iStateAMCLEDs) 217 244 { 218 245 case 0: … … 339 366 LaserAdjustButton->setEnabled( true ); 340 367 CenterAllButton->setEnabled( true ); 341 CalButton->setEnabled( true ); 368 // CalButton->setEnabled( true ); 369 DefocusButton->setEnabled( true ); 342 370 m_zCCMode = false; 343 371 m_iStoredState = g_pAMCState->getState( ); … … 351 379 LaserAdjustButton->setEnabled( false ); 352 380 CenterAllButton->setEnabled( false ); 353 CalButton->setEnabled( false ); 381 // CalButton->setEnabled( false ); 382 DefocusButton->setEnabled( false ); 354 383 m_zCCMode = true; 355 384 g_pAMCState->setState( m_iStoredState ); … … 367 396 StateLabel->setText( g_pAMCState->getText( p_iNewState ) ); 368 397 369 if ( ( p_iNewState == AMC_STATE_READJUST ) && m_zAutoFocus )370 adjustSlot();398 // if ( ( p_iNewState == AMC_STATE_READJUST ) && m_zAutoFocus ) 399 // adjustSlot(); 371 400 } 372 401 … … 379 408 // StateLCD->display( p_iNewState ); 380 409 // StateLabel->setText( g_pHEATState->getText( p_iNewState) ); 410 } 411 412 void ActiveMirrorControl::cmdStateChangedSlot( int p_iOldState, int p_iNewState ) 413 { 414 QString qsMsg; 415 qsMsg.sprintf("Cmd State changed: %d -> %d", p_iOldState, p_iNewState ); 416 g_pLog->logInfo( "ActiveMirrorControl::cmdStateChangedSlot", qsMsg ); 417 418 CmdStateLCD->display( p_iNewState ); 419 CmdStateLabel->setText( g_pHEATState->getText( p_iNewState) ); 381 420 } 382 421 … … 465 504 pDialog->setText( qsMsg ); 466 505 467 qsMsg;468 506 qsMsg.sprintf("Adjust for Zd: %6.2f Az: %6.2f using LUT %s", dZd, dAz, qsLUTName.latin1()); 469 507 g_pLog->logInfo( "ActiveMirrorControl::adjustSlot", qsMsg ); … … 497 535 498 536 QString qsMsg; 499 qsMsg.sprintf("Laser adjust for Zd: %6.2f Az: 6.2f", dZd, dAz);537 qsMsg.sprintf("Laser adjust for Zd: %6.2f Az: %6.2f", dZd, dAz); 500 538 g_pLog->logInfo( "ActiveMirrorControl::laserAdjustSlot", qsMsg ); 501 539 … … 588 626 m_zAutoFocus = p_zOn; 589 627 } 628 /** No descriptions */ 629 void ActiveMirrorControl::defocusSlot() 630 { 631 // enableButtons( false ); 632 QString qsMsg("Defocusing all mirrors"); 633 AMCProgDlg* pDialog = new AMCProgDlg( DEFOCUS_THREAD_CTRL, this, qsMsg, true ); 634 pDialog->setText( qsMsg ); 635 pDialog->start(); 636 pDialog->exec(); 637 delete pDialog; 638 639 }
Note:
See TracChangeset
for help on using the changeset viewer.