Skip to content

Commit

Permalink
merged dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredmales committed Dec 18, 2023
2 parents bf4e17d + 87263af commit 5cb89ca
Show file tree
Hide file tree
Showing 82 changed files with 5,916 additions and 2,747 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/install-rocky.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
with:
path: /opt/MagAOX/
key: rocky-9-dependencies-cache-v1-${{ hashFiles('setup/*', 'setup/**/*') }}
- run: 'bash -x setup/steps/install_rocky_9.2_packages.sh'
- run: 'bash -x setup/steps/install_rocky_9_packages.sh'
name: Install OS dependencies
- run: 'bash -lx setup/provision.sh'
name: Auto-provision
- run: 'bash -l setup/steps/install_MagAOX.sh'
name: Install MagAO-X
# - run: 'make test'
# name: Run tests
- run: 'make test'
name: Run tests
6 changes: 3 additions & 3 deletions .github/workflows/install-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
with:
path: /opt/MagAOX/
key: ubuntu-22.04-dependencies-cache-v1-${{ hashFiles('setup/*', 'setup/**/*') }}
- run: 'bash -x setup/steps/install_ubuntu_22.04_packages.sh'
- run: 'bash -x setup/steps/install_ubuntu_22_packages.sh'
name: Install OS dependencies
- run: 'bash -lx setup/provision.sh'
name: Auto-provision
- run: 'bash -l setup/steps/install_MagAOX.sh'
name: Install MagAO-X
# - run: 'make test'
# name: Run tests
- run: 'make test'
name: Run tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ INDI/xindidriver/xindidriver
apps/indiTSAccumulator/indiTSAccumulator

#k
apps/kcubeCtrl/kcubeCtrl
apps/kTracker/kTracker
apps/koolanceCtrl/koolanceCtrl

Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.rocky
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ FROM rockylinux/rockylinux:9-ubi-init
ENV MAGAOX_ROLE container
RUN echo "MAGAOX_ROLE=${MAGAOX_ROLE}" > /etc/profile.d/magaox_role.sh
ADD ./setup/_common.sh /setup/
ADD ./setup/steps/install_rocky_9.2_packages.sh /setup/steps/
RUN bash /setup/steps/install_rocky_9.2_packages.sh
ADD ./setup/steps/install_rocky_9_packages.sh /setup/steps/
RUN bash /setup/steps/install_rocky_9_packages.sh
ADD ./setup/setup_users_and_groups.sh /setup/
RUN bash /setup/setup_users_and_groups.sh
ADD ./setup/steps/configure_rocky_9.2.sh /setup/steps/
RUN bash /setup/steps/configure_rocky_9.2.sh
ADD ./setup/steps/configure_rocky_9.sh /setup/steps/
RUN bash /setup/steps/configure_rocky_9.sh
ADD . /opt/MagAOX/source/MagAOX
WORKDIR /opt/MagAOX/source/MagAOX/setup
RUN bash -lx provision.sh
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ RUN echo "MAGAOX_ROLE=${MAGAOX_ROLE}" > /etc/profile.d/magaox_role.sh
ADD ./setup/_common.sh /setup/
ADD ./setup/setup_users_and_groups.sh /setup/
RUN bash /setup/setup_users_and_groups.sh
ADD ./setup/steps/install_ubuntu_22.04_packages.sh /setup/steps/
RUN bash /setup/steps/install_ubuntu_22.04_packages.sh
ADD ./setup/steps/configure_ubuntu_22.04.sh /setup/steps/
RUN bash /setup/steps/configure_ubuntu_22.04.sh
ADD ./setup/steps/install_ubuntu_22_packages.sh /setup/steps/
RUN bash /setup/steps/install_ubuntu_22_packages.sh
ADD ./setup/steps/configure_ubuntu_22.sh /setup/steps/
RUN bash /setup/steps/configure_ubuntu_22.sh
ADD . /opt/MagAOX/source/MagAOX
WORKDIR /opt/MagAOX/source/MagAOX/setup
# RUN bash setup_users_and_groups.sh
Expand Down
31 changes: 23 additions & 8 deletions INDI/libcommon/IndiConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ const IndiConnection &IndiConnection::operator= ( const IndiConnection &idRhs )

