From f311daabf95107b04f06722b8943c8bad7fb301e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 16:06:39 -0500 Subject: [PATCH] Update main.c --- main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index 24bc6ca3..836e0d53 100644 --- a/main.c +++ b/main.c @@ -2306,14 +2306,14 @@ void get_tlm_fc() { source_bytes[1] = 0b10000010 ; printf("Volt: %f Int: %d \n", voltage[map[BAT]], (unsigned int)(voltage[map[BAT]] * 1000)); - printf("Volt: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 100)); + printf("Amps: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 100)); - source_bytes[10] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000) >> 8); - source_bytes[11] = 0xff & (unsigned int)(voltage[map[BAT]] * 1000); - source_bytes[10] = 0xff & ((unsigned int)(current[map[BAT]] * 100) >> 8); - source_bytes[11] = 0xff & (unsigned int)(current[map[BAT]] * 100); - source_bytes[14] = 0xff & ((unsigned long int)reset_count >> 8); - source_bytes[15] = 0xff & (unsigned long int)reset_count; + source_bytes[10] = 0xff & (((unsigned int)(voltage[map[BAT]] * 1000) >> 8)); + source_bytes[11] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000)); + source_bytes[10] = 0xff & (((unsigned int)(current[map[BAT]] * 100) >> 8)); + source_bytes[11] = 0xff & ((unsigned int)(current[map[BAT]] * 100)); + source_bytes[14] = 0xff & ((unsigned long int)reset_count >> 8)); + source_bytes[15] = 0xff & ((unsigned long int)reset_count); source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number source_bytes[51] = 0xff & ((unsigned long int)sequence >> 8); source_bytes[52] = 0xff & (unsigned long int)sequence++;