From 8efc44ff31d15b86bd078eea0d189934c7201776 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 20 Jun 2021 21:13:16 -0400 Subject: [PATCH 01/11] added printf for spin --- afsk/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index 326ee409..84a6c9c2 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -272,11 +272,12 @@ int main(int argc, char * argv[]) { // Check for SPI and AX-5043 Digital Transceiver Board FILE * file = popen("sudo raspi-config nonint get_spi", "r"); pclose(file); + printf("getc: %c \n", fgetc(file)); if (fgetc(file) == 48) { printf("SPI is enabled!\n"); FILE * file2 = popen("ls /dev/spidev0.* 2>&1", "r"); - // printf("Result getc: %c \n", getc(file2)); + printf("Result getc: %c \n", getc(file2)); if (fgetc(file2) != 'l') { printf("SPI devices present!\n"); From 78e19fdcb6b8af7ff3005ec1b8a654117f90b039 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 20 Jun 2021 21:17:02 -0400 Subject: [PATCH 02/11] moved wrong pclose --- afsk/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 84a6c9c2..13a5475f 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -271,8 +271,7 @@ int main(int argc, char * argv[]) { // Check for SPI and AX-5043 Digital Transceiver Board FILE * file = popen("sudo raspi-config nonint get_spi", "r"); - pclose(file); - printf("getc: %c \n", fgetc(file)); +// printf("getc: %c \n", fgetc(file)); if (fgetc(file) == 48) { printf("SPI is enabled!\n"); @@ -282,7 +281,7 @@ int main(int argc, char * argv[]) { if (fgetc(file2) != 'l') { printf("SPI devices present!\n"); // } - pclose(file2); + setSpiChannel(SPI_CHANNEL); setSpiSpeed(SPI_SPEED); initializeSpi(); @@ -299,7 +298,9 @@ int main(int argc, char * argv[]) { transmit = TRUE; } else printf("AX5043 not present!\n"); + pclose(file2); } + pclose(file); } // else // { From 92a703e65cf43d3d139d14301cfb0cfad4302846 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 20 Jun 2021 21:20:31 -0400 Subject: [PATCH 03/11] extra pclose --- afsk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index 13a5475f..21a04a35 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -300,7 +300,7 @@ int main(int argc, char * argv[]) { printf("AX5043 not present!\n"); pclose(file2); } - pclose(file); +// pclose(file); } // else // { From d34ce7301010339471ddf7b4c3272c35863de6dd Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 20 Jun 2021 23:01:20 -0400 Subject: [PATCH 04/11] moved coords APRS --- afsk/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 21a04a35..fab5114c 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1143,13 +1143,14 @@ void get_tlm(void) { if (ax5043) { strcpy(str, header_str); - } else { + } else if (mode == AFSK) { strcpy(str, header_str3); + strcat(str, call); + strcat(str, header_str2); + } // printf("Str: %s \n", str); if (mode != CW) { - strcat(str, call); - strcat(str, header_str2); - // sprintf(header_str2b, "=%7.2f%c%c%c%08.2f%cShi hi ",4003.79,'N',0x5c,0x5c,07534.33,'W'); // add APRS lat and long + // sprintf(header_str2b, "=%7.2f%c%c%c%08.2f%cShi hi ",4003.79,'N',0x5c,0x5c,07534.33,'W'); // add APRS lat and long if (latitude > 0) sprintf(header_lat, "%7.2f%c", latitude, 'N'); // lat else @@ -1164,9 +1165,9 @@ void get_tlm(void) { strcat(str, header_str2b); } else { strcat(str, header_str4); -// printf("Str: %s \n", str); } - } +// } + printf("Str: %s \n", str); int channel; for (channel = 1; channel < 7; channel++) { From e8ade8ae0b84c9bbb2356eee62e8d002bae9fda0 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 20 Jun 2021 23:04:47 -0400 Subject: [PATCH 05/11] removed extra hi hi --- afsk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index fab5114c..7b3e7541 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1128,7 +1128,7 @@ void get_tlm(void) { char str[1000]; char tlm_str[1000]; - char header_str[] = "\x03\xf0hi hi "; + char header_str[] = "\x03\xf0"; // hi hi "; char header_str3[] = "echo '"; //char header_str2[] = ">CQ:>041440zhi hi "; //char header_str2[] = ">CQ:=4003.79N\\07534.33WShi hi "; From 6515929a01880cc744964650922ed6bcea0eb666 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 20 Jun 2021 23:10:36 -0400 Subject: [PATCH 06/11] printf data just before tx --- afsk/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/afsk/main.c b/afsk/main.c index 7b3e7541..631e2c57 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1261,6 +1261,7 @@ void get_tlm(void) { #endif fprintf(stderr, "INFO: Transmitting X.25 packet using AX5043\n"); memcpy(data, str, strnlen(str, 256)); + printf("data: %s \n", data); int ret = ax25_tx_frame( & hax25, & hax5043, data, strnlen(str, 256)); if (ret) { fprintf(stderr, From efaa0b54567767b529c7963deb10ca61a0ead14c Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 20 Jun 2021 23:17:04 -0400 Subject: [PATCH 07/11] fixed APRS header for AX5043 --- afsk/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 631e2c57..26b22fd5 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1159,8 +1159,10 @@ void get_tlm(void) { sprintf(header_long, "%08.2f%c", longitude , 'E'); // long else sprintf(header_long, "%08.2f%c", longitude * (-1.0), 'W'); // long - - sprintf(header_str2b, "=%s%c%c%sShi hi ", header_lat, 0x5c, 0x5c, header_long); // add APRS lat and long + if (ax5043) + sprintf(header_str2b, "=%s%c%sShi hi ", header_lat, 0x5c, header_long); // add APRS lat and long + else + sprintf(header_str2b, "=%s%c%c%sShi hi ", header_lat, 0x5c, 0x5c, header_long); // add APRS lat and long // printf("\n\nString is %s \n\n", header_str2b); strcat(str, header_str2b); } else { From 89f7274dc7ff1f9130ff668f247d97e034e26b68 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 20 Jun 2021 23:20:42 -0400 Subject: [PATCH 08/11] added sleep in case CW ID is sent --- afsk/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/afsk/main.c b/afsk/main.c index 26b22fd5..458fc9d9 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -296,6 +296,7 @@ int main(int argc, char * argv[]) { // cycle = OFF; printf("Mode AFSK with AX5043\n"); transmit = TRUE; + sleep(10); // just in case CW ID is sent } else printf("AX5043 not present!\n"); pclose(file2); From 97324e836cc5cd228eef7a93d086a1c05380d62e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 20 Jun 2021 23:24:01 -0400 Subject: [PATCH 09/11] removed CPUQuota --- systemd/cubesatsim.service | 2 -- 1 file changed, 2 deletions(-) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index 213fdfea..5fc952d0 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -9,8 +9,6 @@ StandardOutput=inherit StandardError=inherit Restart=always User=pi -CPUAccounting=true -CPUQuota=5% [Install] WantedBy=default.target From 54ae4e4a29b406f5a93e49fd4ab7e5c59274af84 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 21 Jun 2021 05:58:31 -0400 Subject: [PATCH 10/11] added back in CPUQuota --- systemd/cubesatsim.service | 2 ++ 1 file changed, 2 insertions(+) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index 5fc952d0..213fdfea 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -9,6 +9,8 @@ StandardOutput=inherit StandardError=inherit Restart=always User=pi +CPUAccounting=true +CPUQuota=5% [Install] WantedBy=default.target From bae54e22fc60b6f312a0b59150ce69ce65939aef Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 21 Jun 2021 06:06:39 -0400 Subject: [PATCH 11/11] 5 seconds between APRS packets --- afsk/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 458fc9d9..f269413c 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -296,7 +296,7 @@ int main(int argc, char * argv[]) { // cycle = OFF; printf("Mode AFSK with AX5043\n"); transmit = TRUE; - sleep(10); // just in case CW ID is sent +// sleep(10); // just in case CW ID is sent } else printf("AX5043 not present!\n"); pclose(file2); @@ -1259,9 +1259,9 @@ void get_tlm(void) { } else if (ax5043) { digitalWrite(txLed, txLedOn); - #ifdef DEBUG_LOGGING - printf("Tx LED On 5\n"); - #endif +// #ifdef DEBUG_LOGGING +// printf("Tx LED On 5\n"); +// #endif fprintf(stderr, "INFO: Transmitting X.25 packet using AX5043\n"); memcpy(data, str, strnlen(str, 256)); printf("data: %s \n", data); @@ -1274,9 +1274,9 @@ void get_tlm(void) { } ax5043_wait_for_transmit(); digitalWrite(txLed, txLedOff); - #ifdef DEBUG_LOGGING - printf("Tx LED Off\n"); - #endif +// #ifdef DEBUG_LOGGING +// printf("Tx LED Off\n"); +// #endif if (ret) { fprintf(stderr, @@ -1284,7 +1284,7 @@ void get_tlm(void) { ret); exit(EXIT_FAILURE); } - sleep(2); + sleep(4); // was 2 } else { // APRS using rpitx