From e7fe85856ac278c7201d938edc4cb1ddff420031 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 9 Aug 2025 12:07:25 -0400 Subject: [PATCH] Update main.c cleanup --- main.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/main.c b/main.c index ff1a955a..443423e0 100644 --- a/main.c +++ b/main.c @@ -1504,7 +1504,12 @@ void get_tlm_fox() { encodeB(b_max, 40 + head_offset, (int)(sensor_max[GYRO_X] + 0.5) + 2048); encodeA(b_max, 42 + head_offset, (int)(sensor_max[GYRO_Y] + 0.5) + 2048); encodeB(b_max, 43 + head_offset, (int)(sensor_max[GYRO_Z] + 0.5) + 2048); - + + encodeA(b_max, 33 + head_offset, (int)(sensor_max[PRES] + 0.5)); // Pressure + encodeB(b_max, 34 + head_offset, (int)(sensor_max[ALT] * 10.0 + 0.5)); // Altitude + // encodeB(b_max, 49 + head_offset, (int)(sensor_max[XS1] * 10 + 0.5) + 2048); + encodeB(b_max, 10 + head_offset, (int)(sensor_max[TEMP] * 10 + 0.5)); + encodeA(b_max, 45 + head_offset, (int)(sensor_max[HUMI] * 10 + 0.5)); encodeA(b_max, 48 + head_offset, (int)(sensor_max[DTEMP] * 10 + 0.5) + 2048); encodeB(b_max, 49 + head_offset, (int)(sensor_max[XS1])); @@ -1524,12 +1529,6 @@ void get_tlm_fox() { // encodeB(b_max, 49 + head_offset, 2048); } - encodeA(b_max, 33 + head_offset, (int)(sensor_max[PRES] + 0.5)); // Pressure - encodeB(b_max, 34 + head_offset, (int)(sensor_max[ALT] * 10.0 + 0.5)); // Altitude - // encodeB(b_max, 49 + head_offset, (int)(sensor_max[XS1] * 10 + 0.5) + 2048); - encodeB(b_max, 10 + head_offset, (int)(sensor_max[TEMP] * 10 + 0.5)); - encodeA(b_max, 45 + head_offset, (int)(sensor_max[HUMI] * 10 + 0.5)); - encodeA(b_min, 12 + head_offset, (int)(voltage_min[map[PLUS_X]] * 100)); encodeB(b_min, 13 + head_offset, (int)(voltage_min[map[PLUS_Y]] * 100)); encodeA(b_min, 15 + head_offset, (int)(voltage_min[map[PLUS_Z]] * 100)); @@ -1555,14 +1554,17 @@ void get_tlm_fox() { if (sensor_min[TEMP] != 1000.0) // make sure values are valid { - encodeB(b_min, 4 + head_offset, (int)(sensor_min[ACCEL_X] * 100 + 0.5) + 2048); // Xaccel - encodeA(b_min, 6 + head_offset, (int)(sensor_min[ACCEL_Y] * 100 + 0.5) + 2048); // Yaccel - encodeB(b_min, 7 + head_offset, (int)(sensor_min[ACCEL_Z] * 100 + 0.5) + 2048); // Zaccel - encodeB(b_min, 40 + head_offset, (int)(sensor_min[GYRO_X] + 0.5) + 2048); - encodeA(b_min, 42 + head_offset, (int)(sensor_min[GYRO_Y] + 0.5) + 2048); - encodeB(b_min, 43 + head_offset, (int)(sensor_min[GYRO_Z] + 0.5) + 2048); + encodeB(b_min, 4 + head_offset, (int)(sensor_min[ACCEL_X] * 100 + 0.5) + 2048); // Xaccel + encodeA(b_min, 6 + head_offset, (int)(sensor_min[ACCEL_Y] * 100 + 0.5) + 2048); // Yaccel + encodeB(b_min, 7 + head_offset, (int)(sensor_min[ACCEL_Z] * 100 + 0.5) + 2048); // Zaccel + encodeB(b_min, 40 + head_offset, (int)(sensor_min[GYRO_X] + 0.5) + 2048); + encodeA(b_min, 42 + head_offset, (int)(sensor_min[GYRO_Y] + 0.5) + 2048); + encodeB(b_min, 43 + head_offset, (int)(sensor_min[GYRO_Z] + 0.5) + 2048); - + encodeA(b_min, 33 + head_offset, (int)(sensor_min[PRES] + 0.5)); // Pressure + encodeB(b_min, 34 + head_offset, (int)(sensor_min[ALT] * 10.0 + 0.5)); // Altitude + encodeB(b_min, 10 + head_offset, (int)(sensor_min[TEMP] * 10 + 0.5)); + encodeA(b_min, 45 + head_offset, (int)(sensor_min[HUMI] * 10 + 0.5)); encodeA(b_min, 48 + head_offset, (int)(sensor_min[DTEMP] * 10 + 0.5) + 2048); // encodeB(b_min, 49 + head_offset, (int)(sensor_min[XS1] * 10 + 0.5) + 2048); @@ -1584,10 +1586,7 @@ void get_tlm_fox() { encodeA(b_min, 48 + head_offset, 2048); // encodeB(b_min, 49 + head_offset, 2048); } - encodeA(b_min, 33 + head_offset, (int)(sensor_min[PRES] + 0.5)); // Pressure - encodeB(b_min, 34 + head_offset, (int)(sensor_min[ALT] * 10.0 + 0.5)); // Altitude - encodeB(b_min, 10 + head_offset, (int)(sensor_min[TEMP] * 10 + 0.5)); - encodeA(b_min, 45 + head_offset, (int)(sensor_min[HUMI] * 10 + 0.5)); + } encodeA(b, 30 + head_offset, BAT2Voltage);