IndiConnection::~IndiConnection()
{
try
{
deactivate();
}
catch(...)
{
//do nothing
}

if(m_fstreamOutput)
{
fclose(m_fstreamOutput);
}

}

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -104,7 +118,7 @@ void IndiConnection::construct( const string &szName,

// These are the two descriptors we will use to talk to the outside world.
m_fdInput = STDIN_FILENO;
m_fdOutput = STDOUT_FILENO;
setOutputFd(STDOUT_FILENO);

// setup the signal handler.
//::signal( SIGHUP, IndiConnection::handleSignal );
Expand Down Expand Up @@ -363,18 +377,14 @@ void IndiConnection::sendXml( const string &szXml ) const
{
MutexLock::AutoLock autoOut( &m_mutOutput );

//Convert to stream b/c dprintf will kill silently on a bad file descriptor
FILE * fdout = fdopen(m_fdOutput, "w+");

if(!fdout)
if(!m_fstreamOutput)
{
return;
}

::fprintf( fdout, "%s", szXml.c_str() );
fflush(fdout);
::fprintf( m_fstreamOutput, "%s", szXml.c_str() );
fflush(m_fstreamOutput);

//dprintf(m_fdOutput, "%s", szXml.c_str());
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -415,6 +425,11 @@ void IndiConnection::setInputFd( const int &iFd )
void IndiConnection::setOutputFd( const int &iFd )
{
m_fdOutput = iFd;
if(m_fstreamOutput)
{
fclose(m_fstreamOutput);
}
m_fstreamOutput = fdopen(m_fdOutput, "w+");
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 5 additions & 0 deletions INDI/libcommon/IndiConnection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,13 @@ class IndiConnection : public pcf::Thread
mutable pcf::MutexLock m_mutOutput;
/// The file descriptor to read from.
int m_fdInput;

/// The file descriptor to write to.
int m_fdOutput;

/// Stream for safer output
FILE * m_fstreamOutput {NULL};

/// If the processing of INDI messages is put in a separate thread,
/// this is the thread id of it.
pthread_t m_idProcessThread;
Expand Down
6 changes: 5 additions & 1 deletion Make/magAOX.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ TARGETNAME = $(PATHNAME)$(notdir $(BASENAME))

all: pch magaox_git_version.h $(TARGETNAME)
rm $(SELF_DIR)/../magaox_git_version.h


debug: CXXFLAGS += -g -O0
debug: pch magaox_git_version.h $(TARGETNAME)
rm $(SELF_DIR)/../magaox_git_version.h

pch:
cd $(SELF_DIR)/../libMagAOX; ${MAKE}

Expand Down
48 changes: 26 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,32 @@ apps_common = \
shmimIntegrator \
timeSeriesSimulator

apps_rtcicc = alpaoCtrl \
cacaoInterface \
userGainCtrl \
zaberCtrl \
zaberLowLevel \
picoMotorCtrl
apps_rtcicc = \
bmcCtrl \
rhusbMon \
alpaoCtrl \
cacaoInterface \
userGainCtrl \
zaberCtrl \
zaberLowLevel \
picoMotorCtrl

apps_rtc = \
alpaoCtrl \
ocam2KCtrl \
andorCtrl \
andorCtrl \
siglentSDG \
ttmModulator \
bmcCtrl \
rhusbMon \
pi335Ctrl \
pupilFit \
t2wOffloader \
dmSpeckle \
w2tcsOffloader \
w2tcsOffloader \
pwfsSlopeCalc


apps_icc = \
acronameUsbHub \
acronameUsbHub \
flipperCtrl \
filterWheelCtrl \
hsfwCtrl \
Expand Down Expand Up @@ -65,8 +67,7 @@ apps_tic = \
acronameUsbHub \
baslerCtrl \
bmcCtrl \
trippLitePDU

trippLitePDU

libs_to_build = libtelnet

Expand All @@ -85,13 +86,13 @@ else ifeq ($(MAGAOX_ROLE),TIC)
endif

all_guis = \
dmCtrlGUI \
dmCtrlGUI \
dmModeGUI \
offloadCtrlGUI \
pupilGuideGUI \
pwr \
coronAlignGUI \
loopCtrlGUI \
loopCtrlGUI \
roiGUI \
cameraGUI \
stageGUI
Expand Down Expand Up @@ -126,11 +127,12 @@ else
rtimv_plugins_to_build = $(all_rtimv_plugins)
endif

utils_to_build = logdump \
logstream \
cursesINDI \
xrif2shmim \
xrif2fits
utils_to_build = \
logdump \
logstream \
cursesINDI \
xrif2shmim \
xrif2fits

scripts_to_install = magaox \
query_seeing \
Expand Down Expand Up @@ -202,7 +204,6 @@ lib_clean:
cd libMagAOX; ${MAKE} clean

apps_all: libs_install flatlogs_all

for app in ${apps_to_build}; do \
(cd apps/$$app; ${MAKE} )|| exit 1; \
done
Expand Down Expand Up @@ -282,8 +283,11 @@ utils_clean:
(cd utils/$$app; ${MAKE} clean) || exit 1; \
done

test: tests_clean
cd tests; ${MAKE} test || exit 1;

tests_clean:
cd tests; ${MAKE} clean || exit1;
cd tests; ${MAKE} clean || exit 1;

.PHONY: doc
doc:
Expand Down
4 changes: 2 additions & 2 deletions apps/alpaoCtrl/alpaoCtrl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ int alpaoCtrl::releaseDM()

if(m_dm == nullptr)
{
return log<software_error, -1>({__FILE__, __LINE__, "dm is not initialized"});
return 0;
}

state(stateCodes::READY);
Expand All @@ -478,7 +478,7 @@ int alpaoCtrl::releaseDM()
pthread_kill(m_smThread.native_handle(), SIGUSR1);
}

sleep(1); ///\todo need to trigger shmimMonitor loop to pause it.
sleep(1);

if(zeroDM() < 0)
{
Expand Down
29 changes: 17 additions & 12 deletions apps/andorCtrl/andorCtrl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,6 @@ void andorCtrl::loadConfig()

if(writeConfig() < 0)
{
std::cerr << "m_configFile: " << m_configFile << "\n";
log<software_critical>({__FILE__,__LINE__});
m_shutdown = true;
return;
Expand Down Expand Up @@ -1050,7 +1049,7 @@ int andorCtrl::cameraSelect()
log<text_log>(std::string("Decode: ") + std::to_string(Decode));
log<text_log>(std::string("f/w: ") + std::to_string(CameraFirmwareVersion) + "." + std::to_string(CameraFirmwareBuild));

#if 0
#if 0 //We don't normally need to do this, but keep here in case we want to check in the future
int em_speeds;
error=GetNumberHSSpeeds(0,0, &em_speeds);
if(error != DRV_SUCCESS)
Expand Down Expand Up @@ -1081,7 +1080,7 @@ int andorCtrl::cameraSelect()
std::cerr << i << " " << speed << "\n";
}
#endif
#if 0
#if 0 //We don't normally need to do this, but keep here in case we want to check in the future
int v_speeds;
error=GetNumberVSSpeeds(&v_speeds);
if(error != DRV_SUCCESS)
Expand All @@ -1103,7 +1102,7 @@ int andorCtrl::cameraSelect()
int ss = 2;
if(m_shutterState == 1) ss = 1;
else m_shutterState = 0; //handles startup case
error = SetShutter(1,ss,50,50);
error = SetShutter(1,ss,500,500);
if(error != DRV_SUCCESS)
{
log<software_critical>({__FILE__, __LINE__, "ANDOR SDK SetShutter failed: " + andorSDKErrorName(error)});
Expand Down Expand Up @@ -1460,15 +1459,25 @@ int andorCtrl::setShutter( unsigned os )
recordCamera(true);
AbortAcquisition();
state(stateCodes::CONFIGURING);

if(os == 0) //Shut
{
SetShutter(1,2,50,50);
int error = SetShutter(1,2,500,500);
if(error != DRV_SUCCESS)
{
return log<software_error, -1>({__FILE__, __LINE__, "ANDOR SDK SetShutter failed: " + andorSDKErrorName(error)});
}

m_shutterState = 0;
}
else //Open
{
SetShutter(1,1,50,50);
int error = SetShutter(1,1,500,500);
if(error != DRV_SUCCESS)
{
return log<software_error, -1>({__FILE__, __LINE__, "ANDOR SDK SetShutter failed: " + andorSDKErrorName(error)});
}

m_shutterState = 1;
}

Expand Down Expand Up @@ -1612,17 +1621,13 @@ int andorCtrl::getFPS()

m_expTime = exptime;

//std::cerr << accumCycletime << " " << kinCycletime << "\n";

float readoutTime;
error = GetReadOutTime(&readoutTime);
if(error != DRV_SUCCESS)
{
return log<software_error,-1>({__FILE__, __LINE__, "ANDOR SDK error from GetReadOutTime: " + andorSDKErrorName(error)});
}

//if(readoutTime < exptime) m_fps = 1./m_expTime;
//else m_fps = 1.0/readoutTime;
m_fps = 1.0/accumCycletime;

return 0;
Expand Down Expand Up @@ -1916,7 +1921,7 @@ int andorCtrl::loadImageIntoStream(void * dest)
if( frameGrabber<andorCtrl>::loadImageIntoStreamCopy(dest, m_image_p, m_width, m_height, m_typeSize) == nullptr) return -1;

return 0;
}
}

inline
int andorCtrl::reconfig()
Expand Down
5 changes: 2 additions & 3 deletions apps/bmcCtrl/bmcCtrl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,7 @@ int bmcCtrl::releaseDM()

if(!m_dmopen)
{
log<text_log>("dm is not initialized", logPrio::LOG_ERROR);
return -1;
return 0;
}

state(stateCodes::READY);
Expand All @@ -530,7 +529,7 @@ int bmcCtrl::releaseDM()
pthread_kill(m_smThread.native_handle(), SIGUSR1);
}

sleep(1); ///\todo need to trigger shmimMonitor loop to pause it.
sleep(1);

if(zeroDM() < 0)
{
Expand Down
Loading

0 comments on commit 5cb89ca

Please sign in to comment.