From ed27c3e48a3c2bc88c63974c3db6d7790da8cfad Mon Sep 17 00:00:00 2001 From: Bartek Kostrzewa Date: Thu, 12 May 2011 17:14:46 +0200 Subject: [PATCH] fixed HEADEROFFSET which had the wrong value --- clients/plasma.py | 4 ++-- frameserver/Server.cpp | 12 ++++++++++-- frameserver/defines.h | 10 +++++----- frameserver/display | 14 +++++++------- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/clients/plasma.py b/clients/plasma.py index f6747c2..e305056 100644 --- a/clients/plasma.py +++ b/clients/plasma.py @@ -39,7 +39,7 @@ segments = 8 segwidth = 12 segchannels = 4 -sleeptime = 0.03 +sleeptime = 0.02 t = 0 #timer will hold the elapsed time in seconds @@ -51,7 +51,7 @@ while (1): data += z_buffer for i in range(0,width): for j in range(0,height): - pixel = fabs(sin(2*pi*(float(i+1)/width)+t*frequency)*sin(2*pi*(float(j+1)/height)+t*frequency)) + pixel = 0.5+0.5*sin(2*pi*(float(i+1)/width)+t*frequency)*sin(2*pi*(float(j+1)/height)+t*frequency) data = data + chr(int(255*pixel)) + alpha data = data + "\n" for i in range(0,segwidth): diff --git a/frameserver/Server.cpp b/frameserver/Server.cpp index ed5dcb9..03cae46 100644 --- a/frameserver/Server.cpp +++ b/frameserver/Server.cpp @@ -66,6 +66,10 @@ void Server::listen() socket.receive_from(boost::asio::buffer(recv_buf), remote_endpoint, 0, error); + + // DEBUG OUTPUT RAW BUFFER DATA from packet + // std::cout << recv_buf.data() << std::endl; + // check whether this is a valid packet and discard it if it isn't // note, this is a very hack way of comparing strings... if( std::string( (char*)recv_buf.data(), (size_t)10 ) != std::string(HASH) ) @@ -122,8 +126,7 @@ void Server::listen() { for(int a = 0; a < CHANNELS; a++) { - frame.windows[i][j][a] = recv_buf[HEADEROFFSET+ i*(CHANNELS*WIDTH+1) + j*CHANNELS + a]; - //cout << int( recv_buf[HEADEROFFSET+ i*(CHANNELS*WIDTH+1) + j*CHANNELS + a] ) << endl; + frame.windows[i][j][a] = recv_buf[HEADEROFFSET + i*(CHANNELS*WIDTH+1) + j*CHANNELS + a]; } } } @@ -237,8 +240,11 @@ void Server::mix() int counter = 0; int pixel = 0; + int frames = 0; + while(1) { + frames++; frame_t temp_frame; float temp_alpha; @@ -447,6 +453,8 @@ void Server::console_printframe(frame_t _frame) mvprintw(i+2,j,"%c", brtoc(_frame.windows[i][j][0]) ); } } + +// TODO: correct segment numbering for(int w = 0; w < SEGWIDTH; w++) { diff --git a/frameserver/defines.h b/frameserver/defines.h index 71eb9a9..99b82b7 100644 --- a/frameserver/defines.h +++ b/frameserver/defines.h @@ -1,8 +1,6 @@ #ifndef __DEFINES_H_ #define __DEFINES_H_ -#define HASH "abcdefghij" - // four minutes should be enough (seconds) // timeout set to two seconds for testing purposes #define BUFTIMEOUT 2 @@ -12,8 +10,10 @@ #define REMOTE_IP "127.0.0.1" #define REMOTE_PORT 1234 -// one byte number + 10 character hash -#define HEADEROFFSET 11 + +#define HASH "abcdefghij" +// one byte number + 10 character hash plus newline +#define HEADEROFFSET 12 // 12 windows per floor, 7 floors, Value:Alpha #define WIDTH 12 @@ -27,7 +27,7 @@ #define SEGWIDTH 12 #define SEGCHANNELS 4 -#define BUFLEN HEADEROFFSET+WINDOWOFFSET+ (SEGNUM*SEGCHANNELS+1)*SEGWIDTH +#define BUFLEN HEADEROFFSET+WINDOWOFFSET+(SEGNUM*SEGCHANNELS+1)*SEGWIDTH // not used for simplicity //#define SEGHEIGHT 1 diff --git a/frameserver/display b/frameserver/display index 1045025..daae1ac 100644 --- a/frameserver/display +++ b/frameserver/display @@ -1,10 +1,10 @@ -1c2b3a495867768594a3b2c1 -1c2b3a495867768594a3b2c1 -1c2b3a495867768594a3b2c1 -1c2b3a495867768594a3b2c1 -1c2b3a495867768594a3b2c1 -1c2b3a495867768594a3b2c1 -1c2b3a495867768594a3b2c1 +}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}} rgbargbargbargbargbargbargbargba rgbargbargbargbargbargbargbargba rgbargbargbargbargbargbargbargba