From 9062dfb3901611c1dd2a5c872e3c2cee0071ded7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 11:08:52 -0500 Subject: [PATCH 01/96] Update main.c add jy sat info --- main.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 0d9fd5a9..792660a4 100644 --- a/main.c +++ b/main.c @@ -2303,12 +2303,32 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 + source_bytes[0] = 0b11000001 ; // 0b00000001 ; + // source_bytes[1] = 0b10000010 ; -// printf("Volt: %f Int: %d \n", voltage[map[BAT]], (unsigned int)(voltage[map[BAT]] * 1000)); -// printf("Amps: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 1)); + printf("Volt: %f Int: %d \n", voltage[map[BAT]], (unsigned int)(voltage[map[BAT]] * 1000)); + printf("Amps: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 1)); + + uint16_t x = (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000); + uint16_t y = (uint16_t)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000); + uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000); + uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000); + + source_bytes[FC_EPS + 0] = 0xff & (x >> 8); // mV + source_bytes[FC_EPS + 1] = 0xfd & (x << 0); + + source_bytes[FC_EPS + 1] = source_bytes[FC_EPS + 1] | (0x03 & (y >> 14)); + source_bytes[FC_EPS + 2] = 0xff & (y >> 6); // mV + source_bytes[FC_EPS + 3] = 0xf0 & (y << 2); + source_bytes[FC_EPS + 3] = source_bytes[FC_EPS + 3] | (0x0f & (z >> 12)); + source_bytes[FC_EPS + 4] = 0xff & (z >> 4); // mV + source_bytes[FC_EPS + 5] = 0xc0 & (z << 4); + + source_bytes[FC_EPS + 5] = source_bytes[FC_EPS + 5] | (0x0d & (b >> 8)); // mV + source_bytes[FC_EPS + 6] = 0xff & (b << 6); +/* source_bytes[FC_EPS + 0] = 0xff & (((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) >> 8)); // mV source_bytes[FC_EPS + 1] = 0xff & ((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); source_bytes[FC_EPS + 2] = 0xff & (((unsigned int)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000) >> 8)); // mV @@ -2326,13 +2346,14 @@ void get_tlm_fc() { source_bytes[FC_EPS + 11] = 0xff & ((unsigned int)(current[map[BAT]] * 1)); source_bytes[FC_EPS + 12] = 0xff & (((unsigned long int)reset_count >> 8)); source_bytes[FC_EPS + 13] = 0xff & ((unsigned long int)reset_count); +*/ source_bytes[FC_SW + 0] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number source_bytes[FC_SW + 1] = 0xff & ((unsigned long int)sequence >> 8); source_bytes[FC_SW + 2] = 0xff & (unsigned long int)sequence++; /**/ printf("\nsource_bytes\n"); for (int i=0; i<256; i++) - printf("%d ", source_bytes[i]); + printf("%x ", source_bytes[i]); printf("\n\n"); /**/ From 66dc8f9adb5050431edf1415f1c1ca8c23a1dd09 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 11:10:21 -0500 Subject: [PATCH 02/96] Update main.c add hex print --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 792660a4..b2bca86f 100644 --- a/main.c +++ b/main.c @@ -2307,13 +2307,15 @@ void get_tlm_fc() { // source_bytes[1] = 0b10000010 ; - printf("Volt: %f Int: %d \n", voltage[map[BAT]], (unsigned int)(voltage[map[BAT]] * 1000)); - printf("Amps: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 1)); +// printf("Volt: %f Int: %d \n", voltage[map[BAT]], (unsigned int)(voltage[map[BAT]] * 1000)); +// printf("Amps: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 1)); uint16_t x = (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000); uint16_t y = (uint16_t)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000); uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000); uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000); + + printf("X %x Y %x Z %x B %x\n", x, y, z, b); source_bytes[FC_EPS + 0] = 0xff & (x >> 8); // mV source_bytes[FC_EPS + 1] = 0xfd & (x << 0); From 74a21dfe49318e1a9d9fa0478c4fc8149902cd2a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 11:15:03 -0500 Subject: [PATCH 03/96] Update main.c try test values --- main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.c b/main.c index b2bca86f..4a519a84 100644 --- a/main.c +++ b/main.c @@ -2315,6 +2315,11 @@ void get_tlm_fc() { uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000); uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000); + x = 0xffff; + y = 0x0000; + z = 0xffff; + b = 0xa5a5; + printf("X %x Y %x Z %x B %x\n", x, y, z, b); source_bytes[FC_EPS + 0] = 0xff & (x >> 8); // mV From 90e463b122d36d185f397c6afd47b41fc730473b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 11:20:51 -0500 Subject: [PATCH 04/96] Update main.c try other test cases --- main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 4a519a84..213f4150 100644 --- a/main.c +++ b/main.c @@ -2315,15 +2315,15 @@ void get_tlm_fc() { uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000); uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000); - x = 0xffff; - y = 0x0000; - z = 0xffff; - b = 0xa5a5; + x = 0x00; // 0xffff; + y = 0xffff; // 0x0000; + z = 0x00; // 0xffff; + b = 0xffff; printf("X %x Y %x Z %x B %x\n", x, y, z, b); source_bytes[FC_EPS + 0] = 0xff & (x >> 8); // mV - source_bytes[FC_EPS + 1] = 0xfd & (x << 0); + source_bytes[FC_EPS + 1] = 0xfc & (x << 0); source_bytes[FC_EPS + 1] = source_bytes[FC_EPS + 1] | (0x03 & (y >> 14)); source_bytes[FC_EPS + 2] = 0xff & (y >> 6); // mV From 7767fabebbe6b1a4894d7734591e2ecdeb26d9ad Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 11:29:32 -0500 Subject: [PATCH 05/96] Update main.c fix b --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 213f4150..046bea92 100644 --- a/main.c +++ b/main.c @@ -2333,8 +2333,8 @@ void get_tlm_fc() { source_bytes[FC_EPS + 4] = 0xff & (z >> 4); // mV source_bytes[FC_EPS + 5] = 0xc0 & (z << 4); - source_bytes[FC_EPS + 5] = source_bytes[FC_EPS + 5] | (0x0d & (b >> 8)); // mV - source_bytes[FC_EPS + 6] = 0xff & (b << 6); + source_bytes[FC_EPS + 5] = source_bytes[FC_EPS + 5] | (0x3f & (b >> 10)); // mV + source_bytes[FC_EPS + 6] = 0xff & (b << 2); /* source_bytes[FC_EPS + 0] = 0xff & (((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) >> 8)); // mV source_bytes[FC_EPS + 1] = 0xff & ((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); From c8111dff0bef0406143c9fd049848ab62dd5dde3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 11:32:53 -0500 Subject: [PATCH 06/96] Update main.c try fc --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 046bea92..82d9c193 100644 --- a/main.c +++ b/main.c @@ -2316,9 +2316,9 @@ void get_tlm_fc() { uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000); x = 0x00; // 0xffff; - y = 0xffff; // 0x0000; + y = 0xfffc; // 0x0000; z = 0x00; // 0xffff; - b = 0xffff; + b = 0xfffc; printf("X %x Y %x Z %x B %x\n", x, y, z, b); @@ -2334,7 +2334,7 @@ void get_tlm_fc() { source_bytes[FC_EPS + 5] = 0xc0 & (z << 4); source_bytes[FC_EPS + 5] = source_bytes[FC_EPS + 5] | (0x3f & (b >> 10)); // mV - source_bytes[FC_EPS + 6] = 0xff & (b << 2); + source_bytes[FC_EPS + 6] = 0xff & (b >> 2); /* source_bytes[FC_EPS + 0] = 0xff & (((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) >> 8)); // mV source_bytes[FC_EPS + 1] = 0xff & ((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); From 04b11ee617081a47a819e532b0642a1ca0909c41 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 11:34:14 -0500 Subject: [PATCH 07/96] Update main.c last test --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 82d9c193..b26f776e 100644 --- a/main.c +++ b/main.c @@ -2315,10 +2315,10 @@ void get_tlm_fc() { uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000); uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000); - x = 0x00; // 0xffff; - y = 0xfffc; // 0x0000; - z = 0x00; // 0xffff; - b = 0xfffc; + x = 0xfffc; // 0xffff; + y = 0x0; // 0x0000; + z = 0xfffc; // 0xffff; + b = 0x000c; printf("X %x Y %x Z %x B %x\n", x, y, z, b); From 9cc655235ee7ec5b08a1afd8e860247b4d94b5a2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 11:36:40 -0500 Subject: [PATCH 08/96] Update main.c try real values --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index b26f776e..f9ea25af 100644 --- a/main.c +++ b/main.c @@ -2315,10 +2315,10 @@ void get_tlm_fc() { uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000); uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000); - x = 0xfffc; // 0xffff; - y = 0x0; // 0x0000; - z = 0xfffc; // 0xffff; - b = 0x000c; +// x = 0xfffc; // 0xffff; +// y = 0x0; // 0x0000; +// z = 0xfffc; // 0xffff; +// b = 0x000c; printf("X %x Y %x Z %x B %x\n", x, y, z, b); From 8bc6d29f5a64e8c97f71c89e0dafde9fb9752ebf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 11:54:14 -0500 Subject: [PATCH 09/96] Update main.c drop 2 MSB --- main.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/main.c b/main.c index f9ea25af..37164e62 100644 --- a/main.c +++ b/main.c @@ -2310,10 +2310,10 @@ void get_tlm_fc() { // printf("Volt: %f Int: %d \n", voltage[map[BAT]], (unsigned int)(voltage[map[BAT]] * 1000)); // printf("Amps: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 1)); - uint16_t x = (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000); - uint16_t y = (uint16_t)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000); - uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000); - uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000); + uint16_t x = (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) && 0x3fff; // 14 bits + uint16_t y = (uint16_t)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000) && 0x3fff; + uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000) && 0x3fff; + uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000) && 0x3fff; // x = 0xfffc; // 0xffff; // y = 0x0; // 0x0000; @@ -2322,19 +2322,19 @@ void get_tlm_fc() { printf("X %x Y %x Z %x B %x\n", x, y, z, b); - source_bytes[FC_EPS + 0] = 0xff & (x >> 8); // mV - source_bytes[FC_EPS + 1] = 0xfc & (x << 0); + source_bytes[FC_EPS + 0] = 0xff & (x >> 10); // mV + source_bytes[FC_EPS + 1] = 0xfc & (x << 2); - source_bytes[FC_EPS + 1] = source_bytes[FC_EPS + 1] | (0x03 & (y >> 14)); - source_bytes[FC_EPS + 2] = 0xff & (y >> 6); // mV - source_bytes[FC_EPS + 3] = 0xf0 & (y << 2); + source_bytes[FC_EPS + 1] = source_bytes[FC_EPS + 1] | (0x03 & (y >> 12)); + source_bytes[FC_EPS + 2] = 0xff & (y >> 4); // mV + source_bytes[FC_EPS + 3] = 0xf0 & (y << 0); - source_bytes[FC_EPS + 3] = source_bytes[FC_EPS + 3] | (0x0f & (z >> 12)); - source_bytes[FC_EPS + 4] = 0xff & (z >> 4); // mV - source_bytes[FC_EPS + 5] = 0xc0 & (z << 4); + source_bytes[FC_EPS + 3] = source_bytes[FC_EPS + 3] | (0x0f & (z >> 10)); + source_bytes[FC_EPS + 4] = 0xff & (z >> 2); // mV + source_bytes[FC_EPS + 5] = 0xc0 & (z << 0); - source_bytes[FC_EPS + 5] = source_bytes[FC_EPS + 5] | (0x3f & (b >> 10)); // mV - source_bytes[FC_EPS + 6] = 0xff & (b >> 2); + source_bytes[FC_EPS + 5] = source_bytes[FC_EPS + 5] | (0x3f & (b >> 8)); // mV + source_bytes[FC_EPS + 6] = 0xff & (b >> 0); /* source_bytes[FC_EPS + 0] = 0xff & (((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) >> 8)); // mV source_bytes[FC_EPS + 1] = 0xff & ((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); From cab80e13a106066efb624fde75e7859ffe9422a9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 13:17:24 -0500 Subject: [PATCH 10/96] Update main.c add currents --- main.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 37164e62..5a56fdee 100644 --- a/main.c +++ b/main.c @@ -2315,6 +2315,19 @@ void get_tlm_fc() { uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000) && 0x3fff; uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000) && 0x3fff; + uint16_t ix = (uint16_t)((current[map[PLUS_X]] + current[map[MINUS_X]]) * 1000) && 0x3ff; // 10 bits + uint16_t iy = (uint16_t)((current[map[PLUS_Y]] + current[map[MINUS_Y]]) * 1000) && 0x3ff; + uint16_t iz = (uint16_t)((current[map[PLUS_Z]] + current[map[MINUS_Z]]) * 1000) && 0x3ff; + + if (current[map[BAT]] < 0 ) { + uint16_t ic = (uint16_t)(current[map[BAT]] * -1000) && 0x3ff; // charging current + uint16_t ib = 0; + } + else { + uint16_t ic = 0; + uint16_t ib = (uint16_t)(current[map[BAT]] * 1000) && 0x3ff; // supplying current + } + // x = 0xfffc; // 0xffff; // y = 0x0; // 0x0000; // z = 0xfffc; // 0xffff; @@ -2333,8 +2346,31 @@ void get_tlm_fc() { source_bytes[FC_EPS + 4] = 0xff & (z >> 2); // mV source_bytes[FC_EPS + 5] = 0xc0 & (z << 0); - source_bytes[FC_EPS + 5] = source_bytes[FC_EPS + 5] | (0x3f & (b >> 8)); // mV + source_bytes[FC_EPS + 5] = source_bytes[FC_EPS + 5] | (0x3f & (b >> 8)); source_bytes[FC_EPS + 6] = 0xff & (b >> 0); + + source_bytes[FC_EPS + 7] = 0xff & (ix >> 2); + source_bytes[FC_EPS + 8] = 0xc0 & (iy << 6); + + source_bytes[FC_EPS + 8] = source_bytes[FC_EPS + 8] | (0x3f & (iy >> 4)); + source_bytes[FC_EPS + 9] = 0xf0 & (iy << 4); + + source_bytes[FC_EPS + 9] = source_bytes[FC_EPS + 9] | (0x0f & (iz >> 6)); + source_bytes[FC_EPS + 10] = 0x3f & (iz << 2); + + source_bytes[FC_EPS + 10] = source_bytes[FC_EPS + 10] | (0x03 & (ic >> 8)); + source_bytes[FC_EPS + 11] = 0xff & (ic << 0); + + source_bytes[FC_EPS + 12] = 0xff & (ib >> 2); + source_bytes[FC_EPS + 13] = 0xc0 & (ib << 6); + + source_bytes[FC_EPS + 13] = source_bytes[FC_EPS + 13] | 0x3f & (((unsigned long int)reset_count) >> 2); + source_bytes[FC_EPS + 14] = 0xff & (((unsigned long int)reset_count) << 6); + + uint8_t temp = (int)(other[IHU_TEMP] + 0.5); + + source_bytes[FC_EPS + 17] = source_bytes[FC_EPS + 17] | 0x3f & (temp >> 2); + source_bytes[FC_EPS + 18] = 0xff & (temp << 6); /* source_bytes[FC_EPS + 0] = 0xff & (((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) >> 8)); // mV source_bytes[FC_EPS + 1] = 0xff & ((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); From 7ca536fbe58c82d8fe9ef600a128d853c775edac Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 13:20:04 -0500 Subject: [PATCH 11/96] Update main.c fix currents --- main.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index 5a56fdee..45b7c8ce 100644 --- a/main.c +++ b/main.c @@ -2318,15 +2318,14 @@ void get_tlm_fc() { uint16_t ix = (uint16_t)((current[map[PLUS_X]] + current[map[MINUS_X]]) * 1000) && 0x3ff; // 10 bits uint16_t iy = (uint16_t)((current[map[PLUS_Y]] + current[map[MINUS_Y]]) * 1000) && 0x3ff; uint16_t iz = (uint16_t)((current[map[PLUS_Z]] + current[map[MINUS_Z]]) * 1000) && 0x3ff; + + uint16_t ic = 0, + uint16_t ib = 0; - if (current[map[BAT]] < 0 ) { - uint16_t ic = (uint16_t)(current[map[BAT]] * -1000) && 0x3ff; // charging current - uint16_t ib = 0; - } - else { - uint16_t ic = 0; - uint16_t ib = (uint16_t)(current[map[BAT]] * 1000) && 0x3ff; // supplying current - } + if (current[map[BAT]] < 0 ) + ic = (uint16_t)(current[map[BAT]] * -1000) && 0x3ff; // charging current + else + ib = (uint16_t)(current[map[BAT]] * 1000) && 0x3ff; // supplying current // x = 0xfffc; // 0xffff; // y = 0x0; // 0x0000; From 6c18f94d06be311b4773759cb69901967bd96f67 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 13:20:53 -0500 Subject: [PATCH 12/96] Update main.c missing ; --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 45b7c8ce..403cd68f 100644 --- a/main.c +++ b/main.c @@ -2319,7 +2319,7 @@ void get_tlm_fc() { uint16_t iy = (uint16_t)((current[map[PLUS_Y]] + current[map[MINUS_Y]]) * 1000) && 0x3ff; uint16_t iz = (uint16_t)((current[map[PLUS_Z]] + current[map[MINUS_Z]]) * 1000) && 0x3ff; - uint16_t ic = 0, + uint16_t ic = 0; uint16_t ib = 0; if (current[map[BAT]] < 0 ) From 33f5b2461578607bfdd4e31190b9553632338350 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 13:26:50 -0500 Subject: [PATCH 13/96] Update main.c move sequence number --- main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 403cd68f..e885b67b 100644 --- a/main.c +++ b/main.c @@ -2389,9 +2389,15 @@ void get_tlm_fc() { source_bytes[FC_EPS + 12] = 0xff & (((unsigned long int)reset_count >> 8)); source_bytes[FC_EPS + 13] = 0xff & ((unsigned long int)reset_count); */ - source_bytes[FC_SW + 0] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number - source_bytes[FC_SW + 1] = 0xff & ((unsigned long int)sequence >> 8); - source_bytes[FC_SW + 2] = 0xff & (unsigned long int)sequence++; + +// source_bytes[FC_SW + 0] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number +// source_bytes[FC_SW + 1] = 0xff & ((unsigned long int)sequence >> 8); +// source_bytes[FC_SW + 2] = 0xff & (unsigned long int)sequence++; + + source_bytes[46] = 0xff & ((unsigned long int)sequence >> 16); + source_bytes[47] = 0xff & ((unsigned long int)sequence >> 8); + source_bytes[48] = 0xff & (unsigned long int)sequence++; + /**/ printf("\nsource_bytes\n"); for (int i=0; i<256; i++) From 34b07607dfc8f3b01a51360b98b80a2777ce3366 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 16:33:39 -0500 Subject: [PATCH 14/96] Update main.c add extended header --- main.c | 59 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/main.c b/main.c index e885b67b..b9b504f5 100644 --- a/main.c +++ b/main.c @@ -2303,7 +2303,10 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b11000001 ; // 0b00000001 ; +// source_bytes[0] = 0b00000001 ; // Sat Id is FunCube-EM + source_bytes[0] = 0b11000001 ; // Sat Id is extended + source_bytes[1] = 0x08 ; // extended Nayif + int extended = 1; // source_bytes[1] = 0b10000010 ; @@ -2334,42 +2337,42 @@ void get_tlm_fc() { printf("X %x Y %x Z %x B %x\n", x, y, z, b); - source_bytes[FC_EPS + 0] = 0xff & (x >> 10); // mV - source_bytes[FC_EPS + 1] = 0xfc & (x << 2); + source_bytes[extended + FC_EPS + 0] = 0xff & (x >> 10); // mV + source_bytes[extended + FC_EPS + 1] = 0xfc & (x << 2); - source_bytes[FC_EPS + 1] = source_bytes[FC_EPS + 1] | (0x03 & (y >> 12)); - source_bytes[FC_EPS + 2] = 0xff & (y >> 4); // mV - source_bytes[FC_EPS + 3] = 0xf0 & (y << 0); + source_bytes[extended + FC_EPS + 1] = source_bytes[FC_EPS + 1] | (0x03 & (y >> 12)); + source_bytes[extended + FC_EPS + 2] = 0xff & (y >> 4); // mV + source_bytes[extended + FC_EPS + 3] = 0xf0 & (y << 0); - source_bytes[FC_EPS + 3] = source_bytes[FC_EPS + 3] | (0x0f & (z >> 10)); - source_bytes[FC_EPS + 4] = 0xff & (z >> 2); // mV - source_bytes[FC_EPS + 5] = 0xc0 & (z << 0); + source_bytes[extended + FC_EPS + 3] = source_bytes[FC_EPS + 3] | (0x0f & (z >> 10)); + source_bytes[extended + FC_EPS + 4] = 0xff & (z >> 2); // mV + source_bytes[extended + FC_EPS + 5] = 0xc0 & (z << 0); - source_bytes[FC_EPS + 5] = source_bytes[FC_EPS + 5] | (0x3f & (b >> 8)); - source_bytes[FC_EPS + 6] = 0xff & (b >> 0); + source_bytes[extended + FC_EPS + 5] = source_bytes[FC_EPS + 5] | (0x3f & (b >> 8)); + source_bytes[extended + FC_EPS + 6] = 0xff & (b >> 0); - source_bytes[FC_EPS + 7] = 0xff & (ix >> 2); - source_bytes[FC_EPS + 8] = 0xc0 & (iy << 6); + source_bytes[extended + FC_EPS + 7] = 0xff & (ix >> 2); + source_bytes[extended + FC_EPS + 8] = 0xc0 & (iy << 6); - source_bytes[FC_EPS + 8] = source_bytes[FC_EPS + 8] | (0x3f & (iy >> 4)); - source_bytes[FC_EPS + 9] = 0xf0 & (iy << 4); + source_bytes[extended + FC_EPS + 8] = source_bytes[FC_EPS + 8] | (0x3f & (iy >> 4)); + source_bytes[extended + FC_EPS + 9] = 0xf0 & (iy << 4); - source_bytes[FC_EPS + 9] = source_bytes[FC_EPS + 9] | (0x0f & (iz >> 6)); - source_bytes[FC_EPS + 10] = 0x3f & (iz << 2); + source_bytes[extended + FC_EPS + 9] = source_bytes[FC_EPS + 9] | (0x0f & (iz >> 6)); + source_bytes[extended + FC_EPS + 10] = 0x3f & (iz << 2); - source_bytes[FC_EPS + 10] = source_bytes[FC_EPS + 10] | (0x03 & (ic >> 8)); - source_bytes[FC_EPS + 11] = 0xff & (ic << 0); + source_bytes[extended + FC_EPS + 10] = source_bytes[FC_EPS + 10] | (0x03 & (ic >> 8)); + source_bytes[extended + FC_EPS + 11] = 0xff & (ic << 0); - source_bytes[FC_EPS + 12] = 0xff & (ib >> 2); - source_bytes[FC_EPS + 13] = 0xc0 & (ib << 6); + source_bytes[extended + FC_EPS + 12] = 0xff & (ib >> 2); + source_bytes[extended + FC_EPS + 13] = 0xc0 & (ib << 6); - source_bytes[FC_EPS + 13] = source_bytes[FC_EPS + 13] | 0x3f & (((unsigned long int)reset_count) >> 2); - source_bytes[FC_EPS + 14] = 0xff & (((unsigned long int)reset_count) << 6); + source_bytes[extended + FC_EPS + 13] = source_bytes[FC_EPS + 13] | 0x3f & (((unsigned long int)reset_count) >> 2); + source_bytes[extended + FC_EPS + 14] = 0xff & (((unsigned long int)reset_count) << 6); uint8_t temp = (int)(other[IHU_TEMP] + 0.5); - source_bytes[FC_EPS + 17] = source_bytes[FC_EPS + 17] | 0x3f & (temp >> 2); - source_bytes[FC_EPS + 18] = 0xff & (temp << 6); + source_bytes[extended + FC_EPS + 17] = source_bytes[FC_EPS + 17] | 0x3f & (temp >> 2); + source_bytes[extended + FC_EPS + 18] = 0xff & (temp << 6); /* source_bytes[FC_EPS + 0] = 0xff & (((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) >> 8)); // mV source_bytes[FC_EPS + 1] = 0xff & ((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); @@ -2394,9 +2397,9 @@ void get_tlm_fc() { // source_bytes[FC_SW + 1] = 0xff & ((unsigned long int)sequence >> 8); // source_bytes[FC_SW + 2] = 0xff & (unsigned long int)sequence++; - source_bytes[46] = 0xff & ((unsigned long int)sequence >> 16); - source_bytes[47] = 0xff & ((unsigned long int)sequence >> 8); - source_bytes[48] = 0xff & (unsigned long int)sequence++; + source_bytes[extended + 46] = 0xff & ((unsigned long int)sequence >> 16); + source_bytes[extended + 47] = 0xff & ((unsigned long int)sequence >> 8); + source_bytes[extended + 48] = 0xff & (unsigned long int)sequence++; /**/ printf("\nsource_bytes\n"); From 94dfa92019a032e2fd2242306c1d18454cfde0e8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 16:54:08 -0500 Subject: [PATCH 15/96] Update main.c try extended JY-1 --- main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index b9b504f5..4eab3c2c 100644 --- a/main.c +++ b/main.c @@ -2305,7 +2305,8 @@ void get_tlm_fc() { memset(source_bytes, 0x00, sizeof(source_bytes)); // source_bytes[0] = 0b00000001 ; // Sat Id is FunCube-EM source_bytes[0] = 0b11000001 ; // Sat Id is extended - source_bytes[1] = 0x08 ; // extended Nayif +// source_bytes[1] = 0x08 ; // extended Nayify + source_bytes[1] = 0x00 ; // extended JY-1 int extended = 1; // source_bytes[1] = 0b10000010 ; @@ -2326,7 +2327,7 @@ void get_tlm_fc() { uint16_t ib = 0; if (current[map[BAT]] < 0 ) - ic = (uint16_t)(current[map[BAT]] * -1000) && 0x3ff; // charging current + ic = (uint16_t)(current[map[BAT]] * (-1000)) && 0x3ff; // charging current else ib = (uint16_t)(current[map[BAT]] * 1000) && 0x3ff; // supplying current @@ -2397,9 +2398,9 @@ void get_tlm_fc() { // source_bytes[FC_SW + 1] = 0xff & ((unsigned long int)sequence >> 8); // source_bytes[FC_SW + 2] = 0xff & (unsigned long int)sequence++; - source_bytes[extended + 46] = 0xff & ((unsigned long int)sequence >> 16); - source_bytes[extended + 47] = 0xff & ((unsigned long int)sequence >> 8); - source_bytes[extended + 48] = 0xff & (unsigned long int)sequence++; + source_bytes[extended + 45] = 0xff & ((unsigned long int)sequence >> 16); // was 46 + source_bytes[extended + 46] = 0xff & ((unsigned long int)sequence >> 8); + source_bytes[extended + 47] = 0xff & (unsigned long int)sequence++; /**/ printf("\nsource_bytes\n"); From 98f23505b5566d903f9967a990c9da79f845f052 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 17:03:55 -0500 Subject: [PATCH 16/96] Update main.c back to Nayif --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 4eab3c2c..05888c7d 100644 --- a/main.c +++ b/main.c @@ -2305,8 +2305,8 @@ void get_tlm_fc() { memset(source_bytes, 0x00, sizeof(source_bytes)); // source_bytes[0] = 0b00000001 ; // Sat Id is FunCube-EM source_bytes[0] = 0b11000001 ; // Sat Id is extended -// source_bytes[1] = 0x08 ; // extended Nayify - source_bytes[1] = 0x00 ; // extended JY-1 + source_bytes[1] = 0x08 ; // extended Nayify - works +// source_bytes[1] = 0x00 ; // extended JY-1 - didn't work int extended = 1; // source_bytes[1] = 0b10000010 ; From 10715456bff6a9c9e47f95d4b71609fbf5c2a304 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 21:54:23 -0500 Subject: [PATCH 17/96] Update main.c try 0x10 and 50 for seq --- main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 05888c7d..19141d39 100644 --- a/main.c +++ b/main.c @@ -2305,8 +2305,8 @@ void get_tlm_fc() { memset(source_bytes, 0x00, sizeof(source_bytes)); // source_bytes[0] = 0b00000001 ; // Sat Id is FunCube-EM source_bytes[0] = 0b11000001 ; // Sat Id is extended - source_bytes[1] = 0x08 ; // extended Nayify - works -// source_bytes[1] = 0x00 ; // extended JY-1 - didn't work +// source_bytes[1] = 0x08 ; // extended Nayify - works + source_bytes[1] = 0x10 ; // extended JY-1 - 0x00 didn't work int extended = 1; // source_bytes[1] = 0b10000010 ; @@ -2398,9 +2398,9 @@ void get_tlm_fc() { // source_bytes[FC_SW + 1] = 0xff & ((unsigned long int)sequence >> 8); // source_bytes[FC_SW + 2] = 0xff & (unsigned long int)sequence++; - source_bytes[extended + 45] = 0xff & ((unsigned long int)sequence >> 16); // was 46 - source_bytes[extended + 46] = 0xff & ((unsigned long int)sequence >> 8); - source_bytes[extended + 47] = 0xff & (unsigned long int)sequence++; + source_bytes[extended + 47] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 + source_bytes[extended + 48] = 0xff & ((unsigned long int)sequence >> 8); + source_bytes[extended + 49] = 0xff & (unsigned long int)sequence++; /**/ printf("\nsource_bytes\n"); From a7bc18c4bb40719df2dd96ee0a33c4d01d75ed79 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 22:01:33 -0500 Subject: [PATCH 18/96] Update main.c move seq --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 19141d39..128c64b3 100644 --- a/main.c +++ b/main.c @@ -2398,9 +2398,9 @@ void get_tlm_fc() { // source_bytes[FC_SW + 1] = 0xff & ((unsigned long int)sequence >> 8); // source_bytes[FC_SW + 2] = 0xff & (unsigned long int)sequence++; - source_bytes[extended + 47] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 - source_bytes[extended + 48] = 0xff & ((unsigned long int)sequence >> 8); - source_bytes[extended + 49] = 0xff & (unsigned long int)sequence++; + source_bytes[extended + 45] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 + source_bytes[extended + 46] = 0xff & ((unsigned long int)sequence >> 8); + source_bytes[extended + 47] = 0xff & (unsigned long int)sequence++; /**/ printf("\nsource_bytes\n"); From a129d1344930848aabc3920111831077dba685d3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 22:18:23 -0500 Subject: [PATCH 19/96] Update main.c eclipse = 1, move seq --- main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 128c64b3..d58ade5e 100644 --- a/main.c +++ b/main.c @@ -413,7 +413,8 @@ int main(int argc, char * argv[]) { batt = rnd_float(3.8, 4.3); speed = rnd_float(1.0, 2.5); - eclipse = (rnd_float(-1, +4) > 0) ? 1.0 : 0.0; +// eclipse = (rnd_float(-1, +4) > 0) ? 1.0 : 0.0; + eclipse = 1; period = rnd_float(150, 300); tempS = rnd_float(20, 55); temp_max = rnd_float(50, 70); @@ -728,12 +729,13 @@ int main(int argc, char * argv[]) { if (sim_mode) { // simulated telemetry double time = ((long int)millis() - time_start) / 1000.0; - +/* if ((time - eclipse_time) > period) { eclipse = (eclipse == 1) ? 0 : 1; eclipse_time = time; printf("\n\nSwitching eclipse mode! \n\n"); } + */ double Xi = eclipse * amps_max[0] * (float) sin(2.0 * 3.14 * time / (46.0 * speed)) + rnd_float(-2, 2); double Yi = eclipse * amps_max[1] * (float) sin((2.0 * 3.14 * time / (46.0 * speed)) + (3.14 / 2.0)) + rnd_float(-2, 2); @@ -2398,9 +2400,9 @@ void get_tlm_fc() { // source_bytes[FC_SW + 1] = 0xff & ((unsigned long int)sequence >> 8); // source_bytes[FC_SW + 2] = 0xff & (unsigned long int)sequence++; - source_bytes[extended + 45] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 - source_bytes[extended + 46] = 0xff & ((unsigned long int)sequence >> 8); - source_bytes[extended + 47] = 0xff & (unsigned long int)sequence++; + source_bytes[extended + 46] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 + source_bytes[extended + 47] = 0xff & ((unsigned long int)sequence >> 8); + source_bytes[extended + 48] = 0xff & (unsigned long int)sequence++; /**/ printf("\nsource_bytes\n"); From 55fa313dfcfe5e3e7e7ceb7c52b1bda919bb8805 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 13:33:52 -0500 Subject: [PATCH 20/96] Update main.c add FC-EM and JY-1 defines --- main.c | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/main.c b/main.c index d58ade5e..ace14e71 100644 --- a/main.c +++ b/main.c @@ -2293,10 +2293,12 @@ if (setting == ON) { void get_tlm_fc() { +//# define FC-EM +#define JY-1 + /* create data, stream, and waveform buffers */ unsigned char source_bytes[256]; -// unsigned char encoded_bytes[650]; int byte_count = 256; /* write telemetry into data buffer */ @@ -2305,13 +2307,15 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); -// source_bytes[0] = 0b00000001 ; // Sat Id is FunCube-EM +#ifdef FC-EM + source_bytes[0] = 0b00000001 ; // Sat Id is FunCube-EM +#endif +#ifdef JY-1 source_bytes[0] = 0b11000001 ; // Sat Id is extended // source_bytes[1] = 0x08 ; // extended Nayify - works source_bytes[1] = 0x10 ; // extended JY-1 - 0x00 didn't work int extended = 1; - -// source_bytes[1] = 0b10000010 ; +#endif // printf("Volt: %f Int: %d \n", voltage[map[BAT]], (unsigned int)(voltage[map[BAT]] * 1000)); // printf("Amps: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 1)); @@ -2339,7 +2343,7 @@ void get_tlm_fc() { // b = 0x000c; printf("X %x Y %x Z %x B %x\n", x, y, z, b); - +#ifdef JY-1 source_bytes[extended + FC_EPS + 0] = 0xff & (x >> 10); // mV source_bytes[extended + FC_EPS + 1] = 0xfc & (x << 2); @@ -2376,7 +2380,22 @@ void get_tlm_fc() { source_bytes[extended + FC_EPS + 17] = source_bytes[FC_EPS + 17] | 0x3f & (temp >> 2); source_bytes[extended + FC_EPS + 18] = 0xff & (temp << 6); -/* + +// source_bytes[extended + 46] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 +// source_bytes[extended + 47] = 0xff & ((unsigned long int)sequence >> 8); +// source_bytes[extended + 48] = 0xff & (unsigned long int)sequence++; + + source_bytes[extended + 46] = 0x01; + source_bytes[extended + 47] = 0x02; + source_bytes[extended + 48] = 0x03; + source_bytes[extended + 49] = 0x04; + source_bytes[extended + 50] = 0x05; + source_bytes[extended + 51] = 0x06; + source_bytes[extended + 52] = 0x07; + +#endif + +#ifdef FC-EM source_bytes[FC_EPS + 0] = 0xff & (((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) >> 8)); // mV source_bytes[FC_EPS + 1] = 0xff & ((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); source_bytes[FC_EPS + 2] = 0xff & (((unsigned int)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000) >> 8)); // mV @@ -2394,15 +2413,11 @@ void get_tlm_fc() { source_bytes[FC_EPS + 11] = 0xff & ((unsigned int)(current[map[BAT]] * 1)); source_bytes[FC_EPS + 12] = 0xff & (((unsigned long int)reset_count >> 8)); source_bytes[FC_EPS + 13] = 0xff & ((unsigned long int)reset_count); -*/ -// source_bytes[FC_SW + 0] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number -// source_bytes[FC_SW + 1] = 0xff & ((unsigned long int)sequence >> 8); -// source_bytes[FC_SW + 2] = 0xff & (unsigned long int)sequence++; - - source_bytes[extended + 46] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 - source_bytes[extended + 47] = 0xff & ((unsigned long int)sequence >> 8); - source_bytes[extended + 48] = 0xff & (unsigned long int)sequence++; + source_bytes[FC_SW + 0] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number + source_bytes[FC_SW + 1] = 0xff & ((unsigned long int)sequence >> 8); + source_bytes[FC_SW + 2] = 0xff & (unsigned long int)sequence++; +#endif /**/ printf("\nsource_bytes\n"); From c9aed9aea5cad94c3128f9e901cced0e74d96f0b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 13:35:31 -0500 Subject: [PATCH 21/96] Update main.c fix defines --- main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index ace14e71..6bd1f981 100644 --- a/main.c +++ b/main.c @@ -2293,8 +2293,8 @@ if (setting == ON) { void get_tlm_fc() { -//# define FC-EM -#define JY-1 +//# define FC_EM +#define JY_1 /* create data, stream, and waveform buffers */ @@ -2307,13 +2307,13 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); -#ifdef FC-EM +#ifdef FC_EM source_bytes[0] = 0b00000001 ; // Sat Id is FunCube-EM #endif -#ifdef JY-1 +#ifdef JY_1 source_bytes[0] = 0b11000001 ; // Sat Id is extended -// source_bytes[1] = 0x08 ; // extended Nayify - works - source_bytes[1] = 0x10 ; // extended JY-1 - 0x00 didn't work +// source_bytes[1] = 0x08 ; // extended Nayify - works per code + source_bytes[1] = 0x10 ; // extended JY-1 - works, no documentation int extended = 1; #endif @@ -2343,7 +2343,7 @@ void get_tlm_fc() { // b = 0x000c; printf("X %x Y %x Z %x B %x\n", x, y, z, b); -#ifdef JY-1 +#ifdef JY_1 source_bytes[extended + FC_EPS + 0] = 0xff & (x >> 10); // mV source_bytes[extended + FC_EPS + 1] = 0xfc & (x << 2); @@ -2395,7 +2395,7 @@ void get_tlm_fc() { #endif -#ifdef FC-EM +#ifdef FC_EM source_bytes[FC_EPS + 0] = 0xff & (((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) >> 8)); // mV source_bytes[FC_EPS + 1] = 0xff & ((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); source_bytes[FC_EPS + 2] = 0xff & (((unsigned int)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000) >> 8)); // mV From ca47edbf945bb6c754e6243c16851eb5a0ef8b24 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 13:38:57 -0500 Subject: [PATCH 22/96] Update main.c fix JY-1 seq --- main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 6bd1f981..57491bb1 100644 --- a/main.c +++ b/main.c @@ -2381,10 +2381,11 @@ void get_tlm_fc() { source_bytes[extended + FC_EPS + 17] = source_bytes[FC_EPS + 17] | 0x3f & (temp >> 2); source_bytes[extended + FC_EPS + 18] = 0xff & (temp << 6); -// source_bytes[extended + 46] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 -// source_bytes[extended + 47] = 0xff & ((unsigned long int)sequence >> 8); -// source_bytes[extended + 48] = 0xff & (unsigned long int)sequence++; + source_bytes[extended + 49 = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 + source_bytes[extended + 50] = 0xff & ((unsigned long int)sequence >> 8); + source_bytes[extended + 51] = 0xff & (unsigned long int)sequence++; + /* source_bytes[extended + 46] = 0x01; source_bytes[extended + 47] = 0x02; source_bytes[extended + 48] = 0x03; @@ -2392,7 +2393,7 @@ void get_tlm_fc() { source_bytes[extended + 50] = 0x05; source_bytes[extended + 51] = 0x06; source_bytes[extended + 52] = 0x07; - +*/ #endif #ifdef FC_EM From f781b59b11d847a20e4e14564a0556171984d4dc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 13:40:13 -0500 Subject: [PATCH 23/96] Update main.c missing ] --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 57491bb1..82d650e2 100644 --- a/main.c +++ b/main.c @@ -2381,7 +2381,7 @@ void get_tlm_fc() { source_bytes[extended + FC_EPS + 17] = source_bytes[FC_EPS + 17] | 0x3f & (temp >> 2); source_bytes[extended + FC_EPS + 18] = 0xff & (temp << 6); - source_bytes[extended + 49 = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 + source_bytes[extended + 49] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 source_bytes[extended + 50] = 0xff & ((unsigned long int)sequence >> 8); source_bytes[extended + 51] = 0xff & (unsigned long int)sequence++; From 7bc97bb30bbc442945c9070fce8e316a625c72db Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 13:43:59 -0500 Subject: [PATCH 24/96] Update main.c turn on DEBUG_LOGGING --- main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 82d650e2..bfbafb25 100644 --- a/main.c +++ b/main.c @@ -18,7 +18,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - +#define DEBUG_LOGGING + #include "main.h" //#define HAB // uncomment to change APRS icon from Satellite to Balloon and only BAT telemetry From 2d77bb7ab89bd4fed52793077a060ae3c7d7e65a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 13:48:12 -0500 Subject: [PATCH 25/96] Update main.c sim_mode debugging --- main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index bfbafb25..d27a12b4 100644 --- a/main.c +++ b/main.c @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#define DEBUG_LOGGING #include "main.h" @@ -421,11 +420,11 @@ int main(int argc, char * argv[]) { temp_max = rnd_float(50, 70); temp_min = rnd_float(10, 20); - #ifdef DEBUG_LOGGING +// #ifdef DEBUG_LOGGING for (int i = 0; i < 3; i++) printf("axis: %f angle: %f v: %f i: %f \n", axis[i], angle[i], volts_max[i], amps_max[i]); printf("batt: %f speed: %f eclipse_time: %f eclipse: %f period: %f temp: %f max: %f min: %f\n", batt, speed, eclipse_time, eclipse, period, tempS, temp_max, temp_min); - #endif +// #endif time_start = (long int) millis(); @@ -736,7 +735,7 @@ int main(int argc, char * argv[]) { eclipse_time = time; printf("\n\nSwitching eclipse mode! \n\n"); } - */ +*/ double Xi = eclipse * amps_max[0] * (float) sin(2.0 * 3.14 * time / (46.0 * speed)) + rnd_float(-2, 2); double Yi = eclipse * amps_max[1] * (float) sin((2.0 * 3.14 * time / (46.0 * speed)) + (3.14 / 2.0)) + rnd_float(-2, 2); @@ -746,7 +745,7 @@ int main(int argc, char * argv[]) { double Yv = eclipse * volts_max[1] * (float) sin((2.0 * 3.14 * time / (46.0 * speed)) + (3.14 / 2.0)) + rnd_float(-0.2, 0.2); double Zv = 2.0 * eclipse * volts_max[2] * (float) sin((2.0 * 3.14 * time / (46.0 * speed)) + 3.14 + angle[2]) + rnd_float(-0.2, 0.2); - // printf("Yi: %f Zi: %f %f %f Zv: %f \n", Yi, Zi, amps_max[2], angle[2], Zv); + printf("Yi: %f Zi: %f %f %f Zv: %f \n", Yi, Zi, amps_max[2], angle[2], Zv); current[map[PLUS_X]] = (Xi >= 0) ? Xi : 0; current[map[MINUS_X]] = (Xi >= 0) ? 0 : ((-1.0f) * Xi); From c3056f1cc4c0a52ba7668676b1001ab16aba59b4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 13:57:52 -0500 Subject: [PATCH 26/96] Update main.c prints --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index d27a12b4..13d10ebf 100644 --- a/main.c +++ b/main.c @@ -2317,8 +2317,8 @@ void get_tlm_fc() { int extended = 1; #endif -// printf("Volt: %f Int: %d \n", voltage[map[BAT]], (unsigned int)(voltage[map[BAT]] * 1000)); -// printf("Amps: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 1)); + printf("Volts: %f %f %f %f \n", voltage[map[BAT]], voltage[map[PLUS_X]] , voltage[map[PLUS_Y]], voltage[map[PLUS_Z]]); + printf("Amps: %f %f %f %f \n", current[map[BAT]], current[map[PLUS_X]] , current[map[PLUS_Y]], current[map[PLUS_Z]]); uint16_t x = (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) && 0x3fff; // 14 bits uint16_t y = (uint16_t)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000) && 0x3fff; From b88d8804f4094eaa1392434fe42c7dc562063f7c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 14:05:29 -0500 Subject: [PATCH 27/96] Update main.c prints for x --- main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.c b/main.c index 13d10ebf..20b9ea07 100644 --- a/main.c +++ b/main.c @@ -2320,6 +2320,11 @@ void get_tlm_fc() { printf("Volts: %f %f %f %f \n", voltage[map[BAT]], voltage[map[PLUS_X]] , voltage[map[PLUS_Y]], voltage[map[PLUS_Z]]); printf("Amps: %f %f %f %f \n", current[map[BAT]], current[map[PLUS_X]] , current[map[PLUS_Y]], current[map[PLUS_Z]]); + printf(" %f\n", (voltage[map[PLUS_X]] + voltage[map[MINUS_X]])); + printf(" %f\n", (voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000); + printf(" %d\n", (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); + printf(" %d\n", (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) && 0x3fff); + uint16_t x = (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) && 0x3fff; // 14 bits uint16_t y = (uint16_t)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000) && 0x3fff; uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000) && 0x3fff; From 8f957e0045a45c7034855ec010125a44b2dc97f6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 14:08:55 -0500 Subject: [PATCH 28/96] Update main.c change && to & --- main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/main.c b/main.c index 20b9ea07..c92126ba 100644 --- a/main.c +++ b/main.c @@ -2323,24 +2323,24 @@ void get_tlm_fc() { printf(" %f\n", (voltage[map[PLUS_X]] + voltage[map[MINUS_X]])); printf(" %f\n", (voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000); printf(" %d\n", (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); - printf(" %d\n", (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) && 0x3fff); + printf(" %d\n", (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) & 0x3fff); - uint16_t x = (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) && 0x3fff; // 14 bits - uint16_t y = (uint16_t)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000) && 0x3fff; - uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000) && 0x3fff; - uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000) && 0x3fff; + uint16_t x = (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) & 0x3fff; // 14 bits + uint16_t y = (uint16_t)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000) & 0x3fff; + uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000) & 0x3fff; + uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000) & 0x3fff; - uint16_t ix = (uint16_t)((current[map[PLUS_X]] + current[map[MINUS_X]]) * 1000) && 0x3ff; // 10 bits - uint16_t iy = (uint16_t)((current[map[PLUS_Y]] + current[map[MINUS_Y]]) * 1000) && 0x3ff; - uint16_t iz = (uint16_t)((current[map[PLUS_Z]] + current[map[MINUS_Z]]) * 1000) && 0x3ff; + uint16_t ix = (uint16_t)((current[map[PLUS_X]] + current[map[MINUS_X]]) * 1000) & 0x3ff; // 10 bits + uint16_t iy = (uint16_t)((current[map[PLUS_Y]] + current[map[MINUS_Y]]) * 1000) & 0x3ff; + uint16_t iz = (uint16_t)((current[map[PLUS_Z]] + current[map[MINUS_Z]]) * 1000) & 0x3ff; uint16_t ic = 0; uint16_t ib = 0; if (current[map[BAT]] < 0 ) - ic = (uint16_t)(current[map[BAT]] * (-1000)) && 0x3ff; // charging current + ic = (uint16_t)(current[map[BAT]] * (-1000)) & 0x3ff; // charging current else - ib = (uint16_t)(current[map[BAT]] * 1000) && 0x3ff; // supplying current + ib = (uint16_t)(current[map[BAT]] * 1000) & 0x3ff; // supplying current // x = 0xfffc; // 0xffff; // y = 0x0; // 0x0000; From 45cb44b6fc6075ff03f506b3589a6446647e2db5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 14:26:31 -0500 Subject: [PATCH 29/96] Update main.c find max of plus and minus --- main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index c92126ba..b0dffaee 100644 --- a/main.c +++ b/main.c @@ -2320,12 +2320,9 @@ void get_tlm_fc() { printf("Volts: %f %f %f %f \n", voltage[map[BAT]], voltage[map[PLUS_X]] , voltage[map[PLUS_Y]], voltage[map[PLUS_Z]]); printf("Amps: %f %f %f %f \n", current[map[BAT]], current[map[PLUS_X]] , current[map[PLUS_Y]], current[map[PLUS_Z]]); - printf(" %f\n", (voltage[map[PLUS_X]] + voltage[map[MINUS_X]])); - printf(" %f\n", (voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000); - printf(" %d\n", (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); - printf(" %d\n", (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) & 0x3fff); - - uint16_t x = (uint16_t)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) & 0x3fff; // 14 bits + float xmax = (voltage[map[PLUS_X]] > voltage[map[MINUS_X]]) ? voltage[map[PLUS_X]] : voltage[map[MINUS_X]]; + + uint16_t x = (uint16_t)(xmax * 1000) & 0x3fff; // 14 bits uint16_t y = (uint16_t)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000) & 0x3fff; uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000) & 0x3fff; uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000) & 0x3fff; From 44891ff9c34cbbd34c0f39d9682a4d6f81bbcdc9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 14:39:04 -0500 Subject: [PATCH 30/96] Update main.c don't multiply current by 1000 --- main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index b0dffaee..79490305 100644 --- a/main.c +++ b/main.c @@ -2321,23 +2321,27 @@ void get_tlm_fc() { printf("Amps: %f %f %f %f \n", current[map[BAT]], current[map[PLUS_X]] , current[map[PLUS_Y]], current[map[PLUS_Z]]); float xmax = (voltage[map[PLUS_X]] > voltage[map[MINUS_X]]) ? voltage[map[PLUS_X]] : voltage[map[MINUS_X]]; + float ymax = (voltage[map[PLUS_Y]] > voltage[map[MINUS_Y]]) ? voltage[map[PLUS_Y]] : voltage[map[MINUS_Y]]; + float zmax = (voltage[map[PLUS_Z]] > voltage[map[MINUS_Z]]) ? voltage[map[PLUS_Z]] : voltage[map[MINUS_Z]]; + + printf("Vmax: %f %f %f \n", xmax, ymax, zmax); uint16_t x = (uint16_t)(xmax * 1000) & 0x3fff; // 14 bits - uint16_t y = (uint16_t)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000) & 0x3fff; - uint16_t z = (uint16_t)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000) & 0x3fff; + uint16_t y = (uint16_t)(ymax * 1000) & 0x3fff; + uint16_t z = (uint16_t)(zmax * 1000) & 0x3fff; uint16_t b = (uint16_t)(voltage[map[BAT]] * 1000) & 0x3fff; - uint16_t ix = (uint16_t)((current[map[PLUS_X]] + current[map[MINUS_X]]) * 1000) & 0x3ff; // 10 bits - uint16_t iy = (uint16_t)((current[map[PLUS_Y]] + current[map[MINUS_Y]]) * 1000) & 0x3ff; - uint16_t iz = (uint16_t)((current[map[PLUS_Z]] + current[map[MINUS_Z]]) * 1000) & 0x3ff; + uint16_t ix = (uint16_t)((current[map[PLUS_X]] + current[map[MINUS_X]])) & 0x3ff; // 10 bits + uint16_t iy = (uint16_t)((current[map[PLUS_Y]] + current[map[MINUS_Y]])) & 0x3ff; + uint16_t iz = (uint16_t)((current[map[PLUS_Z]] + current[map[MINUS_Z]])) & 0x3ff; uint16_t ic = 0; uint16_t ib = 0; if (current[map[BAT]] < 0 ) - ic = (uint16_t)(current[map[BAT]] * (-1000)) & 0x3ff; // charging current + ic = (uint16_t)(current[map[BAT]] * (-1)) & 0x3ff; // charging current else - ib = (uint16_t)(current[map[BAT]] * 1000) & 0x3ff; // supplying current + ib = (uint16_t)(current[map[BAT]]) & 0x3ff; // supplying current // x = 0xfffc; // 0xffff; // y = 0x0; // 0x0000; From 98c791ca48f0e2e8a663c2ee73688412c93a66e1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 14:43:43 -0500 Subject: [PATCH 31/96] Update main.c print current minus --- main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 79490305..3df7825d 100644 --- a/main.c +++ b/main.c @@ -2318,7 +2318,8 @@ void get_tlm_fc() { #endif printf("Volts: %f %f %f %f \n", voltage[map[BAT]], voltage[map[PLUS_X]] , voltage[map[PLUS_Y]], voltage[map[PLUS_Z]]); - printf("Amps: %f %f %f %f \n", current[map[BAT]], current[map[PLUS_X]] , current[map[PLUS_Y]], current[map[PLUS_Z]]); + printf("AmpsPlus: %f %f %f %f \n", current[map[BAT]], current[map[PLUS_X]] , current[map[PLUS_Y]], current[map[PLUS_Z]]); + printf("AmpsMinus: %f %f %f %f \n", current[map[BAT2]], current[map[MINUS_X]] , current[map[MINUS_Y]], current[map[MINUS_Z]]); float xmax = (voltage[map[PLUS_X]] > voltage[map[MINUS_X]]) ? voltage[map[PLUS_X]] : voltage[map[MINUS_X]]; float ymax = (voltage[map[PLUS_Y]] > voltage[map[MINUS_Y]]) ? voltage[map[PLUS_Y]] : voltage[map[MINUS_Y]]; From fd69f62a798b3cb57d2dd9f58956defc3d70d416 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 14:47:40 -0500 Subject: [PATCH 32/96] Update main.c print currents --- main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.c b/main.c index 3df7825d..34415c42 100644 --- a/main.c +++ b/main.c @@ -2350,6 +2350,8 @@ void get_tlm_fc() { // b = 0x000c; printf("X %x Y %x Z %x B %x\n", x, y, z, b); + printf("iX %x iY %x iZ %x iB %x iC\n", ix, iy, iz, ib, ic); + #ifdef JY_1 source_bytes[extended + FC_EPS + 0] = 0xff & (x >> 10); // mV source_bytes[extended + FC_EPS + 1] = 0xfc & (x << 2); From 11e8a88489786f78bbc7d5da4fac3be6e5feb3e4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 16:12:25 -0500 Subject: [PATCH 33/96] Update main.c shift fixes --- main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 34415c42..e0b92676 100644 --- a/main.c +++ b/main.c @@ -2353,16 +2353,21 @@ void get_tlm_fc() { printf("iX %x iY %x iZ %x iB %x iC\n", ix, iy, iz, ib, ic); #ifdef JY_1 - source_bytes[extended + FC_EPS + 0] = 0xff & (x >> 10); // mV + source_bytes[extended + FC_EPS + 0] = 0xff & (x >> 6); // 10 source_bytes[extended + FC_EPS + 1] = 0xfc & (x << 2); + printf("1: %x\n", source_bytes[extended + FC_EPS + 1]); + source_bytes[extended + FC_EPS + 1] = source_bytes[FC_EPS + 1] | (0x03 & (y >> 12)); - source_bytes[extended + FC_EPS + 2] = 0xff & (y >> 4); // mV - source_bytes[extended + FC_EPS + 3] = 0xf0 & (y << 0); + + printf("1: %x\n", source_bytes[extended + FC_EPS + 1]); + + source_bytes[extended + FC_EPS + 2] = 0xff & (y >> 2); // mV + source_bytes[extended + FC_EPS + 3] = 0f0 & (y << 4); source_bytes[extended + FC_EPS + 3] = source_bytes[FC_EPS + 3] | (0x0f & (z >> 10)); source_bytes[extended + FC_EPS + 4] = 0xff & (z >> 2); // mV - source_bytes[extended + FC_EPS + 5] = 0xc0 & (z << 0); + source_bytes[extended + FC_EPS + 5] = 0xc0 & (z << 6); source_bytes[extended + FC_EPS + 5] = source_bytes[FC_EPS + 5] | (0x3f & (b >> 8)); source_bytes[extended + FC_EPS + 6] = 0xff & (b >> 0); From b53b6f4079d81005d1f6c8abf15b6d8ad7b0537d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 16:13:07 -0500 Subject: [PATCH 34/96] Update main.c typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index e0b92676..b5508978 100644 --- a/main.c +++ b/main.c @@ -2363,7 +2363,7 @@ void get_tlm_fc() { printf("1: %x\n", source_bytes[extended + FC_EPS + 1]); source_bytes[extended + FC_EPS + 2] = 0xff & (y >> 2); // mV - source_bytes[extended + FC_EPS + 3] = 0f0 & (y << 4); + source_bytes[extended + FC_EPS + 3] = 0xf0 & (y << 4); source_bytes[extended + FC_EPS + 3] = source_bytes[FC_EPS + 3] | (0x0f & (z >> 10)); source_bytes[extended + FC_EPS + 4] = 0xff & (z >> 2); // mV From c61f48b3a9d57d92a97290e3faee288f3021faa0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 16:25:57 -0500 Subject: [PATCH 35/96] Update main.c more prints --- main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.c b/main.c index b5508978..5d1ebbd0 100644 --- a/main.c +++ b/main.c @@ -2357,6 +2357,9 @@ void get_tlm_fc() { source_bytes[extended + FC_EPS + 1] = 0xfc & (x << 2); printf("1: %x\n", source_bytes[extended + FC_EPS + 1]); + printf("1: %x\n", (0x03 & (y >> 12))); + printf("1: %x\n", source_bytes[extended + FC_EPS + 1] + (0x03 & (y >> 12))); + printf("1: %x\n", source_bytes[extended + FC_EPS + 1] | (0x03 & (y >> 12))); source_bytes[extended + FC_EPS + 1] = source_bytes[FC_EPS + 1] | (0x03 & (y >> 12)); From e035b7514f2753997131e1be48a9f46b9257041e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 16:35:28 -0500 Subject: [PATCH 36/96] Update main.c added missing extended + --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 5d1ebbd0..efd4a993 100644 --- a/main.c +++ b/main.c @@ -2361,7 +2361,7 @@ void get_tlm_fc() { printf("1: %x\n", source_bytes[extended + FC_EPS + 1] + (0x03 & (y >> 12))); printf("1: %x\n", source_bytes[extended + FC_EPS + 1] | (0x03 & (y >> 12))); - source_bytes[extended + FC_EPS + 1] = source_bytes[FC_EPS + 1] | (0x03 & (y >> 12)); + source_bytes[extended + FC_EPS + 1] = source_bytes[extended + FC_EPS + 1] | (0x03 & (y >> 12)); printf("1: %x\n", source_bytes[extended + FC_EPS + 1]); From b9674ad1d811853ac99fd1f29d5184abddf882e0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 17:04:51 -0500 Subject: [PATCH 37/96] Update main.c missing extended --- main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index efd4a993..d71e9123 100644 --- a/main.c +++ b/main.c @@ -2368,34 +2368,34 @@ void get_tlm_fc() { source_bytes[extended + FC_EPS + 2] = 0xff & (y >> 2); // mV source_bytes[extended + FC_EPS + 3] = 0xf0 & (y << 4); - source_bytes[extended + FC_EPS + 3] = source_bytes[FC_EPS + 3] | (0x0f & (z >> 10)); + source_bytes[extended + FC_EPS + 3] = source_bytes[extended + FC_EPS + 3] | (0x0f & (z >> 10)); source_bytes[extended + FC_EPS + 4] = 0xff & (z >> 2); // mV source_bytes[extended + FC_EPS + 5] = 0xc0 & (z << 6); - source_bytes[extended + FC_EPS + 5] = source_bytes[FC_EPS + 5] | (0x3f & (b >> 8)); + source_bytes[extended + FC_EPS + 5] = source_bytes[extended + FC_EPS + 5] | (0x3f & (b >> 8)); source_bytes[extended + FC_EPS + 6] = 0xff & (b >> 0); source_bytes[extended + FC_EPS + 7] = 0xff & (ix >> 2); source_bytes[extended + FC_EPS + 8] = 0xc0 & (iy << 6); - source_bytes[extended + FC_EPS + 8] = source_bytes[FC_EPS + 8] | (0x3f & (iy >> 4)); + source_bytes[extended + FC_EPS + 8] = source_bytes[extended + FC_EPS + 8] | (0x3f & (iy >> 4)); source_bytes[extended + FC_EPS + 9] = 0xf0 & (iy << 4); - source_bytes[extended + FC_EPS + 9] = source_bytes[FC_EPS + 9] | (0x0f & (iz >> 6)); + source_bytes[extended + FC_EPS + 9] = source_bytes[extended + FC_EPS + 9] | (0x0f & (iz >> 6)); source_bytes[extended + FC_EPS + 10] = 0x3f & (iz << 2); - source_bytes[extended + FC_EPS + 10] = source_bytes[FC_EPS + 10] | (0x03 & (ic >> 8)); + source_bytes[extended + FC_EPS + 10] = source_bytes[extended + FC_EPS + 10] | (0x03 & (ic >> 8)); source_bytes[extended + FC_EPS + 11] = 0xff & (ic << 0); source_bytes[extended + FC_EPS + 12] = 0xff & (ib >> 2); source_bytes[extended + FC_EPS + 13] = 0xc0 & (ib << 6); - source_bytes[extended + FC_EPS + 13] = source_bytes[FC_EPS + 13] | 0x3f & (((unsigned long int)reset_count) >> 2); + source_bytes[extended + FC_EPS + 13] = source_bytes[extended + FC_EPS + 13] | 0x3f & (((unsigned long int)reset_count) >> 2); source_bytes[extended + FC_EPS + 14] = 0xff & (((unsigned long int)reset_count) << 6); uint8_t temp = (int)(other[IHU_TEMP] + 0.5); - source_bytes[extended + FC_EPS + 17] = source_bytes[FC_EPS + 17] | 0x3f & (temp >> 2); + source_bytes[extended + FC_EPS + 17] = source_bytes[extended + FC_EPS + 17] | 0x3f & (temp >> 2); source_bytes[extended + FC_EPS + 18] = 0xff & (temp << 6); source_bytes[extended + 49] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 From 028b0de5419da326b2c8fecc75b0ae80056b8ded Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 17:10:05 -0500 Subject: [PATCH 38/96] Update main.c put eclipse back in --- main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index d71e9123..46709d69 100644 --- a/main.c +++ b/main.c @@ -413,8 +413,8 @@ int main(int argc, char * argv[]) { batt = rnd_float(3.8, 4.3); speed = rnd_float(1.0, 2.5); -// eclipse = (rnd_float(-1, +4) > 0) ? 1.0 : 0.0; - eclipse = 1; + eclipse = (rnd_float(-1, +4) > 0) ? 1.0 : 0.0; +// eclipse = 1; period = rnd_float(150, 300); tempS = rnd_float(20, 55); temp_max = rnd_float(50, 70); @@ -729,13 +729,12 @@ int main(int argc, char * argv[]) { if (sim_mode) { // simulated telemetry double time = ((long int)millis() - time_start) / 1000.0; -/* + if ((time - eclipse_time) > period) { eclipse = (eclipse == 1) ? 0 : 1; eclipse_time = time; printf("\n\nSwitching eclipse mode! \n\n"); } -*/ double Xi = eclipse * amps_max[0] * (float) sin(2.0 * 3.14 * time / (46.0 * speed)) + rnd_float(-2, 2); double Yi = eclipse * amps_max[1] * (float) sin((2.0 * 3.14 * time / (46.0 * speed)) + (3.14 / 2.0)) + rnd_float(-2, 2); From 94779f8a968f15982e2b1ba535be3010cc563bb6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 Jan 2025 17:25:16 -0500 Subject: [PATCH 39/96] Update main.c remove prints --- main.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/main.c b/main.c index 46709d69..86a98e62 100644 --- a/main.c +++ b/main.c @@ -2316,15 +2316,15 @@ void get_tlm_fc() { int extended = 1; #endif - printf("Volts: %f %f %f %f \n", voltage[map[BAT]], voltage[map[PLUS_X]] , voltage[map[PLUS_Y]], voltage[map[PLUS_Z]]); - printf("AmpsPlus: %f %f %f %f \n", current[map[BAT]], current[map[PLUS_X]] , current[map[PLUS_Y]], current[map[PLUS_Z]]); - printf("AmpsMinus: %f %f %f %f \n", current[map[BAT2]], current[map[MINUS_X]] , current[map[MINUS_Y]], current[map[MINUS_Z]]); +// printf("Volts: %f %f %f %f \n", voltage[map[BAT]], voltage[map[PLUS_X]] , voltage[map[PLUS_Y]], voltage[map[PLUS_Z]]); +// printf("AmpsPlus: %f %f %f %f \n", current[map[BAT]], current[map[PLUS_X]] , current[map[PLUS_Y]], current[map[PLUS_Z]]); +// printf("AmpsMinus: %f %f %f %f \n", current[map[BAT2]], current[map[MINUS_X]] , current[map[MINUS_Y]], current[map[MINUS_Z]]); float xmax = (voltage[map[PLUS_X]] > voltage[map[MINUS_X]]) ? voltage[map[PLUS_X]] : voltage[map[MINUS_X]]; float ymax = (voltage[map[PLUS_Y]] > voltage[map[MINUS_Y]]) ? voltage[map[PLUS_Y]] : voltage[map[MINUS_Y]]; float zmax = (voltage[map[PLUS_Z]] > voltage[map[MINUS_Z]]) ? voltage[map[PLUS_Z]] : voltage[map[MINUS_Z]]; - printf("Vmax: %f %f %f \n", xmax, ymax, zmax); +// printf("Vmax: %f %f %f \n", xmax, ymax, zmax); uint16_t x = (uint16_t)(xmax * 1000) & 0x3fff; // 14 bits uint16_t y = (uint16_t)(ymax * 1000) & 0x3fff; @@ -2348,22 +2348,13 @@ void get_tlm_fc() { // z = 0xfffc; // 0xffff; // b = 0x000c; - printf("X %x Y %x Z %x B %x\n", x, y, z, b); - printf("iX %x iY %x iZ %x iB %x iC\n", ix, iy, iz, ib, ic); +// printf("X %x Y %x Z %x B %x\n", x, y, z, b); +// printf("iX %x iY %x iZ %x iB %x iC\n", ix, iy, iz, ib, ic); #ifdef JY_1 source_bytes[extended + FC_EPS + 0] = 0xff & (x >> 6); // 10 source_bytes[extended + FC_EPS + 1] = 0xfc & (x << 2); - - printf("1: %x\n", source_bytes[extended + FC_EPS + 1]); - printf("1: %x\n", (0x03 & (y >> 12))); - printf("1: %x\n", source_bytes[extended + FC_EPS + 1] + (0x03 & (y >> 12))); - printf("1: %x\n", source_bytes[extended + FC_EPS + 1] | (0x03 & (y >> 12))); - source_bytes[extended + FC_EPS + 1] = source_bytes[extended + FC_EPS + 1] | (0x03 & (y >> 12)); - - printf("1: %x\n", source_bytes[extended + FC_EPS + 1]); - source_bytes[extended + FC_EPS + 2] = 0xff & (y >> 2); // mV source_bytes[extended + FC_EPS + 3] = 0xf0 & (y << 4); From b1f4d72074c94f1b2ff5d4b773beb27e016a501f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Feb 2025 08:03:01 -0500 Subject: [PATCH 40/96] Update main.c add command count and safe mode to FC --- main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/main.c b/main.c index 86a98e62..f0e91e10 100644 --- a/main.c +++ b/main.c @@ -2388,10 +2388,27 @@ void get_tlm_fc() { source_bytes[extended + FC_EPS + 17] = source_bytes[extended + FC_EPS + 17] | 0x3f & (temp >> 2); source_bytes[extended + FC_EPS + 18] = 0xff & (temp << 6); +// source_bytes[extended + FC_EPS + 45] = 0x0a; + source_bytes[extended + FC_EPS + 48] = 0x0a; + source_bytes[extended + 49] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 source_bytes[extended + 50] = 0xff & ((unsigned long int)sequence >> 8); source_bytes[extended + 51] = 0xff & (unsigned long int)sequence++; + uint8_t groundCommandCount = 0; + FILE * command_count_file = fopen("/home/pi/CubeSatSim/command_count.txt", "r"); + if (command_count_file != NULL) { + char count_string[10]; + if ( (fgets(count_string, 10, command_count_file)) != NULL) + groundCommandCount = (uint8_t) atoi(count_string); + } else + printf("Error opening command_count.txt!\n"); + fclose(command_count_file); + + source_bytes[extended + 52] = 0xfc & (groundCommandCount << 2); + + source_bytes[extended + 53] = 0x40 & (SafeMode == 1); + /* source_bytes[extended + 46] = 0x01; source_bytes[extended + 47] = 0x02; @@ -2425,6 +2442,7 @@ void get_tlm_fc() { source_bytes[FC_SW + 0] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number source_bytes[FC_SW + 1] = 0xff & ((unsigned long int)sequence >> 8); source_bytes[FC_SW + 2] = 0xff & (unsigned long int)sequence++; + #endif /**/ From 2ca84d08e577419884310b325c96c34efb8419c9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Feb 2025 08:20:30 -0500 Subject: [PATCH 41/96] Update main.c try antenna deployment --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index f0e91e10..d221320f 100644 --- a/main.c +++ b/main.c @@ -2389,18 +2389,18 @@ void get_tlm_fc() { source_bytes[extended + FC_EPS + 18] = 0xff & (temp << 6); // source_bytes[extended + FC_EPS + 45] = 0x0a; - source_bytes[extended + FC_EPS + 48] = 0x0a; + source_bytes[extended + 48] = 0x0a; source_bytes[extended + 49] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 source_bytes[extended + 50] = 0xff & ((unsigned long int)sequence >> 8); source_bytes[extended + 51] = 0xff & (unsigned long int)sequence++; - uint8_t groundCommandCount = 0; + uint16_t groundCommandCount = 0; FILE * command_count_file = fopen("/home/pi/CubeSatSim/command_count.txt", "r"); if (command_count_file != NULL) { char count_string[10]; if ( (fgets(count_string, 10, command_count_file)) != NULL) - groundCommandCount = (uint8_t) atoi(count_string); + groundCommandCount = (uint16_t) atoi(count_string); } else printf("Error opening command_count.txt!\n"); fclose(command_count_file); From 2f370a238dc6dee0a2c8074fc0f5a6a0c64572ee Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Feb 2025 09:00:05 -0500 Subject: [PATCH 42/96] Update main.c SW valid, Ant 1 and 2 --- main.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/main.c b/main.c index d221320f..22ca7473 100644 --- a/main.c +++ b/main.c @@ -2388,8 +2388,7 @@ void get_tlm_fc() { source_bytes[extended + FC_EPS + 17] = source_bytes[extended + FC_EPS + 17] | 0x3f & (temp >> 2); source_bytes[extended + FC_EPS + 18] = 0xff & (temp << 6); -// source_bytes[extended + FC_EPS + 45] = 0x0a; - source_bytes[extended + 48] = 0x0a; + source_bytes[extended + 48] = 0x0c; // Antenna 1 and 2 deployed source_bytes[extended + 49] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 source_bytes[extended + 50] = 0xff & ((unsigned long int)sequence >> 8); @@ -2405,19 +2404,13 @@ void get_tlm_fc() { printf("Error opening command_count.txt!\n"); fclose(command_count_file); - source_bytes[extended + 52] = 0xfc & (groundCommandCount << 2); +// source_bytes[extended + 52] = 0xfc & (groundCommandCount << 2); // doesn't work - source_bytes[extended + 53] = 0x40 & (SafeMode == 1); +// source_bytes[extended + 53] = 0x40 & (SafeMode == 1); // doesn't work + + source_bytes[extended + 53] = 0x0f; // SW valid + source_bytes[extended + 54] = 0xf0; - /* - source_bytes[extended + 46] = 0x01; - source_bytes[extended + 47] = 0x02; - source_bytes[extended + 48] = 0x03; - source_bytes[extended + 49] = 0x04; - source_bytes[extended + 50] = 0x05; - source_bytes[extended + 51] = 0x06; - source_bytes[extended + 52] = 0x07; -*/ #endif #ifdef FC_EM From 13f60f539a4ff11f0cdc443ca06ef2d9e6a40366 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Feb 2025 09:07:01 -0500 Subject: [PATCH 43/96] Update main.c safe mode --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 22ca7473..b208b80a 100644 --- a/main.c +++ b/main.c @@ -2409,7 +2409,7 @@ void get_tlm_fc() { // source_bytes[extended + 53] = 0x40 & (SafeMode == 1); // doesn't work source_bytes[extended + 53] = 0x0f; // SW valid - source_bytes[extended + 54] = 0xf0; + source_bytes[extended + 54] = 0xe8; // SW valid and safe mode #endif From 0d6a845b263c6a97a6e9d844792edcc5dec0861c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Feb 2025 09:19:48 -0500 Subject: [PATCH 44/96] Update main.c eclipse and safe mode set --- main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index b208b80a..55efcb84 100644 --- a/main.c +++ b/main.c @@ -2409,7 +2409,12 @@ void get_tlm_fc() { // source_bytes[extended + 53] = 0x40 & (SafeMode == 1); // doesn't work source_bytes[extended + 53] = 0x0f; // SW valid - source_bytes[extended + 54] = 0xe8; // SW valid and safe mode + source_bytes[extended + 54] = 0xe8; // SW valid + + if (ix + iy + iz) < 4)) + source_bytes[extended + 54] = source_bytes[extended + 54] | 0x10; // eclipse + if (SafeMode == 1) + source_bytes[extended + 54] = source_bytes[extended + 54] | 0x08; // safe mode #endif From 6870ad11635fa33f0e01b33a5c7fc6c618a262e1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Feb 2025 09:20:50 -0500 Subject: [PATCH 45/96] Update main.c fix typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 55efcb84..0861c578 100644 --- a/main.c +++ b/main.c @@ -2411,7 +2411,7 @@ void get_tlm_fc() { source_bytes[extended + 53] = 0x0f; // SW valid source_bytes[extended + 54] = 0xe8; // SW valid - if (ix + iy + iz) < 4)) + if ((ix + iy + iz) < 4) source_bytes[extended + 54] = source_bytes[extended + 54] | 0x10; // eclipse if (SafeMode == 1) source_bytes[extended + 54] = source_bytes[extended + 54] | 0x08; // safe mode From d9fadf4d471b043eab2ed8edd136315be91a312c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Feb 2025 09:32:55 -0500 Subject: [PATCH 46/96] Update main.c safe mode off --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 0861c578..eba4ed14 100644 --- a/main.c +++ b/main.c @@ -2409,7 +2409,7 @@ void get_tlm_fc() { // source_bytes[extended + 53] = 0x40 & (SafeMode == 1); // doesn't work source_bytes[extended + 53] = 0x0f; // SW valid - source_bytes[extended + 54] = 0xe8; // SW valid + source_bytes[extended + 54] = 0xe0; // SW valid if ((ix + iy + iz) < 4) source_bytes[extended + 54] = source_bytes[extended + 54] | 0x10; // eclipse From d7664224de7cd22b037a054611e7bf5a00772903 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Feb 2025 22:21:33 -0500 Subject: [PATCH 47/96] Update main.c add socket_send --- main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index eba4ed14..fc71c4d2 100644 --- a/main.c +++ b/main.c @@ -1770,6 +1770,8 @@ void get_tlm_fox() { // socket write +socket_send(ctr); +/* if (!socket_open && transmit) { printf("Opening socket!\n"); // struct sockaddr_in address; @@ -1858,6 +1860,7 @@ void get_tlm_fox() { sock_ret = send(sock, &buffer[sock_ret], (unsigned int)(ctr * 2 + 2 - sock_ret), 0); // printf("socket send 2 %d ms bytes: %d \n\n", millis() - start, sock_ret); } +*/ loop_count++; if ((firstTime == 1) || (((loop_count % 180) == 0) && (mode == FSK)) || (((loop_count % 80) == 0) && (mode == BPSK))) // do first time and was every 180 samples @@ -2546,6 +2549,12 @@ void get_tlm_fc() { // socket write +// socket_send((((headerLen + syncBits + dataLen) * samples) * 2) + 2); + socket_send(ctr); + +} +void socket_send(int length) + if (!socket_open && transmit) { printf("Opening socket!\n"); // struct sockaddr_in address; @@ -2616,8 +2625,9 @@ void get_tlm_fc() { /* write waveform buffer over socket */ - int length = (((headerLen + syncBits + dataLen) * samples) * 2) + 2; // ctr * 2 + 2 like bpsk due to 2 bytes per sample. - printf("length: %d ctr: %d\n", length, ctr); +// int length = (((headerLen + syncBits + dataLen) * samples) * 2) + 2; // ctr * 2 + 2 like bpsk due to 2 bytes per sample. + length = length * 2 + 2; // convert from samples to bytes +// printf("length in bytes: %d\n", length); if (!error && transmit) { // digitalWrite (0, LOW); From 7f90dbcfb8a2291a4464bd47c1d61939e62f3d4f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Feb 2025 22:22:27 -0500 Subject: [PATCH 48/96] Update main.h add socket_send --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index 23a1f5a0..01f08db8 100644 --- a/main.h +++ b/main.h @@ -94,6 +94,7 @@ extern int Encode_8b10b[][256]; extern const unsigned char ALPHA_TO[]; // const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count); void program_radio(); +void socket_send(int length); int socket_open = 0; int sock = 0; From d6a5c81bbc45f71f488e2eddc095c3e6f6207ad3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Feb 2025 22:29:39 -0500 Subject: [PATCH 49/96] Update main.c cleanup --- main.c | 64 +++++++++++++++++----------------------------------------- 1 file changed, 19 insertions(+), 45 deletions(-) diff --git a/main.c b/main.c index fc71c4d2..e461314a 100644 --- a/main.c +++ b/main.c @@ -2293,7 +2293,7 @@ if (setting == ON) { return; } -void get_tlm_fc() { +void get_tlm_fc() { // FunCube Mode telemetry generation //# define FC_EM #define JY_1 @@ -2345,55 +2345,50 @@ void get_tlm_fc() { ic = (uint16_t)(current[map[BAT]] * (-1)) & 0x3ff; // charging current else ib = (uint16_t)(current[map[BAT]]) & 0x3ff; // supplying current - -// x = 0xfffc; // 0xffff; -// y = 0x0; // 0x0000; -// z = 0xfffc; // 0xffff; -// b = 0x000c; // printf("X %x Y %x Z %x B %x\n", x, y, z, b); // printf("iX %x iY %x iZ %x iB %x iC\n", ix, iy, iz, ib, ic); #ifdef JY_1 - source_bytes[extended + FC_EPS + 0] = 0xff & (x >> 6); // 10 + source_bytes[extended + FC_EPS + 0] = 0xff & (x >> 6); // Vx source_bytes[extended + FC_EPS + 1] = 0xfc & (x << 2); source_bytes[extended + FC_EPS + 1] = source_bytes[extended + FC_EPS + 1] | (0x03 & (y >> 12)); - source_bytes[extended + FC_EPS + 2] = 0xff & (y >> 2); // mV + source_bytes[extended + FC_EPS + 2] = 0xff & (y >> 2); // Vy source_bytes[extended + FC_EPS + 3] = 0xf0 & (y << 4); source_bytes[extended + FC_EPS + 3] = source_bytes[extended + FC_EPS + 3] | (0x0f & (z >> 10)); - source_bytes[extended + FC_EPS + 4] = 0xff & (z >> 2); // mV + source_bytes[extended + FC_EPS + 4] = 0xff & (z >> 2); // Vz source_bytes[extended + FC_EPS + 5] = 0xc0 & (z << 6); source_bytes[extended + FC_EPS + 5] = source_bytes[extended + FC_EPS + 5] | (0x3f & (b >> 8)); - source_bytes[extended + FC_EPS + 6] = 0xff & (b >> 0); + source_bytes[extended + FC_EPS + 6] = 0xff & (b >> 0); // Vb - source_bytes[extended + FC_EPS + 7] = 0xff & (ix >> 2); - source_bytes[extended + FC_EPS + 8] = 0xc0 & (iy << 6); + source_bytes[extended + FC_EPS + 7] = 0xff & (ix >> 2); // ix + source_bytes[extended + FC_EPS + 8] = 0xc0 & (iy << 6); // iy source_bytes[extended + FC_EPS + 8] = source_bytes[extended + FC_EPS + 8] | (0x3f & (iy >> 4)); source_bytes[extended + FC_EPS + 9] = 0xf0 & (iy << 4); source_bytes[extended + FC_EPS + 9] = source_bytes[extended + FC_EPS + 9] | (0x0f & (iz >> 6)); - source_bytes[extended + FC_EPS + 10] = 0x3f & (iz << 2); + source_bytes[extended + FC_EPS + 10] = 0x3f & (iz << 2); // iz source_bytes[extended + FC_EPS + 10] = source_bytes[extended + FC_EPS + 10] | (0x03 & (ic >> 8)); - source_bytes[extended + FC_EPS + 11] = 0xff & (ic << 0); + source_bytes[extended + FC_EPS + 11] = 0xff & (ic << 0); // ic battery charging curent - source_bytes[extended + FC_EPS + 12] = 0xff & (ib >> 2); + source_bytes[extended + FC_EPS + 12] = 0xff & (ib >> 2); // ib battery discharging current source_bytes[extended + FC_EPS + 13] = 0xc0 & (ib << 6); source_bytes[extended + FC_EPS + 13] = source_bytes[extended + FC_EPS + 13] | 0x3f & (((unsigned long int)reset_count) >> 2); - source_bytes[extended + FC_EPS + 14] = 0xff & (((unsigned long int)reset_count) << 6); + source_bytes[extended + FC_EPS + 14] = 0xff & (((unsigned long int)reset_count) << 6); // reset count uint8_t temp = (int)(other[IHU_TEMP] + 0.5); - source_bytes[extended + FC_EPS + 17] = source_bytes[extended + FC_EPS + 17] | 0x3f & (temp >> 2); + source_bytes[extended + FC_EPS + 17] = source_bytes[extended + FC_EPS + 17] | 0x3f & (temp >> 2); // cpu temp source_bytes[extended + FC_EPS + 18] = 0xff & (temp << 6); source_bytes[extended + 48] = 0x0c; // Antenna 1 and 2 deployed - source_bytes[extended + 49] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46 + source_bytes[extended + 49] = 0xff & ((unsigned long int)sequence >> 16); // sequence number source_bytes[extended + 50] = 0xff & ((unsigned long int)sequence >> 8); source_bytes[extended + 51] = 0xff & (unsigned long int)sequence++; @@ -2407,9 +2402,7 @@ void get_tlm_fc() { printf("Error opening command_count.txt!\n"); fclose(command_count_file); -// source_bytes[extended + 52] = 0xfc & (groundCommandCount << 2); // doesn't work - -// source_bytes[extended + 53] = 0x40 & (SafeMode == 1); // doesn't work +// source_bytes[extended + 52] = 0xfc & (groundCommandCount << 2); // command doesn't work source_bytes[extended + 53] = 0x0f; // SW valid source_bytes[extended + 54] = 0xe0; // SW valid @@ -2418,7 +2411,6 @@ void get_tlm_fc() { source_bytes[extended + 54] = source_bytes[extended + 54] | 0x10; // eclipse if (SafeMode == 1) source_bytes[extended + 54] = source_bytes[extended + 54] | 0x08; // safe mode - #endif #ifdef FC_EM @@ -2512,12 +2504,6 @@ void get_tlm_fc() { { write_wave(ctr, buffer); if ((i % samples) == 0) { - // int symbol = (int)((i - 1) / (samples * 8)); - // int bit = 8 - (i - symbol * samples * 8) / samples + 1; -// val = encoded_bytes[symbol]; -// data = val & 1 << (bit - 1); - // printf ("%d i: %d new frame %d data10[%d] = %x bit %d = %d \n", - // ctr/SAMPLES, i, frames, symbol, val, bit, (data > 0) ); symbol = i / samples - 1; // if (i < 100) printf("symbol = %d\n",symbol); data = encoded_bytes[symbol]; @@ -2537,25 +2523,16 @@ void get_tlm_fc() { // printf("symbol = %d\n",symbol); // printf("\nctr = %d\n\n", ctr); - -/* open socket */ - - int error = 0; - // int count; - // for (count = 0; count < dataLen; count++) { - // printf("%02X", b[count]); - // } - // printf("\n"); - - // socket write - // socket_send((((headerLen + syncBits + dataLen) * samples) * 2) + 2); socket_send(ctr); } -void socket_send(int length) - if (!socket_open && transmit) { +void socket_send(int length) { + + int error = 0; + + if (!socket_open && transmit) { // open socket if not open printf("Opening socket!\n"); // struct sockaddr_in address; // int valread; @@ -2630,7 +2607,6 @@ void socket_send(int length) // printf("length in bytes: %d\n", length); if (!error && transmit) { - // digitalWrite (0, LOW); // printf("Sending %d buffer bytes over socket after %d ms!\n", ctr, (long unsigned int)millis() - start); start = millis(); int sock_ret = send(sock, buffer, length, 0); @@ -2667,6 +2643,4 @@ void socket_send(int length) if (socket_open == 1) firstTime = 0; - - return; } From 94781acc9d5eb1ac034dfe48d2d061327a9ba527 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 08:30:00 -0500 Subject: [PATCH 50/96] Update main.c move more --- main.c | 55 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/main.c b/main.c index e461314a..c643e46f 100644 --- a/main.c +++ b/main.c @@ -1761,7 +1761,7 @@ void get_tlm_fox() { // printf("\ctr/samples = %d ctr/(samples*10) = %d\n\n", ctr/samples, ctr/(samples*10)); #endif - int error = 0; + //int error = 0; // int count; // for (count = 0; count < dataLen; count++) { // printf("%02X", b[count]); @@ -1770,7 +1770,7 @@ void get_tlm_fox() { // socket write -socket_send(ctr); +//socket_send(ctr); /* if (!socket_open && transmit) { printf("Opening socket!\n"); @@ -1881,41 +1881,42 @@ socket_send(ctr); for (int times = 0; times < max; times++) { - start = millis(); // send frame until buffer fills - sock_ret = send(sock, buffer, (unsigned int)(ctr * 2 + 2), 0); +/// start = millis(); // send frame until buffer fills + socket_send(ctr); +/// sock_ret = send(sock, buffer, (unsigned int)(ctr * 2 + 2), 0); // printf("socket send %d in %d ms bytes: %d \n\n",times + 2, (unsigned int)millis() - start, sock_ret); - if ((millis() - start) > 500) { - printf("Buffer over filled!\n"); - break; - } +/// if ((millis() - start) > 500) { +/// printf("Buffer over filled!\n"); +/// break; +/// } - if (sock_ret < (ctr * 2 + 2)) { +/// if (sock_ret < (ctr * 2 + 2)) { // printf("Not resending\n"); - sleep(0.5); - sock_ret = send(sock, &buffer[sock_ret], (unsigned int)(ctr * 2 + 2 - sock_ret), 0); - printf("socket resend %d in %d ms bytes: %d \n\n",times, millis() - start, sock_ret); - } +/// sleep(0.5); +/// sock_ret = send(sock, &buffer[sock_ret], (unsigned int)(ctr * 2 + 2 - sock_ret), 0); +/// printf("socket resend %d in %d ms bytes: %d \n\n",times, millis() - start, sock_ret); +/// } } sampleTime = (unsigned int) millis(); // resetting time for sleeping - fflush(stdout); + // fflush(stdout); // if (firstTime == 1) // max -= 1; } - if (sock_ret == -1) { - printf("Error: %s \n", strerror(errno)); - socket_open = 0; +/// if (sock_ret == -1) { +/// printf("Error: %s \n", strerror(errno)); +/// socket_open = 0; //transmitStatus = -1; - } - } - if (!transmit) { - fprintf(stderr, "\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n"); - fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n"); - } - - if (socket_open == 1) - firstTime = 0; +/// } +/// } +/// if (!transmit) { +/// fprintf(stderr, "\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n"); +/// fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n"); +/// } + +/// if (socket_open == 1) +/// firstTime = 0; // else if (frames_sent > 0) //5) // firstTime = 0; @@ -2620,7 +2621,7 @@ void socket_send(int length) { // printf("socket send 2 %d ms bytes: %d \n\n", millis() - start, sock_ret); } - loop_count++; +// loop_count++; if (sock_ret == -1) { printf("Error: %s \n", strerror(errno)); From c65288e05ac1c39097b34f12720078896e7e5561 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 08:49:47 -0500 Subject: [PATCH 51/96] Update main.c add socket_send print --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index c643e46f..820d5ac4 100644 --- a/main.c +++ b/main.c @@ -2611,8 +2611,8 @@ void socket_send(int length) { // printf("Sending %d buffer bytes over socket after %d ms!\n", ctr, (long unsigned int)millis() - start); start = millis(); int sock_ret = send(sock, buffer, length, 0); -// printf("socket send 1 %d ms bytes: %d \n\n", (unsigned int)millis() - start, sock_ret); -// fflush(stdout); + printf("socket send 1 %d ms bytes: %d \n\n", (unsigned int)millis() - start, sock_ret); + fflush(stdout); if (sock_ret < length) { // printf("Not resending\n"); From e88d2d0dd14b51553a71bedde7c1d5040f5de7c0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 08:55:10 -0500 Subject: [PATCH 52/96] Update main.c print Socket_send --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index 820d5ac4..9d034b9e 100644 --- a/main.c +++ b/main.c @@ -2531,6 +2531,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation void socket_send(int length) { + printf("Socket_send!\n"); int error = 0; if (!socket_open && transmit) { // open socket if not open From 7da5486e68275c8f2bd2a1eaa4dee36ebe7873e2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 09:02:28 -0500 Subject: [PATCH 53/96] Update main.c add back missing socket_send --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 9d034b9e..9ce8a1bb 100644 --- a/main.c +++ b/main.c @@ -1770,7 +1770,7 @@ void get_tlm_fox() { // socket write -//socket_send(ctr); + socket_send(ctr); /* if (!socket_open && transmit) { printf("Opening socket!\n"); From 984e15bed5893bc485e21111240efdf84aa3e046 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 09:10:02 -0500 Subject: [PATCH 54/96] Update main.c remove extra sleep --- main.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 9ce8a1bb..a66e0682 100644 --- a/main.c +++ b/main.c @@ -1910,10 +1910,10 @@ void get_tlm_fox() { //transmitStatus = -1; /// } /// } -/// if (!transmit) { -/// fprintf(stderr, "\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n"); -/// fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n"); -/// } + if (!transmit) { + fprintf(stderr, "\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n"); + fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n"); + } /// if (socket_open == 1) /// firstTime = 0; @@ -2527,6 +2527,19 @@ void get_tlm_fc() { // FunCube Mode telemetry generation // socket_send((((headerLen + syncBits + dataLen) * samples) * 2) + 2); socket_send(ctr); + if (!transmit) { + fprintf(stderr, "\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n"); + fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n"); + } + + int startSleep = millis(); + if ((millis() - sampleTime) < ((unsigned int)frameTime)) // - 750 + pi_zero_2_offset)) + sleep(1.0); + while ((millis() - sampleTime) < ((unsigned int)frameTime)) // - 750 + pi_zero_2_offset)) + sleep(0.1); + printf("Start sleep %d Sleep period: %d while period: %d\n", startSleep, millis() - startSleep, millis() - sampleTime); + sampleTime = (unsigned int) millis(); // resetting time for sleeping + fflush(stdout); } void socket_send(int length) { @@ -2629,6 +2642,8 @@ void socket_send(int length) { socket_open = 0; } } + +/* if (!transmit) { fprintf(stderr, "\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n"); fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n"); @@ -2642,6 +2657,7 @@ void socket_send(int length) { printf("Start sleep %d Sleep period: %d while period: %d\n", startSleep, millis() - startSleep, millis() - sampleTime); sampleTime = (unsigned int) millis(); // resetting time for sleeping fflush(stdout); + */ if (socket_open == 1) firstTime = 0; From 249444a19ebb949d52c2999c5c44a4be6573d2d9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 13:31:00 -0500 Subject: [PATCH 55/96] Update main.c add Frame IMG2 --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index a66e0682..bb998bab 100644 --- a/main.c +++ b/main.c @@ -2314,8 +2314,10 @@ void get_tlm_fc() { // FunCube Mode telemetry generation source_bytes[0] = 0b00000001 ; // Sat Id is FunCube-EM #endif #ifdef JY_1 - source_bytes[0] = 0b11000001 ; // Sat Id is extended -// source_bytes[1] = 0x08 ; // extended Nayify - works per code +// source_bytes[0] = 0b11000001 ; // Sat Id is extended, Frame 2 (RT2 + WO2) + source_bytes[0] = 0xE0 | 0x20 | 0x01; // Sat Id is extended, Frame 34 (RT2 + IMG2) + + // source_bytes[1] = 0x08 ; // extended Nayify - works per code source_bytes[1] = 0x10 ; // extended JY-1 - works, no documentation int extended = 1; #endif From cd038e0ae5af2a7b7482b3895172f58af2bdfcb3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 13:34:42 -0500 Subject: [PATCH 56/96] Update main.c try RT1 --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index bb998bab..8eacff66 100644 --- a/main.c +++ b/main.c @@ -2315,7 +2315,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation #endif #ifdef JY_1 // source_bytes[0] = 0b11000001 ; // Sat Id is extended, Frame 2 (RT2 + WO2) - source_bytes[0] = 0xE0 | 0x20 | 0x01; // Sat Id is extended, Frame 34 (RT2 + IMG2) + source_bytes[0] = 0xE0 | 0x20 | 0x00; // 1; // Sat Id is extended, Frame 34 (RT2 + IMG2) // source_bytes[1] = 0x08 ; // extended Nayify - works per code source_bytes[1] = 0x10 ; // extended JY-1 - works, no documentation From 23eb29adc3b067a89c8e6d68d00c5cdbec8df037 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 16:22:16 -0500 Subject: [PATCH 57/96] Update main.h add image_id and image_file --- main.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.h b/main.h index 01f08db8..c64d265f 100644 --- a/main.h +++ b/main.h @@ -109,6 +109,8 @@ short int buffer[2336400]; // max size for 10 frames count of BPSK FILE *sopen(const char *program); FILE *telem_file; long int sequence = 0; +int image_id = 0; +FILE *image_file; #define S_RATE (48000) // (44100) From a3820ed7dd77aeb8cd93435c3f2929dd582ed749 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 16:22:27 -0500 Subject: [PATCH 58/96] Update main.c add image read --- main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/main.c b/main.c index 8eacff66..a60a63e2 100644 --- a/main.c +++ b/main.c @@ -2320,6 +2320,28 @@ void get_tlm_fc() { // FunCube Mode telemetry generation // source_bytes[1] = 0x08 ; // extended Nayify - works per code source_bytes[1] = 0x10 ; // extended JY-1 - works, no documentation int extended = 1; + + if (image_file == NULL) { + file = fopen("/home/pi/CubeSatSim/image_file.bin", "r"); + image_id++; + printf("Opening file image_file.bin for image_id: %d\n", image_id); + } + int pos = 56; + source_bytes[pos++] = 0x55; + source_bytes[pos++] = 0x68; + int val; + if (image_file == NULL) { + printf("Writing image data to payload\n"); + while (((val = getc(image_file)) != EOF) && (pos < 256)) { + source_bytes[pos++] = val; + printf("%2x ", val); + } + if (val == EOF) { + image_file = NULL; + printf("End of file reached!"); + } + } + #endif // printf("Volts: %f %f %f %f \n", voltage[map[BAT]], voltage[map[PLUS_X]] , voltage[map[PLUS_Y]], voltage[map[PLUS_Z]]); From 2288de9b635cb61f336635c5f2d7c8d07e2df429 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 16:24:00 -0500 Subject: [PATCH 59/96] Update main.c fixed image_file --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index a60a63e2..4e59fae6 100644 --- a/main.c +++ b/main.c @@ -2322,7 +2322,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation int extended = 1; if (image_file == NULL) { - file = fopen("/home/pi/CubeSatSim/image_file.bin", "r"); + image_file = fopen("/home/pi/CubeSatSim/image_file.bin", "r"); image_id++; printf("Opening file image_file.bin for image_id: %d\n", image_id); } @@ -2330,7 +2330,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation source_bytes[pos++] = 0x55; source_bytes[pos++] = 0x68; int val; - if (image_file == NULL) { + if (image_file != NULL) { printf("Writing image data to payload\n"); while (((val = getc(image_file)) != EOF) && (pos < 256)) { source_bytes[pos++] = val; From 4970765985635b1f9b2df237f4a647a923dfe74d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 16:24:57 -0500 Subject: [PATCH 60/96] Update main.c don't need to redefine val --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 4e59fae6..e9fab87d 100644 --- a/main.c +++ b/main.c @@ -2329,7 +2329,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation int pos = 56; source_bytes[pos++] = 0x55; source_bytes[pos++] = 0x68; - int val; +// int val; if (image_file != NULL) { printf("Writing image data to payload\n"); while (((val = getc(image_file)) != EOF) && (pos < 256)) { From adf41188da3b5897956df16641b7ece5740b9a44 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 16:25:36 -0500 Subject: [PATCH 61/96] Update main.c change to value --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index e9fab87d..e3330202 100644 --- a/main.c +++ b/main.c @@ -2329,12 +2329,12 @@ void get_tlm_fc() { // FunCube Mode telemetry generation int pos = 56; source_bytes[pos++] = 0x55; source_bytes[pos++] = 0x68; -// int val; + int value; if (image_file != NULL) { printf("Writing image data to payload\n"); - while (((val = getc(image_file)) != EOF) && (pos < 256)) { - source_bytes[pos++] = val; - printf("%2x ", val); + while (((value = getc(image_file)) != EOF) && (pos < 256)) { + source_bytes[pos++] = value; + printf("%2x ", value); } if (val == EOF) { image_file = NULL; From 8baab38270885a32f0d4d8205d7f3e5dca8873ed Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 16:26:15 -0500 Subject: [PATCH 62/96] Update main.c typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index e3330202..e076b3df 100644 --- a/main.c +++ b/main.c @@ -2336,7 +2336,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation source_bytes[pos++] = value; printf("%2x ", value); } - if (val == EOF) { + if (value == EOF) { image_file = NULL; printf("End of file reached!"); } From ddc3292b414d25c8341113e813245c944ce6d13c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 16:34:08 -0500 Subject: [PATCH 63/96] Update main.c don't do 55 and 68 --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index e076b3df..3a67f44a 100644 --- a/main.c +++ b/main.c @@ -2326,9 +2326,9 @@ void get_tlm_fc() { // FunCube Mode telemetry generation image_id++; printf("Opening file image_file.bin for image_id: %d\n", image_id); } - int pos = 56; - source_bytes[pos++] = 0x55; - source_bytes[pos++] = 0x68; + int pos = 56; // 56 +// source_bytes[pos++] = 0x55; +// source_bytes[pos++] = 0x68; int value; if (image_file != NULL) { printf("Writing image data to payload\n"); From 0ef6c60bcb4837c4c0b6f7885496e8d3fa48573d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 16:36:27 -0500 Subject: [PATCH 64/96] Update main.c try 57 --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 3a67f44a..89c20f1d 100644 --- a/main.c +++ b/main.c @@ -2326,9 +2326,9 @@ void get_tlm_fc() { // FunCube Mode telemetry generation image_id++; printf("Opening file image_file.bin for image_id: %d\n", image_id); } - int pos = 56; // 56 -// source_bytes[pos++] = 0x55; -// source_bytes[pos++] = 0x68; + int pos = 57; // 56 + source_bytes[pos++] = 0x55; + source_bytes[pos++] = 0x68; int value; if (image_file != NULL) { printf("Writing image data to payload\n"); From 75515ce24b69dc0260b2f15f812b1a0c54ed0487 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 16:38:25 -0500 Subject: [PATCH 65/96] Update main.c back to 56 --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 89c20f1d..a04a96ae 100644 --- a/main.c +++ b/main.c @@ -2326,7 +2326,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation image_id++; printf("Opening file image_file.bin for image_id: %d\n", image_id); } - int pos = 57; // 56 + int pos = 56; // 56 source_bytes[pos++] = 0x55; source_bytes[pos++] = 0x68; int value; From 0e3e5a50e29356cee176f76d60786a4b251236d6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 16:42:24 -0500 Subject: [PATCH 66/96] Update main.c start after sequence > 10 --- main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index a04a96ae..673866bd 100644 --- a/main.c +++ b/main.c @@ -2321,10 +2321,12 @@ void get_tlm_fc() { // FunCube Mode telemetry generation source_bytes[1] = 0x10 ; // extended JY-1 - works, no documentation int extended = 1; - if (image_file == NULL) { - image_file = fopen("/home/pi/CubeSatSim/image_file.bin", "r"); - image_id++; - printf("Opening file image_file.bin for image_id: %d\n", image_id); + if (sequence > 10) { + if (image_file == NULL) { + image_file = fopen("/home/pi/CubeSatSim/image_file.bin", "r"); + image_id++; + printf("Opening file image_file.bin for image_id: %d\n", image_id); + } } int pos = 56; // 56 source_bytes[pos++] = 0x55; From 41cfd26c5d0d67610d10bef508ffb1ff0a1e5883 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 16:59:05 -0500 Subject: [PATCH 67/96] Update main.c remove duplicate 55 and 68 --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 673866bd..f1b089cd 100644 --- a/main.c +++ b/main.c @@ -2329,8 +2329,8 @@ void get_tlm_fc() { // FunCube Mode telemetry generation } } int pos = 56; // 56 - source_bytes[pos++] = 0x55; - source_bytes[pos++] = 0x68; +// source_bytes[pos++] = 0x55; +// source_bytes[pos++] = 0x68; int value; if (image_file != NULL) { printf("Writing image data to payload\n"); From 6a25bd055ef0bba95c9251ec2552f25f20eacb2f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 20:31:45 -0500 Subject: [PATCH 68/96] Update transmit.py add FC image --- transmit.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/transmit.py b/transmit.py index 9e37acf7..48cd7e33 100644 --- a/transmit.py +++ b/transmit.py @@ -756,6 +756,7 @@ if __name__ == "__main__": # system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.9e6 -t float &") system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f " + tx + "e6 -t float &") print("Turning LED on/off and listening for carrier") + image_index = 0; while 1: output(txLed, txLedOff) sleep(0.4) @@ -771,10 +772,26 @@ if __name__ == "__main__": output(txLed, txLedOn) # print(txLed) # print(txLedOn) + if (mode == 'b'): - sleep(4.2) - else: - sleep(4.6) + sleep(4.2) + else: # FunCube mode image + try: + file = open("/home/pi/CubeSatSim/image_file.bin") + file.close() + image_present = True + except: + image_present = False + + if (!image_present): + system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") + print("Photo taken") + system("/home/pi/ssdv/ssdv -e -c CALLSIGN -i " + image_index + " -q 3 -J camera_out.jpg image_file.bin") + print("image_index " + image_index + "\n") + image_index = ( index_image + 1 ) % 256 + sleep(2) + else: + sleep(4.6) elif (mode == 'e'): # code based on https://zr6aic.blogspot.com/2016/11/creating-2m-fm-repeater-with-raspberry.html print("Repeater") print("Stopping command and control") From 572c05c0d3517695217a934fd2fe301f7cb408f4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 20:34:48 -0500 Subject: [PATCH 69/96] Update main.c delete image_file.bin when done --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index f1b089cd..ffc5f713 100644 --- a/main.c +++ b/main.c @@ -2340,7 +2340,9 @@ void get_tlm_fc() { // FunCube Mode telemetry generation } if (value == EOF) { image_file = NULL; - printf("End of file reached!"); + printf("End of file reached! Delete image_file.bin"); + FILE * delete_image = popen("sudo rm /home/pi/CubeSatSim/image_file.bin", "r"); + pclose(delete_image); } } From 450fb2aa353e752129f3c5149d083d97cb485921 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 20:38:54 -0500 Subject: [PATCH 70/96] Update transmit.py fix not --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 48cd7e33..cd771503 100644 --- a/transmit.py +++ b/transmit.py @@ -783,7 +783,7 @@ if __name__ == "__main__": except: image_present = False - if (!image_present): + if (image_present == False): system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") print("Photo taken") system("/home/pi/ssdv/ssdv -e -c CALLSIGN -i " + image_index + " -q 3 -J camera_out.jpg image_file.bin") From 6236ed301d8c97db7f4c9a7b719368435e6a4e1e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 2 Feb 2025 20:41:50 -0500 Subject: [PATCH 71/96] Update transmit.py fix str --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index cd771503..78fbfc6d 100644 --- a/transmit.py +++ b/transmit.py @@ -786,7 +786,7 @@ if __name__ == "__main__": if (image_present == False): system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") print("Photo taken") - system("/home/pi/ssdv/ssdv -e -c CALLSIGN -i " + image_index + " -q 3 -J camera_out.jpg image_file.bin") + system("/home/pi/ssdv/ssdv -e -c CALLSIGN -i " + str(image_index) + " -q 3 -J camera_out.jpg /home/pi/CubeSatSim/image_file.bin") print("image_index " + image_index + "\n") image_index = ( index_image + 1 ) % 256 sleep(2) From 1ee36692d370ce4594393620a8640f55547ea7af Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 08:44:45 -0500 Subject: [PATCH 72/96] Update transmit.py add str() to print --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 78fbfc6d..4c01e21f 100644 --- a/transmit.py +++ b/transmit.py @@ -787,7 +787,7 @@ if __name__ == "__main__": system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") print("Photo taken") system("/home/pi/ssdv/ssdv -e -c CALLSIGN -i " + str(image_index) + " -q 3 -J camera_out.jpg /home/pi/CubeSatSim/image_file.bin") - print("image_index " + image_index + "\n") + print("image_index " + str(image_index) + "\n") image_index = ( index_image + 1 ) % 256 sleep(2) else: From d6c2745e154846d423445a3632e764df3f271838 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 09:00:49 -0500 Subject: [PATCH 73/96] Update transmit.py image_index typo --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 4c01e21f..92ab89e4 100644 --- a/transmit.py +++ b/transmit.py @@ -788,7 +788,7 @@ if __name__ == "__main__": print("Photo taken") system("/home/pi/ssdv/ssdv -e -c CALLSIGN -i " + str(image_index) + " -q 3 -J camera_out.jpg /home/pi/CubeSatSim/image_file.bin") print("image_index " + str(image_index) + "\n") - image_index = ( index_image + 1 ) % 256 + image_index = ( image_index + 1 ) % 256 sleep(2) else: sleep(4.6) From 98f93f5706a441e3277d44082de2ab039cc407fa Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 09:04:00 -0500 Subject: [PATCH 74/96] Update transmit.py turn off rpitx --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 92ab89e4..4c4f0fc4 100644 --- a/transmit.py +++ b/transmit.py @@ -754,7 +754,7 @@ if __name__ == "__main__": if (command_tx == True): # system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.9e6 -t float &") - system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f " + tx + "e6 -t float &") +## system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f " + tx + "e6 -t float &") print("Turning LED on/off and listening for carrier") image_index = 0; while 1: From 51d05521fa572cea58af7bd9a22ccdb829b76318 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 09:05:02 -0500 Subject: [PATCH 75/96] Update transmit.py comment out if --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 4c4f0fc4..405b6c9e 100644 --- a/transmit.py +++ b/transmit.py @@ -752,7 +752,7 @@ if __name__ == "__main__": GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 GPIO.setup(txLed, GPIO.OUT) - if (command_tx == True): +## if (command_tx == True): # system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.9e6 -t float &") ## system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f " + tx + "e6 -t float &") print("Turning LED on/off and listening for carrier") From 85fc2da06d983d2e4286c14c3297c80b324401f4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 09:07:54 -0500 Subject: [PATCH 76/96] Update transmit.py add prints --- transmit.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/transmit.py b/transmit.py index 405b6c9e..292ef37f 100644 --- a/transmit.py +++ b/transmit.py @@ -758,6 +758,7 @@ if __name__ == "__main__": print("Turning LED on/off and listening for carrier") image_index = 0; while 1: + print ("LED on") output(txLed, txLedOff) sleep(0.4) # if (command_tx == False): @@ -776,6 +777,7 @@ if __name__ == "__main__": if (mode == 'b'): sleep(4.2) else: # FunCube mode image + print("Checking image_file.bin") try: file = open("/home/pi/CubeSatSim/image_file.bin") file.close() From 315d824f7557cea2b56e418d7a22d86d03a4f3d6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 09:11:44 -0500 Subject: [PATCH 77/96] Update transmit.py CALL, image index start at 1 --- transmit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transmit.py b/transmit.py index 292ef37f..8a7290d6 100644 --- a/transmit.py +++ b/transmit.py @@ -756,7 +756,7 @@ if __name__ == "__main__": # system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.9e6 -t float &") ## system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f " + tx + "e6 -t float &") print("Turning LED on/off and listening for carrier") - image_index = 0; + image_index = 1; while 1: print ("LED on") output(txLed, txLedOff) @@ -788,7 +788,7 @@ if __name__ == "__main__": if (image_present == False): system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") print("Photo taken") - system("/home/pi/ssdv/ssdv -e -c CALLSIGN -i " + str(image_index) + " -q 3 -J camera_out.jpg /home/pi/CubeSatSim/image_file.bin") + system("/home/pi/ssdv/ssdv -e -c CALL -i " + str(image_index) + " -q 3 -J camera_out.jpg /home/pi/CubeSatSim/image_file.bin") print("image_index " + str(image_index) + "\n") image_index = ( image_index + 1 ) % 256 sleep(2) From ca10f464302089cba1370bbeca088071ad283677 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 09:13:53 -0500 Subject: [PATCH 78/96] Update transmit.py turning transmit back on --- transmit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transmit.py b/transmit.py index 8a7290d6..cc295bbe 100644 --- a/transmit.py +++ b/transmit.py @@ -752,9 +752,9 @@ if __name__ == "__main__": GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 GPIO.setup(txLed, GPIO.OUT) -## if (command_tx == True): + if (command_tx == True): # system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.9e6 -t float &") -## system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f " + tx + "e6 -t float &") + system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f " + tx + "e6 -t float &") print("Turning LED on/off and listening for carrier") image_index = 1; while 1: From 377929ce58bfe7c08e25166ec78d33f2c8a07d80 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 09:15:29 -0500 Subject: [PATCH 79/96] Update transmit.py fix camera image path --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index cc295bbe..690b9e04 100644 --- a/transmit.py +++ b/transmit.py @@ -788,7 +788,7 @@ if __name__ == "__main__": if (image_present == False): system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") print("Photo taken") - system("/home/pi/ssdv/ssdv -e -c CALL -i " + str(image_index) + " -q 3 -J camera_out.jpg /home/pi/CubeSatSim/image_file.bin") + system("/home/pi/ssdv/ssdv -e -c CALL -i " + str(image_index) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") print("image_index " + str(image_index) + "\n") image_index = ( image_index + 1 ) % 256 sleep(2) From 4ee431033d555effeb625b51796fac602faf9f57 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 11:56:04 -0500 Subject: [PATCH 80/96] Update install add ssdv install for FunCube images --- install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install b/install index 046ab3c8..7294539d 100755 --- a/install +++ b/install @@ -125,6 +125,10 @@ cd rpitx cd +git clone https://github.com/alanbjohnston/ssdv.git # install ssdv for FunCube images +cd ssdv +make + cd sudo cp ~/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service From 305129c995effbbfd4dc507c668ff2e03bdcf6ae Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 11:59:03 -0500 Subject: [PATCH 81/96] Update main.c alternate last bit of frame id --- main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.c b/main.c index ffc5f713..c8dd4945 100644 --- a/main.c +++ b/main.c @@ -2317,6 +2317,8 @@ void get_tlm_fc() { // FunCube Mode telemetry generation // source_bytes[0] = 0b11000001 ; // Sat Id is extended, Frame 2 (RT2 + WO2) source_bytes[0] = 0xE0 | 0x20 | 0x00; // 1; // Sat Id is extended, Frame 34 (RT2 + IMG2) + source_bytes[0] = source_bytes[0] | ( 0x01 & (uint_8)(sequence % 2)) // alternate last bit for RT1, RT2. + // source_bytes[1] = 0x08 ; // extended Nayify - works per code source_bytes[1] = 0x10 ; // extended JY-1 - works, no documentation int extended = 1; From 14d52e7925bc5d068ddcdd357953ecba126710e3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 12:00:24 -0500 Subject: [PATCH 82/96] Update main.c unit typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index c8dd4945..3a9677ea 100644 --- a/main.c +++ b/main.c @@ -2317,7 +2317,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation // source_bytes[0] = 0b11000001 ; // Sat Id is extended, Frame 2 (RT2 + WO2) source_bytes[0] = 0xE0 | 0x20 | 0x00; // 1; // Sat Id is extended, Frame 34 (RT2 + IMG2) - source_bytes[0] = source_bytes[0] | ( 0x01 & (uint_8)(sequence % 2)) // alternate last bit for RT1, RT2. + source_bytes[0] = source_bytes[0] | ( 0x01 & (uint8_t)(sequence % 2)) // alternate last bit for RT1, RT2. // source_bytes[1] = 0x08 ; // extended Nayify - works per code source_bytes[1] = 0x10 ; // extended JY-1 - works, no documentation From 792304ce7e4aaf4ad57ff72b373a55fc9e264f83 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 12:01:01 -0500 Subject: [PATCH 83/96] Update main.c missing ; --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 3a9677ea..524abd32 100644 --- a/main.c +++ b/main.c @@ -2317,7 +2317,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation // source_bytes[0] = 0b11000001 ; // Sat Id is extended, Frame 2 (RT2 + WO2) source_bytes[0] = 0xE0 | 0x20 | 0x00; // 1; // Sat Id is extended, Frame 34 (RT2 + IMG2) - source_bytes[0] = source_bytes[0] | ( 0x01 & (uint8_t)(sequence % 2)) // alternate last bit for RT1, RT2. + source_bytes[0] = source_bytes[0] | ( 0x01 & (uint8_t)(sequence % 2)); // alternate last bit for RT1, RT2. // source_bytes[1] = 0x08 ; // extended Nayify - works per code source_bytes[1] = 0x10 ; // extended JY-1 - works, no documentation From 794bb40ff2ace2ba0fce807c48e7472234d82a38 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 12:24:56 -0500 Subject: [PATCH 84/96] Update transmit.py no call, no FEC --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 690b9e04..b636b5a9 100644 --- a/transmit.py +++ b/transmit.py @@ -788,7 +788,7 @@ if __name__ == "__main__": if (image_present == False): system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") print("Photo taken") - system("/home/pi/ssdv/ssdv -e -c CALL -i " + str(image_index) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") + system("/home/pi/ssdv/ssdv -e -n -i " + str(image_index) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") print("image_index " + str(image_index) + "\n") image_index = ( image_index + 1 ) % 256 sleep(2) From a5a0f1a8a11e4a67edbb0191d12508c3226248ea Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 12:46:23 -0500 Subject: [PATCH 85/96] Update main.c check pos before getc --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 524abd32..9e47c212 100644 --- a/main.c +++ b/main.c @@ -2336,7 +2336,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation int value; if (image_file != NULL) { printf("Writing image data to payload\n"); - while (((value = getc(image_file)) != EOF) && (pos < 256)) { + while ((pos < 256) && ((value = getc(image_file)) != EOF)) { source_bytes[pos++] = value; printf("%2x ", value); } From 024e2cdf32e8bcb66899b2f5d52ebe50893ed60c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 16:11:08 -0500 Subject: [PATCH 86/96] Update transmit.py camera_photo function, -q 2 --- transmit.py | 82 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 27 deletions(-) diff --git a/transmit.py b/transmit.py index b636b5a9..caf827b6 100644 --- a/transmit.py +++ b/transmit.py @@ -135,6 +135,33 @@ def increment_mode(): except: print("can't write to .mode file") +def camera_photo(): + + system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") + print("Photo taken") + + file='/home/pi/CubeSatSim/camera_out.jpg' + font1 = ImageFont.truetype('DejaVuSerif.ttf', 20) + font2 = ImageFont.truetype('DejaVuSerif-Bold.ttf', 16) + + try: + filep = open("/home/pi/CubeSatSim/telem_string.txt") + telem_string = filep.readline() + except: + telem_string = "" + if (debug_mode == 1): + print("Can't read telem_string.txt") + print(telem_string) + + img = Image.open(file) + draw = ImageDraw.Draw(img) +# draw.text((10, 10), callsign, font=font2, fill='white') +# draw.text((120, 10), telem_string, font=font2, fill='white') + draw.text((12, 12), callsign, font=font1, fill='black') + draw.text((10, 10), callsign, font=font1, fill='white') + draw.text((122, 12), telem_string, font=font2, fill='black') + draw.text((120, 10), telem_string, font=font2, fill='white') + img.save(file) print("CubeSatSim v2.0 transmit.py starting...") @@ -580,32 +607,32 @@ if __name__ == "__main__": print("image 2 did not load - copy from CubeSatSim/sstv directory") while 1: # command_control_check() - - system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") - print("Photo taken") - - file='/home/pi/CubeSatSim/camera_out.jpg' - font1 = ImageFont.truetype('DejaVuSerif.ttf', 20) - font2 = ImageFont.truetype('DejaVuSerif-Bold.ttf', 16) - - try: - filep = open("/home/pi/CubeSatSim/telem_string.txt") - telem_string = filep.readline() - except: - telem_string = "" - if (debug_mode == 1): - print("Can't read telem_string.txt") - print(telem_string) - - img = Image.open(file) - draw = ImageDraw.Draw(img) + camera_photo() +## system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") +## print("Photo taken") +## +## file='/home/pi/CubeSatSim/camera_out.jpg' +## font1 = ImageFont.truetype('DejaVuSerif.ttf', 20) +## font2 = ImageFont.truetype('DejaVuSerif-Bold.ttf', 16) +## +## try: +## filep = open("/home/pi/CubeSatSim/telem_string.txt") +## telem_string = filep.readline() +## except: +## telem_string = "" +## if (debug_mode == 1): +## print("Can't read telem_string.txt") +## print(telem_string) +## +## img = Image.open(file) +## draw = ImageDraw.Draw(img) # draw.text((10, 10), callsign, font=font2, fill='white') # draw.text((120, 10), telem_string, font=font2, fill='white') - draw.text((12, 12), callsign, font=font1, fill='black') - draw.text((10, 10), callsign, font=font1, fill='white') - draw.text((122, 12), telem_string, font=font2, fill='black') - draw.text((120, 10), telem_string, font=font2, fill='white') - img.save(file) +## draw.text((12, 12), callsign, font=font1, fill='black') +## draw.text((10, 10), callsign, font=font1, fill='white') +## draw.text((122, 12), telem_string, font=font2, fill='black') +## draw.text((120, 10), telem_string, font=font2, fill='white') +## img.save(file) # command_control_check() @@ -786,9 +813,10 @@ if __name__ == "__main__": image_present = False if (image_present == False): - system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") - print("Photo taken") - system("/home/pi/ssdv/ssdv -e -n -i " + str(image_index) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") + camera_photo() +## system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") +## print("Photo taken") + system("/home/pi/ssdv/ssdv -e -n -i " + str(image_index) + " -q 2 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") print("image_index " + str(image_index) + "\n") image_index = ( image_index + 1 ) % 256 sleep(2) From a1985178cc3b5074fd019b3f7d07e4726d1377b5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 16:21:53 -0500 Subject: [PATCH 87/96] Update main.c --- main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 9e47c212..79051464 100644 --- a/main.c +++ b/main.c @@ -526,7 +526,10 @@ int main(int argc, char * argv[]) { sin_samples = S_RATE/freq_Hz; for (int j = 0; j < sin_samples; j++) { - sin_map[j] = (short int)(amplitude * sin((float)(2 * M_PI * j / sin_samples))); + sin_map[j] = (short int)(amplitude * sin((float)(2 * M_PI * j / sin_samples))); + + FILE * delete_image = popen("sudo rm /home/pi/CubeSatSim/image_file.bin", "r"); // delete any previous camera images + pclose(delete_image); } printf("\n"); } @@ -2323,13 +2326,13 @@ void get_tlm_fc() { // FunCube Mode telemetry generation source_bytes[1] = 0x10 ; // extended JY-1 - works, no documentation int extended = 1; - if (sequence > 10) { +// if (sequence > 10) { if (image_file == NULL) { image_file = fopen("/home/pi/CubeSatSim/image_file.bin", "r"); image_id++; printf("Opening file image_file.bin for image_id: %d\n", image_id); } - } +// } int pos = 56; // 56 // source_bytes[pos++] = 0x55; // source_bytes[pos++] = 0x68; @@ -2338,7 +2341,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation printf("Writing image data to payload\n"); while ((pos < 256) && ((value = getc(image_file)) != EOF)) { source_bytes[pos++] = value; - printf("%2x ", value); +// printf("%2x ", value); } if (value == EOF) { image_file = NULL; From ed45ad6eb142de1ffc2f2b8aa4a6d58ccb7b5201 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 16:22:16 -0500 Subject: [PATCH 88/96] Update transmit.py -q 4 --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index caf827b6..e5eb5cd6 100644 --- a/transmit.py +++ b/transmit.py @@ -816,7 +816,7 @@ if __name__ == "__main__": camera_photo() ## system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") ## print("Photo taken") - system("/home/pi/ssdv/ssdv -e -n -i " + str(image_index) + " -q 2 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") + system("/home/pi/ssdv/ssdv -e -n -i " + str(image_index) + " -q 4 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") print("image_index " + str(image_index) + "\n") image_index = ( image_index + 1 ) % 256 sleep(2) From 30aa9bb4224ce635fcca33bcd6710b36e6831738 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 22:05:55 -0500 Subject: [PATCH 89/96] add non-progressive jpeg for ssd --- sstv/sstv_image_2_320_x_256.jpeg | Bin 0 -> 24002 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 sstv/sstv_image_2_320_x_256.jpeg diff --git a/sstv/sstv_image_2_320_x_256.jpeg b/sstv/sstv_image_2_320_x_256.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..588a1aa78589f76bdd85e7daee181e0ccd1d8277 GIT binary patch literal 24002 zcmeFYbzECdvoId4NLwfrX^UI226va@g+OpG#U%uSyA&$8)1pNJ1b3H~;uI+am*VbP z{FnA?&%O6~-uLtV{ksb%XU^`-?Ck99W@h%}cH(v(@IXmUQ4WBHh6ad2{Q+(l041^> zHkJT@q9Q8*2LJ$I1BlQt0B9)a*YyMq>-YT?3MT&(wnf3rf8wB{U@kOtz> zFfr;LfVynnV*aL$N5Q`es=MFMf8FI3Rn%y>*||8`dH7M3oZNiEoZP~kJT%qF-9ECYJ9Guxr&7rR>*v+624i8gD4lZ_14uGhHhoh;PorMd{ zD+?V(I~OaHju@!*dH~ zGnkE|iw)F)<`+lPS5Q|MF*;QLe+UL~R8jex@xRpp1oBJT-`LJBvTi8i|C7d?H9Z|I zIKURpP*<3lg{+%}gA4s%J2?=oVyb|C7 za`FmU0C~Cj1c9%3`7D8EuPiM2dAWqlEO>?f;-l!`>|*L*X7P&;iZica zDG!j-Oi&QWE5u_8H02TEN3rAN5_-jFZf41C`4>G1W`i;#Q~Q6F=NBJy6dzM=ES76n zLB!}(OwDLO8h=)6+CVHcTuguIh)aM+ke^48n}?5|UyxIf>rV`A3z##?GJf&;y>94e z%*}-5P@GIr(`*AVwX)!_b+oYhExoV|%)--4tdaWrZ>%lm<{{^n1UdVg5twEPo-oTU-26 zDM|@IPHrG4&!0-*Lp}ah0tadU9KROhA7kP8@5B7v_Ad+fFLcyy@C*EVa}lTc-}1j2 z_+JhDuLk~C1OKam|JA_%|1|JVcw*sza&_EM!N=_)dYPh(jENc;B&Ya778RQT0O+6W z%^=R0k^lh2!374Em!{Fx)2G4S0H6af0T`%HN>ejuM=3S67r%m{e_u|=en(q?5#TRg z{~qT**4{Tqg(0YLjRu7wY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b 2025 22:17:02 -0500 Subject: [PATCH 90/96] Update transmit.py FC send stored image if no camera --- transmit.py | 55 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/transmit.py b/transmit.py index e5eb5cd6..2e16f767 100644 --- a/transmit.py +++ b/transmit.py @@ -135,33 +135,40 @@ def increment_mode(): except: print("can't write to .mode file") -def camera_photo(): - - system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") - print("Photo taken") - - file='/home/pi/CubeSatSim/camera_out.jpg' - font1 = ImageFont.truetype('DejaVuSerif.ttf', 20) - font2 = ImageFont.truetype('DejaVuSerif-Bold.ttf', 16) - +def camera_photo(): + stored_image = False try: - filep = open("/home/pi/CubeSatSim/telem_string.txt") - telem_string = filep.readline() + system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") + f = open("/home/pi/CubeSatSim/camera_out.jpg") + f.close() + print("Photo taken") except: - telem_string = "" - if (debug_mode == 1): - print("Can't read telem_string.txt") - print(telem_string) + system("cp /home/pi/CubeSatSim/sstv//sstv_image_2_320_x_256.jpeg /home/pi/CubeSatSim/camera_out.jpg") + print("Using stored image") + stored_image = True + if (stored_image == False): + file='/home/pi/CubeSatSim/camera_out.jpg' + font1 = ImageFont.truetype('DejaVuSerif.ttf', 20) + font2 = ImageFont.truetype('DejaVuSerif-Bold.ttf', 16) - img = Image.open(file) - draw = ImageDraw.Draw(img) -# draw.text((10, 10), callsign, font=font2, fill='white') -# draw.text((120, 10), telem_string, font=font2, fill='white') - draw.text((12, 12), callsign, font=font1, fill='black') - draw.text((10, 10), callsign, font=font1, fill='white') - draw.text((122, 12), telem_string, font=font2, fill='black') - draw.text((120, 10), telem_string, font=font2, fill='white') - img.save(file) + try: + filep = open("/home/pi/CubeSatSim/telem_string.txt") + telem_string = filep.readline() + except: + telem_string = "" + if (debug_mode == 1): + print("Can't read telem_string.txt") + print(telem_string) + + img = Image.open(file) + draw = ImageDraw.Draw(img) + # draw.text((10, 10), callsign, font=font2, fill='white') + # draw.text((120, 10), telem_string, font=font2, fill='white') + draw.text((12, 12), callsign, font=font1, fill='black') + draw.text((10, 10), callsign, font=font1, fill='white') + draw.text((122, 12), telem_string, font=font2, fill='black') + draw.text((120, 10), telem_string, font=font2, fill='white') + img.save(file) print("CubeSatSim v2.0 transmit.py starting...") From b19dc85b80a3d6376ca569d363c611c82a924b8e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 22:18:53 -0500 Subject: [PATCH 91/96] Update main.h add FC_PAYLOAD --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index c64d265f..4082e5c3 100644 --- a/main.h +++ b/main.h @@ -56,6 +56,7 @@ #define FC_EPS 1 #define FC_BOB 25 #define FC_SW 50 +#define FC_PAYLOAD 45 #define RSSI 0 #define IHU_TEMP 2 From 28a7318db879c5416d7c996234238159e58c2d69 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 22:19:25 -0500 Subject: [PATCH 92/96] Update main.c add FC_PAYLOAD --- main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.c b/main.c index 79051464..8c499bd3 100644 --- a/main.c +++ b/main.c @@ -2333,9 +2333,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation printf("Opening file image_file.bin for image_id: %d\n", image_id); } // } - int pos = 56; // 56 -// source_bytes[pos++] = 0x55; -// source_bytes[pos++] = 0x68; + int pos = FC_PAYLOAD + extended; / int value; if (image_file != NULL) { printf("Writing image data to payload\n"); From 6401fd236e0fbea1066825b14bb1d7cd16f844f5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 22:20:14 -0500 Subject: [PATCH 93/96] Update main.c fix FC_PAYLOAD --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 8c499bd3..de0e06b3 100644 --- a/main.c +++ b/main.c @@ -2333,7 +2333,7 @@ void get_tlm_fc() { // FunCube Mode telemetry generation printf("Opening file image_file.bin for image_id: %d\n", image_id); } // } - int pos = FC_PAYLOAD + extended; / + int pos = FC_PAYLOAD + extended; int value; if (image_file != NULL) { printf("Writing image data to payload\n"); From b1bbaeb7d9c2729c4f24f5e430307c4c3f5e14a0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 22:28:27 -0500 Subject: [PATCH 94/96] Update main.h payload starts at 55 --- main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.h b/main.h index 4082e5c3..8c886988 100644 --- a/main.h +++ b/main.h @@ -56,7 +56,7 @@ #define FC_EPS 1 #define FC_BOB 25 #define FC_SW 50 -#define FC_PAYLOAD 45 +#define FC_PAYLOAD 55 #define RSSI 0 #define IHU_TEMP 2 From a9a1c767807125987865d886d90c96d618818115 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 22:35:39 -0500 Subject: [PATCH 95/96] Update transmit.py fix camera test --- transmit.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/transmit.py b/transmit.py index 2e16f767..a3844747 100644 --- a/transmit.py +++ b/transmit.py @@ -135,7 +135,8 @@ def increment_mode(): except: print("can't write to .mode file") -def camera_photo(): +def camera_photo(): + system("sudo rm /home/pi/CubeSatSim/camera_out.jpg") stored_image = False try: system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") @@ -792,7 +793,7 @@ if __name__ == "__main__": print("Turning LED on/off and listening for carrier") image_index = 1; while 1: - print ("LED on") +# print ("LED on") output(txLed, txLedOff) sleep(0.4) # if (command_tx == False): @@ -811,7 +812,7 @@ if __name__ == "__main__": if (mode == 'b'): sleep(4.2) else: # FunCube mode image - print("Checking image_file.bin") +# print("Checking image_file.bin") try: file = open("/home/pi/CubeSatSim/image_file.bin") file.close() From ea1448b6cf2dfc8b66dfd548bef50e121392de6a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 22:38:55 -0500 Subject: [PATCH 96/96] Update transmit.py quality 3 --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index a3844747..f7246370 100644 --- a/transmit.py +++ b/transmit.py @@ -824,7 +824,7 @@ if __name__ == "__main__": camera_photo() ## system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") ## print("Photo taken") - system("/home/pi/ssdv/ssdv -e -n -i " + str(image_index) + " -q 4 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") + system("/home/pi/ssdv/ssdv -e -n -i " + str(image_index) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") print("image_index " + str(image_index) + "\n") image_index = ( image_index + 1 ) % 256 sleep(2)