mirror of
https://github.com/eddyem/CCD_Capture.git
synced 2025-12-06 10:45:13 +03:00
fixed bug in broken image over net
This commit is contained in:
parent
72db4c0eab
commit
290e95b76a
14
client.c
14
client.c
@ -317,8 +317,17 @@ static void *grabnext(void _U_ *arg){ // daemon grabbing images through the net
|
|||||||
expstate = CAMERA_CAPTURE;
|
expstate = CAMERA_CAPTURE;
|
||||||
SENDMSG(CMD_EXPSTATE "=%d", CAMERA_CAPTURE); // start capture
|
SENDMSG(CMD_EXPSTATE "=%d", CAMERA_CAPTURE); // start capture
|
||||||
double timeout = GP->exptime + CLIENT_TIMEOUT, t0 = dtime();
|
double timeout = GP->exptime + CLIENT_TIMEOUT, t0 = dtime();
|
||||||
|
useconds_t sleept = 500000; // 0.5s
|
||||||
|
if(GP->exptime < 0.5){
|
||||||
|
sleept = (useconds_t)(GP->exptime * 500000.);
|
||||||
|
if(sleept < 1000) sleept = 1000;
|
||||||
|
}
|
||||||
while(dtime() - t0 < timeout){
|
while(dtime() - t0 < timeout){
|
||||||
SENDMSG(CMD_EXPSTATE);
|
DBG("SLEEP!");
|
||||||
|
usleep(sleept);
|
||||||
|
//SENDMSG(CMD_EXPSTATE);
|
||||||
|
getans(sock);
|
||||||
|
DBG("EXPSTATE ===> %d", expstate);
|
||||||
if(expstate != CAMERA_CAPTURE) break;
|
if(expstate != CAMERA_CAPTURE) break;
|
||||||
}
|
}
|
||||||
if(dtime() - t0 >= timeout || expstate != CAMERA_FRAMERDY){
|
if(dtime() - t0 >= timeout || expstate != CAMERA_FRAMERDY){
|
||||||
@ -326,7 +335,8 @@ static void *grabnext(void _U_ *arg){ // daemon grabbing images through the net
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DBG("Frame ready");
|
DBG("Frame ready");
|
||||||
sendstrmessage(sock, CMD_GETIMAGE);
|
while(readmsg(sock)); // clear all incoming data
|
||||||
|
sendstrmessage(sock, CMD_GETIMAGE); // ask for image
|
||||||
if(imbufsz < imdatalen){
|
if(imbufsz < imdatalen){
|
||||||
DBG("Reallocate memory from %d to %d", imbufsz, imdatalen);
|
DBG("Reallocate memory from %d to %d", imbufsz, imdatalen);
|
||||||
ima.data = realloc(ima.data, imdatalen);
|
ima.data = realloc(ima.data, imdatalen);
|
||||||
|
|||||||
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2023-03-09 11:35+0300\n"
|
"POT-Creation-Date: 2023-03-20 11:45+0300\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|||||||
2
socket.c
2
socket.c
@ -136,6 +136,8 @@ int start_socket(int isserver, char *path, int isnet){
|
|||||||
int sendimage(int fd, uint16_t *data, int l){
|
int sendimage(int fd, uint16_t *data, int l){
|
||||||
if(fd < 1 || !data || l < 1) return TRUE; // empty message
|
if(fd < 1 || !data || l < 1) return TRUE; // empty message
|
||||||
DBG("send new image (size=%d) to fd %d", l, fd);
|
DBG("send new image (size=%d) to fd %d", l, fd);
|
||||||
|
//strncpy((char*)data, "TEST image data\n", 17);
|
||||||
|
//l = 16;
|
||||||
if(l != send(fd, data, l, MSG_NOSIGNAL)){
|
if(l != send(fd, data, l, MSG_NOSIGNAL)){
|
||||||
WARN("write()");
|
WARN("write()");
|
||||||
LOGWARN("write()");
|
LOGWARN("write()");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user