|
|
|
|
@ -143,12 +143,13 @@ int main(void)
|
|
|
|
|
msg_length = encode_header(&packet[0], MAX_MESSAGE_LENGTH + 1);
|
|
|
|
|
|
|
|
|
|
printf("\nINFO: Sending TLM header\n");
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
retVal = transmit_packet(&remoteaddr_tx, packet, (uint16_t)(msg_length)); // send telemetry
|
|
|
|
|
if (retVal != AXRADIO_ERR_NOERROR) {
|
|
|
|
|
fprintf(stderr, "ERROR: Unable to transmit a packet\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
@ -165,22 +166,29 @@ int main(void)
|
|
|
|
|
msg_length = encode_tlm_partial(&packet[0], channel, tlm[channel][1], tlm[channel][2]);
|
|
|
|
|
|
|
|
|
|
printf("\nINFO: Sending TLM channel %d \n", channel);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
retVal = transmit_packet(&remoteaddr_tx, packet, (uint16_t)(msg_length)); // send telemetry
|
|
|
|
|
if (retVal != AXRADIO_ERR_NOERROR) {
|
|
|
|
|
fprintf(stderr, "ERROR: Unable to transmit a packet\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
get_tlm(tlm);
|
|
|
|
|
send_afsk(tlm);
|
|
|
|
|
|
|
|
|
|
config_cw();
|
|
|
|
|
|
|
|
|
|
msg_length = encode_tlm_partial(&packet[0], channel, tlm[channel][3], tlm[channel][4]);
|
|
|
|
|
|
|
|
|
|
printf("\nINFO: Sending TLM channel %d \n", channel);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
retVal = transmit_packet(&remoteaddr_tx, packet, (uint16_t)(msg_length)); // send telemetry
|
|
|
|
|
if (retVal != AXRADIO_ERR_NOERROR) {
|
|
|
|
|
fprintf(stderr, "ERROR: Unable to transmit a packet\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
// sleep(1);
|
|
|
|
|
|
|
|
|
|
// usleep(200000);
|
|
|
|
|
@ -578,19 +586,19 @@ int get_tlm(int tlm[][5]) {
|
|
|
|
|
}
|
|
|
|
|
// printf("1B: ina219[%d]: %s val: %f \n", SENSOR_40 + CURRENT, ina219[SENSOR_40 + CURRENT], strtof(ina219[SENSOR_40 + CURRENT], NULL));
|
|
|
|
|
|
|
|
|
|
tlm[1][B] = (int) (99.5 - strtof(ina219[SENSOR_40 + CURRENT], NULL)/10); // +X current [4]
|
|
|
|
|
tlm[1][D] = (int) (99.5 - strtof(ina219[SENSOR_41 + CURRENT], NULL)/10); // +Y current [7]
|
|
|
|
|
tlm[1][C] = (int) (99.5 - strtof(ina219[SENSOR_44 + CURRENT], NULL)/10); // +Z current [10] (actually -X current, AO-7 didn't have a Z solar panel?)
|
|
|
|
|
tlm[1][B] = (int) (99.5 - strtof(ina219[SENSOR_40 + CURRENT], NULL)/5.0); // +X current [4]
|
|
|
|
|
tlm[1][D] = (int) (99.5 - strtof(ina219[SENSOR_41 + CURRENT], NULL)/5.0); // +Y current [7]
|
|
|
|
|
tlm[1][C] = (int) (99.5 - strtof(ina219[SENSOR_44 + CURRENT], NULL)/5.0); // +Z current [10] (actually -X current, AO-7 didn't have a Z solar panel?)
|
|
|
|
|
|
|
|
|
|
// int tlm_3b = (int)(strtof(ina219[0], NULL) * 10.0);
|
|
|
|
|
// int tlm_2d = (int)(50.0 + strtof(ina219[SENSOR_4A + VOLTAGE], NULL)/40.0);
|
|
|
|
|
tlm[3][B] = (int)(strtof(ina219[SENSOR_4A + VOLTAGE], NULL) * 10.0); // 5V supply to Pi
|
|
|
|
|
tlm[3][B] = (int)(strtof(ina219[SENSOR_4A + VOLTAGE], NULL) * 5.0); // 5V supply to Pi
|
|
|
|
|
tlm[2][D] = (int)(50.5 + strtof(ina219[SENSOR_45 + CURRENT], NULL)/10.0); // NiMH Battery current
|
|
|
|
|
// printf(" 2D: %d 3B: %d\n", tlm_2d, tlm_3b);
|
|
|
|
|
|
|
|
|
|
// printf("1A: ina219[%d]: %s val: %f \n", SENSOR_4A + CURRENT, ina219[SENSOR_4A + CURRENT], strtof(ina219[SENSOR_4A + CURRENT], NULL));
|
|
|
|
|
|
|
|
|
|
tlm[1][A] = (int)(strtof(ina219[SENSOR_4A + CURRENT], NULL) / 15 + 0.5); // Current of 5V supply to Pi
|
|
|
|
|
tlm[1][A] = (int)(strtof(ina219[SENSOR_4A + CURRENT], NULL) / 7.5 + 0.5); // Current of 5V supply to Pi
|
|
|
|
|
|
|
|
|
|
int tempValue = wiringPiI2CReadReg16(tempSensor, 0);
|
|
|
|
|
// printf("Read: %x\n", tempValue);
|
|
|
|
|
@ -618,7 +626,7 @@ int get_tlm(int tlm[][5]) {
|
|
|
|
|
printf(" %2d ", tlm[k][j]);
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|