Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of workinQM_5thJan_azad by
Diff: TCTM.cpp
- Revision:
- 66:a5d2b8dc6b9e
- Parent:
- 64:241406992336
- Child:
- 67:c0dd13285d80
diff -r d1b12729fcdc -r a5d2b8dc6b9e TCTM.cpp
--- a/TCTM.cpp Thu Nov 24 09:45:08 2016 +0000
+++ b/TCTM.cpp Sun Dec 04 07:58:20 2016 +0000
@@ -279,6 +279,9 @@
uint8_t* tm; // without it some identifier error
uint16_t crc16=CRC::crc16_gen(telemetry,9); //implementing crc
gpc.printf("\n\r the crc is %x",crc16);
+ // for(int qw=0;qw<11;qw++);
+ // gpc.printf("\n\r the telecommand %d \t %x",qw,tc[qw]);
+ // pc.printf("\n the tc provided is %s \n" , tc");
if( ( ((uint8_t)((crc16 & 0xFF00)>>8)==tc[9]) && ((uint8_t)(crc16 & 0x00FF)==tc[10]) )== 0 )
{
telemetry[0]=0xB0;
@@ -522,13 +525,13 @@
for(int i=0;i<16;i++)
{
- telemetry[90+i] = (uint8_t)(quant_data.voltage_quant[i]<<3)+(quant_data.voltage_quant[i]<<1); /*multiplied by 10 */
+ telemetry[90+i] = (uint8_t)(quant_data.voltage_quant[i]);//changed (uint8_t)(quant_data.voltage_quant[i]<<3)+(quant_data.voltage_quant[i]<<1); /*multiplied by 10 */
//printf("\n\r %d \t %d",i,telemetry[90+i]);
telemetry[106+i] = quant_data.current_quant[i];
/*check the working*/
}
- telemetry[122] = (quant_data.Batt_voltage_quant<<3)+(quant_data.Batt_voltage_quant<<1);
+ telemetry[122] = quant_data.Batt_voltage_quant;// changed (quant_data.Batt_voltage_quant<<3)+(quant_data.Batt_voltage_quant<<1);
telemetry[123] = quant_data.BAE_temp_quant;
telemetry[124] = (uint8_t)(actual_data.Batt_gauge_actual[1]);
telemetry[125] = quant_data.Batt_temp_quant[0];
@@ -548,7 +551,7 @@
}
case 0x0001:
{
- gpc.printf("\r\nhk data tm");
+ gpc.printf("\r\nmin_max hk data tm");
telemetry[0] = 0x30; // changed0x06 shifted by 1 bit 0x03
telemetry[1] = tc[0];
telemetry[2] = ACK_CODE;
@@ -556,11 +559,11 @@
for(int i;i<16;i++)
{
- telemetry[i+4] = (bae_HK_minmax.voltage_max[i]<<3)+(bae_HK_minmax.voltage_max[i]<<2);
+ telemetry[i+4] = (uint8_t)bae_HK_minmax.voltage_max[i];//(bae_HK_minmax.voltage_max[i]<<3)+(bae_HK_minmax.voltage_max[i]<<2);
telemetry[i+20] = bae_HK_minmax.current_max[i];
}
- telemetry[36] = (bae_HK_minmax.Batt_voltage_max<<3)+(bae_HK_minmax.Batt_voltage_max<<2);
+ telemetry[36] = (uint8_t)bae_HK_minmax.Batt_voltage_max;//(bae_HK_minmax.Batt_voltage_max<<3)+(bae_HK_minmax.Batt_voltage_max<<2);
telemetry[37] = bae_HK_minmax.BAE_temp_max;
telemetry[38] = bae_HK_minmax.Batt_SOC_max;
@@ -583,12 +586,12 @@
/*min data*/
for(int i;i<16;i++)
- telemetry[i+54] = (bae_HK_minmax.voltage_min[i]<<3)+(bae_HK_minmax.voltage_min[i]<<1);
+ { telemetry[i+54] = (uint8_t)bae_HK_minmax.voltage_min[i];//(bae_HK_minmax.voltage_min[i]<<3)+(bae_HK_minmax.voltage_min[i]<<1);
+ //for(int i;i<16;i++)
+ telemetry[i+70] = bae_HK_minmax.current_min[i];
+ }
- for(int i;i<16;i++)
- telemetry[i+70] = bae_HK_minmax.current_min[i];
-
- telemetry[86] = (bae_HK_minmax.Batt_voltage_min<<3)+(bae_HK_minmax.Batt_voltage_min<<1);
+ telemetry[86] = (uint8_t)bae_HK_minmax.Batt_voltage_min;//(bae_HK_minmax.Batt_voltage_min<<3)+(bae_HK_minmax.Batt_voltage_min<<1);
telemetry[87] = bae_HK_minmax.BAE_temp_min;
/*battery soc*/
@@ -832,13 +835,13 @@
}
case 0x80:
{
- //gpc.printf("Function Management Service\r\n");
+ gpc.printf("Function Management Service\r\n");//changed
uint8_t service_subtype=(tc[2]&0x0F);
switch(service_subtype)
{
case 0x01:
{
- gpc.printf("\n\rFMS Activated");
+ gpc.printf("\n\rFMS Activated daa");
uint8_t fid=tc[3];//changed from pid to fid
switch(fid)
{
@@ -1320,6 +1323,7 @@
}
case 0xE2:
{
+ gpc.printf("\n\renterd E2 case");
uint8_t BCN_SPND_STATE;
BCN_SPND_STATE=tc[4];
if(BCN_SPND_STATE==0x00)
@@ -1331,6 +1335,7 @@
else if(BCN_SPND_STATE==0x01)
{
FCTN_BCN_SPND_TX();
+ //BCN_SW =1;
//stop BCN_STANDBY_TIMER.start();//create
if(BCN_TX_MAIN_STATUS==0)
{
@@ -1823,6 +1828,7 @@
case 0x25:
{
gpc.printf("\n\rSW_OFF_BCN_TX_SW_ENABLE");
+ gpc.printf("\n\r bcn switched off");
//ACK_L234_TM
telemetry[0]=0xB0;
telemetry[1]=tc[0];
@@ -2013,27 +2019,28 @@
}
case 0x40://condition changed by AK47 now 00 means off in TC
{
+ printf("\n entering 0x40 case");
uint8_t STANDBY_DATA_TC;
- BAE_STANDBY=0x00;
+ BAE_STANDBY=0x07;
STANDBY_DATA_TC=tc[4];
if(STANDBY_DATA_TC==0x00)
{
- BAE_STANDBY |=0x04;
- BAE_STANDBY_TIMER_RESET();
+ BAE_STANDBY &=0x03;//for bcn
+ //$ L BAE_STANDBY_TIMER_RESET();
//BAE_STANDBY_TIMER();//to be created to make all sensor on after 20 minutes
}
- STANDBY_DATA_TC=tc[5];
+ STANDBY_DATA_TC=tc[5];//for acs
if(STANDBY_DATA_TC==0x00)
{
- BAE_STANDBY |=0x02;
- BAE_STANDBY_TIMER_RESET();
+ BAE_STANDBY &=0x05;
+ //$ L BAE_STANDBY_TIMER_RESET();
//BAE_STANDBY_TIMER();//to be created to make all sensor on after 20 minutes
}
- STANDBY_DATA_TC=tc[6];
+ STANDBY_DATA_TC=tc[6];//eps
if(STANDBY_DATA_TC==0x00)
{
- BAE_STANDBY |=0x01;
- BAE_STANDBY_TIMER_RESET();
+ BAE_STANDBY &=0x06;
+ //$ L BAE_STANDBY_TIMER_RESET();
//BAE_STANDBY_TIMER();//to be created to make all sensor on after 20 minutes
}
telemetry[0]=0xB0;
