From 7414ec6667a7e4a2cc965fef90c8774aba8ec75e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 25 Oct 2018 16:14:17 -0400 Subject: [PATCH] AFSK telem only fast --- cw/cw_main.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/cw/cw_main.c b/cw/cw_main.c index 5f3ecf23..8046a4c6 100644 --- a/cw/cw_main.c +++ b/cw/cw_main.c @@ -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; }