![](/media/cache/group/nine_tails_kurama_by_zubair43-d4zyf5s.jpg.50x50_q85.jpg)
ACS data acq changed completely. Tested and working. Deals all faults.
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of QM_BAE_review_1 by
Diff: main.cpp
- Revision:
- 6:036d08b62785
- Parent:
- 5:bb592f3185cc
- Child:
- 7:a46a1dee4497
diff -r bb592f3185cc -r 036d08b62785 main.cpp --- a/main.cpp Thu Dec 31 17:12:52 2015 +0000 +++ b/main.cpp Fri Jan 22 19:51:50 2016 +0000 @@ -39,7 +39,8 @@ char EPS_BATTERY_HEAT_ENABLE = 'q'; //.......................global variables..................................................................// new hk structure- everything has to changed based on this -uint8_t BAE_data[73]; +uint8_t BAE_data[74]; +char BAE_chardata[74]; //*************************************Global declarations************************************************// @@ -180,7 +181,7 @@ } } - float b1[3]={-23.376,-37.56,14.739}, omega1[3]={-1.52,2.746,0.7629}, moment1[3]= {1.0498,-1.0535,1.3246}; + //float b1[3]={-23.376,-37.56,14.739}, omega1[3]={-1.52,2.746,0.7629}, moment1[3]= {1.0498,-1.0535,1.3246}; //b1[3] = {22, 22,10}; //omega1[3] = {2.1,3.0,1.5}; // gpo1 = 0; // att sens2 switch is disabled @@ -202,18 +203,18 @@ pc.printf("gyro values\n\r"); //printing the angular velocity and magnetic field values for(int i=0; i<3; i++) { - pc.printf("%f\n\r",data[i]); + pc.printf("%f\n\r",actual_data.AngularSpeed_actual[i]); } pc.printf("mag values\n\r"); - for(int i=3; i<6; i++) + for(int i=0; i<3; i++) { - pc.printf("%f\n\r",data[i]); + pc.printf("%f\n\r",actual_data.Bvalue_actual[i]); } - for(int i=0;i<3;i++) - { - omega1[i]= data[i]; - b1[i] = data[i+3]; - } + // for(int i=0;i<3;i++) +// { +// omega1[i]= data[i]; +// b1[i] = data[i+3]; +// } }//if ACS_DATA_ACQ_ENABLE = 1 else { @@ -262,7 +263,7 @@ FLAG(); printf("\n\r nominal"); ACS_STATUS = '4'; // set ACS_STATUS = ACS_NOMINAL_ONLY - FCTN_ACS_CNTRLALGO(b1,omega1); + FCTN_ACS_CNTRLALGO(actual_data.Bvalue_actual,actual_data.AngularSpeed_actual); printf("\n\r moment values returned by control algo \n"); for(int i=0; i<3; i++) { @@ -286,7 +287,7 @@ FLAG(); printf("\n\r Entered detumbling \n"); ACS_STATUS = '6'; // set ACS_STATUS = ACS_DETUMBLING_ONLY - FCTN_ACS_CNTRLALGO(b1,omega1); // detumbling code has to be included + FCTN_ACS_CNTRLALGO(actual_data.Bvalue_actual,actual_data.AngularSpeed_actual); // detumbling code has to be included FCTN_ACS_GENPWM_MAIN(moment) ; } else @@ -314,9 +315,6 @@ PWM3 = 0; //clear pwm pins } } //else for acs control off - - - ACS_MAIN_STATUS = 'c'; //clear ACS_MAIN_STATUS flag } @@ -370,9 +368,10 @@ // EPS_STATUS = EPS_ERR_BATTERY_TEMP; // } FCTN_HK_MAIN(); + // printf("\n\r here"); FCTN_APPEND_HKDATA(); minMaxHkData(); - + //printf("\n\r here"); EPS_MAIN_STATUS = 'c'; // clear EPS main status } @@ -401,7 +400,11 @@ else if( slave.receive() == 1) // slave writes to master { if(data_send_flag == 'h') - write_ack=slave.write((char*)BAE_data,73); + { + //FCTN_APPEND_HKDATA(); + // pc.printf("\n\r here"); + write_ack=slave.write(BAE_chardata,74); + } else if(data_send_flag == 't') { write_ack=slave.write(telemetry,tm_len); @@ -412,8 +415,8 @@ else if( slave.receive()==3 || slave.receive()==2) // slave read { read_ack=slave.read(telecommand,tc_len); - pc.printf("\n\rTELECOMMAND received from CDMS is %s \n",telecommand); - pc.printf("\n\r Executing Telecommand \n"); + //pc.printf("\n\rTELECOMMAND received from CDMS is %s \n",telecommand); + //pc.printf("\n\r Executing Telecommand \n"); // FCTN_TC_DECODE((uint8_t*) telecommand); uint8_t* temp = FCTN_BAE_TM_TC((uint8_t*) telecommand); telemetry = (char*)temp; @@ -422,6 +425,7 @@ //pc.printf("%c", telemetry[i]); } + } }