Changeset 4473 for trunk/MagicSoft/AMC


Ignore:
Timestamp:
08/04/04 16:19:36 (20 years ago)
Author:
merck
Message:
MMerck: Added version information to main window.
CVc: Committing in .
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/activemirrorcontrol.cpp

    r4171 r4473  
    1717
    1818#include "activemirrorcontrol.h"
     19#include "amcdefs.h"
    1920#include "adjustmirrordlg.h"
    2021#include "amccmdserversocket.h"
     
    2425#include "amcreportsocket.h"
    2526#include "amcstate.h"
     27#include "amccmdstate.h"
    2628#include "heatstate.h"
    2729#include "calibratelasermovementdialog.h"
     
    3739#include <qpushbutton.h>
    3840#include <qspinbox.h>
     41#include <qstring.h>
    3942#include <stdio.h>
    4043#include <math.h>
    4144
    42 extern AMCState*  g_pAMCState;
    43 extern HEATState* g_pHEATState;
    44 extern AMCLog*    g_pLog;
     45extern AMCState*    g_pAMCState;
     46extern HEATState*   g_pHEATState;
     47extern AMCCmdState* g_pAMCCmdState;
     48extern AMCLog*      g_pLog;
    4549
    4650
    4751ActiveMirrorControl::ActiveMirrorControl(QWidget *parent, const char *name) : ActiveMirrorControlBase(parent, name)
    4852{
     53        VersionLabel->setText( AMC_VERSION );
     54        VersionDateLabel->setText( __DATE__ );
     55        VersionTimeLabel->setText( __TIME__ );
     56
    4957        m_zCCMode = true;
    5058        qDebug("Connecting AMCState signal");
     
    5260        qDebug("Connecting HEATState signal");
    5361        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)));
    5464        qDebug("Setting AMCState");
    5565        g_pAMCState->setState( AMC_STATE_NOT_AVAILABLE );
     66        qDebug("Setting AMCCMDState");
     67        g_pAMCCmdState->setState( AMC_CMD_STATE_NOCMD );
    5668        qDebug("Setting HEATState");
    5769        g_pHEATState->setState( HEAT_STATE_NOT_AVAILABLE );
     
    110122        CommandTime->setText( dateString );
    111123        CommandLabel->setText( m_qsCmd );
     124        g_pAMCCmdState->setCmd( m_qsCmd, rcvTime );
    112125        logMessage( m_qsCmd );
    113126
     
    115128        QString qsCommand;
    116129  qts >> qsCommand;
     130
    117131        if ( qsCommand == "INAMC" )
    118132        {       
     133                g_pAMCCmdState->setState(AMC_CMD_STATE_ACKNOWLEDGED);
    119134                qDebug("FIX ME: INAMC");
     135                g_pAMCCmdState->setState(AMC_CMD_STATE_COMPLETED);
    120136        }
    121137        if ( qsCommand == "ADJST" )
    122138        {       
     139                g_pAMCCmdState->setState(AMC_CMD_STATE_ACKNOWLEDGED);
     140                g_pAMCCmdState->setState(AMC_CMD_STATE_INVALID);
    123141                qDebug("FIX ME: ADJST");
    124         }
    125         if ( qsCommand == "INAMC" )
     142                g_pAMCCmdState->setState(AMC_CMD_STATE_COMPLETED);
     143        }
     144        if ( qsCommand == "LSADJ" )
    126145        {       
     146                g_pAMCCmdState->setState(AMC_CMD_STATE_ACKNOWLEDGED);
     147                g_pAMCCmdState->setState(AMC_CMD_STATE_INVALID);
    127148                qDebug("FIX ME: LSADJ");
     149                g_pAMCCmdState->setState(AMC_CMD_STATE_COMPLETED);
    128150        }
    129151        if ( qsCommand == "BREAK" )
    130152        {       
    131153                qDebug("FIX ME: BREAK");
     154                g_pAMCCmdState->setState(AMC_CMD_STATE_ABORTED);
    132155        }
    133156        if ( qsCommand == "SHUTD" )
    134157        {       
     158                g_pAMCCmdState->setState(AMC_CMD_STATE_ACKNOWLEDGED);
    135159                qDebug("FIX ME: SHUTD");
    136         }
     160                g_pAMCCmdState->setState(AMC_CMD_STATE_COMPLETED);
     161        }
     162        else
     163                g_pAMCCmdState->setState(AMC_CMD_STATE_NOTACKNOWLEDGED);
    137164       
    138165}
     
    165192  qts >> iStateDAQ >> iStateCAOS >> iStateDrive >> iStateStarGuider;
    166193  int iStateCaCo, iStateCalib, iStateSentinel, iStateHVPS, iStateLid;
    167   int iStateLV, iStateCool, iStateHV, iStateDC, iStateLEDs;
    168   int iStateFADCFans, iStateCalCan, iStateCalIO, iStateCalLV;
     194  int iStateLV, iStateCool, iStateHV, iStateDC, iStateCaosLEDs;
     195  int iStateFADCFans, iStateCalCan, iStateCalIO, iStateCalLV, iStateAMCLEDs;
    169196  qts >> iStateCaCo >> iStateCalib >> iStateSentinel >> iStateHVPS >> iStateLid;
    170   qts >> iStateLV >> iStateCool >> iStateHV >> iStateDC >> iStateLEDs;
    171   qts >> iStateFADCFans >> iStateCalCan >> iStateCalIO >> iStateCalLV;
     197  qts >> iStateLV >> iStateCool >> iStateHV >> iStateDC >> iStateCaosLEDs;
     198  qts >> iStateFADCFans >> iStateCalCan >> iStateCalIO >> iStateCalLV >> iStateAMCLEDs;
    172199  int iStateAMC, iStateHEAT;
    173200  qts >> iStateAMC >> iStateHEAT;
     
    214241                        qsLID.sprintf("Unknown");
    215242  }
    216   switch (iStateLEDs)
     243  switch (iStateAMCLEDs)
    217244        {
    218245                case 0:
     
    339366                LaserAdjustButton->setEnabled( true );
    340367                CenterAllButton->setEnabled( true );
    341                 CalButton->setEnabled( true );
     368//              CalButton->setEnabled( true );
     369                DefocusButton->setEnabled( true );
    342370                m_zCCMode = false;
    343371                m_iStoredState = g_pAMCState->getState( );
     
    351379                LaserAdjustButton->setEnabled( false );
    352380                CenterAllButton->setEnabled( false );
    353                 CalButton->setEnabled( false );
     381//              CalButton->setEnabled( false );
     382                DefocusButton->setEnabled( false );
    354383                m_zCCMode = true;
    355384                g_pAMCState->setState( m_iStoredState );
     
    367396  StateLabel->setText( g_pAMCState->getText( p_iNewState ) );
    368397
    369         if ( ( p_iNewState == AMC_STATE_READJUST ) && m_zAutoFocus )
    370      adjustSlot();
     398//      if ( ( p_iNewState == AMC_STATE_READJUST ) && m_zAutoFocus )
     399//     adjustSlot();
    371400}
    372401
     
    379408//      StateLCD->display( p_iNewState );
    380409//  StateLabel->setText( g_pHEATState->getText( p_iNewState) );
     410}
     411
     412void 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) );
    381420}
    382421
     
    465504        pDialog->setText( qsMsg );
    466505
    467         qsMsg;
    468506  qsMsg.sprintf("Adjust for Zd: %6.2f Az: %6.2f using LUT %s", dZd, dAz, qsLUTName.latin1());
    469507        g_pLog->logInfo( "ActiveMirrorControl::adjustSlot", qsMsg );
     
    497535
    498536        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);
    500538        g_pLog->logInfo( "ActiveMirrorControl::laserAdjustSlot", qsMsg );
    501539
     
    588626  m_zAutoFocus = p_zOn;
    589627}
     628/** No descriptions */
     629void 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.