check tlm each channel

pull/1/head
Alan Johnston 7 years ago
parent c6f82ca0bf
commit b520230ea5

@ -89,38 +89,9 @@ int main(void)
int channel; // AO-7 telemetry format has 6 channels, 4 sub channels in each
int msg_length;
FILE* file = popen("mpcmd show data 2>&1", "r");
char cmdbuffer[1000];
fgets(cmdbuffer, 1000, file);
pclose(file);
printf("buffer is :%s\n", cmdbuffer);
char mopower[64][14];
char * data;
int i = 0;
data = strtok (cmdbuffer," ");
while (data != NULL)
{
strcpy(mopower[i], data);
printf ("mopwer[%d]=%s\n",i,mopower[i]);
data = strtok (NULL, " ");
i++;
}
printf("Battery voltage = %s ADC5 = %s ADC6 = %s ADC7 = %s ADC8 %s \n",
mopower[VBATT],mopower[ADC5],mopower[ADC6],mopower[ADC7],mopower[ADC8]);
float vbat;
//char s[100] ="7.0800" ;
vbat = strtof(mopower[VBATT], NULL);
printf(" vbat: %f \n", vbat);
int tlm_3a = (int)((vbat * 10) - 65.5);
printf("TLM 3A = %d \n", tlm_3a);
while(1) { // loop forever
for (channel = 0; channel < 7; channel++) {
for (channel = 0; channel < 7; channel++) {
if (channel == 0) { // start with telemetry header "hi hi" plus a few chars to help CW decoding software sync
msg_length = encode_header(&packet[0], MAX_MESSAGE_LENGTH + 1);
@ -128,6 +99,35 @@ int main(void)
printf("\nINFO: Sending TLM header\n");
} else {
FILE* file = popen("mpcmd show data 2>&1", "r");
char cmdbuffer[1000];
fgets(cmdbuffer, 1000, file);
pclose(file);
printf("buffer is :%s\n", cmdbuffer);
char mopower[64][14];
char * data;
int i = 0;
data = strtok (cmdbuffer," ");
while (data != NULL)
{
strcpy(mopower[i], data);
printf ("mopwer[%d]=%s\n",i,mopower[i]);
data = strtok (NULL, " ");
i++;
}
printf("Battery voltage = %s ADC5 = %s ADC6 = %s ADC7 = %s ADC8 %s \n",
mopower[VBATT],mopower[ADC5],mopower[ADC6],mopower[ADC7],mopower[ADC8]);
float vbat;
vbat = strtof(mopower[VBATT], NULL);
printf(" vbat: %f \n", vbat);
int tlm_3a = (int)((vbat * 10) - 65.5);
printf("TLM 3A = %d \n", tlm_3a);
msg_length = encode_tlm(&packet[0], channel, // add a channel with dummy data to buffer
tlm_3a, channel+1, channel+2, channel+3,
(MAX_MESSAGE_LENGTH + 1));

Loading…
Cancel
Save

Powered by TurnKey Linux.