Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quick if refactor #51

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 11 additions & 24 deletions AOloopControl_IOtools/ao188_preprocessor.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ static CLICMDARGDEF farg[] =
};
#include <stdio.h>
#include <sys/select.h>
int is_ready(int fd) {
int is_ready(int fd)
{
fd_set fdset;
struct timeval timeout;
int ret;
FD_ZERO(&fdset);
FD_SET(fd, &fdset);
timeout.tv_sec = 0;
timeout.tv_usec = 1;
return select(fd+1, &fdset, NULL, NULL, &timeout) == 1 ? 1 : 0;
return select(fd + 1, &fdset, NULL, NULL, &timeout) == 1 ? 1 : 0;
}

// Optional custom configuration setup.
Expand Down Expand Up @@ -89,29 +90,12 @@ static errno_t apd_safety_execute(int lowfs_howfs)
printf("Oh no APD emergency shutdown crapped!!!; can't create socket\n");
return RETURN_FAILURE;
}
/*
int t = 1;
if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &t, sizeof(int)) < 0)
{
printf("setsockopt(SO_REUSEADDR) failed");
return RETURN_FAILURE;
}
*/

struct sockaddr_in server_addr;
// Expecting elsewhere to manage SSH tunnels from localhost:18816/8 -> OBCP:10.0.0.6:18818
if(lowfs_howfs)
{
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
server_addr.sin_port = htons(18816);
}
else
{
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
server_addr.sin_port = htons(18818);
}
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
server_addr.sin_port = lowfs_howfs ? htons(18816) : htons(18818);

if(connect(sockfd, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0)
{
Expand Down Expand Up @@ -251,7 +235,10 @@ static errno_t compute_function()
{
DEBUG_TRACE_FSTART();

IMGID apd_mat_in = stream_connect(apd_mat_name);
// Since it's a fps PARAM_IMG, it's expected to be already loaded.
IMGID apd_mat_in = mkIMGID_from_name(apd_mat_name);
resolveIMGID(&apd_mat_in, ERRMODE_ABORT);

float apd_integrator[NUM_APD_HOWFS];
memset(apd_integrator, 0, NUM_APD_HOWFS * sizeof(float));

Expand Down Expand Up @@ -401,4 +388,4 @@ cacaoio.ao188preproc ..loopcntMax -1
readshmim apd
cacaoio.ao188preproc apd apd
EOF
*/
*/
Loading