# HG changeset patch # User paul # Date 2014-07-15 14:04:09 # Node ID 3367da3ef050e8b3401ea629a080562e1e989045 # Parent e0676cd8b3cd5624be55deaaa47bf08c2cb00492 2.0.1.0 JIRA #283 corrected (acquisition_time) diff --git a/FSW-qt/Makefile b/FSW-qt/Makefile --- a/FSW-qt/Makefile +++ b/FSW-qt/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: bin/fsw -# Generated by qmake (2.01a) (Qt 4.8.6) on: Mon Jun 23 07:48:42 2014 +# Generated by qmake (2.01a) (Qt 4.8.6) on: Tue Jul 15 15:57:23 2014 # Project: fsw-qt.pro # Template: app # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro @@ -10,7 +10,7 @@ CC = sparc-rtems-gcc CXX = sparc-rtems-g++ -DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=12 -DPRINT_MESSAGES_ON_CONSOLE +DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=0 -DPRINT_MESSAGES_ON_CONSOLE CFLAGS = -pipe -O3 -Wall $(DEFINES) CXXFLAGS = -pipe -O3 -Wall $(DEFINES) INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters diff --git a/FSW-qt/fsw-qt.pro b/FSW-qt/fsw-qt.pro --- a/FSW-qt/fsw-qt.pro +++ b/FSW-qt/fsw-qt.pro @@ -8,10 +8,10 @@ include(./sparc.pri) # flight software version SWVERSION=-1-0 -DEFINES += SW_VERSION_N1=1 # major +DEFINES += SW_VERSION_N1=2 # major DEFINES += SW_VERSION_N2=0 # minor -DEFINES += SW_VERSION_N3=0 # patch -DEFINES += SW_VERSION_N4=12 # internal +DEFINES += SW_VERSION_N3=1 # patch +DEFINES += SW_VERSION_N4=0 # internal contains( CONFIG, debug_tch ) { DEFINES += DEBUG_TCH diff --git a/FSW-qt/fsw-qt.pro.user b/FSW-qt/fsw-qt.pro.user --- a/FSW-qt/fsw-qt.pro.user +++ b/FSW-qt/fsw-qt.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -442,65 +442,6 @@ void send_dumb_hk( void ) PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); } -void get_v_e1_e2_f3_old( unsigned char *spacecraft_potential ) -{ - unsigned int coarseTime; - unsigned int acquisitionTime; - unsigned int deltaT = 0; - unsigned char *bufferPtr; - - unsigned int offset_in_samples; - unsigned int offset_in_bytes; - unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz - - if (lfrCurrentMode == LFR_MODE_STANDBY) - { - spacecraft_potential[0] = 0x00; - spacecraft_potential[1] = 0x00; - spacecraft_potential[2] = 0x00; - spacecraft_potential[3] = 0x00; - spacecraft_potential[4] = 0x00; - spacecraft_potential[5] = 0x00; - } - else - { - coarseTime = time_management_regs->coarse_time & 0x7fffffff; - bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address; - acquisitionTime = (unsigned int) ( ( bufferPtr[2] & 0x7f ) << 24 ) - + (unsigned int) ( bufferPtr[3] << 16 ) - + (unsigned int) ( bufferPtr[0] << 8 ) - + (unsigned int) ( bufferPtr[1] ); - if ( coarseTime > acquisitionTime ) - { - deltaT = coarseTime - acquisitionTime; - offset_in_samples = (deltaT-1) * f3 ; - } - else if( coarseTime == acquisitionTime ) - { - bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer - offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1; - } - else - { - offset_in_samples = 0; - PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) - } - - if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) - { - PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) - offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; - } - offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; - spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0]; - spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1]; - spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2]; - spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3]; - spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4]; - spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5]; - } -} - void get_v_e1_e2_f3( unsigned char *spacecraft_potential ) { unsigned int coarseTime; diff --git a/src/processing/fsw_processing.c b/src/processing/fsw_processing.c --- a/src/processing/fsw_processing.c +++ b/src/processing/fsw_processing.c @@ -613,10 +613,10 @@ unsigned long long int get_acquisition_t acquisitionTimeAslong = 0x00; acquisitionTimeAslong = ( (unsigned long long int) (timePtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit + ( (unsigned long long int) timePtr[1] << 32 ) - + ( timePtr[2] << 24 ) - + ( timePtr[3] << 16 ) - + ( timePtr[6] << 8 ) - + ( timePtr[7] ); + + ( (unsigned long long int) timePtr[2] << 24 ) + + ( (unsigned long long int) timePtr[3] << 16 ) + + ( (unsigned long long int) timePtr[6] << 8 ) + + ( (unsigned long long int) timePtr[7] ); return acquisitionTimeAslong; } diff --git a/src/wf_handler.c b/src/wf_handler.c --- a/src/wf_handler.c +++ b/src/wf_handler.c @@ -841,80 +841,6 @@ int send_waveform_CWF3_light(volatile in return ret; } -void compute_acquisition_time_old( unsigned int coarseTime, unsigned int fineTime, - unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) -{ - unsigned long long int acquisitionTimeAsLong; - unsigned char localAcquisitionTime[6]; - double deltaT; - - deltaT = 0.; - - localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 ); - localAcquisitionTime[1] = (unsigned char) ( coarseTime ); - localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 ); - localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 ); - localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 ); - localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 ); - - acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) - + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) - + ( localAcquisitionTime[2] << 24 ) - + ( localAcquisitionTime[3] << 16 ) - + ( localAcquisitionTime[4] << 8 ) - + ( localAcquisitionTime[5] ); - - switch( sid ) - { - case SID_NORM_SWF_F0: - deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; - break; - - case SID_NORM_SWF_F1: - deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; - break; - - case SID_NORM_SWF_F2: - deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; - break; - - case SID_SBM1_CWF_F1: - deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; - break; - - case SID_SBM2_CWF_F2: - deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; - break; - - case SID_BURST_CWF_F2: - deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; - break; - - case SID_NORM_CWF_F3: - deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; - break; - - case SID_NORM_CWF_LONG_F3: - deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; - break; - - default: - PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) - deltaT = 0.; - break; - } - - acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; - // - acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); - acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); - acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); - acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); - acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); - acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); - -} - void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) { @@ -933,10 +859,10 @@ void compute_acquisition_time( unsigned acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) - + ( localAcquisitionTime[2] << 24 ) - + ( localAcquisitionTime[3] << 16 ) - + ( localAcquisitionTime[4] << 8 ) - + ( localAcquisitionTime[5] ); + + ( (unsigned long long int) localAcquisitionTime[2] << 24 ) + + ( (unsigned long long int) localAcquisitionTime[3] << 16 ) + + ( (unsigned long long int) localAcquisitionTime[4] << 8 ) + + ( (unsigned long long int) localAcquisitionTime[5] ); switch( sid ) { @@ -1098,21 +1024,6 @@ void build_snapshot_from_ring( ring_node } } -void build_acquisition_time_old( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) -{ - unsigned char *acquisitionTimeCharPtr; - - acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; - - *acquisitionTimeAslong = 0x00; - *acquisitionTimeAslong = ( acquisitionTimeCharPtr[0] << 24 ) - + ( acquisitionTimeCharPtr[1] << 16 ) - + ( (unsigned long long int) (acquisitionTimeCharPtr[2] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit - + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 32 ) - + ( acquisitionTimeCharPtr[4] << 8 ) - + ( acquisitionTimeCharPtr[5] ); -} - void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) { unsigned char *acquisitionTimeCharPtr; @@ -1122,10 +1033,10 @@ void build_acquisition_time( unsigned lo *acquisitionTimeAslong = 0x00; *acquisitionTimeAslong = ( (unsigned long long int) (acquisitionTimeCharPtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit + ( (unsigned long long int) acquisitionTimeCharPtr[1] << 32 ) - + ( acquisitionTimeCharPtr[2] << 24 ) - + ( acquisitionTimeCharPtr[3] << 16 ) - + ( acquisitionTimeCharPtr[6] << 8 ) - + ( acquisitionTimeCharPtr[7] ); + + ( (unsigned long long int) acquisitionTimeCharPtr[2] << 24 ) + + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 16 ) + + ( (unsigned long long int) acquisitionTimeCharPtr[6] << 8 ) + + ( (unsigned long long int) acquisitionTimeCharPtr[7] ); } //**************