From e46aef11411bfbdd083b6c999bd50c1def7fc7a9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 14:23:37 +0200 Subject: [PATCH 001/515] add files from funcube-dev/funcubeLib --- codecAO40.cpp | 516 +++++++++++++++++++++++++++++++++++++++++++++++++ codecAO40.h | 65 +++++++ fecConstants.h | 128 ++++++++++++ 3 files changed, 709 insertions(+) create mode 100644 codecAO40.cpp create mode 100644 codecAO40.h create mode 100644 fecConstants.h diff --git a/codecAO40.cpp b/codecAO40.cpp new file mode 100644 index 00000000..89073739 --- /dev/null +++ b/codecAO40.cpp @@ -0,0 +1,516 @@ +#include +#include "codecAO40.h" + +/* ---------------------- */ +/* AO40 Encoder - Decoder */ +/* ---------------------- */ + +/* Scramble and RS encode 256 byte blocks of data into 5200 bits + * or Descramble and RS decode 5200 bits into the 256 bytes of data + * + * -------------------------------------------------------------------------- + * This decoder has evolved extensively through the work of Phil Karn. It draws + * on his own ideas and optimisations, and on the work of others. The lineage + * is as below, and parts of the authors' notices are included here. (JRM) + + * AO40 encoder / decoder + * Copyright 2002 Phil Karn, KA9Q + * May be used under the terms of the GNU General Public License (GPL) + * + * Reed-Solomon coding and decoding + * Phil Karn (karn@ka9q.ampr.org) September 1996 + * + * This file is derived from the program "new_rs_erasures.c" by Robert + * Morelos-Zaragoza (robert@spectra.eng.hawaii.edu) and Hari Thirumoorthy + * (harit@spectra.eng.hawaii.edu), Aug 1995 + * -------------------------------------------------------------------------- + * + * From the RM-Z & HT program: + * The encoding and decoding methods are based on the + * book "Error Control Coding: Fundamentals and Applications", + * by Lin and Costello, Prentice Hall, 1983, ISBN 0-13-283796-X + * Portions of this program are from a Reed-Solomon encoder/decoder + * in C, written by Simon Rockliff (simon@augean.ua.oz.au) on 21/9/89. + * -------------------------------------------------------------------------- + * + * From the 1989/1991 SR program (also based on Lin and Costello): + * This program may be freely modified and/or given to whoever wants it. + * A condition of such distribution is that the author's contribution be + * acknowledged by his name being left in the comments heading the program, + * Simon Rockliff, 26th June 1991 + * + */ + +/* Defines for RS Decoder(s) */ +#ifndef min +#define min(a,b) ((a) < (b) ? (a) : (b)) +#endif + +CCodecAO40::CCodecAO40(void) +{ +} + + +CCodecAO40::~CCodecAO40(void) +{ +} + + +int CCodecAO40::mod255(int x) { + while (x >= 255) { + x -= 255; + x = (x >> 8) + (x & 255); + } + return x; +} + +int CCodecAO40::decode_rs_8(char *data, int *eras_pos, int no_eras){ + + int deg_lambda, el, deg_omega; + int i, j, r,k; + unsigned char u,q,tmp,num1,num2,den,discr_r; + unsigned char lambda[NROOTS+1], s[NROOTS]; /* Err+Eras Locator poly and syndrome poly */ + unsigned char b[NROOTS+1], t[NROOTS+1], omega[NROOTS+1]; + unsigned char root[NROOTS], reg[NROOTS+1], loc[NROOTS]; + int syn_error, count; + + /* form the syndromes; i.e., evaluate data(x) at roots of g(x) */ + for(i=0;i 0) { + /* Init lambda to be the erasure locator polynomial */ + lambda[1] = ALPHA_TO[mod255(PRIM*(NN-1-eras_pos[0]))]; + for (i = 1; i < no_eras; i++) { + u = mod255(PRIM*(NN-1-eras_pos[i])); + for (j = i+1; j > 0; j--) { + tmp = INDEX_OF[lambda[j - 1]]; + if(tmp != A0) + lambda[j] ^= ALPHA_TO[mod255(u + tmp)]; + } + } + } + for(i=0;i 0; j--){ + if (reg[j] != A0) { + reg[j] = mod255(reg[j] + j); + q ^= ALPHA_TO[reg[j]]; + } + } + if (q != 0) + continue; /* Not a root */ + /* store root (index-form) and error location number */ + root[count] = i; + loc[count] = k; + /* If we've already found max possible roots, + * abort the search to save time + */ + if(++count == deg_lambda) + break; + } + if (deg_lambda != count) { + /* + * deg(lambda) unequal to number of roots => uncorrectable + * error detected + */ + count = -1; + goto finish; + } + /* + * Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo + * x**NROOTS). in index form. Also find deg(omega). + */ + deg_omega = 0; + for (i = 0; i < NROOTS;i++){ + tmp = 0; + j = (deg_lambda < i) ? deg_lambda : i; + for(;j >= 0; j--){ + if ((s[i - j] != A0) && (lambda[j] != A0)) + tmp ^= ALPHA_TO[mod255(s[i - j] + lambda[j])]; + } + if(tmp != 0) + deg_omega = i; + omega[i] = INDEX_OF[tmp]; + } + omega[NROOTS] = A0; + + /* + * Compute error values in poly-form. num1 = omega(inv(X(l))), num2 = + * inv(X(l))**(FCR-1) and den = lambda_pr(inv(X(l))) all in poly-form + */ + for (j = count-1; j >=0; j--) { + num1 = 0; + for (i = deg_omega; i >= 0; i--) { + if (omega[i] != A0) + num1 ^= ALPHA_TO[mod255(omega[i] + i * root[j])]; + } + num2 = ALPHA_TO[mod255(root[j] * (FCR - 1) + NN)]; + den = 0; + + /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ + for (i = min(deg_lambda,NROOTS-1) & ~1; i >= 0; i -=2) { + if(lambda[i+1] != A0) + den ^= ALPHA_TO[mod255(lambda[i+1] + i * root[j])]; + } + if (den == 0) { + count = -1; + goto finish; + } + /* Apply error to data */ + if (num1 != 0) { + data[loc[j]] ^= ALPHA_TO[mod255(INDEX_OF[num1] + INDEX_OF[num2] + NN - INDEX_OF[den])]; + } + } +finish: + if(eras_pos != NULL){ + for(i=0;i> 7); + c <<= 1; + interleave_symbol( Partab[m_conv_sr & CPOLYA]); + interleave_symbol(!Partab[m_conv_sr & CPOLYB]); /* Second encoder symbol is inverted */ + } +} + +/* Scramble a byte, convolutionally encode and interleave into frame */ +void CCodecAO40::scramble_and_encode(unsigned char c){ + c ^= Scrambler[m_encoded_bytes]; /* Scramble byte */ + encode_and_interleave(c,8); /* RS encode and place into reencode buffer */ +} + +/* Encodes the 256 byte source block RSdecdata[] into 5200 byte block of symbols +* results stored in m_encoded. +* On success encoded buffer is returned, an zeroed buffer on failure +*/ +const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count) +{ + if(BLOCKSIZE != byte_count || NULL == source_bytes ) + { + memset(m_encoded, 0, BLOCKSIZE); + return m_encoded; + } + + init_encoder(); + + for(int i=0;i>1]; + scramble_and_encode(c); + if(++m_encoded_bytes == 320){ + /* Tail off the convolutional encoder (flush) */ + encode_and_interleave(0,6); + } +} + + + +void CCodecAO40::descramble_to_rsblocks(unsigned char viterbi_decoded[NBITS_OUT], char rsblocks[RSBLOCKS][NN]) +{ + /* interleave into Reed Solomon codeblocks */ + memset(rsblocks,0,RSBLOCKS*NN); /* Zero rsblocks array */ + int di = 0; + int si = 0; + for(int col=RSPAD;col>7) ) + { + error_count++ ; + } + } + return error_count; +} diff --git a/codecAO40.h b/codecAO40.h new file mode 100644 index 00000000..f7f1238d --- /dev/null +++ b/codecAO40.h @@ -0,0 +1,65 @@ +/* AO40 encoder / decoder + * Copyright 2002 Phil Karn, KA9Q + * May be used under the terms of the GNU General Public License (GPL) + * See CodecAO40.cpp for lineage + * + * This file is part of FUNcubeLib. + * + * FUNcubeLib is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * FUNcubeLib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FUNcubeLib If not, see . + * +*/ + +#pragma once + +#include "fecConstants.h" + +class CCodecAO40 +{ +public: + CCodecAO40(void); + virtual ~CCodecAO40(void); + + int decode(unsigned char viterbi_decoded[NBITS_OUT], unsigned char *decoded_data); + + /* Encodes the 256 byte source block into 5200 byte block of symbols into m_encoded buffer */ + const unsigned char *encode( + unsigned char *source_bytes, /* input to encode */ + int byte_count); /* input length in bytes */ + + /* Compares raw input symbols to current buffer of encoded symbols and counts the errors */ + int count_errors( unsigned char *raw_symbols); + +private: + int mod255(int x); + int decode_rs_8(char *data, int *eras_pos, int no_eras); + void scramble_and_encode(unsigned char c); + void encode_and_interleave(unsigned char c,int cnt); + + void descramble_to_rsblocks( + unsigned char viterbi_decoded[NBITS_OUT], + char rsblocks[RSBLOCKS][NN]); + + void init_encoder(void); + void encode_byte(unsigned char c); + void encode_parity(void); + + void interleave_symbol(int c); + + int m_encoded_bytes; /* Byte counter for encode_data() */ + int m_ileaver_index; /* Byte counter for interleaver */ + unsigned char m_conv_sr; /* Convolutional encoder shift register state */ + + unsigned char m_RS_block[RSBLOCKS][NROOTS]; /* RS parity blocks */ + unsigned char m_encoded[SYMPBLOCK] ; /* encoded symbols */ +}; diff --git a/fecConstants.h b/fecConstants.h new file mode 100644 index 00000000..850c0aa6 --- /dev/null +++ b/fecConstants.h @@ -0,0 +1,128 @@ +#pragma once + +/* + Amsat P3 FEC Encoder/decoder system. Look-up tables + Created by Phil Karn KA9Q and James Miller G3RUH + Last modified 2003 Jun 20 +*/ + +/* Defines for Viterbi Decoder for r=1/2 k=7 (to CCSDS convention) */ +#define K 7 /* Constraint length */ +#define N 2 /* Number of symbols per data bit */ +#define CPOLYA 0x4f /* First convolutional encoder polynomial */ +#define CPOLYB 0x6d /* Second convolutional encoder polynomial */ + +#define SYNC_POLY 0x48 /* Sync vector PN polynomial */ + +#define NN 255 +#define KK 223 +#define NROOTS 32 /* NN-KK */ +#define A0 (NN) +#define FCR 112 +#define PRIM 11 +#define IPRIM 116 +#define BLOCKSIZE 256 /* Data bytes per frame */ +#define RSBLOCKS 2 /* Number of RS decoder blocks */ +#define RSPAD 95 /* Unused bytes in block (KK-BLOCKSIZE/RSBLOCKS) */ + +/* Defines for Interleaver */ +#define ROWS 80 /* Block interleaver rows */ +#define COLUMNS 65 /* Block interleaver columns */ +#define SYMPBLOCK (ROWS*COLUMNS) /* Encoded symbols per block */ + +/* Number of symbols in an FEC block that are */ +/* passed to the Viterbi decoder (320*8 + 6) */ +#define NBITS ((BLOCKSIZE+NROOTS*RSBLOCKS)*8+K-1) +/* Number of bits obtained from Viterbi decoder */ +#define NBITS_OUT (BLOCKSIZE+NROOTS*RSBLOCKS) + +const unsigned char RS_poly[] = { + 249, 59, 66, 4, 43,126,251, 97, 30, 3,213, 50, 66,170, 5, 24 +}; + +/* Tables for RS decoder */ +/* Galois field log/antilog tables */ +const unsigned char ALPHA_TO[] = +{ + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x87, 0x89, 0x95, 0xad, 0xdd, 0x3d, 0x7a, 0xf4, + 0x6f, 0xde, 0x3b, 0x76, 0xec, 0x5f, 0xbe, 0xfb, 0x71, 0xe2, 0x43, 0x86, 0x8b, 0x91, 0xa5, 0xcd, + 0x1d, 0x3a, 0x74, 0xe8, 0x57, 0xae, 0xdb, 0x31, 0x62, 0xc4, 0x0f, 0x1e, 0x3c, 0x78, 0xf0, 0x67, + 0xce, 0x1b, 0x36, 0x6c, 0xd8, 0x37, 0x6e, 0xdc, 0x3f, 0x7e, 0xfc, 0x7f, 0xfe, 0x7b, 0xf6, 0x6b, + 0xd6, 0x2b, 0x56, 0xac, 0xdf, 0x39, 0x72, 0xe4, 0x4f, 0x9e, 0xbb, 0xf1, 0x65, 0xca, 0x13, 0x26, + 0x4c, 0x98, 0xb7, 0xe9, 0x55, 0xaa, 0xd3, 0x21, 0x42, 0x84, 0x8f, 0x99, 0xb5, 0xed, 0x5d, 0xba, + 0xf3, 0x61, 0xc2, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, + 0x47, 0x8e, 0x9b, 0xb1, 0xe5, 0x4d, 0x9a, 0xb3, 0xe1, 0x45, 0x8a, 0x93, 0xa1, 0xc5, 0x0d, 0x1a, + 0x34, 0x68, 0xd0, 0x27, 0x4e, 0x9c, 0xbf, 0xf9, 0x75, 0xea, 0x53, 0xa6, 0xcb, 0x11, 0x22, 0x44, + 0x88, 0x97, 0xa9, 0xd5, 0x2d, 0x5a, 0xb4, 0xef, 0x59, 0xb2, 0xe3, 0x41, 0x82, 0x83, 0x81, 0x85, + 0x8d, 0x9d, 0xbd, 0xfd, 0x7d, 0xfa, 0x73, 0xe6, 0x4b, 0x96, 0xab, 0xd1, 0x25, 0x4a, 0x94, 0xaf, + 0xd9, 0x35, 0x6a, 0xd4, 0x2f, 0x5e, 0xbc, 0xff, 0x79, 0xf2, 0x63, 0xc6, 0x0b, 0x16, 0x2c, 0x58, + 0xb0, 0xe7, 0x49, 0x92, 0xa3, 0xc1, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0xc7, 0x09, 0x12, 0x24, + 0x48, 0x90, 0xa7, 0xc9, 0x15, 0x2a, 0x54, 0xa8, 0xd7, 0x29, 0x52, 0xa4, 0xcf, 0x19, 0x32, 0x64, + 0xc8, 0x17, 0x2e, 0x5c, 0xb8, 0xf7, 0x69, 0xd2, 0x23, 0x46, 0x8c, 0x9f, 0xb9, 0xf5, 0x6d, 0xda, + 0x33, 0x66, 0xcc, 0x1f, 0x3e, 0x7c, 0xf8, 0x77, 0xee, 0x5b, 0xb6, 0xeb, 0x51, 0xa2, 0xc3, 0x00, +}; + +const unsigned char INDEX_OF[]= +{ + 0xff, 0x00, 0x01, 0x63, 0x02, 0xc6, 0x64, 0x6a, 0x03, 0xcd, 0xc7, 0xbc, 0x65, 0x7e, 0x6b, 0x2a, + 0x04, 0x8d, 0xce, 0x4e, 0xc8, 0xd4, 0xbd, 0xe1, 0x66, 0xdd, 0x7f, 0x31, 0x6c, 0x20, 0x2b, 0xf3, + 0x05, 0x57, 0x8e, 0xe8, 0xcf, 0xac, 0x4f, 0x83, 0xc9, 0xd9, 0xd5, 0x41, 0xbe, 0x94, 0xe2, 0xb4, + 0x67, 0x27, 0xde, 0xf0, 0x80, 0xb1, 0x32, 0x35, 0x6d, 0x45, 0x21, 0x12, 0x2c, 0x0d, 0xf4, 0x38, + 0x06, 0x9b, 0x58, 0x1a, 0x8f, 0x79, 0xe9, 0x70, 0xd0, 0xc2, 0xad, 0xa8, 0x50, 0x75, 0x84, 0x48, + 0xca, 0xfc, 0xda, 0x8a, 0xd6, 0x54, 0x42, 0x24, 0xbf, 0x98, 0x95, 0xf9, 0xe3, 0x5e, 0xb5, 0x15, + 0x68, 0x61, 0x28, 0xba, 0xdf, 0x4c, 0xf1, 0x2f, 0x81, 0xe6, 0xb2, 0x3f, 0x33, 0xee, 0x36, 0x10, + 0x6e, 0x18, 0x46, 0xa6, 0x22, 0x88, 0x13, 0xf7, 0x2d, 0xb8, 0x0e, 0x3d, 0xf5, 0xa4, 0x39, 0x3b, + 0x07, 0x9e, 0x9c, 0x9d, 0x59, 0x9f, 0x1b, 0x08, 0x90, 0x09, 0x7a, 0x1c, 0xea, 0xa0, 0x71, 0x5a, + 0xd1, 0x1d, 0xc3, 0x7b, 0xae, 0x0a, 0xa9, 0x91, 0x51, 0x5b, 0x76, 0x72, 0x85, 0xa1, 0x49, 0xeb, + 0xcb, 0x7c, 0xfd, 0xc4, 0xdb, 0x1e, 0x8b, 0xd2, 0xd7, 0x92, 0x55, 0xaa, 0x43, 0x0b, 0x25, 0xaf, + 0xc0, 0x73, 0x99, 0x77, 0x96, 0x5c, 0xfa, 0x52, 0xe4, 0xec, 0x5f, 0x4a, 0xb6, 0xa2, 0x16, 0x86, + 0x69, 0xc5, 0x62, 0xfe, 0x29, 0x7d, 0xbb, 0xcc, 0xe0, 0xd3, 0x4d, 0x8c, 0xf2, 0x1f, 0x30, 0xdc, + 0x82, 0xab, 0xe7, 0x56, 0xb3, 0x93, 0x40, 0xd8, 0x34, 0xb0, 0xef, 0x26, 0x37, 0x0c, 0x11, 0x44, + 0x6f, 0x78, 0x19, 0x9a, 0x47, 0x74, 0xa7, 0xc1, 0x23, 0x53, 0x89, 0xfb, 0x14, 0x5d, 0xf8, 0x97, + 0x2e, 0x4b, 0xb9, 0x60, 0x0f, 0xed, 0x3e, 0xe5, 0xf6, 0x87, 0xa5, 0x17, 0x3a, 0xa3, 0x3c, 0xb7, +}; + +/* 8-bit parity table */ +const unsigned char Partab[] = { + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, +}; + +/* Scramble byte table */ +const unsigned char Scrambler[]= +{ + 0xff, 0x48, 0x0e, 0xc0, 0x9a, 0x0d, 0x70, 0xbc, 0x8e, 0x2c, 0x93, 0xad, 0xa7, 0xb7, 0x46, 0xce, + 0x5a, 0x97, 0x7d, 0xcc, 0x32, 0xa2, 0xbf, 0x3e, 0x0a, 0x10, 0xf1, 0x88, 0x94, 0xcd, 0xea, 0xb1, + 0xfe, 0x90, 0x1d, 0x81, 0x34, 0x1a, 0xe1, 0x79, 0x1c, 0x59, 0x27, 0x5b, 0x4f, 0x6e, 0x8d, 0x9c, + 0xb5, 0x2e, 0xfb, 0x98, 0x65, 0x45, 0x7e, 0x7c, 0x14, 0x21, 0xe3, 0x11, 0x29, 0x9b, 0xd5, 0x63, + 0xfd, 0x20, 0x3b, 0x02, 0x68, 0x35, 0xc2, 0xf2, 0x38, 0xb2, 0x4e, 0xb6, 0x9e, 0xdd, 0x1b, 0x39, + 0x6a, 0x5d, 0xf7, 0x30, 0xca, 0x8a, 0xfc, 0xf8, 0x28, 0x43, 0xc6, 0x22, 0x53, 0x37, 0xaa, 0xc7, + 0xfa, 0x40, 0x76, 0x04, 0xd0, 0x6b, 0x85, 0xe4, 0x71, 0x64, 0x9d, 0x6d, 0x3d, 0xba, 0x36, 0x72, + 0xd4, 0xbb, 0xee, 0x61, 0x95, 0x15, 0xf9, 0xf0, 0x50, 0x87, 0x8c, 0x44, 0xa6, 0x6f, 0x55, 0x8f, + 0xf4, 0x80, 0xec, 0x09, 0xa0, 0xd7, 0x0b, 0xc8, 0xe2, 0xc9, 0x3a, 0xda, 0x7b, 0x74, 0x6c, 0xe5, + 0xa9, 0x77, 0xdc, 0xc3, 0x2a, 0x2b, 0xf3, 0xe0, 0xa1, 0x0f, 0x18, 0x89, 0x4c, 0xde, 0xab, 0x1f, + 0xe9, 0x01, 0xd8, 0x13, 0x41, 0xae, 0x17, 0x91, 0xc5, 0x92, 0x75, 0xb4, 0xf6, 0xe8, 0xd9, 0xcb, + 0x52, 0xef, 0xb9, 0x86, 0x54, 0x57, 0xe7, 0xc1, 0x42, 0x1e, 0x31, 0x12, 0x99, 0xbd, 0x56, 0x3f, + 0xd2, 0x03, 0xb0, 0x26, 0x83, 0x5c, 0x2f, 0x23, 0x8b, 0x24, 0xeb, 0x69, 0xed, 0xd1, 0xb3, 0x96, + 0xa5, 0xdf, 0x73, 0x0c, 0xa8, 0xaf, 0xcf, 0x82, 0x84, 0x3c, 0x62, 0x25, 0x33, 0x7a, 0xac, 0x7f, + 0xa4, 0x07, 0x60, 0x4d, 0x06, 0xb8, 0x5e, 0x47, 0x16, 0x49, 0xd6, 0xd3, 0xdb, 0xa3, 0x67, 0x2d, + 0x4b, 0xbe, 0xe6, 0x19, 0x51, 0x5f, 0x9f, 0x05, 0x08, 0x78, 0xc4, 0x4a, 0x66, 0xf5, 0x58, 0xff, + 0x48, 0x0e, 0xc0, 0x9a, 0x0d, 0x70, 0xbc, 0x8e, 0x2c, 0x93, 0xad, 0xa7, 0xb7, 0x46, 0xce, 0x5a, + 0x97, 0x7d, 0xcc, 0x32, 0xa2, 0xbf, 0x3e, 0x0a, 0x10, 0xf1, 0x88, 0x94, 0xcd, 0xea, 0xb1, 0xfe, + 0x90, 0x1d, 0x81, 0x34, 0x1a, 0xe1, 0x79, 0x1c, 0x59, 0x27, 0x5b, 0x4f, 0x6e, 0x8d, 0x9c, 0xb5, + 0x2e, 0xfb, 0x98, 0x65, 0x45, 0x7e, 0x7c, 0x14, 0x21, 0xe3, 0x11, 0x29, 0x9b, 0xd5, 0x63, 0xfd, +}; From 83272e0119b72d7bd57c2c0a3e0541b1d1d32204 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 07:28:39 -0500 Subject: [PATCH 002/515] Update Makefile added codecAO40.o codecAO40.h fecConstants.h --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dd699fbd..dc1602c9 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,8 @@ cubesatsim: afsk/ax25.o cubesatsim: afsk/ax5043.o cubesatsim: TelemEncoding.o cubesatsim: main.o - gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o cubesatsim -Wall -Wextra -L./ afsk/ax25.o afsk/ax5043.o TelemEncoding.o main.o -lwiringPi -lax5043 -lm +cubesatsim: codecAO40.o + gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o cubesatsim -Wall -Wextra -L./ afsk/ax25.o afsk/ax5043.o TelemEncoding.o codecAO40.o main.o -lwiringPi -lax5043 -lm telem: telem.o gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o telem -Wall -Wextra -L./ telem.o -lwiringPi @@ -51,6 +52,11 @@ TelemEncoding.o: TelemEncoding.c TelemEncoding.o: TelemEncoding.h gcc -std=gnu99 $(DEBUG_BEHAVIOR) -Wall -Wextra -c TelemEncoding.c +codecAO40.o: codecAO40.cpp +codecAO40.o: codecAO40.h +codecAO40.o: fecConstants.h + gcc -std=dnu99 $(DEBUG_BEHAVIOR) -Wall -Wextra -c codecAO40.cpp + ax5043/generated/configcommon.o: ax5043/generated/configcommon.c ax5043/generated/configcommon.o: ax5043/generated/configrx.h ax5043/generated/configcommon.o: ax5043/generated/configtx.h From ef02dd3dc2de322a31ffabbf5d10931debb6382d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 07:29:27 -0500 Subject: [PATCH 003/515] Update Makefile typo --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dc1602c9..6a1d5069 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ TelemEncoding.o: TelemEncoding.h codecAO40.o: codecAO40.cpp codecAO40.o: codecAO40.h codecAO40.o: fecConstants.h - gcc -std=dnu99 $(DEBUG_BEHAVIOR) -Wall -Wextra -c codecAO40.cpp + gcc -std=gnu99 $(DEBUG_BEHAVIOR) -Wall -Wextra -c codecAO40.cpp ax5043/generated/configcommon.o: ax5043/generated/configcommon.c ax5043/generated/configcommon.o: ax5043/generated/configrx.h From cd2e064f6855530761e1f111d29f122e20a76263 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 07:32:50 -0500 Subject: [PATCH 004/515] Update Makefile g++ --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6a1d5069..abd68b00 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ TelemEncoding.o: TelemEncoding.h codecAO40.o: codecAO40.cpp codecAO40.o: codecAO40.h codecAO40.o: fecConstants.h - gcc -std=gnu99 $(DEBUG_BEHAVIOR) -Wall -Wextra -c codecAO40.cpp + g++ -std=c++14 $(DEBUG_BEHAVIOR) -Wall -Wextra -c codecAO40.cpp ax5043/generated/configcommon.o: ax5043/generated/configcommon.c ax5043/generated/configcommon.o: ax5043/generated/configrx.h From 6895e01f06242a690097a55d3dcf6fdabae4cb13 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 07:38:38 -0500 Subject: [PATCH 005/515] Update Makefile added another g++ --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index abd68b00..713eacf3 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ cubesatsim: afsk/ax5043.o cubesatsim: TelemEncoding.o cubesatsim: main.o cubesatsim: codecAO40.o - gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o cubesatsim -Wall -Wextra -L./ afsk/ax25.o afsk/ax5043.o TelemEncoding.o codecAO40.o main.o -lwiringPi -lax5043 -lm + g++ -std=c++14 $(DEBUG_BEHAVIOR) -o cubesatsim -Wall -Wextra -L./ afsk/ax25.o afsk/ax5043.o TelemEncoding.o codecAO40.o main.o -lwiringPi -lax5043 -lm telem: telem.o gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o telem -Wall -Wextra -L./ telem.o -lwiringPi From 33f2a7c2dde6382b0161d2518d1838f0170fa304 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 08:52:21 -0500 Subject: [PATCH 006/515] Update main.h added fc --- main.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.h b/main.h index 6708d1af..b06f86d4 100644 --- a/main.h +++ b/main.h @@ -76,6 +76,7 @@ float toAprsFormat(float input); float rnd_float(double min, double max); void get_tlm(); void get_tlm_fox(); +void get_tlm_fc(); int encodeA(short int * b, int index, int val); int encodeB(short int * b, int index, int val); void config_x25(); @@ -86,6 +87,7 @@ void update_rs(unsigned char parity[32], unsigned char c); void write_little_endian(unsigned int word, int num_bytes, FILE *wav_file); static int init_rf(); extern int Encode_8b10b[][256]; +const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count); void program_radio(); int socket_open = 0; From 08f9ccab29c6f8c6066f8745fe4b18ee93eb22f7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 08:52:57 -0500 Subject: [PATCH 007/515] Update main.c added get_tlm_fc() for fc --- main.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/main.c b/main.c index 36dfce4c..6721524f 100644 --- a/main.c +++ b/main.c @@ -2238,3 +2238,27 @@ if (setting == ON) { } return; } + +void get_tlm_fc() { + + /* create data, stream, and waveform buffers */ + + unsigned char source_bytes[256]; + unsigned char encoded_bytes[650]; + int byte_count = 256; + + memset(source_bytes, 0xa5, sizeof(source_bytes)); + + /* write telemetry into data buffer */ + + /* convert data buffer into stream buffer */ + +// const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count) + encoded_bytes = CCodecAO40::encode(*source_bytes, byte_count); + /* convert to waveform buffer */ + + /* open socket */ + + /* write waveform buffer over socket */ + +} From c726476fd9f3f785343107e8386f0c4c37d4deab Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 08:59:18 -0500 Subject: [PATCH 008/515] Update main.c fix ao40 objects --- main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 6721524f..8777a974 100644 --- a/main.c +++ b/main.c @@ -2254,11 +2254,23 @@ void get_tlm_fc() { /* convert data buffer into stream buffer */ // const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count) - encoded_bytes = CCodecAO40::encode(*source_bytes, byte_count); + + CCodecAO40 ao40; + encoded_bytes = ao40.encode((unsigned char*)source_bytes, byte_count); + /* convert to waveform buffer */ /* open socket */ /* write waveform buffer over socket */ + /* from funcubeLib/common/testFec.cpp + + U8 sourceBytes[BLOCK_SIZE]; + memset(sourceBytes, 42, BLOCK_SIZE); + + CCodecAO40 ao40; + const U8* encoded = ao40.encode((unsigned char*)sourceBytes, BLOCK_SIZE); + */ + } From 44d9af5216a0ec07691c6030ec4ae4f56e7ba05a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 09:00:33 -0500 Subject: [PATCH 009/515] Update main.h remove ao40 --- main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.h b/main.h index b06f86d4..a10d144f 100644 --- a/main.h +++ b/main.h @@ -87,7 +87,7 @@ void update_rs(unsigned char parity[32], unsigned char c); void write_little_endian(unsigned int word, int num_bytes, FILE *wav_file); static int init_rf(); extern int Encode_8b10b[][256]; -const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count); +// const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count); void program_radio(); int socket_open = 0; From f1711bc68cc73068ae3ab6185c2269aa9df2aa72 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 09:08:12 -0500 Subject: [PATCH 010/515] Update main.h added codecAO40.h --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index a10d144f..2b123615 100644 --- a/main.h +++ b/main.h @@ -13,6 +13,7 @@ #include #include //#include "TelemEncoding.h" +#include "codecAO40.h" #include #include #include From 885cf51ecca7089948ed89088caad0b1bd9adf47 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 10:22:20 -0500 Subject: [PATCH 011/515] Update codecAO40.h remove cpp --- codecAO40.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/codecAO40.h b/codecAO40.h index f7f1238d..abd1b54f 100644 --- a/codecAO40.h +++ b/codecAO40.h @@ -24,11 +24,11 @@ #include "fecConstants.h" -class CCodecAO40 -{ -public: - CCodecAO40(void); - virtual ~CCodecAO40(void); +//class CCodecAO40 +//{ +//public: +// CCodecAO40(void); +// virtual ~CCodecAO40(void); int decode(unsigned char viterbi_decoded[NBITS_OUT], unsigned char *decoded_data); @@ -40,7 +40,7 @@ public: /* Compares raw input symbols to current buffer of encoded symbols and counts the errors */ int count_errors( unsigned char *raw_symbols); -private: +//private: int mod255(int x); int decode_rs_8(char *data, int *eras_pos, int no_eras); void scramble_and_encode(unsigned char c); @@ -62,4 +62,4 @@ private: unsigned char m_RS_block[RSBLOCKS][NROOTS]; /* RS parity blocks */ unsigned char m_encoded[SYMPBLOCK] ; /* encoded symbols */ -}; +//}; From 67b8eb31c04219c1d67849034355f3ab212b1639 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 10:26:40 -0500 Subject: [PATCH 012/515] Update codecAO40.cpp remove cpp things --- codecAO40.cpp | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/codecAO40.cpp b/codecAO40.cpp index 89073739..f1646e46 100644 --- a/codecAO40.cpp +++ b/codecAO40.cpp @@ -46,6 +46,7 @@ #define min(a,b) ((a) < (b) ? (a) : (b)) #endif +/* CCodecAO40::CCodecAO40(void) { } @@ -55,8 +56,9 @@ CCodecAO40::~CCodecAO40(void) { } - -int CCodecAO40::mod255(int x) { +*/ +//int CCodecAO40::mod255(int x) { +int mod255(int x) { while (x >= 255) { x -= 255; x = (x >> 8) + (x & 255); @@ -64,7 +66,8 @@ int CCodecAO40::mod255(int x) { return x; } -int CCodecAO40::decode_rs_8(char *data, int *eras_pos, int no_eras){ +//int CCodecAO40::decode_rs_8(char *data, int *eras_pos, int no_eras){ +int decode_rs_8(char *data, int *eras_pos, int no_eras){ int deg_lambda, el, deg_omega; int i, j, r,k; @@ -268,7 +271,8 @@ finish: /* Write one binary channel symbol into the interleaver frame and update the pointers */ -void CCodecAO40::interleave_symbol(int c) +//void CCodecAO40::interleave_symbol(int c) +void interleave_symbol(int c) { int row,col; col=m_ileaver_index/COLUMNS; @@ -281,7 +285,8 @@ void CCodecAO40::interleave_symbol(int c) } /* Convolutionally encode and interleave one byte */ -void CCodecAO40::encode_and_interleave(unsigned char c,int cnt){ +//void CCodecAO40::encode_and_interleave(unsigned char c,int cnt){ +void encode_and_interleave(unsigned char c,int cnt){ while(cnt-- != 0) { m_conv_sr = (m_conv_sr << 1) | (c >> 7); @@ -292,7 +297,8 @@ void CCodecAO40::encode_and_interleave(unsigned char c,int cnt){ } /* Scramble a byte, convolutionally encode and interleave into frame */ -void CCodecAO40::scramble_and_encode(unsigned char c){ +//void CCodecAO40::scramble_and_encode(unsigned char c){ +void scramble_and_encode(unsigned char c){ c ^= Scrambler[m_encoded_bytes]; /* Scramble byte */ encode_and_interleave(c,8); /* RS encode and place into reencode buffer */ } @@ -301,7 +307,8 @@ void CCodecAO40::scramble_and_encode(unsigned char c){ * results stored in m_encoded. * On success encoded buffer is returned, an zeroed buffer on failure */ -const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count) +//const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count) +const unsigned char *encode(unsigned char *source_bytes, int byte_count) { if(BLOCKSIZE != byte_count || NULL == source_bytes ) { @@ -333,7 +340,8 @@ encode_parity() Called 64 times to finish off */ /* This function initializes the encoder. */ -void CCodecAO40::init_encoder(void){ +//void CCodecAO40::init_encoder(void){ +void init_encoder(void){ int i,j,sr; m_encoded_bytes = 0; @@ -370,7 +378,8 @@ void CCodecAO40::init_encoder(void){ * current frame. It should be called in sequence 256 times per frame, followed * by 64 calls to encode_parity(). */ -void CCodecAO40::encode_byte(unsigned char c){ +//void CCodecAO40::encode_byte(unsigned char c){ +void encode_byte(unsigned char c){ unsigned char *rp; /* RS block pointer */ int i; unsigned char feedback; @@ -417,7 +426,8 @@ void CCodecAO40::encode_byte(unsigned char c){ * have been passed to update_encoder. Each call scrambles, encodes and * interleaves one byte of Reed-Solomon parity. */ -void CCodecAO40::encode_parity(void) { +//void CCodecAO40::encode_parity(void) { +void encode_parity(void) { unsigned char c; c = m_RS_block[m_encoded_bytes & 1][(m_encoded_bytes-256)>>1]; @@ -430,7 +440,8 @@ void CCodecAO40::encode_parity(void) { -void CCodecAO40::descramble_to_rsblocks(unsigned char viterbi_decoded[NBITS_OUT], char rsblocks[RSBLOCKS][NN]) +//void CCodecAO40::descramble_to_rsblocks(unsigned char viterbi_decoded[NBITS_OUT], char rsblocks[RSBLOCKS][NN]) +void descramble_to_rsblocks(unsigned char viterbi_decoded[NBITS_OUT], char rsblocks[RSBLOCKS][NN]) { /* interleave into Reed Solomon codeblocks */ memset(rsblocks,0,RSBLOCKS*NN); /* Zero rsblocks array */ @@ -465,7 +476,8 @@ void CCodecAO40::descramble_to_rsblocks(unsigned char viterbi_decoded[NBITS_OUT] * rserrs[x] contains -1 * Data output should not be used. */ -int CCodecAO40::decode(unsigned char vitdecdata[NBITS_OUT], unsigned char *decoded_data) +//int CCodecAO40::decode(unsigned char vitdecdata[NBITS_OUT], unsigned char *decoded_data) +int decode(unsigned char vitdecdata[NBITS_OUT], unsigned char *decoded_data) { int row, col, row_errors, total_errors; char rsblocks[RSBLOCKS][NN]; @@ -502,7 +514,8 @@ int CCodecAO40::decode(unsigned char vitdecdata[NBITS_OUT], unsigned char *decod } /* Compairs raw input symbols to current buffer of encoded symbols and counts the errors */ -int CCodecAO40::count_errors(unsigned char *raw_symbols) +//int CCodecAO40::count_errors(unsigned char *raw_symbols) +int count_errors(unsigned char *raw_symbols) { int error_count = 0; for(int i=0;i Date: Sun, 19 Jan 2025 10:26:56 -0500 Subject: [PATCH 013/515] Rename codecAO40.cpp to codecAO40.c --- codecAO40.cpp => codecAO40.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename codecAO40.cpp => codecAO40.c (100%) diff --git a/codecAO40.cpp b/codecAO40.c similarity index 100% rename from codecAO40.cpp rename to codecAO40.c From dd07e5fe2b4ca407ed63c35ea930758046166a08 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 10:28:33 -0500 Subject: [PATCH 014/515] Update Makefile remove cpp and g++ --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 713eacf3..49398b19 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ cubesatsim: afsk/ax5043.o cubesatsim: TelemEncoding.o cubesatsim: main.o cubesatsim: codecAO40.o - g++ -std=c++14 $(DEBUG_BEHAVIOR) -o cubesatsim -Wall -Wextra -L./ afsk/ax25.o afsk/ax5043.o TelemEncoding.o codecAO40.o main.o -lwiringPi -lax5043 -lm + gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o cubesatsim -Wall -Wextra -L./ afsk/ax25.o afsk/ax5043.o TelemEncoding.o codecAO40.o main.o -lwiringPi -lax5043 -lm telem: telem.o gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o telem -Wall -Wextra -L./ telem.o -lwiringPi @@ -52,10 +52,10 @@ TelemEncoding.o: TelemEncoding.c TelemEncoding.o: TelemEncoding.h gcc -std=gnu99 $(DEBUG_BEHAVIOR) -Wall -Wextra -c TelemEncoding.c -codecAO40.o: codecAO40.cpp +codecAO40.o: codecAO40.c codecAO40.o: codecAO40.h codecAO40.o: fecConstants.h - g++ -std=c++14 $(DEBUG_BEHAVIOR) -Wall -Wextra -c codecAO40.cpp + gcc -std=gnu99 $(DEBUG_BEHAVIOR) -Wall -Wextra -c codecAO40.c ax5043/generated/configcommon.o: ax5043/generated/configcommon.c ax5043/generated/configcommon.o: ax5043/generated/configrx.h From bbecb000645dc90cad286f6d17257ddd1bde99f3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 10:29:46 -0500 Subject: [PATCH 015/515] Update main.c remove objects --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 8777a974..2255f7f3 100644 --- a/main.c +++ b/main.c @@ -2255,8 +2255,8 @@ void get_tlm_fc() { // const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count) - CCodecAO40 ao40; - encoded_bytes = ao40.encode((unsigned char*)source_bytes, byte_count); +// CCodecAO40 ao40; + encoded_bytes = encode((unsigned char*)source_bytes, byte_count); /* convert to waveform buffer */ From 62692432cb784253b377c1017a47fd04b1d8a176 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 10:31:08 -0500 Subject: [PATCH 016/515] Update main.c encoded_bytes --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 2255f7f3..60278612 100644 --- a/main.c +++ b/main.c @@ -2244,7 +2244,7 @@ void get_tlm_fc() { /* create data, stream, and waveform buffers */ unsigned char source_bytes[256]; - unsigned char encoded_bytes[650]; +// unsigned char encoded_bytes[650]; int byte_count = 256; memset(source_bytes, 0xa5, sizeof(source_bytes)); @@ -2256,7 +2256,7 @@ void get_tlm_fc() { // const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count) // CCodecAO40 ao40; - encoded_bytes = encode((unsigned char*)source_bytes, byte_count); + unsigned char* encoded_bytes = encode((unsigned char*)source_bytes, byte_count); /* convert to waveform buffer */ From d9a0d1e7f2933040b8997b1d234492904f370996 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 10:43:03 -0500 Subject: [PATCH 017/515] Update codecAO40.h added extern --- codecAO40.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codecAO40.h b/codecAO40.h index abd1b54f..0de54acf 100644 --- a/codecAO40.h +++ b/codecAO40.h @@ -24,6 +24,8 @@ #include "fecConstants.h" +extern const unsigned char ALPHA_TO[]; + //class CCodecAO40 //{ //public: From b4cd3ea74a18a68784db86ce86ba7d505113b457 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 10:45:19 -0500 Subject: [PATCH 018/515] Update main.h added extern --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index 2b123615..68cf6d1a 100644 --- a/main.h +++ b/main.h @@ -88,6 +88,7 @@ void update_rs(unsigned char parity[32], unsigned char c); void write_little_endian(unsigned int word, int num_bytes, FILE *wav_file); static int init_rf(); 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(); From b067ea74f9cd73a45502ef40ea29ab32f6894acb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 10:54:34 -0500 Subject: [PATCH 019/515] Update codecAO40.c added variables --- codecAO40.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/codecAO40.c b/codecAO40.c index f1646e46..5674a7b6 100644 --- a/codecAO40.c +++ b/codecAO40.c @@ -1,6 +1,12 @@ #include #include "codecAO40.h" + unsigned char m_RS_block[RSBLOCKS][NROOTS]; /* RS parity blocks */ + unsigned char m_encoded[SYMPBLOCK] ; /* encoded symbols */ + int m_encoded_bytes; /* Byte counter for encode_data() */ + int m_ileaver_index; /* Byte counter for interleaver */ + unsigned char m_conv_sr; /* Convolutional encoder shift register state */ + /* ---------------------- */ /* AO40 Encoder - Decoder */ /* ---------------------- */ From 90033f77da06a28ff5aaa11efb5aa484ac8a4bcb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 10:54:44 -0500 Subject: [PATCH 020/515] Update codecAO40.h moved variables --- codecAO40.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/codecAO40.h b/codecAO40.h index 0de54acf..52585e54 100644 --- a/codecAO40.h +++ b/codecAO40.h @@ -58,10 +58,5 @@ extern const unsigned char ALPHA_TO[]; void interleave_symbol(int c); - int m_encoded_bytes; /* Byte counter for encode_data() */ - int m_ileaver_index; /* Byte counter for interleaver */ - unsigned char m_conv_sr; /* Convolutional encoder shift register state */ - unsigned char m_RS_block[RSBLOCKS][NROOTS]; /* RS parity blocks */ - unsigned char m_encoded[SYMPBLOCK] ; /* encoded symbols */ //}; From ef0608f5df50abca7b8bab39c966f7ebc6e4990d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 10:55:53 -0500 Subject: [PATCH 021/515] Update codecAO40.c moved variables --- codecAO40.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/codecAO40.c b/codecAO40.c index 5674a7b6..f1646e46 100644 --- a/codecAO40.c +++ b/codecAO40.c @@ -1,12 +1,6 @@ #include #include "codecAO40.h" - unsigned char m_RS_block[RSBLOCKS][NROOTS]; /* RS parity blocks */ - unsigned char m_encoded[SYMPBLOCK] ; /* encoded symbols */ - int m_encoded_bytes; /* Byte counter for encode_data() */ - int m_ileaver_index; /* Byte counter for interleaver */ - unsigned char m_conv_sr; /* Convolutional encoder shift register state */ - /* ---------------------- */ /* AO40 Encoder - Decoder */ /* ---------------------- */ From 51d35f4b7b6cca205ce9c2f8358b0796a929dd8b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 10:56:27 -0500 Subject: [PATCH 022/515] Update main.h added variables --- main.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.h b/main.h index 68cf6d1a..bb9c5992 100644 --- a/main.h +++ b/main.h @@ -207,3 +207,9 @@ long int loopTime; int error_count = 0; int groundCommandCount = 0; + + unsigned char m_RS_block[RSBLOCKS][NROOTS]; /* RS parity blocks */ + unsigned char m_encoded[SYMPBLOCK] ; /* encoded symbols */ + int m_encoded_bytes; /* Byte counter for encode_data() */ + int m_ileaver_index; /* Byte counter for interleaver */ + unsigned char m_conv_sr; /* Convolutional encoder shift register state */ From 5d7c292336482f1e358516be6924c7e84b751077 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 10:57:34 -0500 Subject: [PATCH 023/515] Update codecAO40.h added extern --- codecAO40.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/codecAO40.h b/codecAO40.h index 52585e54..a45151a6 100644 --- a/codecAO40.h +++ b/codecAO40.h @@ -26,6 +26,12 @@ extern const unsigned char ALPHA_TO[]; +extern unsigned char m_RS_block[RSBLOCKS][NROOTS]; /* RS parity blocks */ +extern unsigned char m_encoded[SYMPBLOCK] ; /* encoded symbols */ +extern int m_encoded_bytes; /* Byte counter for encode_data() */ +extern int m_ileaver_index; /* Byte counter for interleaver */ +extern unsigned char m_conv_sr; /* Convolutional encoder shift register state */ + //class CCodecAO40 //{ //public: From a2bc1e99f51ac36d143c57179c1eb6632c939908 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 11:01:01 -0500 Subject: [PATCH 024/515] Update main.h copy in fecConstants.h --- main.h | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/main.h b/main.h index bb9c5992..96877dc7 100644 --- a/main.h +++ b/main.h @@ -213,3 +213,135 @@ int groundCommandCount = 0; int m_encoded_bytes; /* Byte counter for encode_data() */ int m_ileaver_index; /* Byte counter for interleaver */ unsigned char m_conv_sr; /* Convolutional encoder shift register state */ + + +// from funcubeLib/common/fecConstants.h + +//#pragma once + +/* + Amsat P3 FEC Encoder/decoder system. Look-up tables + Created by Phil Karn KA9Q and James Miller G3RUH + Last modified 2003 Jun 20 +*/ + +/* Defines for Viterbi Decoder for r=1/2 k=7 (to CCSDS convention) */ +#define K 7 /* Constraint length */ +#define N 2 /* Number of symbols per data bit */ +#define CPOLYA 0x4f /* First convolutional encoder polynomial */ +#define CPOLYB 0x6d /* Second convolutional encoder polynomial */ + +#define SYNC_POLY 0x48 /* Sync vector PN polynomial */ + +#define NN 255 +#define KK 223 +#define NROOTS 32 /* NN-KK */ +#define A0 (NN) +#define FCR 112 +#define PRIM 11 +#define IPRIM 116 +#define BLOCKSIZE 256 /* Data bytes per frame */ +#define RSBLOCKS 2 /* Number of RS decoder blocks */ +#define RSPAD 95 /* Unused bytes in block (KK-BLOCKSIZE/RSBLOCKS) */ + +/* Defines for Interleaver */ +#define ROWS 80 /* Block interleaver rows */ +#define COLUMNS 65 /* Block interleaver columns */ +#define SYMPBLOCK (ROWS*COLUMNS) /* Encoded symbols per block */ + +/* Number of symbols in an FEC block that are */ +/* passed to the Viterbi decoder (320*8 + 6) */ +#define NBITS ((BLOCKSIZE+NROOTS*RSBLOCKS)*8+K-1) +/* Number of bits obtained from Viterbi decoder */ +#define NBITS_OUT (BLOCKSIZE+NROOTS*RSBLOCKS) + +const unsigned char RS_poly[] = { + 249, 59, 66, 4, 43,126,251, 97, 30, 3,213, 50, 66,170, 5, 24 +}; + +/* Tables for RS decoder */ +/* Galois field log/antilog tables */ +const unsigned char ALPHA_TO[] = +{ + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x87, 0x89, 0x95, 0xad, 0xdd, 0x3d, 0x7a, 0xf4, + 0x6f, 0xde, 0x3b, 0x76, 0xec, 0x5f, 0xbe, 0xfb, 0x71, 0xe2, 0x43, 0x86, 0x8b, 0x91, 0xa5, 0xcd, + 0x1d, 0x3a, 0x74, 0xe8, 0x57, 0xae, 0xdb, 0x31, 0x62, 0xc4, 0x0f, 0x1e, 0x3c, 0x78, 0xf0, 0x67, + 0xce, 0x1b, 0x36, 0x6c, 0xd8, 0x37, 0x6e, 0xdc, 0x3f, 0x7e, 0xfc, 0x7f, 0xfe, 0x7b, 0xf6, 0x6b, + 0xd6, 0x2b, 0x56, 0xac, 0xdf, 0x39, 0x72, 0xe4, 0x4f, 0x9e, 0xbb, 0xf1, 0x65, 0xca, 0x13, 0x26, + 0x4c, 0x98, 0xb7, 0xe9, 0x55, 0xaa, 0xd3, 0x21, 0x42, 0x84, 0x8f, 0x99, 0xb5, 0xed, 0x5d, 0xba, + 0xf3, 0x61, 0xc2, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, + 0x47, 0x8e, 0x9b, 0xb1, 0xe5, 0x4d, 0x9a, 0xb3, 0xe1, 0x45, 0x8a, 0x93, 0xa1, 0xc5, 0x0d, 0x1a, + 0x34, 0x68, 0xd0, 0x27, 0x4e, 0x9c, 0xbf, 0xf9, 0x75, 0xea, 0x53, 0xa6, 0xcb, 0x11, 0x22, 0x44, + 0x88, 0x97, 0xa9, 0xd5, 0x2d, 0x5a, 0xb4, 0xef, 0x59, 0xb2, 0xe3, 0x41, 0x82, 0x83, 0x81, 0x85, + 0x8d, 0x9d, 0xbd, 0xfd, 0x7d, 0xfa, 0x73, 0xe6, 0x4b, 0x96, 0xab, 0xd1, 0x25, 0x4a, 0x94, 0xaf, + 0xd9, 0x35, 0x6a, 0xd4, 0x2f, 0x5e, 0xbc, 0xff, 0x79, 0xf2, 0x63, 0xc6, 0x0b, 0x16, 0x2c, 0x58, + 0xb0, 0xe7, 0x49, 0x92, 0xa3, 0xc1, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0xc7, 0x09, 0x12, 0x24, + 0x48, 0x90, 0xa7, 0xc9, 0x15, 0x2a, 0x54, 0xa8, 0xd7, 0x29, 0x52, 0xa4, 0xcf, 0x19, 0x32, 0x64, + 0xc8, 0x17, 0x2e, 0x5c, 0xb8, 0xf7, 0x69, 0xd2, 0x23, 0x46, 0x8c, 0x9f, 0xb9, 0xf5, 0x6d, 0xda, + 0x33, 0x66, 0xcc, 0x1f, 0x3e, 0x7c, 0xf8, 0x77, 0xee, 0x5b, 0xb6, 0xeb, 0x51, 0xa2, 0xc3, 0x00, +}; + +const unsigned char INDEX_OF[]= +{ + 0xff, 0x00, 0x01, 0x63, 0x02, 0xc6, 0x64, 0x6a, 0x03, 0xcd, 0xc7, 0xbc, 0x65, 0x7e, 0x6b, 0x2a, + 0x04, 0x8d, 0xce, 0x4e, 0xc8, 0xd4, 0xbd, 0xe1, 0x66, 0xdd, 0x7f, 0x31, 0x6c, 0x20, 0x2b, 0xf3, + 0x05, 0x57, 0x8e, 0xe8, 0xcf, 0xac, 0x4f, 0x83, 0xc9, 0xd9, 0xd5, 0x41, 0xbe, 0x94, 0xe2, 0xb4, + 0x67, 0x27, 0xde, 0xf0, 0x80, 0xb1, 0x32, 0x35, 0x6d, 0x45, 0x21, 0x12, 0x2c, 0x0d, 0xf4, 0x38, + 0x06, 0x9b, 0x58, 0x1a, 0x8f, 0x79, 0xe9, 0x70, 0xd0, 0xc2, 0xad, 0xa8, 0x50, 0x75, 0x84, 0x48, + 0xca, 0xfc, 0xda, 0x8a, 0xd6, 0x54, 0x42, 0x24, 0xbf, 0x98, 0x95, 0xf9, 0xe3, 0x5e, 0xb5, 0x15, + 0x68, 0x61, 0x28, 0xba, 0xdf, 0x4c, 0xf1, 0x2f, 0x81, 0xe6, 0xb2, 0x3f, 0x33, 0xee, 0x36, 0x10, + 0x6e, 0x18, 0x46, 0xa6, 0x22, 0x88, 0x13, 0xf7, 0x2d, 0xb8, 0x0e, 0x3d, 0xf5, 0xa4, 0x39, 0x3b, + 0x07, 0x9e, 0x9c, 0x9d, 0x59, 0x9f, 0x1b, 0x08, 0x90, 0x09, 0x7a, 0x1c, 0xea, 0xa0, 0x71, 0x5a, + 0xd1, 0x1d, 0xc3, 0x7b, 0xae, 0x0a, 0xa9, 0x91, 0x51, 0x5b, 0x76, 0x72, 0x85, 0xa1, 0x49, 0xeb, + 0xcb, 0x7c, 0xfd, 0xc4, 0xdb, 0x1e, 0x8b, 0xd2, 0xd7, 0x92, 0x55, 0xaa, 0x43, 0x0b, 0x25, 0xaf, + 0xc0, 0x73, 0x99, 0x77, 0x96, 0x5c, 0xfa, 0x52, 0xe4, 0xec, 0x5f, 0x4a, 0xb6, 0xa2, 0x16, 0x86, + 0x69, 0xc5, 0x62, 0xfe, 0x29, 0x7d, 0xbb, 0xcc, 0xe0, 0xd3, 0x4d, 0x8c, 0xf2, 0x1f, 0x30, 0xdc, + 0x82, 0xab, 0xe7, 0x56, 0xb3, 0x93, 0x40, 0xd8, 0x34, 0xb0, 0xef, 0x26, 0x37, 0x0c, 0x11, 0x44, + 0x6f, 0x78, 0x19, 0x9a, 0x47, 0x74, 0xa7, 0xc1, 0x23, 0x53, 0x89, 0xfb, 0x14, 0x5d, 0xf8, 0x97, + 0x2e, 0x4b, 0xb9, 0x60, 0x0f, 0xed, 0x3e, 0xe5, 0xf6, 0x87, 0xa5, 0x17, 0x3a, 0xa3, 0x3c, 0xb7, +}; + +/* 8-bit parity table */ +const unsigned char Partab[] = { + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, +}; + +/* Scramble byte table */ +const unsigned char Scrambler[]= +{ + 0xff, 0x48, 0x0e, 0xc0, 0x9a, 0x0d, 0x70, 0xbc, 0x8e, 0x2c, 0x93, 0xad, 0xa7, 0xb7, 0x46, 0xce, + 0x5a, 0x97, 0x7d, 0xcc, 0x32, 0xa2, 0xbf, 0x3e, 0x0a, 0x10, 0xf1, 0x88, 0x94, 0xcd, 0xea, 0xb1, + 0xfe, 0x90, 0x1d, 0x81, 0x34, 0x1a, 0xe1, 0x79, 0x1c, 0x59, 0x27, 0x5b, 0x4f, 0x6e, 0x8d, 0x9c, + 0xb5, 0x2e, 0xfb, 0x98, 0x65, 0x45, 0x7e, 0x7c, 0x14, 0x21, 0xe3, 0x11, 0x29, 0x9b, 0xd5, 0x63, + 0xfd, 0x20, 0x3b, 0x02, 0x68, 0x35, 0xc2, 0xf2, 0x38, 0xb2, 0x4e, 0xb6, 0x9e, 0xdd, 0x1b, 0x39, + 0x6a, 0x5d, 0xf7, 0x30, 0xca, 0x8a, 0xfc, 0xf8, 0x28, 0x43, 0xc6, 0x22, 0x53, 0x37, 0xaa, 0xc7, + 0xfa, 0x40, 0x76, 0x04, 0xd0, 0x6b, 0x85, 0xe4, 0x71, 0x64, 0x9d, 0x6d, 0x3d, 0xba, 0x36, 0x72, + 0xd4, 0xbb, 0xee, 0x61, 0x95, 0x15, 0xf9, 0xf0, 0x50, 0x87, 0x8c, 0x44, 0xa6, 0x6f, 0x55, 0x8f, + 0xf4, 0x80, 0xec, 0x09, 0xa0, 0xd7, 0x0b, 0xc8, 0xe2, 0xc9, 0x3a, 0xda, 0x7b, 0x74, 0x6c, 0xe5, + 0xa9, 0x77, 0xdc, 0xc3, 0x2a, 0x2b, 0xf3, 0xe0, 0xa1, 0x0f, 0x18, 0x89, 0x4c, 0xde, 0xab, 0x1f, + 0xe9, 0x01, 0xd8, 0x13, 0x41, 0xae, 0x17, 0x91, 0xc5, 0x92, 0x75, 0xb4, 0xf6, 0xe8, 0xd9, 0xcb, + 0x52, 0xef, 0xb9, 0x86, 0x54, 0x57, 0xe7, 0xc1, 0x42, 0x1e, 0x31, 0x12, 0x99, 0xbd, 0x56, 0x3f, + 0xd2, 0x03, 0xb0, 0x26, 0x83, 0x5c, 0x2f, 0x23, 0x8b, 0x24, 0xeb, 0x69, 0xed, 0xd1, 0xb3, 0x96, + 0xa5, 0xdf, 0x73, 0x0c, 0xa8, 0xaf, 0xcf, 0x82, 0x84, 0x3c, 0x62, 0x25, 0x33, 0x7a, 0xac, 0x7f, + 0xa4, 0x07, 0x60, 0x4d, 0x06, 0xb8, 0x5e, 0x47, 0x16, 0x49, 0xd6, 0xd3, 0xdb, 0xa3, 0x67, 0x2d, + 0x4b, 0xbe, 0xe6, 0x19, 0x51, 0x5f, 0x9f, 0x05, 0x08, 0x78, 0xc4, 0x4a, 0x66, 0xf5, 0x58, 0xff, + 0x48, 0x0e, 0xc0, 0x9a, 0x0d, 0x70, 0xbc, 0x8e, 0x2c, 0x93, 0xad, 0xa7, 0xb7, 0x46, 0xce, 0x5a, + 0x97, 0x7d, 0xcc, 0x32, 0xa2, 0xbf, 0x3e, 0x0a, 0x10, 0xf1, 0x88, 0x94, 0xcd, 0xea, 0xb1, 0xfe, + 0x90, 0x1d, 0x81, 0x34, 0x1a, 0xe1, 0x79, 0x1c, 0x59, 0x27, 0x5b, 0x4f, 0x6e, 0x8d, 0x9c, 0xb5, + 0x2e, 0xfb, 0x98, 0x65, 0x45, 0x7e, 0x7c, 0x14, 0x21, 0xe3, 0x11, 0x29, 0x9b, 0xd5, 0x63, 0xfd, +}; From ec75a7d21c3f00e5d60467d1b5eb97257c39e262 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 11:03:17 -0500 Subject: [PATCH 025/515] Update codecAO40.h add externs --- codecAO40.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/codecAO40.h b/codecAO40.h index a45151a6..b3a08925 100644 --- a/codecAO40.h +++ b/codecAO40.h @@ -22,9 +22,7 @@ #pragma once -#include "fecConstants.h" - -extern const unsigned char ALPHA_TO[]; +//#include "fecConstants.h" extern unsigned char m_RS_block[RSBLOCKS][NROOTS]; /* RS parity blocks */ extern unsigned char m_encoded[SYMPBLOCK] ; /* encoded symbols */ @@ -32,6 +30,12 @@ extern int m_encoded_bytes; /* Byte counter for encode_data() extern int m_ileaver_index; /* Byte counter for interleaver */ extern unsigned char m_conv_sr; /* Convolutional encoder shift register state */ +extern const unsigned char RS_poly[]; +extern const unsigned char ALPHA_TO[]; +extern const unsigned char INDEX_OF[]; +extern const unsigned char Partab[]; +extern const unsigned char Scrambler[]; + //class CCodecAO40 //{ //public: From 8c1496fc6434056d79d396bf6972c72a9e187042 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 11:03:45 -0500 Subject: [PATCH 026/515] Update Makefile remove fec --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 49398b19..bf295216 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,6 @@ TelemEncoding.o: TelemEncoding.h codecAO40.o: codecAO40.c codecAO40.o: codecAO40.h -codecAO40.o: fecConstants.h gcc -std=gnu99 $(DEBUG_BEHAVIOR) -Wall -Wextra -c codecAO40.c ax5043/generated/configcommon.o: ax5043/generated/configcommon.c From c3df2ead757b9b7be06e6cefa4aa6c6f160a53b1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 11:06:37 -0500 Subject: [PATCH 027/515] Update codecAO40.h added fec defines --- codecAO40.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/codecAO40.h b/codecAO40.h index b3a08925..3ca2c11c 100644 --- a/codecAO40.h +++ b/codecAO40.h @@ -24,6 +24,44 @@ //#include "fecConstants.h" + +/* + Amsat P3 FEC Encoder/decoder system. Look-up tables + Created by Phil Karn KA9Q and James Miller G3RUH + Last modified 2003 Jun 20 +*/ + +/* Defines for Viterbi Decoder for r=1/2 k=7 (to CCSDS convention) */ +#define K 7 /* Constraint length */ +#define N 2 /* Number of symbols per data bit */ +#define CPOLYA 0x4f /* First convolutional encoder polynomial */ +#define CPOLYB 0x6d /* Second convolutional encoder polynomial */ + +#define SYNC_POLY 0x48 /* Sync vector PN polynomial */ + +#define NN 255 +#define KK 223 +#define NROOTS 32 /* NN-KK */ +#define A0 (NN) +#define FCR 112 +#define PRIM 11 +#define IPRIM 116 +#define BLOCKSIZE 256 /* Data bytes per frame */ +#define RSBLOCKS 2 /* Number of RS decoder blocks */ +#define RSPAD 95 /* Unused bytes in block (KK-BLOCKSIZE/RSBLOCKS) */ + +/* Defines for Interleaver */ +#define ROWS 80 /* Block interleaver rows */ +#define COLUMNS 65 /* Block interleaver columns */ +#define SYMPBLOCK (ROWS*COLUMNS) /* Encoded symbols per block */ + +/* Number of symbols in an FEC block that are */ +/* passed to the Viterbi decoder (320*8 + 6) */ +#define NBITS ((BLOCKSIZE+NROOTS*RSBLOCKS)*8+K-1) +/* Number of bits obtained from Viterbi decoder */ +#define NBITS_OUT (BLOCKSIZE+NROOTS*RSBLOCKS) + + extern unsigned char m_RS_block[RSBLOCKS][NROOTS]; /* RS parity blocks */ extern unsigned char m_encoded[SYMPBLOCK] ; /* encoded symbols */ extern int m_encoded_bytes; /* Byte counter for encode_data() */ From 85ccf749a684b0f27b231fca22c690292f828a11 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 11:08:08 -0500 Subject: [PATCH 028/515] Update main.h remove fec const defines --- main.h | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/main.h b/main.h index 96877dc7..b3ec473f 100644 --- a/main.h +++ b/main.h @@ -217,44 +217,6 @@ int groundCommandCount = 0; // from funcubeLib/common/fecConstants.h -//#pragma once - -/* - Amsat P3 FEC Encoder/decoder system. Look-up tables - Created by Phil Karn KA9Q and James Miller G3RUH - Last modified 2003 Jun 20 -*/ - -/* Defines for Viterbi Decoder for r=1/2 k=7 (to CCSDS convention) */ -#define K 7 /* Constraint length */ -#define N 2 /* Number of symbols per data bit */ -#define CPOLYA 0x4f /* First convolutional encoder polynomial */ -#define CPOLYB 0x6d /* Second convolutional encoder polynomial */ - -#define SYNC_POLY 0x48 /* Sync vector PN polynomial */ - -#define NN 255 -#define KK 223 -#define NROOTS 32 /* NN-KK */ -#define A0 (NN) -#define FCR 112 -#define PRIM 11 -#define IPRIM 116 -#define BLOCKSIZE 256 /* Data bytes per frame */ -#define RSBLOCKS 2 /* Number of RS decoder blocks */ -#define RSPAD 95 /* Unused bytes in block (KK-BLOCKSIZE/RSBLOCKS) */ - -/* Defines for Interleaver */ -#define ROWS 80 /* Block interleaver rows */ -#define COLUMNS 65 /* Block interleaver columns */ -#define SYMPBLOCK (ROWS*COLUMNS) /* Encoded symbols per block */ - -/* Number of symbols in an FEC block that are */ -/* passed to the Viterbi decoder (320*8 + 6) */ -#define NBITS ((BLOCKSIZE+NROOTS*RSBLOCKS)*8+K-1) -/* Number of bits obtained from Viterbi decoder */ -#define NBITS_OUT (BLOCKSIZE+NROOTS*RSBLOCKS) - const unsigned char RS_poly[] = { 249, 59, 66, 4, 43,126,251, 97, 30, 3,213, 50, 66,170, 5, 24 }; From 7ac8870e29d455fdeb9955b42a4d02dcaee508d5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 12:15:52 -0500 Subject: [PATCH 029/515] Update main.h added FC --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index b3ec473f..82a2b10f 100644 --- a/main.h +++ b/main.h @@ -112,6 +112,7 @@ FILE *telem_file; #define BPSK 3 #define SSTV 4 #define CW 5 +#define FC 7 #define REPEATER 11 #define TXCOMMAND 12 From 80adb03f8e8d009957147e640606932d5abd766e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 12:19:46 -0500 Subject: [PATCH 030/515] Update config add mode j funcube --- config | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/config b/config index 104a17e3..c006a662 100755 --- a/config +++ b/config @@ -249,6 +249,8 @@ if [ "$1" = "" ]; then echo "Mode is SSTV" elif [ "$1" = "e" ]; then echo "Mode is Repeater" + elif [ "$1" = "j" ]; then + echo "Mode is FunCube" elif [ "$1" = "n" ]; then echo -n "Mode is Transmit Commands with " FILE=/home/pi/CubeSatSim/transmit_dtmf @@ -1403,6 +1405,22 @@ elif [ "$1" = "-g" ]; then echo "Not resetting" fi +elif [ "$1" = "-j" ]; then + + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value + +# if [ "$1" == "n" ]; then + +# transmit_command_bpsk + +# else + + echo "changing CubeSatSim to FunCube mode" + sudo echo "j" > /home/pi/CubeSatSim/.mode + restart=1 +# fi elif [ "$1" = "-h" ]; then @@ -1416,7 +1434,8 @@ elif [ "$1" = "-h" ]; then echo " -f Change to FSK/DUV mode" echo " -b Change to BPSK mode" echo " -s Change to SSTV mode" - echo " -n Change to Transmit Commands mode" + echo " -j Change to FunCube mode" + echo " -n Change to Transmit Commands mode" echo " -e Change to Repeater mode" echo " -i Restart CubeSatsim software" echo " -c Change the CALLSIGN in the configuration file sim.cfg" From 20a39c05aa69e7d09a243726651423f9e3215326 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 12:23:58 -0500 Subject: [PATCH 031/515] Update transmit.py add mode -j --- transmit.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/transmit.py b/transmit.py index 6932638e..f38ccc44 100644 --- a/transmit.py +++ b/transmit.py @@ -383,7 +383,7 @@ if __name__ == "__main__": # if (mode != ) and (command_tx == True): # if (command_tx == True): - if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's')) and (command_tx == True) and (skip == False): + if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'j')) and (command_tx == True) and (skip == False): # battery_saver_mode GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) @@ -739,9 +739,12 @@ if __name__ == "__main__": # output(pd, 0) sleep(10) - elif (mode == 'b'): + elif (mode == 'b') or (mode == 'j'): # command_control_check() - print("BPSK") + if (mode == 'b'): + print("BPSK") + else + print("FunCube") print("turn on FM rx") output(pd, 1) output(ptt, 1) @@ -768,7 +771,10 @@ if __name__ == "__main__": output(txLed, txLedOn) # print(txLed) # print(txLedOn) - sleep(4.2) + if (mode == 'b'): + sleep(4.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 168a4f6e910f4ca1b2cf549c451cb6b00dff0bf6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 12:35:40 -0500 Subject: [PATCH 032/515] Update main.c add mode FC same as BPSK --- main.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 60278612..2185f36c 100644 --- a/main.c +++ b/main.c @@ -190,6 +190,9 @@ int main(int argc, char * argv[]) { } else if ( * argv[1] == 'm') { mode = CW; printf("Mode is CW\n"); + } else if ( * argv[1] == 'j') { + mode = FC; + printf("Mode is FunCube\n"); } else { printf("Mode is BPSK\n"); } @@ -228,6 +231,9 @@ int main(int argc, char * argv[]) { } else if ( mode_string == 'm') { mode = CW; printf("Mode is CW\n"); + } else if ( mode_string == 'j') { + mode = FC; + printf("Mode is FunCube\n"); } else if ( mode_string == 'e') { mode = REPEATER; printf("Mode is Repeater\n"); @@ -487,6 +493,36 @@ int main(int argc, char * argv[]) { // printf(" %d", sin_map[j]); } printf("\n"); + } else if (mode == FC) { // for now copy BPSK settings + bitRate = 1200; + rsFrames = 3; + payloads = 6; + rsFrameLen = 159; + headerLen = 8; + dataLen = 78; + syncBits = 31; + syncWord = 0b1000111110011010010000101011101; + parityLen = 32; + amplitude = 32767; + samples = S_RATE / bitRate; + bufLen = (frameCnt * (syncBits + 10 * (headerLen + rsFrames * (rsFrameLen + parityLen))) * samples); + + samplePeriod = ((float)((syncBits + 10 * (headerLen + rsFrames * (rsFrameLen + parityLen))))/(float)bitRate) * 1000 - 1800; + // samplePeriod = 3000; + // sleepTime = 3.0; + //samplePeriod = 2200; // reduce dut to python and sensor querying delays + sleepTime = 2.2f; + + frameTime = ((float)((float)bufLen / (samples * frameCnt * bitRate))) * 1000; // frame time in ms + + printf("\n BPSK Mode, bufLen: %d, %d bits per frame, %d bits per second, %d ms per frame %d ms sample period\n", + bufLen, bufLen / (samples * frameCnt), bitRate, frameTime, samplePeriod); + + 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))); + } + printf("\n"); } memset(voltage, 0, sizeof(voltage)); @@ -496,6 +532,9 @@ int main(int argc, char * argv[]) { if (((mode == FSK) || (mode == BPSK))) // && !sim_mode) get_tlm_fox(); // fill transmit buffer with reset count 0 packets that will be ignored + else if (((mode == FC))) // && !sim_mode) + get_tlm_fc(); // fill transmit buffer with reset count 0 packets that will be ignored + firstTime = 1; // if (!sim_mode) // always read sensors, even in sim mode @@ -869,6 +908,8 @@ int main(int argc, char * argv[]) { } else if ((mode == FSK) || (mode == BPSK)) {// FSK or BPSK get_tlm_fox(); + } else if ((mode == FC)) { + get_tlm_fc(); } else { // SSTV // fprintf(stderr, "Sleeping\n"); sleep(30); @@ -879,7 +920,7 @@ int main(int argc, char * argv[]) { #endif } - if (mode == BPSK) { + if ((mode == BPSK) || (mode == FC)) { // digitalWrite(txLed, txLedOn); #ifdef DEBUG_LOGGING // printf("Tx LED On 1\n"); @@ -2257,6 +2298,11 @@ void get_tlm_fc() { // CCodecAO40 ao40; unsigned char* encoded_bytes = encode((unsigned char*)source_bytes, byte_count); + + printf("\n\n"); + for (int i=0; i<100; i++) + printf("%x", encoded_bytes[i]; + printf("\n\n"); /* convert to waveform buffer */ @@ -2272,5 +2318,8 @@ void get_tlm_fc() { CCodecAO40 ao40; const U8* encoded = ao40.encode((unsigned char*)sourceBytes, BLOCK_SIZE); */ - + + mode = BPSK; + get_tlm_fox(); // for now, do same as BPSK + mode = FC; } From 7f1d88df12b9efda4207ac2eb2afe3d6e63fe49c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 12:36:47 -0500 Subject: [PATCH 033/515] Update main.c typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 2185f36c..bc56212a 100644 --- a/main.c +++ b/main.c @@ -2301,7 +2301,7 @@ void get_tlm_fc() { printf("\n\n"); for (int i=0; i<100; i++) - printf("%x", encoded_bytes[i]; + printf("%x", encoded_bytes[i]); printf("\n\n"); /* convert to waveform buffer */ From 1c37ad5d4d10ba6cb15dd619718e5603b6ab9cf1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 12:41:09 -0500 Subject: [PATCH 034/515] Update transmit.py typo --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index f38ccc44..801ac33f 100644 --- a/transmit.py +++ b/transmit.py @@ -743,7 +743,7 @@ if __name__ == "__main__": # command_control_check() if (mode == 'b'): print("BPSK") - else + else: print("FunCube") print("turn on FM rx") output(pd, 1) From 335ebf5d91dd73286a7cad74aed9048739a5b50a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 12:42:56 -0500 Subject: [PATCH 035/515] Update transmit.py another typo --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 801ac33f..9e37acf7 100644 --- a/transmit.py +++ b/transmit.py @@ -773,7 +773,7 @@ if __name__ == "__main__": # print(txLedOn) if (mode == 'b'): sleep(4.2) - else + 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") From 597ffcb48289d31e099d35ba8ecfa75da3a7ab28 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 12:47:10 -0500 Subject: [PATCH 036/515] Update main.c another test sequence --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index bc56212a..1abf05c8 100644 --- a/main.c +++ b/main.c @@ -2288,7 +2288,7 @@ void get_tlm_fc() { // unsigned char encoded_bytes[650]; int byte_count = 256; - memset(source_bytes, 0xa5, sizeof(source_bytes)); + memset(source_bytes, 0x5a, sizeof(source_bytes)); /* write telemetry into data buffer */ From 97eda2eab8085ea9a10ea7e398b34c1a43139aeb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 16:05:31 -0500 Subject: [PATCH 037/515] Update main.c added FC code --- main.c | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 194 insertions(+), 19 deletions(-) diff --git a/main.c b/main.c index 1abf05c8..16be128b 100644 --- a/main.c +++ b/main.c @@ -461,6 +461,7 @@ int main(int argc, char * argv[]) { printf("\n FSK Mode, %d bits per frame, %d bits per second, %d ms per frame, %d ms sample period\n", bufLen / (samples * frameCnt), bitRate, frameTime, samplePeriod); + } else if (mode == BPSK) { bitRate = 1200; rsFrames = 3; @@ -493,30 +494,33 @@ int main(int argc, char * argv[]) { // printf(" %d", sin_map[j]); } printf("\n"); + } else if (mode == FC) { // for now copy BPSK settings bitRate = 1200; - rsFrames = 3; - payloads = 6; - rsFrameLen = 159; - headerLen = 8; - dataLen = 78; - syncBits = 31; - syncWord = 0b1000111110011010010000101011101; - parityLen = 32; +// rsFrames = 3; +// payloads = 6; +// rsFrameLen = 159; + headerLen = 768; // 8; + dataLen = 5200; // 78; + syncBits = 32; // 31; + syncWord = 0x1acffc1d; // 0b1000111110011010010000101011101; +// parityLen = 32; amplitude = 32767; samples = S_RATE / bitRate; - bufLen = (frameCnt * (syncBits + 10 * (headerLen + rsFrames * (rsFrameLen + parityLen))) * samples); + // bufLen = (frameCnt * (syncBits + 10 * (headerLen + rsFrames * (rsFrameLen + parityLen))) * samples); + bufLen = (headerLen + syncBits + dataLen)/8; - samplePeriod = ((float)((syncBits + 10 * (headerLen + rsFrames * (rsFrameLen + parityLen))))/(float)bitRate) * 1000 - 1800; + // samplePeriod = ((float)((syncBits + 10 * (headerLen + rsFrames * (rsFrameLen + parityLen))))/(float)bitRate) * 1000 - 1800; + samplePeriod = 5000; // samplePeriod = 3000; // sleepTime = 3.0; //samplePeriod = 2200; // reduce dut to python and sensor querying delays - sleepTime = 2.2f; +// sleepTime = 2.2f; frameTime = ((float)((float)bufLen / (samples * frameCnt * bitRate))) * 1000; // frame time in ms - printf("\n BPSK Mode, bufLen: %d, %d bits per frame, %d bits per second, %d ms per frame %d ms sample period\n", - bufLen, bufLen / (samples * frameCnt), bitRate, frameTime, samplePeriod); + printf("\n FC Mode, bufLen: %d, %d bits per frame, %d bits per second, %d ms per frame %d ms sample period\n", + bufLen, bufLen / samples, bitRate, frameTime, samplePeriod); sin_samples = S_RATE/freq_Hz; for (int j = 0; j < sin_samples; j++) { @@ -2306,9 +2310,180 @@ void get_tlm_fc() { /* convert to waveform buffer */ - /* open socket */ + int data; + int val; + //int offset = 0; + + for (i = 1; i <= headerLen * samples; i++) { + write_wave(ctr, buffer); + if ((i % samples) == 0) { + phase *= -1; + if ((ctr - smaller) > 0) { + for (int j = 1; j <= smaller; j++) + buffer[ctr - j] = buffer[ctr - j] * 0.4; + } + flip_ctr = ctr; + } + } + + for (i = 1; i <= syncBits * samples; i++) { + write_wave(ctr, buffer); + // printf("%d ",ctr); + if ((i % samples) == 0) { + int bit = syncBits - i / samples + 1; + val = syncWord; + data = val & 1 << (bit - 1); + // printf ("%d i: %d new frame %d sync bit %d = %d \n", + // ctr/SAMPLES, i, frames, bit, (data > 0) ); + + if (data == 0) { + phase *= -1; + if ((ctr - smaller) > 0) { + for (int j = 1; j <= smaller; j++) + buffer[ctr - j] = buffer[ctr - j] * 0.4; + } + flip_ctr = ctr; + } + } + } + + for (i = 1; i <= (dataLen * samples); i++) // 572 + { + 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) ); + + if (data == 0) { + phase *= -1; + if ((ctr - smaller) > 0) { + for (int j = 1; j <= smaller; j++) + buffer[ctr - j] = buffer[ctr - j] * 0.4; + } + flip_ctr = ctr; + } + } + } + +/* open socket */ + + int error = 0; + // int count; + // for (count = 0; count < dataLen; count++) { + // printf("%02X", b[count]); + // } + // printf("\n"); + + // socket write + + if (!socket_open && transmit) { + printf("Opening socket!\n"); + // struct sockaddr_in address; + // int valread; + struct sockaddr_in serv_addr; + // char *hello = "Hello from client"; + // char buffer[1024] = {0}; + if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + printf("\n Socket creation error \n"); + error = 1; + } + + memset( & serv_addr, '0', sizeof(serv_addr)); + + serv_addr.sin_family = AF_INET; + serv_addr.sin_port = htons(PORT); + + // Convert IPv4 and IPv6 addresses from text to binary form + if (inet_pton(AF_INET, "127.0.0.1", & serv_addr.sin_addr) <= 0) { + printf("\nInvalid address/ Address not supported \n"); + error = 1; + } + + if (connect(sock, (struct sockaddr * ) & serv_addr, sizeof(serv_addr)) < 0) { + printf("\nConnection Failed \n"); + printf("Error: %s\n", strerror(errno)); + error = 1; - /* write waveform buffer over socket */ + // try again + error = 0; + if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + printf("\n Socket creation error \n"); + error = 1; + } + + memset( & serv_addr, '0', sizeof(serv_addr)); + + serv_addr.sin_family = AF_INET; + serv_addr.sin_port = htons(PORT); + + // Convert IPv4 and IPv6 addresses from text to binary form + if (inet_pton(AF_INET, "127.0.0.1", & serv_addr.sin_addr) <= 0) { + printf("\nInvalid address/ Address not supported \n"); + error = 1; + } + + if (connect(sock, (struct sockaddr * ) & serv_addr, sizeof(serv_addr)) < 0) { + printf("\nConnection Failed \n"); + printf("Error: %s\n", strerror(errno)); + error = 1; + } + } + if (error == 1) { + printf("Socket error count: %d\n", error_count); +// ; //transmitStatus = -1; + if (error_count++ > 5) { + printf("Restarting transmit\n"); + FILE * transmit_restartf = popen("sudo systemctl restart transmit", "r"); + pclose(transmit_restartf); + sleep(10); // was 5 // sleep if socket connection refused + } + } + else { + socket_open = 1; + error_count = 0; + } + } + +/* write waveform buffer over socket */ + + int length = (headerLen + syncBits + frameLen) * samples + + 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); +// 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"); + sleep(0.5); + sock_ret = send(sock, &buffer[sock_ret], length - sock_ret, 0); +// printf("socket send 2 %d ms bytes: %d \n\n", millis() - start, sock_ret); + } + + loop_count++; + + if (sock_ret == -1) { + printf("Error: %s \n", strerror(errno)); + 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"); + } + + if (socket_open == 1) + firstTime = 0; + + return; +} /* from funcubeLib/common/testFec.cpp @@ -2319,7 +2494,7 @@ void get_tlm_fc() { const U8* encoded = ao40.encode((unsigned char*)sourceBytes, BLOCK_SIZE); */ - mode = BPSK; - get_tlm_fox(); // for now, do same as BPSK - mode = FC; -} +// mode = BPSK; +// get_tlm_fox(); // for now, do same as BPSK +// mode = FC; +// } From 829c62b3582d42f262232a7125099f500702dde2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 16:06:58 -0500 Subject: [PATCH 038/515] Update main.c labels --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 16be128b..c12206bd 100644 --- a/main.c +++ b/main.c @@ -2291,11 +2291,11 @@ void get_tlm_fc() { unsigned char source_bytes[256]; // unsigned char encoded_bytes[650]; int byte_count = 256; + + /* write telemetry into data buffer */ memset(source_bytes, 0x5a, sizeof(source_bytes)); - /* write telemetry into data buffer */ - /* convert data buffer into stream buffer */ // const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count) From 472937c09e588d03d1525acba2984ac19600a6fb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 16:08:33 -0500 Subject: [PATCH 039/515] Update main.c variable declarations --- main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index c12206bd..fea58871 100644 --- a/main.c +++ b/main.c @@ -2312,6 +2312,7 @@ void get_tlm_fc() { int data; int val; + int i; //int offset = 0; for (i = 1; i <= headerLen * samples; i++) { @@ -2450,7 +2451,7 @@ void get_tlm_fc() { /* write waveform buffer over socket */ - int length = (headerLen + syncBits + frameLen) * samples + int length = (headerLen + syncBits + dataLen) * samples if (!error && transmit) { // digitalWrite (0, LOW); From 1f81630ba969a77ee098b176b5177fab2d64813f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 16:09:22 -0500 Subject: [PATCH 040/515] Update main.c missing ; --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index fea58871..6763b05c 100644 --- a/main.c +++ b/main.c @@ -2451,7 +2451,7 @@ void get_tlm_fc() { /* write waveform buffer over socket */ - int length = (headerLen + syncBits + dataLen) * samples + int length = (headerLen + syncBits + dataLen) * samples; if (!error && transmit) { // digitalWrite (0, LOW); From 96a749b57d9780728cdc82e686c03a6692bbc85f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 16:19:33 -0500 Subject: [PATCH 041/515] Update main.c data zeros, zero str --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 6763b05c..8613a7eb 100644 --- a/main.c +++ b/main.c @@ -2294,7 +2294,7 @@ void get_tlm_fc() { /* write telemetry into data buffer */ - memset(source_bytes, 0x5a, sizeof(source_bytes)); + memset(source_bytes, 0x00, sizeof(source_bytes)); /* convert data buffer into stream buffer */ @@ -2307,6 +2307,7 @@ void get_tlm_fc() { for (int i=0; i<100; i++) printf("%x", encoded_bytes[i]); printf("\n\n"); + printf("size of encoded_bytes: %d\n\n", sizeof(encoded_bytes)); /* convert to waveform buffer */ @@ -2314,7 +2315,8 @@ void get_tlm_fc() { int val; int i; //int offset = 0; - + ctr = 0; + for (i = 1; i <= headerLen * samples; i++) { write_wave(ctr, buffer); if ((i % samples) == 0) { From d3b1fb327eb7dfc0705184114290cdb6e279730d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 16:39:03 -0500 Subject: [PATCH 042/515] Update main.c add random in data block --- main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 8613a7eb..0e41bc6c 100644 --- a/main.c +++ b/main.c @@ -2291,10 +2291,12 @@ void get_tlm_fc() { unsigned char source_bytes[256]; // unsigned char encoded_bytes[650]; int byte_count = 256; - + smaller = (int) (S_RATE / (2 * freq_Hz)); + /* write telemetry into data buffer */ memset(source_bytes, 0x00, sizeof(source_bytes)); + source_byte[10] = (uint8_t) rnd_float(0,255); /* convert data buffer into stream buffer */ @@ -2304,10 +2306,10 @@ void get_tlm_fc() { unsigned char* encoded_bytes = encode((unsigned char*)source_bytes, byte_count); printf("\n\n"); - for (int i=0; i<100; i++) + for (int i=0; i<650; i++) printf("%x", encoded_bytes[i]); printf("\n\n"); - printf("size of encoded_bytes: %d\n\n", sizeof(encoded_bytes)); +// printf("size of encoded_bytes: %d\n\n", sizeof(encoded_bytes)); /* convert to waveform buffer */ @@ -2336,8 +2338,8 @@ void get_tlm_fc() { int bit = syncBits - i / samples + 1; val = syncWord; data = val & 1 << (bit - 1); - // printf ("%d i: %d new frame %d sync bit %d = %d \n", - // ctr/SAMPLES, i, frames, bit, (data > 0) ); + printf ("%d i: %d new frame %d sync bit %d = %d \n", + ctr/SAMPLES, i, frames, bit, (data > 0) ); if (data == 0) { phase *= -1; From bf18748ea75d5408cc6ffe89be4ebb4b2132b8e4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 16:42:27 -0500 Subject: [PATCH 043/515] Update main.c fixed printf --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 0e41bc6c..ced52f31 100644 --- a/main.c +++ b/main.c @@ -1708,7 +1708,7 @@ void get_tlm_fox() { val = sync; data = val & 1 << (bit - 1); // printf ("%d i: %d new frame %d sync bit %d = %d \n", - // ctr/SAMPLES, i, frames, bit, (data > 0) ); + // ctr/, i, frames, bit, (data > 0) ); if (mode == FSK) { phase = ((data != 0) * 2) - 1; // printf("Sending a %d\n", phase); @@ -1736,7 +1736,7 @@ void get_tlm_fox() { val = data10[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) ); + // ctr/, i, frames, symbol, val, bit, (data > 0) ); if (mode == FSK) { phase = ((data != 0) * 2) - 1; // printf("Sending a %d\n", phase); @@ -2338,8 +2338,8 @@ void get_tlm_fc() { int bit = syncBits - i / samples + 1; val = syncWord; data = val & 1 << (bit - 1); - printf ("%d i: %d new frame %d sync bit %d = %d \n", - ctr/SAMPLES, i, frames, bit, (data > 0) ); + printf ("%d i: %d sync bit %d = %d \n", + ctr, i, bit, (data > 0) ); if (data == 0) { phase *= -1; From 529fbba34f4091df3af73f043a4b8240e4194621 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 16:43:30 -0500 Subject: [PATCH 044/515] Update main.c source_bytes typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index ced52f31..520ab75b 100644 --- a/main.c +++ b/main.c @@ -2296,7 +2296,7 @@ void get_tlm_fc() { /* write telemetry into data buffer */ memset(source_bytes, 0x00, sizeof(source_bytes)); - source_byte[10] = (uint8_t) rnd_float(0,255); + source_bytes[10] = (uint8_t) rnd_float(0,255); /* convert data buffer into stream buffer */ From 2bde5b77a88d462afde292e7ceb0c36fe49e1028 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 16:54:09 -0500 Subject: [PATCH 045/515] Update main.c add prints --- main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 520ab75b..79eb492a 100644 --- a/main.c +++ b/main.c @@ -2293,6 +2293,10 @@ void get_tlm_fc() { int byte_count = 256; smaller = (int) (S_RATE / (2 * freq_Hz)); + printf("\n\n"); + for (int i=0; i<256; i++) + printf("%d ", source_bytes[i]); + printf("\n\n"); /* write telemetry into data buffer */ memset(source_bytes, 0x00, sizeof(source_bytes)); @@ -2307,7 +2311,7 @@ void get_tlm_fc() { printf("\n\n"); for (int i=0; i<650; i++) - printf("%x", encoded_bytes[i]); + printf("%d ", encoded_bytes[i]); printf("\n\n"); // printf("size of encoded_bytes: %d\n\n", sizeof(encoded_bytes)); @@ -2373,6 +2377,8 @@ void get_tlm_fc() { } } } + printf("\nctr = %d\n\n", ctr); + /* open socket */ From 46fb18d6012077557c6a242e6d98a3321a370307 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 16:59:54 -0500 Subject: [PATCH 046/515] Update main.c change prints --- main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 79eb492a..661f777d 100644 --- a/main.c +++ b/main.c @@ -2293,15 +2293,17 @@ void get_tlm_fc() { int byte_count = 256; smaller = (int) (S_RATE / (2 * freq_Hz)); - printf("\n\n"); - for (int i=0; i<256; i++) - printf("%d ", source_bytes[i]); - printf("\n\n"); /* write telemetry into data buffer */ memset(source_bytes, 0x00, sizeof(source_bytes)); source_bytes[10] = (uint8_t) rnd_float(0,255); + printf("\nsource_bytes\n"); + for (int i=0; i<256; i++) + printf("%d ", source_bytes[i]); + printf("\n\n"); + + /* convert data buffer into stream buffer */ // const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count) @@ -2309,7 +2311,7 @@ void get_tlm_fc() { // CCodecAO40 ao40; unsigned char* encoded_bytes = encode((unsigned char*)source_bytes, byte_count); - printf("\n\n"); + printf("\nencoded_bytes\n"); for (int i=0; i<650; i++) printf("%d ", encoded_bytes[i]); printf("\n\n"); From 1d2e3a067a412e679d0a1f97f9f85a9b32146ecc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 17:04:56 -0500 Subject: [PATCH 047/515] Update main.c add const --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 661f777d..ebae89b9 100644 --- a/main.c +++ b/main.c @@ -2309,7 +2309,7 @@ void get_tlm_fc() { // const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count) // CCodecAO40 ao40; - unsigned char* encoded_bytes = encode((unsigned char*)source_bytes, byte_count); + const unsigned char* encoded_bytes = encode((unsigned char*)source_bytes, byte_count); printf("\nencoded_bytes\n"); for (int i=0; i<650; i++) From 74eb0ad2f5c8ea1d9b5430ff76cd761d288ecf6f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 17:10:37 -0500 Subject: [PATCH 048/515] Update main.c print BLOCKSIZE --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index ebae89b9..f17e2015 100644 --- a/main.c +++ b/main.c @@ -2295,6 +2295,8 @@ void get_tlm_fc() { /* write telemetry into data buffer */ + printf("\nBLOCKSIZE = %d\n", BLOCKSIZE); + memset(source_bytes, 0x00, sizeof(source_bytes)); source_bytes[10] = (uint8_t) rnd_float(0,255); @@ -2344,8 +2346,8 @@ void get_tlm_fc() { int bit = syncBits - i / samples + 1; val = syncWord; data = val & 1 << (bit - 1); - printf ("%d i: %d sync bit %d = %d \n", - ctr, i, bit, (data > 0) ); +// printf ("%d i: %d sync bit %d = %d \n", + // ctr, i, bit, (data > 0) ); if (data == 0) { phase *= -1; From 7feb25402226b64972127fd230f90fd1eb043171 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 17:12:59 -0500 Subject: [PATCH 049/515] Update main.c remove () --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index f17e2015..76730519 100644 --- a/main.c +++ b/main.c @@ -2311,7 +2311,7 @@ void get_tlm_fc() { // const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count) // CCodecAO40 ao40; - const unsigned char* encoded_bytes = encode((unsigned char*)source_bytes, byte_count); + const unsigned char* encoded_bytes = encode(source_bytes, byte_count); printf("\nencoded_bytes\n"); for (int i=0; i<650; i++) From a2f35f42417a88b3f491d4a1580191c881be5446 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 17:17:51 -0500 Subject: [PATCH 050/515] Update main.c print --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index 76730519..a7eb0fcb 100644 --- a/main.c +++ b/main.c @@ -2296,6 +2296,7 @@ void get_tlm_fc() { /* write telemetry into data buffer */ printf("\nBLOCKSIZE = %d\n", BLOCKSIZE); + printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); source_bytes[10] = (uint8_t) rnd_float(0,255); From c76db650877447a3d4e2cc1786e18eca908254b9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 17:24:36 -0500 Subject: [PATCH 051/515] Update main.c change from bytes to bits in encoded --- main.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index a7eb0fcb..4f459c76 100644 --- a/main.c +++ b/main.c @@ -2315,8 +2315,8 @@ void get_tlm_fc() { const unsigned char* encoded_bytes = encode(source_bytes, byte_count); printf("\nencoded_bytes\n"); - for (int i=0; i<650; i++) - printf("%d ", encoded_bytes[i]); + for (int i=0; i<5200; i++) + printf("%d", encoded_bytes[i]); printf("\n\n"); // printf("size of encoded_bytes: %d\n\n", sizeof(encoded_bytes)); @@ -2365,13 +2365,14 @@ 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); + // 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; + data = encoded_bytes[symbol]; if (data == 0) { phase *= -1; if ((ctr - smaller) > 0) { From 28604844dc1aa04b204d0cf9eb850e8af42af9df Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 17:25:09 -0500 Subject: [PATCH 052/515] Update main.c missing int --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 4f459c76..23f9e617 100644 --- a/main.c +++ b/main.c @@ -2371,7 +2371,7 @@ void get_tlm_fc() { // 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; + int symbol = i / samples; data = encoded_bytes[symbol]; if (data == 0) { phase *= -1; From 6d05cce4d51ad4639dd10b2bfbd4e4db3b0a89f9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 22:57:11 -0500 Subject: [PATCH 053/515] Update main.c added sleeps --- main.c | 58 ++++++++++++++++++++++++---------------------------------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/main.c b/main.c index 23f9e617..8423f980 100644 --- a/main.c +++ b/main.c @@ -511,16 +511,17 @@ int main(int argc, char * argv[]) { bufLen = (headerLen + syncBits + dataLen)/8; // samplePeriod = ((float)((syncBits + 10 * (headerLen + rsFrames * (rsFrameLen + parityLen))))/(float)bitRate) * 1000 - 1800; - samplePeriod = 5000; + samplePeriod = 5000; // samplePeriod = 3000; // sleepTime = 3.0; //samplePeriod = 2200; // reduce dut to python and sensor querying delays // sleepTime = 2.2f; - frameTime = ((float)((float)bufLen / (samples * frameCnt * bitRate))) * 1000; // frame time in ms - +// frameTime = ((float)((float)bufLen / (samples * frameCnt * bitRate))) * 1000; // frame time in ms + frameTime = 5000; + printf("\n FC Mode, bufLen: %d, %d bits per frame, %d bits per second, %d ms per frame %d ms sample period\n", - bufLen, bufLen / samples, bitRate, frameTime, samplePeriod); + bufLen, bufLen / samples, bitRate, frameTime, samplePeriod); sin_samples = S_RATE/freq_Hz; for (int j = 0; j < sin_samples; j++) { @@ -2291,42 +2292,37 @@ void get_tlm_fc() { unsigned char source_bytes[256]; // unsigned char encoded_bytes[650]; int byte_count = 256; - smaller = (int) (S_RATE / (2 * freq_Hz)); /* write telemetry into data buffer */ - printf("\nBLOCKSIZE = %d\n", BLOCKSIZE); - printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); +// printf("\nBLOCKSIZE = %d\n", BLOCKSIZE); +// printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); source_bytes[10] = (uint8_t) rnd_float(0,255); - +/* printf("\nsource_bytes\n"); for (int i=0; i<256; i++) printf("%d ", source_bytes[i]); printf("\n\n"); - +*/ /* convert data buffer into stream buffer */ -// const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count) - -// CCodecAO40 ao40; const unsigned char* encoded_bytes = encode(source_bytes, byte_count); - +/* printf("\nencoded_bytes\n"); for (int i=0; i<5200; i++) printf("%d", encoded_bytes[i]); printf("\n\n"); -// printf("size of encoded_bytes: %d\n\n", sizeof(encoded_bytes)); - +*/ /* convert to waveform buffer */ int data; int val; int i; - //int offset = 0; ctr = 0; + smaller = (int) (S_RATE / (2 * freq_Hz)); for (i = 1; i <= headerLen * samples; i++) { write_wave(ctr, buffer); @@ -2348,8 +2344,7 @@ void get_tlm_fc() { val = syncWord; data = val & 1 << (bit - 1); // printf ("%d i: %d sync bit %d = %d \n", - // ctr, i, bit, (data > 0) ); - + // ctr, i, bit, (data > 0) ); if (data == 0) { phase *= -1; if ((ctr - smaller) > 0) { @@ -2361,7 +2356,7 @@ void get_tlm_fc() { } } - for (i = 1; i <= (dataLen * samples); i++) // 572 + for (i = 1; i <= (dataLen * samples); i++) // 5200 { write_wave(ctr, buffer); if ((i % samples) == 0) { @@ -2475,7 +2470,7 @@ void get_tlm_fc() { 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); +// fflush(stdout); if (sock_ret < length) { // printf("Not resending\n"); @@ -2496,22 +2491,17 @@ void get_tlm_fc() { 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, (unsigned int)frameTime - 750 + pi_zero_2_offset); + sampleTime = (unsigned int) millis(); // resetting time for sleeping + fflush(stdout); + if (socket_open == 1) firstTime = 0; return; } - - /* from funcubeLib/common/testFec.cpp - - U8 sourceBytes[BLOCK_SIZE]; - memset(sourceBytes, 42, BLOCK_SIZE); - - CCodecAO40 ao40; - const U8* encoded = ao40.encode((unsigned char*)sourceBytes, BLOCK_SIZE); - */ - -// mode = BPSK; -// get_tlm_fox(); // for now, do same as BPSK -// mode = FC; -// } From b4c6f588f4380f63888ca92b888b47255f5497bd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 19 Jan 2025 23:25:11 -0500 Subject: [PATCH 054/515] Update main.c fix sleep time --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 8423f980..e9e3a23e 100644 --- a/main.c +++ b/main.c @@ -2492,11 +2492,11 @@ void get_tlm_fc() { } int startSleep = millis(); - if ((millis() - sampleTime) < ((unsigned int)frameTime - 750 + pi_zero_2_offset)) + 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)) + 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, (unsigned int)frameTime - 750 + pi_zero_2_offset); + 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); From 1fb6cda81e67b69ee9d41c0b92cf074f92372728 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 09:01:50 -0500 Subject: [PATCH 055/515] Update main.c print smaller --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index e9e3a23e..71c805e7 100644 --- a/main.c +++ b/main.c @@ -2323,6 +2323,7 @@ void get_tlm_fc() { int i; ctr = 0; smaller = (int) (S_RATE / (2 * freq_Hz)); + printf("\n\nsmaller = %d \n\n",smaller); for (i = 1; i <= headerLen * samples; i++) { write_wave(ctr, buffer); From 83b91ee4b102507d03c00d45ba5ab4a1c8e331b9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 09:04:10 -0500 Subject: [PATCH 056/515] Update main.c print buffer --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 71c805e7..e1b91556 100644 --- a/main.c +++ b/main.c @@ -1980,7 +1980,7 @@ void write_wave(int i, short int *buffer) else // buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); } -// printf("%d %d \n", i, buffer[ctr - 1]); + printf("%d %d \n", i, buffer[ctr - 1]); } From 684f1e444378df70c51e8f170a8f161a0c9d4952 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 09:11:55 -0500 Subject: [PATCH 057/515] Update main.c print * for flip_ctr --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index e1b91556..61ba76a6 100644 --- a/main.c +++ b/main.c @@ -1974,9 +1974,11 @@ void write_wave(int i, short int *buffer) } else { - if ((ctr - flip_ctr) < smaller) + if ((ctr - flip_ctr) < smaller) { // buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples] / 2); + printf("*"); + } else // buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); } From 0c5c7938775ea6f39277233920e470c708e4f389 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 09:17:45 -0500 Subject: [PATCH 058/515] Update main.c only print < 1000 --- main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 61ba76a6..f8b693b4 100644 --- a/main.c +++ b/main.c @@ -1977,12 +1977,13 @@ void write_wave(int i, short int *buffer) if ((ctr - flip_ctr) < smaller) { // buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples] / 2); - printf("*"); + if (ctr < 1000) printf("*"); } else // buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); - buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); } - printf("%d %d \n", i, buffer[ctr - 1]); + buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); + } + if (ctr < 1000) printf("%d %d \n", i, buffer[ctr - 1]); } From b6718b536f7775a213122e5f40edff9e9655521b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 09:21:36 -0500 Subject: [PATCH 059/515] Update main.c print smaller if < 1000 --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index f8b693b4..12f1abe3 100644 --- a/main.c +++ b/main.c @@ -2377,6 +2377,7 @@ void get_tlm_fc() { if ((ctr - smaller) > 0) { for (int j = 1; j <= smaller; j++) buffer[ctr - j] = buffer[ctr - j] * 0.4; + if (ctr < 1000) printf("# %d %d\n", ctr - j, buffer[ctr - j]); } flip_ctr = ctr; } From c640b477a908762b1a116f96b2e0ebda687136d2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 09:24:20 -0500 Subject: [PATCH 060/515] Update main.c fix j --- main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 12f1abe3..5eac6139 100644 --- a/main.c +++ b/main.c @@ -2375,7 +2375,8 @@ void get_tlm_fc() { if (data == 0) { phase *= -1; if ((ctr - smaller) > 0) { - for (int j = 1; j <= smaller; j++) + int j; + for (j = 1; j <= smaller; j++) buffer[ctr - j] = buffer[ctr - j] * 0.4; if (ctr < 1000) printf("# %d %d\n", ctr - j, buffer[ctr - j]); } From 9e102a166e4d4bf6bff4732883a4830888b211b0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 09:39:13 -0500 Subject: [PATCH 061/515] Update main.c fix {} --- main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 5eac6139..f6213a6c 100644 --- a/main.c +++ b/main.c @@ -1983,7 +1983,7 @@ void write_wave(int i, short int *buffer) // buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); } - if (ctr < 1000) printf("%d %d \n", i, buffer[ctr - 1]); + if (ctr < 1000) printf("%d %d %d \n", ctr, i, buffer[ctr - 1]); } @@ -2376,9 +2376,10 @@ void get_tlm_fc() { phase *= -1; if ((ctr - smaller) > 0) { int j; - for (j = 1; j <= smaller; j++) + for (j = 1; j <= smaller; j++) { buffer[ctr - j] = buffer[ctr - j] * 0.4; if (ctr < 1000) printf("# %d %d\n", ctr - j, buffer[ctr - j]); + } } flip_ctr = ctr; } From 81b0746c2937c69309093bf35eed1df05b75d5bd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 09:48:43 -0500 Subject: [PATCH 062/515] Update main.c print smaller --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index f6213a6c..96f7df2d 100644 --- a/main.c +++ b/main.c @@ -2333,8 +2333,11 @@ void get_tlm_fc() { if ((i % samples) == 0) { phase *= -1; if ((ctr - smaller) > 0) { - for (int j = 1; j <= smaller; j++) - buffer[ctr - j] = buffer[ctr - j] * 0.4; + int j; + for (j = 1; j <= smaller; j++) { + buffer[ctr - j] = buffer[ctr - j] * 0.4; + if (ctr < 1000) printf("# %d %d\n", ctr - j, buffer[ctr - j]); + } } flip_ctr = ctr; } From 349e2d7ca014ea281cd4667f76203e20ca984a2b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 09:53:50 -0500 Subject: [PATCH 063/515] Update main.c remove prints --- main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index 96f7df2d..e7903a0a 100644 --- a/main.c +++ b/main.c @@ -1977,13 +1977,13 @@ void write_wave(int i, short int *buffer) if ((ctr - flip_ctr) < smaller) { // buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples] / 2); - if (ctr < 1000) printf("*"); +// if (ctr < 1000) printf("*"); } else // buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); } - if (ctr < 1000) printf("%d %d %d \n", ctr, i, buffer[ctr - 1]); +// if (ctr < 1000) printf("%d %d %d \n", ctr, i, buffer[ctr - 1]); } @@ -2335,8 +2335,8 @@ void get_tlm_fc() { if ((ctr - smaller) > 0) { int j; for (j = 1; j <= smaller; j++) { - buffer[ctr - j] = buffer[ctr - j] * 0.4; - if (ctr < 1000) printf("# %d %d\n", ctr - j, buffer[ctr - j]); + buffer[ctr - j] = buffer[ctr - j] * 0.5; +// if (ctr < 1000) printf("# %d %d\n", ctr - j, buffer[ctr - j]); } } flip_ctr = ctr; @@ -2355,8 +2355,9 @@ void get_tlm_fc() { if (data == 0) { phase *= -1; if ((ctr - smaller) > 0) { - for (int j = 1; j <= smaller; j++) - buffer[ctr - j] = buffer[ctr - j] * 0.4; + int j; + for (j = 1; j <= smaller; j++) + buffer[ctr - j] = buffer[ctr - j] * 0.5; } flip_ctr = ctr; } @@ -2380,8 +2381,8 @@ void get_tlm_fc() { if ((ctr - smaller) > 0) { int j; for (j = 1; j <= smaller; j++) { - buffer[ctr - j] = buffer[ctr - j] * 0.4; - if (ctr < 1000) printf("# %d %d\n", ctr - j, buffer[ctr - j]); + buffer[ctr - j] = buffer[ctr - j] * 0.5; +// if (ctr < 1000) printf("# %d %d\n", ctr - j, buffer[ctr - j]); } } flip_ctr = ctr; From 5a271f314cb0021fe73102390000052c698b0c11 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 10:19:44 -0500 Subject: [PATCH 064/515] Update main.c try sin wave --- main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index e7903a0a..60c53e7f 100644 --- a/main.c +++ b/main.c @@ -1975,13 +1975,15 @@ void write_wave(int i, short int *buffer) else { if ((ctr - flip_ctr) < smaller) { -// buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); - buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples] / 2); +// buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); + buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); +// buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples] / 2); // if (ctr < 1000) printf("*"); } else -// buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); - buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); +// buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); + buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); +// buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); } // if (ctr < 1000) printf("%d %d %d \n", ctr, i, buffer[ctr - 1]); From af38f7ff002a5b69c455914a01a675afa1078b4c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 10:24:58 -0500 Subject: [PATCH 065/515] Update main.c cleanup --- main.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 60c53e7f..82197709 100644 --- a/main.c +++ b/main.c @@ -1976,14 +1976,12 @@ void write_wave(int i, short int *buffer) { if ((ctr - flip_ctr) < smaller) { // buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); - buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); -// buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples] / 2); + buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples] / 2); // if (ctr < 1000) printf("*"); } else // buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); - buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); -// buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); + buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); } // if (ctr < 1000) printf("%d %d %d \n", ctr, i, buffer[ctr - 1]); @@ -2328,7 +2326,7 @@ void get_tlm_fc() { int i; ctr = 0; smaller = (int) (S_RATE / (2 * freq_Hz)); - printf("\n\nsmaller = %d \n\n",smaller); +// printf("\n\nsmaller = %d \n\n",smaller); for (i = 1; i <= headerLen * samples; i++) { write_wave(ctr, buffer); From 20a62c9a37949387831837e2a3972cc64f14717b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 10:50:25 -0500 Subject: [PATCH 066/515] Update main.c change Sat Id to 10 --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index 82197709..f6b8255a 100644 --- a/main.c +++ b/main.c @@ -2302,6 +2302,7 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); + source_bytes[0] = 0b10000000; source_bytes[10] = (uint8_t) rnd_float(0,255); /* printf("\nsource_bytes\n"); From f800c57ce024ed8991cd74400dec45db9c628ec0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 10:57:19 -0500 Subject: [PATCH 067/515] Update main.c add frame type --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index f6b8255a..c3592ad8 100644 --- a/main.c +++ b/main.c @@ -2302,7 +2302,7 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b10000000; + source_bytes[0] = 0b10000001; source_bytes[10] = (uint8_t) rnd_float(0,255); /* printf("\nsource_bytes\n"); From b0b44a42265f6ff19af535bffc1a53dbe0f2ac70 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 11:00:52 -0500 Subject: [PATCH 068/515] Update main.c try frame MSB first --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index c3592ad8..380a9945 100644 --- a/main.c +++ b/main.c @@ -2302,7 +2302,7 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b10000001; + source_bytes[0] = 0b10100000; source_bytes[10] = (uint8_t) rnd_float(0,255); /* printf("\nsource_bytes\n"); From 08c929c8caaf54812161e453ec4d83acf740404d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 11:01:48 -0500 Subject: [PATCH 069/515] Update main.c try [1] --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index 380a9945..de0dbeb6 100644 --- a/main.c +++ b/main.c @@ -2303,6 +2303,7 @@ void get_tlm_fc() { memset(source_bytes, 0x00, sizeof(source_bytes)); source_bytes[0] = 0b10100000; + source_bytes[1] = 0b10100000; source_bytes[10] = (uint8_t) rnd_float(0,255); /* printf("\nsource_bytes\n"); From 60654237a107607cf0d8177557eafc35e7d32e72 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 12:40:26 -0500 Subject: [PATCH 070/515] Update main.c try another --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index de0dbeb6..69e71efa 100644 --- a/main.c +++ b/main.c @@ -2302,8 +2302,8 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b10100000; - source_bytes[1] = 0b10100000; + source_bytes[0] = 0b10000001; // 10100000 + source_bytes[1] = 0b10000001; source_bytes[10] = (uint8_t) rnd_float(0,255); /* printf("\nsource_bytes\n"); From 3a5bb8866ca017ce09550223c03d96b0acdf7155 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 12:44:49 -0500 Subject: [PATCH 071/515] Update main.c print symbol --- main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 69e71efa..5ae3f5ce 100644 --- a/main.c +++ b/main.c @@ -2302,8 +2302,8 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b10000001; // 10100000 - source_bytes[1] = 0b10000001; + source_bytes[0] = 0b01000001; // 10100000 10000001 + source_bytes[1] = 0b01000001; source_bytes[10] = (uint8_t) rnd_float(0,255); /* printf("\nsource_bytes\n"); @@ -2377,6 +2377,7 @@ void get_tlm_fc() { // printf ("%d i: %d new frame %d data10[%d] = %x bit %d = %d \n", // ctr/SAMPLES, i, frames, symbol, val, bit, (data > 0) ); int symbol = i / samples; + if (i < 100) printf("symbol = %d\n",symbol); data = encoded_bytes[symbol]; if (data == 0) { phase *= -1; From d3d3d64ba1a574ba7aa45602a72b8de26a66b21e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 12:49:02 -0500 Subject: [PATCH 072/515] Update main.c print final symbol --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 5ae3f5ce..99e29411 100644 --- a/main.c +++ b/main.c @@ -2327,6 +2327,7 @@ void get_tlm_fc() { int val; int i; ctr = 0; + int symbol = 0; smaller = (int) (S_RATE / (2 * freq_Hz)); // printf("\n\nsmaller = %d \n\n",smaller); @@ -2376,7 +2377,7 @@ void get_tlm_fc() { // 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) ); - int symbol = i / samples; + symbol = i / samples - 1; if (i < 100) printf("symbol = %d\n",symbol); data = encoded_bytes[symbol]; if (data == 0) { @@ -2392,6 +2393,7 @@ void get_tlm_fc() { } } } + printf("symbol = %d\n",symbol); printf("\nctr = %d\n\n", ctr); From 0dcafa2b774d95d325134fc16991ffe9f8d07ffc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 12:53:06 -0500 Subject: [PATCH 073/515] Update main.c try again --- main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 99e29411..1daa8613 100644 --- a/main.c +++ b/main.c @@ -2302,8 +2302,8 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b01000001; // 10100000 10000001 - source_bytes[1] = 0b01000001; + source_bytes[0] = 0b10000001; // + source_bytes[1] = 0b10000001; source_bytes[10] = (uint8_t) rnd_float(0,255); /* printf("\nsource_bytes\n"); @@ -2378,7 +2378,7 @@ void get_tlm_fc() { // 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); +// if (i < 100) printf("symbol = %d\n",symbol); data = encoded_bytes[symbol]; if (data == 0) { phase *= -1; @@ -2393,8 +2393,8 @@ void get_tlm_fc() { } } } - printf("symbol = %d\n",symbol); - printf("\nctr = %d\n\n", ctr); +// printf("symbol = %d\n",symbol); +// printf("\nctr = %d\n\n", ctr); /* open socket */ From 41778baa06d8cdcabd92115b48934852ca258fe3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 12:55:54 -0500 Subject: [PATCH 074/515] Update main.c more --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 1daa8613..a16540f5 100644 --- a/main.c +++ b/main.c @@ -2302,8 +2302,8 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b10000001; // - source_bytes[1] = 0b10000001; + source_bytes[0] = 0b10100000; // 10000001 + source_bytes[1] = 0b10100000; source_bytes[10] = (uint8_t) rnd_float(0,255); /* printf("\nsource_bytes\n"); From afc7053a037431f7cc1a1703d9ad527963a009aa Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 13:00:20 -0500 Subject: [PATCH 075/515] Update main.c more --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index a16540f5..f1ffbece 100644 --- a/main.c +++ b/main.c @@ -2302,8 +2302,8 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b10100000; // 10000001 - source_bytes[1] = 0b10100000; + source_bytes[0] = 0b10000001 ; // 10100000 + source_bytes[1] = 0b10000001 ; source_bytes[10] = (uint8_t) rnd_float(0,255); /* printf("\nsource_bytes\n"); From 8d8422f74ac7b5779e2116d026d1f49735d9703d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 13:05:07 -0500 Subject: [PATCH 076/515] Update main.c check syncWord --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index f1ffbece..b5bcf737 100644 --- a/main.c +++ b/main.c @@ -2353,8 +2353,8 @@ void get_tlm_fc() { int bit = syncBits - i / samples + 1; val = syncWord; data = val & 1 << (bit - 1); -// printf ("%d i: %d sync bit %d = %d \n", - // ctr, i, bit, (data > 0) ); + printf ("--- %d i: %d sync bit %d = %d \n", + ctr, i, bit, (data > 0) ); if (data == 0) { phase *= -1; if ((ctr - smaller) > 0) { From 3b68b3f643fb2ffb2eca2083385c1fc0f463dbc4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 13:08:41 -0500 Subject: [PATCH 077/515] Update main.c more --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index b5bcf737..4de29107 100644 --- a/main.c +++ b/main.c @@ -2302,8 +2302,8 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b10000001 ; // 10100000 - source_bytes[1] = 0b10000001 ; + source_bytes[0] = 0b01000001 ; // 10100000 10000001 + source_bytes[1] = 0b01000001 ; source_bytes[10] = (uint8_t) rnd_float(0,255); /* printf("\nsource_bytes\n"); @@ -2353,8 +2353,8 @@ void get_tlm_fc() { int bit = syncBits - i / samples + 1; val = syncWord; data = val & 1 << (bit - 1); - printf ("--- %d i: %d sync bit %d = %d \n", - ctr, i, bit, (data > 0) ); +// printf ("--- %d i: %d sync bit %d = %d \n", +// ctr, i, bit, (data > 0) ); if (data == 0) { phase *= -1; if ((ctr - smaller) > 0) { From 969482330bfbab63d199ccbf68af37a78754f9c6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 13:26:02 -0500 Subject: [PATCH 078/515] Update main.c again --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 4de29107..4b3efb95 100644 --- a/main.c +++ b/main.c @@ -2302,15 +2302,15 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b01000001 ; // 10100000 10000001 - source_bytes[1] = 0b01000001 ; + source_bytes[0] = 0b10000001 ; // 10100000 10000001 01000001 + source_bytes[1] = 0b10000001 ; source_bytes[10] = (uint8_t) rnd_float(0,255); -/* +/**/ printf("\nsource_bytes\n"); for (int i=0; i<256; i++) printf("%d ", source_bytes[i]); printf("\n\n"); -*/ +/**/ /* convert data buffer into stream buffer */ From ae9258e587ff34fae16f820f0662c113192341f9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 13:52:44 -0500 Subject: [PATCH 079/515] Update main.c add sequence number --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 4b3efb95..eacd0e0f 100644 --- a/main.c +++ b/main.c @@ -2302,9 +2302,12 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b10000001 ; // 10100000 10000001 01000001 + source_bytes[0] = 0b10000001 ; // 10100000 10000001 01000001 10000001 source_bytes[1] = 0b10000001 ; source_bytes[10] = (uint8_t) rnd_float(0,255); + source_bytes[50] = 0xff; // Sequence number + source_bytes[51] = 0xff; + source_bytes[52] = 0xff; /**/ printf("\nsource_bytes\n"); for (int i=0; i<256; i++) From 79eab435353705dce8e751989056914297fe641e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jan 2025 13:55:07 -0500 Subject: [PATCH 080/515] Update main.c --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index eacd0e0f..83d5c932 100644 --- a/main.c +++ b/main.c @@ -2302,8 +2302,8 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b10000001 ; // 10100000 10000001 01000001 10000001 - source_bytes[1] = 0b10000001 ; + source_bytes[0] = 0b10000010 ; // 10100000 10000001 01000001 10000001 10000001 + source_bytes[1] = 0b10000010 ; source_bytes[10] = (uint8_t) rnd_float(0,255); source_bytes[50] = 0xff; // Sequence number source_bytes[51] = 0xff; From 5e74e602d9dc29f3d26eca2d072ab974a9c20a53 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 10:19:45 -0500 Subject: [PATCH 081/515] Update main.c updated length to 2*ctr+2 like bpsk --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 83d5c932..8dc0f1a1 100644 --- a/main.c +++ b/main.c @@ -2481,7 +2481,7 @@ void get_tlm_fc() { /* write waveform buffer over socket */ - int length = (headerLen + syncBits + dataLen) * samples; + int length = (((headerLen + syncBits + dataLen) * samples) * 2) + 2; // ctr * 2 + 2 like bpsk due to 2 bytes per sample. if (!error && transmit) { // digitalWrite (0, LOW); From 3684cd08cbe1bbd6ebf2a6a352dee82e94e883a4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 12:03:16 -0500 Subject: [PATCH 082/515] Update main.c first byte 01 --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 8dc0f1a1..32afae52 100644 --- a/main.c +++ b/main.c @@ -2302,7 +2302,7 @@ void get_tlm_fc() { // printf("\nSYMPBLOCK = %d\n", SYMPBLOCK); memset(source_bytes, 0x00, sizeof(source_bytes)); - source_bytes[0] = 0b10000010 ; // 10100000 10000001 01000001 10000001 10000001 + source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 source_bytes[1] = 0b10000010 ; source_bytes[10] = (uint8_t) rnd_float(0,255); source_bytes[50] = 0xff; // Sequence number From 24ffeac63e74cd07ad93c7f7a2841e1c49760ebe Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 14:41:44 -0500 Subject: [PATCH 083/515] Update main.c print length ctr --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index 32afae52..e64630ed 100644 --- a/main.c +++ b/main.c @@ -2482,6 +2482,7 @@ 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); if (!error && transmit) { // digitalWrite (0, LOW); From dae1fac673ac1af75352e1ae8e6dd78328cebbf4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:01:47 -0500 Subject: [PATCH 084/515] Update main.c add sequence --- main.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/main.c b/main.c index e64630ed..4fee5847 100644 --- a/main.c +++ b/main.c @@ -56,7 +56,7 @@ int main(int argc, char * argv[]) { // program_radio(); // do in transmit instead if (uptime_sec < 30.0) { - reset_count = (reset_count + 1) % 0xffff; // only increment uptime if just rebooted + reset_count = (reset_count + 1) % ff; // only increment uptime if just rebooted fprintf(stderr,"INFO: Reset Count: %d Uptime since Reset: %ld \n", reset_count, uptime_sec); } @@ -1343,12 +1343,12 @@ void get_tlm_fox() { if (uptime != 0) // if uptime is 0, leave reset count at 0 { h[0] = (short int) ((h[0] & 0x07) | ((reset_count & 0x1f) << 3)); - h[1] = (short int) ((reset_count >> 5) & 0xff); + h[1] = (short int) ((reset_count >> 5) & ); h[2] = (short int) ((h[2] & 0xf8) | ((reset_count >> 13) & 0x07)); } h[2] = (short int) ((h[2] & 0x0e) | ((uptime & 0x1f) << 3)); - h[3] = (short int) ((uptime >> 5) & 0xff); - h[4] = (short int) ((uptime >> 13) & 0xff); + h[3] = (short int) ((uptime >> 5) & ); + h[4] = (short int) ((uptime >> 13) & ); h[5] = (short int) ((h[5] & 0xf0) | ((uptime >> 21) & 0x0f)); h[5] = (short int) ((h[5] & 0x0f) | (frm_type << 4)); @@ -1596,12 +1596,12 @@ void get_tlm_fox() { } if (mode == BPSK) { // wod field experiments - unsigned long val = 0xffff; - encodeA(b, 64 + head_offset, 0xff & val); + unsigned long val = ff; + encodeA(b, 64 + head_offset, & val); encodeA(b, 65 + head_offset, val >> 8); encodeA(b, 63 + head_offset, 0x00); encodeA(b, 62 + head_offset, 0x01); - encodeB(b, 74 + head_offset, 0xfff); + encodeB(b, 74 + head_offset, f); } short int data10[headerLen + rsFrames * (rsFrameLen + parityLen)]; short int data8[headerLen + rsFrames * (rsFrameLen + parityLen)]; @@ -1989,7 +1989,7 @@ void write_wave(int i, short int *buffer) int encodeA(short int *b, int index, int val) { // printf("Encoding A\n"); - b[index] = val & 0xff; + b[index] = val & ; b[index + 1] = (short int) ((b[index + 1] & 0xf0) | ((val >> 8) & 0x0f)); return 0; } @@ -1997,7 +1997,7 @@ int encodeA(short int *b, int index, int val) { int encodeB(short int *b, int index, int val) { // printf("Encoding B\n"); b[index] = (short int) ((b[index] & 0x0f) | ((val << 4) & 0xf0)); - b[index + 1] = (val >> 4 ) & 0xff; + b[index + 1] = (val >> 4 ) & ; return 0; } @@ -2305,9 +2305,9 @@ void get_tlm_fc() { source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 source_bytes[1] = 0b10000010 ; source_bytes[10] = (uint8_t) rnd_float(0,255); - source_bytes[50] = 0xff; // Sequence number - source_bytes[51] = 0xff; - source_bytes[52] = 0xff; + source_bytes[50] = 0x00; // Sequence number + source_bytes[51] = 0x00; + source_bytes[52] = 0xFF & sequence++; /**/ printf("\nsource_bytes\n"); for (int i=0; i<256; i++) From 87fa349b122376760043bc2c03e8aa9f2a14b80e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:04:08 -0500 Subject: [PATCH 085/515] Update main.h --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index 82a2b10f..b39db37a 100644 --- a/main.h +++ b/main.h @@ -104,6 +104,7 @@ FILE * file1; short int buffer[2336400]; // max size for 10 frames count of BPSK FILE *sopen(const char *program); FILE *telem_file; +long int sequence = 0; #define S_RATE (48000) // (44100) From d4161f28d4e55387109c86505ae2bb1e910bbbea Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:05:15 -0500 Subject: [PATCH 086/515] Update main.c revert --- main.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/main.c b/main.c index 4fee5847..e64630ed 100644 --- a/main.c +++ b/main.c @@ -56,7 +56,7 @@ int main(int argc, char * argv[]) { // program_radio(); // do in transmit instead if (uptime_sec < 30.0) { - reset_count = (reset_count + 1) % ff; // only increment uptime if just rebooted + reset_count = (reset_count + 1) % 0xffff; // only increment uptime if just rebooted fprintf(stderr,"INFO: Reset Count: %d Uptime since Reset: %ld \n", reset_count, uptime_sec); } @@ -1343,12 +1343,12 @@ void get_tlm_fox() { if (uptime != 0) // if uptime is 0, leave reset count at 0 { h[0] = (short int) ((h[0] & 0x07) | ((reset_count & 0x1f) << 3)); - h[1] = (short int) ((reset_count >> 5) & ); + h[1] = (short int) ((reset_count >> 5) & 0xff); h[2] = (short int) ((h[2] & 0xf8) | ((reset_count >> 13) & 0x07)); } h[2] = (short int) ((h[2] & 0x0e) | ((uptime & 0x1f) << 3)); - h[3] = (short int) ((uptime >> 5) & ); - h[4] = (short int) ((uptime >> 13) & ); + h[3] = (short int) ((uptime >> 5) & 0xff); + h[4] = (short int) ((uptime >> 13) & 0xff); h[5] = (short int) ((h[5] & 0xf0) | ((uptime >> 21) & 0x0f)); h[5] = (short int) ((h[5] & 0x0f) | (frm_type << 4)); @@ -1596,12 +1596,12 @@ void get_tlm_fox() { } if (mode == BPSK) { // wod field experiments - unsigned long val = ff; - encodeA(b, 64 + head_offset, & val); + unsigned long val = 0xffff; + encodeA(b, 64 + head_offset, 0xff & val); encodeA(b, 65 + head_offset, val >> 8); encodeA(b, 63 + head_offset, 0x00); encodeA(b, 62 + head_offset, 0x01); - encodeB(b, 74 + head_offset, f); + encodeB(b, 74 + head_offset, 0xfff); } short int data10[headerLen + rsFrames * (rsFrameLen + parityLen)]; short int data8[headerLen + rsFrames * (rsFrameLen + parityLen)]; @@ -1989,7 +1989,7 @@ void write_wave(int i, short int *buffer) int encodeA(short int *b, int index, int val) { // printf("Encoding A\n"); - b[index] = val & ; + b[index] = val & 0xff; b[index + 1] = (short int) ((b[index + 1] & 0xf0) | ((val >> 8) & 0x0f)); return 0; } @@ -1997,7 +1997,7 @@ int encodeA(short int *b, int index, int val) { int encodeB(short int *b, int index, int val) { // printf("Encoding B\n"); b[index] = (short int) ((b[index] & 0x0f) | ((val << 4) & 0xf0)); - b[index + 1] = (val >> 4 ) & ; + b[index + 1] = (val >> 4 ) & 0xff; return 0; } @@ -2305,9 +2305,9 @@ void get_tlm_fc() { source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 source_bytes[1] = 0b10000010 ; source_bytes[10] = (uint8_t) rnd_float(0,255); - source_bytes[50] = 0x00; // Sequence number - source_bytes[51] = 0x00; - source_bytes[52] = 0xFF & sequence++; + source_bytes[50] = 0xff; // Sequence number + source_bytes[51] = 0xff; + source_bytes[52] = 0xff; /**/ printf("\nsource_bytes\n"); for (int i=0; i<256; i++) From 094af3c1a3ff2a7d654204569461229233cf2d4e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:06:35 -0500 Subject: [PATCH 087/515] Update main.c add sequence number --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index e64630ed..9bbec852 100644 --- a/main.c +++ b/main.c @@ -2305,9 +2305,9 @@ void get_tlm_fc() { source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 source_bytes[1] = 0b10000010 ; source_bytes[10] = (uint8_t) rnd_float(0,255); - source_bytes[50] = 0xff; // Sequence number - source_bytes[51] = 0xff; - source_bytes[52] = 0xff; + source_bytes[50] = 0x00; // Sequence number + source_bytes[51] = 0x00; + source_bytes[52] = 0xff & (unsigned long int)sequence; /**/ printf("\nsource_bytes\n"); for (int i=0; i<256; i++) From 0fa446fe638e7e84bb0f55e24c293330a8352193 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:06:55 -0500 Subject: [PATCH 088/515] Update main.c add increment --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 9bbec852..9b996487 100644 --- a/main.c +++ b/main.c @@ -2307,7 +2307,7 @@ void get_tlm_fc() { source_bytes[10] = (uint8_t) rnd_float(0,255); source_bytes[50] = 0x00; // Sequence number source_bytes[51] = 0x00; - source_bytes[52] = 0xff & (unsigned long int)sequence; + source_bytes[52] = 0xff & (unsigned long int)sequence++; /**/ printf("\nsource_bytes\n"); for (int i=0; i<256; i++) From 6eb339da263afa1554158a536e8558acf151d866 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:12:00 -0500 Subject: [PATCH 089/515] Update main.c add sequence offset --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 9b996487..011f91c1 100644 --- a/main.c +++ b/main.c @@ -2305,8 +2305,8 @@ void get_tlm_fc() { source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 source_bytes[1] = 0b10000010 ; source_bytes[10] = (uint8_t) rnd_float(0,255); - source_bytes[50] = 0x00; // Sequence number - source_bytes[51] = 0x00; + source_bytes[50] = 0x02; // Sequence number + source_bytes[51] = 0x01; source_bytes[52] = 0xff & (unsigned long int)sequence++; /**/ printf("\nsource_bytes\n"); From 995a2e5d31592814effe2fb27acaf55fcb2baf62 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:15:28 -0500 Subject: [PATCH 090/515] Update main.c full sequence number --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 011f91c1..4094799e 100644 --- a/main.c +++ b/main.c @@ -2305,8 +2305,8 @@ void get_tlm_fc() { source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 source_bytes[1] = 0b10000010 ; source_bytes[10] = (uint8_t) rnd_float(0,255); - source_bytes[50] = 0x02; // Sequence number - source_bytes[51] = 0x01; + source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16) // Sequence number + source_bytes[51] = 0xff & ((unsigned long int)sequence >> 8) source_bytes[52] = 0xff & (unsigned long int)sequence++; /**/ printf("\nsource_bytes\n"); From aba7ec0ae7145b55c521d762ea94f2573e94bbee Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:17:42 -0500 Subject: [PATCH 091/515] Update main.h test sequence starting at 0x201000 --- main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.h b/main.h index b39db37a..d2c9411b 100644 --- a/main.h +++ b/main.h @@ -104,7 +104,7 @@ FILE * file1; short int buffer[2336400]; // max size for 10 frames count of BPSK FILE *sopen(const char *program); FILE *telem_file; -long int sequence = 0; +long int sequence = 131328; #define S_RATE (48000) // (44100) From 5fdae9491daf8c860a47ef906b2cae0331dfcca1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:19:02 -0500 Subject: [PATCH 092/515] Update main.c missing ; --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 4094799e..5964d3b2 100644 --- a/main.c +++ b/main.c @@ -2305,8 +2305,8 @@ void get_tlm_fc() { source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 source_bytes[1] = 0b10000010 ; source_bytes[10] = (uint8_t) rnd_float(0,255); - source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16) // Sequence number - source_bytes[51] = 0xff & ((unsigned long int)sequence >> 8) + source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number + source_bytes[51] = 0xff & ((unsigned long int)sequence >> 8); source_bytes[52] = 0xff & (unsigned long int)sequence++; /**/ printf("\nsource_bytes\n"); From bb5f3e82713d43b32cc699731ff0435209f370c5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:34:27 -0500 Subject: [PATCH 093/515] Update main.c add bat volt current resets --- main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 5964d3b2..9eed0416 100644 --- a/main.c +++ b/main.c @@ -2304,7 +2304,12 @@ void get_tlm_fc() { memset(source_bytes, 0x00, sizeof(source_bytes)); source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 source_bytes[1] = 0b10000010 ; - source_bytes[10] = (uint8_t) rnd_float(0,255); + source_bytes[10] = 0xff & ((voltage[map[BAT]] * 1000) >> 8); + source_bytes[11] = 0xff & (voltage[map[BAT]] * 1000); + source_bytes[10] = 0xff & ((current[map[BAT]] * 1000) >> 8); + source_bytes[11] = 0xff & (current[map[BAT]] * 1000); + source_bytes[14] = 0xff & ((unsigned long int)reset_count >> 8); + source_bytes[15] = 0xff & (unsigned long int)reset_count; source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number source_bytes[51] = 0xff & ((unsigned long int)sequence >> 8); source_bytes[52] = 0xff & (unsigned long int)sequence++; From 4214c0a0f9b6158de3390d9c2948d550bcb35185 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:37:48 -0500 Subject: [PATCH 094/515] Update main.c added conversion --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 9eed0416..b8d3afcb 100644 --- a/main.c +++ b/main.c @@ -2304,10 +2304,10 @@ void get_tlm_fc() { memset(source_bytes, 0x00, sizeof(source_bytes)); source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 source_bytes[1] = 0b10000010 ; - source_bytes[10] = 0xff & ((voltage[map[BAT]] * 1000) >> 8); - source_bytes[11] = 0xff & (voltage[map[BAT]] * 1000); - source_bytes[10] = 0xff & ((current[map[BAT]] * 1000) >> 8); - source_bytes[11] = 0xff & (current[map[BAT]] * 1000); + source_bytes[10] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000) >> 8); + source_bytes[11] = 0xff & ((unsigned int)voltage[map[BAT]] * 1000); + source_bytes[10] = 0xff & (((unsigned int)current[map[BAT]] * 1000) >> 8); + source_bytes[11] = 0xff & ((unsigned int)current[map[BAT]] * 1000); source_bytes[14] = 0xff & ((unsigned long int)reset_count >> 8); source_bytes[15] = 0xff & (unsigned long int)reset_count; source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number From ec519a606b6c104bbb72b20ba117acfa362c63fa Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:50:54 -0500 Subject: [PATCH 095/515] Update main.c fix telem --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index b8d3afcb..6d76c8cb 100644 --- a/main.c +++ b/main.c @@ -2305,9 +2305,9 @@ void get_tlm_fc() { source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 source_bytes[1] = 0b10000010 ; source_bytes[10] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000) >> 8); - source_bytes[11] = 0xff & ((unsigned int)voltage[map[BAT]] * 1000); - source_bytes[10] = 0xff & (((unsigned int)current[map[BAT]] * 1000) >> 8); - source_bytes[11] = 0xff & ((unsigned int)current[map[BAT]] * 1000); + source_bytes[11] = 0xff & (unsigned int)(voltage[map[BAT]] * 1000); + source_bytes[10] = 0xff & ((unsigned int)(current[map[BAT]] * 100) >> 8); + source_bytes[11] = 0xff & (unsigned int)(current[map[BAT]] * 100); source_bytes[14] = 0xff & ((unsigned long int)reset_count >> 8); source_bytes[15] = 0xff & (unsigned long int)reset_count; source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number From b268750a33badd943df88f6de07603a44ac55bdd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:54:13 -0500 Subject: [PATCH 096/515] Update main.c print current and voltage --- main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.c b/main.c index 6d76c8cb..2bf6a8f8 100644 --- a/main.c +++ b/main.c @@ -2304,6 +2304,10 @@ void get_tlm_fc() { memset(source_bytes, 0x00, sizeof(source_bytes)); source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 source_bytes[1] = 0b10000010 ; + + print("Volt: %f Int: %d \n", voltage[map[BAT]], (unsigned int)(voltage[map[BAT]] * 1000)); + print("Volt: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 100)); + source_bytes[10] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000) >> 8); source_bytes[11] = 0xff & (unsigned int)(voltage[map[BAT]] * 1000); source_bytes[10] = 0xff & ((unsigned int)(current[map[BAT]] * 100) >> 8); From ffe7fe1d8d2b575c490f24c71a1b23857a2379ca Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 15:54:38 -0500 Subject: [PATCH 097/515] Update main.c printf --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 2bf6a8f8..f7686a7a 100644 --- a/main.c +++ b/main.c @@ -2305,8 +2305,8 @@ void get_tlm_fc() { source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 source_bytes[1] = 0b10000010 ; - print("Volt: %f Int: %d \n", voltage[map[BAT]], (unsigned int)(voltage[map[BAT]] * 1000)); - print("Volt: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 100)); + printf("Volt: %f Int: %d \n", voltage[map[BAT]], (unsigned int)(voltage[map[BAT]] * 1000)); + printf("Volt: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 100)); source_bytes[10] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000) >> 8); source_bytes[11] = 0xff & (unsigned int)(voltage[map[BAT]] * 1000); From df01235fb77ab02166b33ab9b0df9e612a7998b8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 16:00:15 -0500 Subject: [PATCH 098/515] Update main.c print bat voltage and current --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index f7686a7a..24bc6ca3 100644 --- a/main.c +++ b/main.c @@ -774,7 +774,7 @@ int main(int argc, char * argv[]) { current[map[BAT]] = ((current[map[BAT2]] * voltage[map[BAT2]]) / batt) - charging; - // printf("charging: %f bat curr: %f bus curr: %f bat volt: %f bus volt: %f \n",charging, current[map[BAT]], current[map[BAT2]], batt, voltage[map[BAT2]]); + printf("charging: %f bat curr: %f bus curr: %f bat volt: %f bus volt: %f \n",charging, current[map[BAT]], current[map[BAT2]], batt, voltage[map[BAT2]]); batt -= (batt > 3.5) ? current[map[BAT]] / 30000 : current[map[BAT]] / 3000; if (batt < 3.0) { From f311daabf95107b04f06722b8943c8bad7fb301e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 16:06:39 -0500 Subject: [PATCH 099/515] Update main.c --- main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index 24bc6ca3..836e0d53 100644 --- a/main.c +++ b/main.c @@ -2306,14 +2306,14 @@ void get_tlm_fc() { source_bytes[1] = 0b10000010 ; printf("Volt: %f Int: %d \n", voltage[map[BAT]], (unsigned int)(voltage[map[BAT]] * 1000)); - printf("Volt: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 100)); + printf("Amps: %f Int: %d \n", current[map[BAT]], (unsigned int)(current[map[BAT]] * 100)); - source_bytes[10] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000) >> 8); - source_bytes[11] = 0xff & (unsigned int)(voltage[map[BAT]] * 1000); - source_bytes[10] = 0xff & ((unsigned int)(current[map[BAT]] * 100) >> 8); - source_bytes[11] = 0xff & (unsigned int)(current[map[BAT]] * 100); - source_bytes[14] = 0xff & ((unsigned long int)reset_count >> 8); - source_bytes[15] = 0xff & (unsigned long int)reset_count; + source_bytes[10] = 0xff & (((unsigned int)(voltage[map[BAT]] * 1000) >> 8)); + source_bytes[11] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000)); + source_bytes[10] = 0xff & (((unsigned int)(current[map[BAT]] * 100) >> 8)); + source_bytes[11] = 0xff & ((unsigned int)(current[map[BAT]] * 100)); + source_bytes[14] = 0xff & ((unsigned long int)reset_count >> 8)); + source_bytes[15] = 0xff & ((unsigned long int)reset_count); source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number source_bytes[51] = 0xff & ((unsigned long int)sequence >> 8); source_bytes[52] = 0xff & (unsigned long int)sequence++; From 989773974634628fe9521884e9f404cb6e8d5e08 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 16:07:22 -0500 Subject: [PATCH 100/515] Update main.c --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 836e0d53..e1a5cc93 100644 --- a/main.c +++ b/main.c @@ -2312,7 +2312,7 @@ void get_tlm_fc() { source_bytes[11] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000)); source_bytes[10] = 0xff & (((unsigned int)(current[map[BAT]] * 100) >> 8)); source_bytes[11] = 0xff & ((unsigned int)(current[map[BAT]] * 100)); - source_bytes[14] = 0xff & ((unsigned long int)reset_count >> 8)); + source_bytes[14] = 0xff & (((unsigned long int)reset_count >> 8)); source_bytes[15] = 0xff & ((unsigned long int)reset_count); source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number source_bytes[51] = 0xff & ((unsigned long int)sequence >> 8); From c4a0ae01ff90287acd804bbf0b7cd3313d1f3adf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 16:10:11 -0500 Subject: [PATCH 101/515] Update main.c fixed numbering --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index e1a5cc93..ff9464d2 100644 --- a/main.c +++ b/main.c @@ -2310,8 +2310,8 @@ void get_tlm_fc() { source_bytes[10] = 0xff & (((unsigned int)(voltage[map[BAT]] * 1000) >> 8)); source_bytes[11] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000)); - source_bytes[10] = 0xff & (((unsigned int)(current[map[BAT]] * 100) >> 8)); - source_bytes[11] = 0xff & ((unsigned int)(current[map[BAT]] * 100)); + source_bytes[12] = 0xff & (((unsigned int)(current[map[BAT]] * 100) >> 8)); + source_bytes[13] = 0xff & ((unsigned int)(current[map[BAT]] * 100)); source_bytes[14] = 0xff & (((unsigned long int)reset_count >> 8)); source_bytes[15] = 0xff & ((unsigned long int)reset_count); source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number From 4a283318c5f7b4e332094a787e663a397767008c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 16:28:14 -0500 Subject: [PATCH 102/515] Update main.c fix sim charging current bug --- main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index ff9464d2..6530d56d 100644 --- a/main.c +++ b/main.c @@ -772,7 +772,8 @@ int main(int argc, char * argv[]) { // float charging = current[map[PLUS_X]] + current[map[MINUS_X]] + current[map[PLUS_Y]] + current[map[MINUS_Y]] + current[map[PLUS_Z]] + current[map[MINUS_Z]]; float charging = eclipse * (fabs(amps_max[0] * 0.707) + fabs(amps_max[1] * 0.707) + rnd_float(-4.0, 4.0)); - current[map[BAT]] = ((current[map[BAT2]] * voltage[map[BAT2]]) / batt) - charging; +// current[map[BAT]] = ((current[map[BAT2]] * voltage[map[BAT2]]) / batt) - charging; + current[map[BAT]] = ((rnd_float(158, 171) * rnd_float(5.0, 5.005)) / batt) - charging; printf("charging: %f bat curr: %f bus curr: %f bat volt: %f bus volt: %f \n",charging, current[map[BAT]], current[map[BAT2]], batt, voltage[map[BAT2]]); From 003c3f7f01453e3af83b22546c19bc0284cdaee3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 16:34:25 -0500 Subject: [PATCH 103/515] Update main.c --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 6530d56d..f6b522c5 100644 --- a/main.c +++ b/main.c @@ -743,7 +743,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); @@ -759,7 +759,7 @@ int main(int argc, char * argv[]) { voltage[map[PLUS_Z]] = (Zv >= 1) ? Zv : rnd_float(0.9, 1.1); voltage[map[MINUS_Z]] = (Zv <= -1) ? ((-1.0f) * Zv) : rnd_float(0.9, 1.1); - // printf("temp: %f Time: %f Eclipse: %d : %f %f | %f %f | %f %f\n",tempS, time, eclipse, voltage[map[PLUS_X]], voltage[map[MINUS_X]], voltage[map[PLUS_Y]], voltage[map[MINUS_Y]], current[map[PLUS_Z]], current[map[MINUS_Z]]); + printf("temp: %f Time: %f Eclipse: %d : %f %f | %f %f | %f %f\n",tempS, time, eclipse, voltage[map[PLUS_X]], voltage[map[MINUS_X]], voltage[map[PLUS_Y]], voltage[map[MINUS_Y]], current[map[PLUS_Z]], current[map[MINUS_Z]]); tempS += (eclipse > 0) ? ((temp_max - tempS) / 50.0f) : ((temp_min - tempS) / 50.0f); tempS += +rnd_float(-1.0, 1.0); From 1c836a2ba6967840f9b4ba28e03cf8fc7027665b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 16:39:43 -0500 Subject: [PATCH 104/515] Update main.c fix sim current --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index f6b522c5..da373c37 100644 --- a/main.c +++ b/main.c @@ -773,7 +773,7 @@ int main(int argc, char * argv[]) { float charging = eclipse * (fabs(amps_max[0] * 0.707) + fabs(amps_max[1] * 0.707) + rnd_float(-4.0, 4.0)); // current[map[BAT]] = ((current[map[BAT2]] * voltage[map[BAT2]]) / batt) - charging; - current[map[BAT]] = ((rnd_float(158, 171) * rnd_float(5.0, 5.005)) / batt) - charging; + current[map[BAT]] = rnd_float(285, 410) - current[map[PLUS_X]] - current[map[MINUS_X]] - current[map[PLUS_Y]] - current[map[MINUS_Y]] - current[map[PLUS_Z]] - current[map[MINUS_Z]]; printf("charging: %f bat curr: %f bus curr: %f bat volt: %f bus volt: %f \n",charging, current[map[BAT]], current[map[BAT2]], batt, voltage[map[BAT2]]); From 3a8169bfcbd5d875e3fc5dea6e81d002db5f52a7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 16:44:26 -0500 Subject: [PATCH 105/515] Update main.c shift in block --- main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index da373c37..d2f229f2 100644 --- a/main.c +++ b/main.c @@ -2309,12 +2309,12 @@ 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]] * 100)); - source_bytes[10] = 0xff & (((unsigned int)(voltage[map[BAT]] * 1000) >> 8)); - source_bytes[11] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000)); - source_bytes[12] = 0xff & (((unsigned int)(current[map[BAT]] * 100) >> 8)); - source_bytes[13] = 0xff & ((unsigned int)(current[map[BAT]] * 100)); - source_bytes[14] = 0xff & (((unsigned long int)reset_count >> 8)); - source_bytes[15] = 0xff & ((unsigned long int)reset_count); + source_bytes[9] = 0xff & (((unsigned int)(voltage[map[BAT]] * 1000) >> 8)); + source_bytes[10] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000)); + source_bytes[11] = 0xff & (((unsigned int)(current[map[BAT]] * 100) >> 8)); + source_bytes[12] = 0xff & ((unsigned int)(current[map[BAT]] * 100)); + source_bytes[13] = 0xff & (((unsigned long int)reset_count >> 8)); + source_bytes[14] = 0xff & ((unsigned long int)reset_count); source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number source_bytes[51] = 0xff & ((unsigned long int)sequence >> 8); source_bytes[52] = 0xff & (unsigned long int)sequence++; From c62859adb9c61f9d7855d5db5a67b9faf9c48f91 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 16:46:57 -0500 Subject: [PATCH 106/515] Update main.c change to mA --- main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index d2f229f2..d2f46596 100644 --- a/main.c +++ b/main.c @@ -2306,13 +2306,13 @@ void get_tlm_fc() { source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 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]] * 100)); +// 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)); - source_bytes[9] = 0xff & (((unsigned int)(voltage[map[BAT]] * 1000) >> 8)); + source_bytes[9] = 0xff & (((unsigned int)(voltage[map[BAT]] * 1000) >> 8)); // mV source_bytes[10] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000)); - source_bytes[11] = 0xff & (((unsigned int)(current[map[BAT]] * 100) >> 8)); - source_bytes[12] = 0xff & ((unsigned int)(current[map[BAT]] * 100)); + source_bytes[11] = 0xff & (((unsigned int)(current[map[BAT]] * 1) >> 8)); // mA + source_bytes[12] = 0xff & ((unsigned int)(current[map[BAT]] * 1)); source_bytes[13] = 0xff & (((unsigned long int)reset_count >> 8)); source_bytes[14] = 0xff & ((unsigned long int)reset_count); source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number From 24345b17220e9fba4f6784515bb779c1a2de8564 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 23:01:40 -0500 Subject: [PATCH 107/515] Update main.h added FC offsets --- main.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.h b/main.h index d2c9411b..23a1f5a0 100644 --- a/main.h +++ b/main.h @@ -53,6 +53,9 @@ #define XS2 21 #define XS3 22 #define SENSOR_FIELDS 26 +#define FC_EPS 1 +#define FC_BOB 25 +#define FC_SW 50 #define RSSI 0 #define IHU_TEMP 2 @@ -104,7 +107,7 @@ FILE * file1; short int buffer[2336400]; // max size for 10 frames count of BPSK FILE *sopen(const char *program); FILE *telem_file; -long int sequence = 131328; +long int sequence = 0; #define S_RATE (48000) // (44100) From c8cf6463ea7208f8bc266ac176fd4f528eaa4716 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 23:01:47 -0500 Subject: [PATCH 108/515] Update main.c more FC telem --- main.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/main.c b/main.c index d2f46596..9859e9b2 100644 --- a/main.c +++ b/main.c @@ -2304,20 +2304,31 @@ void get_tlm_fc() { memset(source_bytes, 0x00, sizeof(source_bytes)); source_bytes[0] = 0b00000001 ; // 10100000 10000001 01000001 10000001 10000001 - source_bytes[1] = 0b10000010 ; +// 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)); - - source_bytes[9] = 0xff & (((unsigned int)(voltage[map[BAT]] * 1000) >> 8)); // mV - source_bytes[10] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000)); - source_bytes[11] = 0xff & (((unsigned int)(current[map[BAT]] * 1) >> 8)); // mA - source_bytes[12] = 0xff & ((unsigned int)(current[map[BAT]] * 1)); - source_bytes[13] = 0xff & (((unsigned long int)reset_count >> 8)); - source_bytes[14] = 0xff & ((unsigned long int)reset_count); - source_bytes[50] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number - source_bytes[51] = 0xff & ((unsigned long int)sequence >> 8); - source_bytes[52] = 0xff & (unsigned long int)sequence++; + + source_bytes[EPS + 0] = 0xff & (((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) >> 8)); // mV + source_bytes[EPS + 1] = 0xff & ((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); + source_bytes[EPS + 2] = 0xff & (((unsigned int)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000) >> 8)); // mV + source_bytes[EPS + 3] = 0xff & ((unsigned int)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000)); + source_bytes[EPS + 4] = 0xff & (((unsigned int)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000) >> 8)); // mV + source_bytes[EPS + 5] = 0xff & ((unsigned int)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000)); + unsigned int total_solar_current = (unsigned int) (current[map[PLUS_X]] + current[map[MINUS_X]] + + current[map[PLUS_Y]] + current[map[MINUS_Y]] + + current[map[PLUS_Z]] + current[map[MINUS_Z]]); + source_bytes[EPS + 6] = 0xff & total_solar_current >> 8; + source_bytes[EPS + 7] = 0xff & total_solar_current; + source_bytes[EPS + 8] = 0xff & (((unsigned int)(voltage[map[BAT]] * 1000) >> 8)); // mV + source_bytes[EPS + 9] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000)); + source_bytes[EPS + 10] = 0xff & (((unsigned int)(current[map[BAT]] * 1) >> 8)); // mA + source_bytes[EPS + 11] = 0xff & ((unsigned int)(current[map[BAT]] * 1)); + source_bytes[EPS + 12] = 0xff & (((unsigned long int)reset_count >> 8)); + source_bytes[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++) From 369c8c9291ce51400926e250ca3c190d777831ad Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 28 Jan 2025 23:02:58 -0500 Subject: [PATCH 109/515] Update main.c changed to FC_EPS --- main.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/main.c b/main.c index 9859e9b2..a0ee4e9e 100644 --- a/main.c +++ b/main.c @@ -2309,23 +2309,23 @@ 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)); - source_bytes[EPS + 0] = 0xff & (((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000) >> 8)); // mV - source_bytes[EPS + 1] = 0xff & ((unsigned int)((voltage[map[PLUS_X]] + voltage[map[MINUS_X]]) * 1000)); - source_bytes[EPS + 2] = 0xff & (((unsigned int)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000) >> 8)); // mV - source_bytes[EPS + 3] = 0xff & ((unsigned int)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000)); - source_bytes[EPS + 4] = 0xff & (((unsigned int)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000) >> 8)); // mV - source_bytes[EPS + 5] = 0xff & ((unsigned int)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000)); + 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 + source_bytes[FC_EPS + 3] = 0xff & ((unsigned int)((voltage[map[PLUS_Y]] + voltage[map[MINUS_Y]]) * 1000)); + source_bytes[FC_EPS + 4] = 0xff & (((unsigned int)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000) >> 8)); // mV + source_bytes[FC_EPS + 5] = 0xff & ((unsigned int)((voltage[map[PLUS_Z]] + voltage[map[MINUS_Z]]) * 1000)); unsigned int total_solar_current = (unsigned int) (current[map[PLUS_X]] + current[map[MINUS_X]] + current[map[PLUS_Y]] + current[map[MINUS_Y]] + current[map[PLUS_Z]] + current[map[MINUS_Z]]); - source_bytes[EPS + 6] = 0xff & total_solar_current >> 8; - source_bytes[EPS + 7] = 0xff & total_solar_current; - source_bytes[EPS + 8] = 0xff & (((unsigned int)(voltage[map[BAT]] * 1000) >> 8)); // mV - source_bytes[EPS + 9] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000)); - source_bytes[EPS + 10] = 0xff & (((unsigned int)(current[map[BAT]] * 1) >> 8)); // mA - source_bytes[EPS + 11] = 0xff & ((unsigned int)(current[map[BAT]] * 1)); - source_bytes[EPS + 12] = 0xff & (((unsigned long int)reset_count >> 8)); - source_bytes[EPS + 13] = 0xff & ((unsigned long int)reset_count); + source_bytes[FC_EPS + 6] = 0xff & total_solar_current >> 8; + source_bytes[FC_EPS + 7] = 0xff & total_solar_current; + source_bytes[FC_EPS + 8] = 0xff & (((unsigned int)(voltage[map[BAT]] * 1000) >> 8)); // mV + source_bytes[FC_EPS + 9] = 0xff & ((unsigned int)(voltage[map[BAT]] * 1000)); + source_bytes[FC_EPS + 10] = 0xff & (((unsigned int)(current[map[BAT]] * 1) >> 8)); // mA + 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++; From 1b114b4541c945f6c7210dadc953659a20c31ddd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 29 Jan 2025 13:02:38 -0500 Subject: [PATCH 110/515] Update main.c reduce sim current --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index a0ee4e9e..0d9fd5a9 100644 --- a/main.c +++ b/main.c @@ -769,11 +769,11 @@ int main(int argc, char * argv[]) { voltage[map[BAT2]] = 0.0; // rnd_float(5.0, 5.005); current[map[BAT2]] = 0.0; // rnd_float(158, 171); - // float charging = current[map[PLUS_X]] + current[map[MINUS_X]] + current[map[PLUS_Y]] + current[map[MINUS_Y]] + current[map[PLUS_Z]] + current[map[MINUS_Z]]; - float charging = eclipse * (fabs(amps_max[0] * 0.707) + fabs(amps_max[1] * 0.707) + rnd_float(-4.0, 4.0)); + float charging = current[map[PLUS_X]] + current[map[MINUS_X]] + current[map[PLUS_Y]] + current[map[MINUS_Y]] + current[map[PLUS_Z]] + current[map[MINUS_Z]]; +// float charging = eclipse * (fabs(amps_max[0] * 0.707) + fabs(amps_max[1] * 0.707) + rnd_float(-4.0, 4.0)); // current[map[BAT]] = ((current[map[BAT2]] * voltage[map[BAT2]]) / batt) - charging; - current[map[BAT]] = rnd_float(285, 410) - current[map[PLUS_X]] - current[map[MINUS_X]] - current[map[PLUS_Y]] - current[map[MINUS_Y]] - current[map[PLUS_Z]] - current[map[MINUS_Z]]; + current[map[BAT]] = rnd_float(285, 305) - charging; printf("charging: %f bat curr: %f bus curr: %f bat volt: %f bus volt: %f \n",charging, current[map[BAT]], current[map[BAT2]], batt, voltage[map[BAT2]]); From 9062dfb3901611c1dd2a5c872e3c2cee0071ded7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 Jan 2025 11:08:52 -0500 Subject: [PATCH 111/515] 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 112/515] 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 113/515] 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 114/515] 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 115/515] 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 116/515] 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 117/515] 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 118/515] 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 119/515] 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 120/515] 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 121/515] 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 122/515] 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 123/515] 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 124/515] 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 125/515] 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 126/515] 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 127/515] 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 128/515] 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 129/515] 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 130/515] 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 131/515] 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 132/515] 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 133/515] 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 134/515] 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 135/515] 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 136/515] 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 137/515] 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 138/515] 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 139/515] 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 140/515] 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 141/515] 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 142/515] 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 143/515] 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 144/515] 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 145/515] 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 146/515] 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 147/515] 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 148/515] 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 149/515] 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 150/515] 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 151/515] 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 152/515] 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 153/515] 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 154/515] 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 155/515] 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 156/515] 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 157/515] 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 158/515] 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 159/515] 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 160/515] 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 161/515] 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 162/515] 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 163/515] 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 164/515] 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 165/515] 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 166/515] 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 167/515] 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 168/515] 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 169/515] 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 170/515] 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 171/515] 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 172/515] 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 173/515] 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 174/515] 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 175/515] 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 176/515] 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 177/515] 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 178/515] 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 179/515] 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 180/515] 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 181/515] 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 182/515] 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 183/515] 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 184/515] 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 185/515] 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 186/515] 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 187/515] 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 188/515] 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 189/515] 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 190/515] 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 191/515] 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 192/515] 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 193/515] 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 194/515] 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 195/515] 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 196/515] 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 197/515] 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 198/515] 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 199/515] 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(0YLjRu7wY32xXLBTIkFu%Kt<1hFF3MNK*Z00Dq2n9cbp#((16Tj+T z{Q+jixU*K2&0-IUGASfJO6b^$q!~w-0UH1>z{1@!= z3x?RcqGbDBe#NNwEF82nPo|`sjb^7%~6=f?xokrv0C~S4jXs z?OOog(WIj(%=C9Z7^qKlOH{yqm0^4gmmo27l-c)%L3$kUb6nXrgrWq8|YG zm<#|swL=7yPBO+oF;$KYAFiXy}+&cd&6VaPd&>N)G^N zD7n!wF|e>OaItVvc8iXI3BV$}Lqv>dr$tbyH$gFEN?l_etob!LMNDUl@264zNjsvf5-c%wnA@hHs|;_b^ah5MmGl zBmn1HlFV3uPsHc}YItb>4P!ih<-3L9^X+sk;qj9PP z3ymVu;}dQAj2gz=AIx#`BCTy9uN^o~F0ccKZ3&x}g#e$6q%uGV@z(Hft6 z;oKo9iaclG#f}S`agy{*SPsErTGmA%fvlnpB~fFa2_l z$m`asIdR?5<)41|%%HdST1PTIb!}!epmRBJD;fQfU_XGK@_%;!G8s+M@Obv4`{g#d zv-jKfhQ!`jo+_%fi*^uEc_zM?1Fi<40Xj#XpIiy7FblXZ(I3#5WdC<)hvqahmdE`h#Oxr#9q-QN3PM9 za0CuAqe5RUC#84Mhnz8;!r}0GPI(YEo?XS$00*@!2T$*C$!+kYKUOwt;fjfibc%^G zUJ`My9ja0iTuiNJaJ=N2RGQ6nWgE!KhA3LX6=B9Py2mdwE>;*ml$2=F3g84%8t&Z>DDRs!CeN_e{9tFic z2l^j}dxnCBn_8a=!Fg0<4Ju7b7u1>!-y84e87aSLYAo68Sk$7+o<+D$= z8FQX0zq7CyJBtq4nXa>X9rYs8$v6nOp9hSJ7z;Pk>Wu3h7<|;belQ{~ADRNzmQuvL z7cHx*9@5dVkad}NoEmoBu*ZiFPXv~K9UuvEUlUaLd@|)dme7HOY-;3=8P1U{dNq?* z);{Tguj~lrw@rzHgnkIM>2B^1`jTYNj**3QvR^UCsTsx5W6bfHCHY&SBo(RQHy-| zd4VR6DKOPch%YEjMNu=X5NE%|!@KlU3~M&ebOmZmD!`Ymja%1iBdAiM-WD3WxSX=k z#jp1&tBp5)wA(P-_ek1|KLA5Yf|gai%g6II_48{xTZgqNx~wGkh^wR43*SLD=zX$d zpv}1R=>Ws0r24Nl1}A4NbMO#mbsEfA5VRO-e%K>W@l*j!R*UTpX{pcmur^(zlnGT6 z(Zo~Oy-#HLRh8r35$iQ;JN_|xz{9Eku%}JW(uVn0PO~5B1zlvZa~W!bKR;FOeIz$h z%Rn$lEns{2a1J9LUT=h?v$}DuXW2-BP_R0V~-W~hDxxk zc7RIsyGxw^7(aWu1T4{rOg?9a)lmEJEADOKTd$RW3-EsAeG52^x&>(H zMxJaEye22my#-_mTjUg{fD?Mz4Jl}xgE+%)Y>Yhnn0{;ukTl2>n*7*}s&q?aQ`z>5 zGL0fJ7B0O7P#0uOBwxi@uCIi$NP|~8U#;X59z_#Lu1(v>s#K*xw2K;~7_V;ugoSOw zP*dJZ^Ky~UxcnQ!Z#vU=gR@hC``t!@E^2LmHJ zMkijQo3)=;dLXH=!7Ta89r311%G`})iwHrsx?xa6&SlFpC&#>m4i=`wafbTioU!jD z#l;s-WV&T^>@tBZ7aF}IF$wv;5@eLM+6F9__jZ@4VdU`ZNOxNZt6TDjbX`GgL&JVe zte#%v9+lo;uEkKx%+lO5GSZz3H`m-RW|91evpKtO9`jIkd`(cUAQM%pnRM#T?#oRh zIW1f9_sVzsD3ZRNxE~;omAf~luxv@);>%LkSXDKA4M)CJrskA2JJsS76!HZ>qEsO( zBqBH9LZZ8o)Jtou}&?1-f$*-NObJE;;+ zZG1; zHpOl7$&ni_7DE{hD`_=wb_80H8*~mRTwkX2wWG> z>4n=E!@FxXJ>5krrRR~SP4BIhzzHmZ0OD{+HwIO^)p+vOoK0CV^a-)a-LT%R`gvab zX`Qk$+fDs=?}@P}tmm<^$Wj*pq_@>Gd>f>kn;=jw7g)Kn;z>aFJs|USL*bu z*6Wr|b)=XkFS(nY79uyLp%SfTCN(#{B`XP@c_ONZeI9CK4JcfQs2X>y+@%;WG}5ou&{{UHYG_e^1D)5dYy z@MD-Yb44l@5xykDE;h{-LgBPv!!3O%4_9DT4s=)aM*O|+G`|RRiercmQUc7E6OPc= zoK;F?*}ny_+LZ7gC64&uay&D;wsh=vR&8a(QR%<*qKM4_2rvi!pf(!){@qP0n`|Cz zLnU&cUllm0Ps>6&}L z<3I>Te6%T@D4Mfms}{GBj{mR=d#)~~at~@{oI{4E$Zl}ndL~|~QT4rIySOI7%$fZ{ zi;?vM%n;Z9Q%2lbStF2!lk7Ey}S^B_PwDlhr(x3Kz|S z(NJ(4G`BB{%Wb488o8-nQC2E6J)HMw_eZ4ROtQ~emv|xLz-+$DZsGU+qNz~jnx1HG z`WH4?^I%`JPG3R#sJ6KD6NL8I=J2MDb_`f!wKC!sAc5SS*wV+g=Dq7nW?ZnYRXgae z&d$8w5&^u5Gk}4@lAj4jK8>rHx}h2oHkw*B#Owv%RiOpI&_N8bzRnY;B@xBSo7IAa zU!=wL`Ucw%rbb&WpB0Owu~#ddOdIppy-YlBTT7}Hy$Vm?aQZ%#P8no)ne*WX1|ipv znyTK=M6d|02bz%3<2Cv#zCO6p&6q1(>@Z760Xp3pDv1z(DA8~aYV_5XI%);;8jJyqO{hVT4o2yM?F*VIZh` zIe_h6uid46%Hmy5w>Vcj`txDazAADs8OZ><@iOgF0I0$St z`FaiF@}2h5@|LyAHvrp?jS%MHH?djX0R3e%c*f4`zmMCs_hpW%)*#<%UM#*-CF9Og ziY4}-hzpXZHa^kkbH(G$mQ@4YeY~hUJ@T=-Q1?^>++2t#)>ey96l(DOmYQg+zu0Sd z4yi5W?#a!xQ4Y4TpLHNAjt#4iqVHpqgkm3{^@tsXd%Zj>zWn$D9B+YA3VG4O+R$MG zW343ziw?X%2O*d1uOsTjPR+tNKA4ov(bKwdeK)Vfaa$v!ai-*%C%&SFMedX;jwqG) z!@U8aM_<-1#YV5KRX6b-ydL05oZM=CVNDq~yjxVIG+bX-XULxY7L%6poM~}jZ_uys zkz<(K$W)Z%G=xkfrRKfcns!-PZyG*BtRq08WADcgUWC%-*oEu**9aB%x-X>3iLXoC zET|S1HBYhSHkkLNF5BS9^RquKoTVqSwDXj21K~UQwgppcnT8FT$k|MiD7d?0+?i7N!7w)Oq4NMmLid#UqCuJj4Y`f07o>QbnU7T-mW zkf>LSoa*q_6FJ1x-A6-+6k$R*D2!kh#N)Bna}Es}FW4)q=1`|huEnXYr_CXG;9swb zOfYMuc^Fj;(VIqAm1}|za&AhUL#D*^2TgXglsDt9pKnT85nNS=q&hEG29}n7cU5ih zv!!AUsOAq?P^6~8#awEw?@-Nvh$st=bcOjND9grxjZ#xewN+~uiHmVx&%nxpYpdNS z66#&ZhVn_yRQ5JV4rlKG415RV=Z$hMSxXY^L<}tO3W*@K=RY4#@7PWojjcGnI+7y{ zra6d+{b6;b@*%`^Fzr`10q0YIs<)=-F=jiBS8|Ctu3*<#$^F{z1owoGN@1Z@J7w|} zyu}sJBy_#tfjbIEobLJfZZs^$^OjAgg{2eg-){jAImi@>r_cS}%PZxkiofpD``-+& zx4yocUA{Oyz3Hw_m%}2UcvtEb+f9FY2xF>KNPh7U%u(F%Tppyo!^bBCnp|%QOEE6B zI*cSc;Bh+RkD@w`lo^}K-%Im z#t!*|!DAiO3!{RI@_h1&4L0J&l@49j=jJ}e3^zw%g32~Gj1R=Cvwi*Ta)(`aH<{(f zFFmiqt2R^%7ji3HVWPap<88CC;+dN(hd&Bkh1!-jtR3<@K?lqLGKQR+jl*ft5a!VR z2jiuUGFsCcF0;Z$wtTJEVq{(J>#kynX$4CqhgT8Mu_*GX5kyU=Jt;3=R#m%O)0=s{ zu2{{;X(`aW{65oG0&Al_)WW`qwRg3|7U{j}ed8xFG*;*dwhI#BkV)xbh*e~`NIta^ z{Wl3C8dWR+Ha%TH#9!)~`0G0!jX0-RiUl)26(DAPZ*1Hi1Y*ajGw~xkea(QWM+qH> z#+Oq@Z1-S@GKaj5igzbWecdR^z8)F>Gj9WO3wR-ubngVbM7XM7YfHx2j_!`B5E&C9 ztQHB2hGRWUL!1{r)#iNJUe}Dzdw{kOmhboYL}EL_$;^;H4IC^|1T%Wgi@%cRh$i@j zndTWfcT9{XPjXg(8p)UeWf$1U%mB#AV7LoTB!9)gAHP+Sf2yPwttcU-i2xJ7+SK$= zPVsrK*t0+!ldorG9KtBK^Af#T(#|?L;1B0*f7|6nan=Irg-c&j-j~GANc7?H8p7=v*+BSki8@p5-hjisxe{dvGD!RnL8v0|L zGH4BE6Ij}o!o*kPlh5K28rdYOv28|#-yl6J@qDoVnJN44Hv4<3dLU0I&mR!FH1;@j zSQslY_A0W)L~fX79trzp<2)u$Ont33!AddqY+_{DMq$8!>#$^p=C#m|Q%ylriMAj8 zJu}q@Z$!K8J7Uv5`LZh2#ui|;spPtNmgO|#o4XTj5t-E)IKgvPSd{{M6-0xWg(#1P zKvivGN1({GpHb!IrB(Jhj3LHp;Z(8R6j%z-Ylpdoc8DX)&pBL%(Tm6<;F5=a?s)hj zW})+Vtm%72ECRQjhem=W{tRqZe^bYl(P&KhsB4b(Bh%BA4YEKn^@7aY>(W)GyeI1A zt3Y?sTfpF~Tc9dd@w{wefNJy0x2A zXZySYne^Zr^Z6l7hdm!<>KTi)N6!+gkoxByL4-0EOg{)5?Z|bm8BY<{b@*vjCS!0z zQZ67q{TLH}4QDw}dYXO+kPcXy3$}=3h-YENV*#s5$2v-#-3cz0sk;*J%}pw1v{Zew zC02F9A=wRGNQ+^?^>cofj%SGPQ(zgu(vPf zL_@*DWk|RWBsc7)Y}gELti+MsQUeOYcr9w+!9)r6FPXQ+jaLMvFfD7C9>E)DhJ!Z+ z61o>#NhPebE*K{O=g@=ES zu-bT3S|8IgM6pb&tN8A{qfm@~B_@U^gyEPuuVWR}GliH~SQNx+-7>+r6#LA$w}36; zXU_?S)E?I=3Qrab6CgDFzPnG7ddlPa32VOaw8p-yO_pFCIX@K12|_~~{D}1W+Rm5J z=@4ybq?i3*3?49LAiMEKTZ2$uM9G|K6-S%oOce{C8|@3&Hg55lu^Q8MYcRwv{F>4e zY2WG4ATpnvo0e`W78veEDiHyGO&*-HMpqAZ;W3QoR zwMwPmkj9$TEanOl5S@kBtni2;HR94cLF&LU_uA7pnG+f5nL*H`bBt|te1>?KP{_Md z@ZBlC*2r{Lgb*TG&mWvneCo-92VgEPdyq3v*~-ZT^lBMl=fk3w&Dfo^-j4KA*RY*f zRG>e5SIq4ciwE|07e}%MfhTDk=6#t#bgwwMHl!aD=eau{My^c-6YBScF_j%twFLx< zr*#0ByZkpKm5jc$d5XPZ)}ya#V)6Yr)mO}}UrkyYCZb}4i(jKb*$O1XeGwNsuN>^D zvUK(i94Uu<0Aq{QFpN2A_^~jUb8$DvVLkDh*qM3C@ z>~kSgkUr?+kxu(6VyMAC+iQ35Q}sRNjsl)RgAY!Ke9uuhIF=-wqF6%k{PP!bRTcXK z_U-R#zUN1Ajy-EJ`km*5-I#yvIlm9vFvcC0?>*^C<@7{gF<6b2q)T@Bd27(bGe7X$ z0i(ZDSRNw$=Tr_&$J)K8K~8FmdzOAy&}@e2E-^2nKb5RLa-$l{<TIh&h0nY_d{+(KwVEJY4*{G_o&lhXigih0`7|(er}B_ z2tiF+EA!EVSmn2t>Jf4WgGc9A%UN-e-xlqv6SZQM`bD-Bqp8fp18=^UlliQXu2B%^~xGjM~n ze9N!MPIbMHA*|!eHCe$;)O$Uu)4TUj#8j7~G|kn1VmkyS=Kp%dIrPUnwBQjfGxOfs__ zc{23dQAh29|260Ut(wx{<>4F82O&v9KNO+sm(c()GrRzD^1PV;vPm0O?S!r&piaOs zJD-%aFXPw=r1Y{~q<-%yMp;Mm$uaX zQpye*KH9+I5phRG3S9jZIV< zlAY@`Exz(>#S3X)YdL5fC^*4c?CYlAv4FMlNkbS86EMCgmI@e080ek33LPEW9NL_K zzD+9e=ta@5jfefH6sA0QSS_JU%ZDc&7S%Vr&H~9J&RI}>&JbMFLZr+}TfMD-)#CnA z>!{MaHv_NdunTO>R+CcK6ZZ7(jzVNL|CL1zc-x(bq`B5Wg2zs^W92SjfgwC^6|t!I z<$WcEOyGbJ-f1DxcVS8KPXrp$Igz610T70x@MKcuZ`=NNsVzGzw#>>o8hW^S-J%`g z?X=eI=lP;hz-od^+rl~S_OXoT(DC91kzOb-p9bV_`&wOkMM?P@rtnmyt{d^WFx8w~vn$K#huiVl_HOZ?ZpwPlGS=8xV5SJ&FQ zjUu>g!%zo5(>SxXR3d}W1jHe4L7nsIg5m0E4N zP;SD&2K4SR^fW#`#|n*&_TE~J5&a{EyhluH$w~Ib2<-@X(4MWb{a#y3N^25w6FjoI zG^aJ``>jnUH1ea%U8RDa;T@_kEy9zw&-1A8=a<79nGQr1+G=tz!j#y5?S(G>(ENEAq&= ze&0L2ZPTE<+37Co(JQ^KVtrR*%RW(&CQo$@yxow7Ho3=%6Mf%rK6KATEijl-vpiPQ zKKtCBt{j>Z1OGKaX%>cbJn79I=lw@w_II-s%a-eym9R{ z17@S9)fuH?-?VHB$``CmUE+$aW%hHDPF#b|@h@{RKF!)|Nt9=vu_NDI`)wtf|bbHfv`Qsdoa+q;wjYqw{jY*3o^E zL{dBaknV@0c{Lr|2h2>#{mdX7eHbwg%>_Y!0z#J#53E=#+1N zxWZwoVmKn@*%x$`HsQC4HI&lv@l9!=3|N#sUA=M&!qsrC5!(#$kINoAs$@pv?((J6 z$ax8pR;xyqFz3-U@xzzE;E&wTO6wB8*PhipOG9XTqf3fa;G@}$k6K<99DKbxVUkDM zA^rN@u}NdPjF|S1kgBy?aXD2r$shT*huauE`xEuw@bqTr2i%Vuj9bSoeeN|IRY*nH z((g+?oCussQDYSD(q`Htd}`<_K*Soj@SjzU}P9jPKn)BI@onpR!U%efZX zE1lz|Hs1&bleMR7h{TBRMV#6RN-i$mYnnFSau_M z+&(~_nBqG`0{kCV$I%1$|dA zgV!n8!+NJAH0$L8Bt!6mUsb%WUwK)1W>8cPtF3W^oI8rYneUF!Ex?*#P2%9%j#Bn* z5VL6RwTjG2#(_4E5I2!VYUnloej{Ux4VPg9{b*DaaC|eZx zf@6N8w%Cgf$#K!2JBCcDN}xRtl*P2a`$Y!B33KQ15*D5yeUH5An78Vv!A06ERdi(E zfxiTzWpi3@N5vwwaP$^HG__VtP&d1~Sp%`vmTh2}=;?aZ1Y6kYt&EanTi3UIYX;}o zKR!F!y2+rA(_bxy`X+yX*)`aa*gi5=9012%W67}4QB^be;BEPicHeL4Q8It-60~jQ zDgACcb29sGBZ*t)!QZO+_u4tzm(L3W7RZ%?2)aQpNx_n| z44BM;;1t7#4>OwQDXm}SL&dCycgTFrjvg8g0$h5z6nz;*)hdf25lvy4!3HRgT!|^|G}ewTg#98mPfO{3mI*0ODEt7uQnu z&dQrm&UU9%;+k5bDO@L9CKy=h-ISszmFH(BIyoq0y$lSu@HGx9e(L zSvfg6zM#-qWYaXZbj{isVS`V!xltshg!Tug_^iB(+b_^;+fpKxe^x|nO!Z_|u@B67>S&z*gn zjZQ`{j8-qjUrfePv5Q~5#hZ1NXJu3pMICl|^*J7708eTc>X-&IKFd25n4D^k195X$h%qN5ykC+ zj2!X9cpiy4EAi%8gNO|J=ND$f&8At()#7adkwYT))TqK9-KVf(z6Au*-)PcfN_ea_ zM1z@67|a z>T;&Lc*rmxI(KewL(!?Y_GUSfAVbRULL|M`XKHta919l?Gx*?{xaxXpXw2%L71d^> z<>c{8QZpTQHv}5=LOnnf&BB%ahBhPF&O4{515M(GU4)=TQ2v--zDIo;!k!KF8$abY zLDT*5!Xw31)2cN&w}AKTv^IhaM1l-Dut~m0xn7pjZ}h%j4D6qNc#jm+KHCMVl9D~H z6Z{(TW)gB;5{%f%K6`+xL?BlCK$Ae)!+LE5W{|z2>EF~Oh%@6}6dq-mJQ~H5bxu-z z58xaV?R>SxrR^bz%Q^^y1B!fA?y}3L9|UMNF+_d1P{Sl+0K~840EjgGiCQ^qyBeQa zHZxYx?I4@!q0#{5aqG*G@T>Q_;HX0>z8HCza1yGAej!Ok?h@0KdSehzsJx*AJTa#ldy7xw&Am;IN;1 zH0nu1tM-h;w~ds9&OY@tEjNa9dljY zk8$|?o_lrZBP|rzqd}ZiOI&Nj#FRLMdW{%o86m5;I;G3UyvOqz5(?hMvSK)zInv$m z?)+9yh8a+mgBG0=Ex!`lt4?cZmFc(?TFCwpE4-@^yv4D6wV6h1;;PnTiGvBxRQwGq4s@p z(%NT@$^$tlHybhtB>*?@1r<*ipJ)6WYg~oUz3#uzB$B;5o6d|==$_eu#`iC~(Qoiu zgWWKt(dbrp&4$6VuW4q(*78(XyoJ{=C-%z9wJ{65R z@5a6;g0o!dY7-NnNhS{!;voh&SnSP_MO%}qX{-keupcPbnk}>Ay^|_)0>u~|ZW%Mq zAA0)7MD9h&xa@&X*iUEklqW6btV%JfNh&@C-Y^zcJUmfHuXZQ}79q}R`H0Q7&S!e? zU@7hDW5Q-%-o$V4A)2Mels8TE@7w|=+-lt_g18Qw>FML9aakU3!*%+%P7Aic2sX%* zq-*FUN7uS5Nh*tcWaT;O9Q@~Wm`z0*$A~hoGB7PCF>c@b@DYZnnYB`)=ZXoF(ACRW zw<3|JYZ_D4!X-J^{t_9|2^@}fEYIlUPWX!(x7dR6j2-Z27}C+xL>asp>4T%PBuS20 zd07m;Ho__BKe7mkRt$|h>xHIQ{q<5g8af)q5Q$n|2`*THfU|Y)vCe`{?Xr9(^~I<7A=c)h+#4X?i zY*=q|E#WenWLfOyVV5D~X^e~}ngXoYsngKXoT=0JD}B{(VwMkuVoQGoH6ROFNy}kz zmtL)mo8N+rc6)}i61TY@BfZMYz$;rX4F#1>!$Sy~bl3JYxo!wIg?#wf&kE{HS4OXV zTBtR~l$w*Q#<5bgN`#SXkNkg*>s*1L46kB^qYx!eEVY7UcMWRZJFB#5S_rkjCzqCq z%xGUgqbGllyBtoWxZc6sAt%D%(NN7~Tv)8N3QF;=Bm+5jvc7nZ{A&{au)2p8Q)y23 zbME)j+>5>gLheiGzuCv{+jtvj2YGW>|8=2PkXQ?yK9T>c=^y0rKPVdM_u+!OgsE!> zQ6?XLoVK{;?zkkYYOEx-X04rEP=;!=vPCY;rxeVwRrv+iJRiPh2$*5>5g=L1dT3e) z9+11+dj+LHkCj4`vTbX{RaN1s9Czn-f6`vJd~TKMM@dLhg6MEmlV{#6_Vpjjegz071vOh#u>0NJA3 z{uB8S#iKh*YRY`r#%>zZs@A0m;!ePrWuThB)Z|V7*2Jom@=ZB(k;f^r{s9AdfR4l0qME&`rWgcq_UxAqGC3AXYt)NuS+(KMzID!r8zn~5`l_^Uddmo8gq|>`6jB` z27f@+c-S%hj+3zc4QWj2nO^I%7znVRR(@;gTlkscet{$*Glh3GWR9QZZK0f<(223@ zerWphGYsp`|D+fLm(~7EJ_8;$hA(Dr-%Gqi-d8MuJOJw0%}my;-@lVB>pHTMNncCd zBoBBP7jVZB%XYXb6Dp($S9y9~v73`qHW?mRD=}8n`{2=xs=v~|PSPJ=7N}P~(LT{r z$;4187uDsaN%d;K4k8#r@+N=fz!el{ZsI--82dyG3+8e@u@J=Zx%}jZI;4GDe%xgi zB}#ElUc$QNv7^zK{nJwdlow;8uO$8D5e-F5At>$K8f6wuV{`E7J>KJQdCXe0zYSY)wHUvjqH%h#;P*6C%(78ZUqi8>gxj36-IVKE(M^ffg8H-lp zJ@k6`-<@nSvh-;CTI0}?t2!s6d;PO6{yZFFoXD_6*UH8u4n@B}cJ4Lmeb_V`ptrT; z2(I6z6o32k7BDyH6opUTm9&;L4|S5;!YgcVy1J2w8vizUVPl^_I<*C@$ThY+BV?2Q zxn}m^77*pXNOe-Kq_`XD>jj3Zx7pp>W3O~M7qi^ZI;e})4TR##XcvaJWnW5bcxoUZ zWl=Fz@ovN6>SuVY7kNO;fu%=}qKc^w= zw=8|6j9WayH8ED|P{0baQ8ZmD==JdXC_gy#deaUq<=K1dhda_Zo+kR}=6Tlt#_Rl# ziJ{-|%e|IuJsi&@(!TzDmb+3cV1?xe@@A5nGwj?Bl~hT5XBNGl7F{O3ZM78Y%LpaW zSP;xwj;lL2lkPuhF&w_7H)rfZ{UcSL#*CcfML zQ@(fj*)NV2}TwfjftO$c-q98 z5xuIaA{03X2Cl^g2A!#^HOaj{ElRiTzzum$LT%J#KTWza&VbeV_5rwp7)%ptWS5bz zk=kL<9o!n57}I&8qap+?&FNr`U-f7qd~OK-1DS;sof3+7Rc1Z$4t331TZ#Q*n4SCL zv3`n1ARaI$03P6oyA!AJX3SAe+tJwGi}ezb>@;nZtGOEOhUhe4RS=&%yKpZFsmXBn zNG;wFVqA_OPm>!SRw5%YBfXlOPvdiT4NDEgogb~rQ3l6F(I5=K#02!Li{*t%yL^nF z4+y+RILNQQmFxy32s#xF&fc&$`h*$TkW2q#Vs}n9tb%TGU6ob15bYukQQ!Ao)*|?P zzmRsTVocQN9Muv0j1D0vM)My{2V5jrmG?E-yl*f;oc^?C@6!%x%39pQr9|c`sclf) zY?4G73w;tQR|FG-bK((9SPU;;@1TAP_~$Yi0P&&+6x8_d3Ho2H-U2Q|EHZD*{g}IS zuIjJu_vh2t6oW?DiUUzO#ld*Prz-~xq_fK2onxP;t1y>RV|@$P-8GA#uKG3L+@J6a zQcqE#d~}&q)Yt^u2WA=K90MysSOX)}*@ZvDINIT4=Ddr3K*hPe z=mq?J!Oz{(6K5qxPipqR8zAH*ij-3f_M2}3HTY>>Iy_^sAr90SK1u9?KmC!meenF_ zE~P+=wz=n3Wqv>t$FiEXq;Q|hNPGf&@I`g&dLa~fwA8t0m5{WRQBF$ipk3^IvFH9e ztgXrTlq?r#26!Q_B9XV$ThX1q(@X40@a&t0jWq`gt0V^F^B`4KL4f;Wb^b;TEE6w2 zHBF(Tm6R)k!?XU^?r}(qM7ggom9XdM2tlFbFm-#BZ=-hK3IyP~#iJ z;f1Ip<$b-2)NA!it^Vdjg{mYLMDv-m#~xa>T~tn zaBF|ttE&-;M(qNpY?)+HT$mCP@@{t2R!n@jc(g%1e#-Xi3V_|U!QL$6MG@G z$wcN^tD!yrjzCs|Yn6zbuiNLeEGY{dy8-8zD)XXP?|n{@)y5<(`}Jvkkx&Q7*Fju% zrj_w+#~tfA?fRxuuTa9J>zSILW~Wc1hPzd4`{jnoy;jgC`aqp;DDSgNxzZ{~$NS>| zQq$KcyunWx1?LQ9nFL1^;i&@c6>)xPN`r<4+dI>-!JDddZOOZW`jWW$?ryP4$p>Nkr!>yYph_jg5VI#{0KmB&)ts(Sj?L;Ncsx zVNkkXaI%AJ$@h_FaC@I(`UmGF9-1qqtL`_CV=pR#0GCAf8&z*oEgiy86rR-6s`z=}lwP)$v_`~C1-Azo8Vwiv{ME_&z zi&RCUHLj=Xoo|6G1Ac%i0Hc|i-|H^GGrzur=2g59*cd7#1e6(l%Rc&ay(qPuq(Hxo zsWB*btQvf|y`rjiTWa6>FMZ7Xug?~;(bN9sbDlqcrM&OAS}I4;d`X|4Pdwh<7o)@1 zI~(UMR+QtXi9c3{DCXvM3a%ZQ+1$u5r)AO)*@+#X`z{r8~ zfFD1B0c(9}Yq;aWR_r64{58XUkWt!jk)8(pW?4+Nrg?6q7RkA0csG(SC_AYw=ntp8 zWAnx&RG!$@7WhBvCsGs@=X`cv2fwtGakC zs42K7{ARwBCwgA$3@N$g=>$SPuo1PL0V&$4VYhBQp86nN5WqprZRz_4>@5BvnfzW0 zxZus*DFS+|`p#HQ&JJP<)5)AQFk`z{_+TaVCxVb!ZHcR~B?2wUL<_Mj|Kzl7iLoTL z33ZsARBq3L{TPAg%XxXLb@?Z4dyXuip+{ONZI*dUuqv3-`2O?AW9^Di$-Vn#28aNw z!~NK=go<5HhY45PAh$5krh1GsxW7fB3DLkD!%Hs^b5n#Kw3YLPqwGUxG~8j5G0MNk z)QY66TfrjHXp`+ak?Z!2yvGHjoHa0&AXiM2TfzlD1^Lp7obueTS& zR*6zG2`tbsTDM^P<&h}$E*m*;)tF{p?Sc2Jqx{OscM8~|4}!IrLx=V~>{NrqKD*?m z;}oyKjTf?aTw^}D-gO!>tczYM{AoUZ7wn?(oTsfwtYVCS&jMm?uM8zZGgO*B4e~YZ z$UaS8`sCa|8=zFA{f;*EM2X}r(OSA1yry2*JhgF91)`~|)5`f}&fl+NXBKA-){n=5 zSm$%L0`Be%22sF6{J#IN*t=26v0gPsw05xg)#GcU?aO5nxWrd3s#ON27Ga1H64MY7 z1#rENlx1-LjvFowk)o{}-ODyKM9tn#KM_=YX&O3|7)v`RJxT26wHI8zJXL?u-k(jq za*H+{?6cxPb>Q|6V9CDM|5g5q0H9dSQDYnT4Z_*p!qN`;POPW%9x(h=o6Tw^$95b! zs9Z>_KD>WTEWrKHOWKn&Px#cLzs~&&93*BI5=S!y2?a4}NQeT**$P)W=A@3%2@slE zR3C2FBM9RECbcl*eQllC0+RP*iQbCH1ATghD8g|x*v)FD8!^w))5pU>hIqcfG}WtA z+FBcl2z($nFO29FSb_^m?@hs`moSQyg=Qk+9W1Yitm#+*{(RQtkAbJFVrw@q17)n3 z5^gWJZg%E&yG)rw!^Cn;ZR8dP-48+&hs@>?dyT`QHPH8~vj(@_w##y@Z`aoc8MXkoczEB ztl}#-uhu%6EFNwAIApO?$l!idC1q}102{u+E}S^X!}rPJvIRB$4*Lrv53?dIl4^ZAsUxy9664o`J*?$Hg^j(z zE&2YUE7FLDVlMkZg0UJfnyg-0K`s~m_61Qvo=>*eg$R)UoEj@|Upojem!giy^qe2Q z0B8>xyDRyKGg;IJPS|V;Y{h#GK!$?jWTMK&sD0I#_Nu4W%vPt{R9Zv*cQfN+i^>Fd zjjDi)_feTjqE0cJnZn0~jSA4Z-f+a@#;Nd|Xh{iAI@xQ<1J{fv1Pr?9ID;r&b(<(i zL#Oe#YE4rLIlKH`b5T8)OsDuHofCCS9LC#5nmv;|+PmXgy?}I@|`h%w#Z7l=3 z+%kJ7*UzU{*JDbDXm%Xa1wiQTtobBiMVNYkaLKds(>Oj9E8_-_n}*)haVf^!(Adcl|jKeWoh%8hqN%_XdRj*q+D@8;JQ%Ni5H_{Vc zO@;wkv%7b0(K$R?ikM1@*VEe@k+YJkhxM8GyP(qN6KuX_4LB`&X(gSOC|Ds(-Ftd? z?Aivh?KcZzhrt*H*apsV2;ERw*D3qNTOQZRVokx&o92Hyg6d%!Dn zyM03>*YMmf zB-gizIe_Q5vtgGxa}m~6MgpTfEjCUMj=qm)rTEQGqM(+de!kgli#z^{ix+@?fzocc z#8?iVnKZewY+W}h`0%=o4;N`_TCzVKL_5> z?I^y~P*D-w9oEmVkT4z7u-=#3LnA8nu@?aRJ|=*78W-TW+Y$+vMV{8i&KPv9 zq<_#nM`oewMbB|-x*;|~vGN9y-0)#CT`#@pcm-N;7*DUy5)MpEs~Wv>0_)|X`tS`yl|;$E~=$Wsol$(Qk( zGfBTgB(e&~boz?<+#e;O1mw0dJv1jvFCMUvb=DH0*3;Oxx^9ulX(Xgje z<|pMxf4brvW~IfeN6jm9PM*>I-Qps3 z?XLhTTPe*j^I`B=dHcGzpPs6g7vDan^o{P}ZK~9tGy3*H&AMo?BnZJqpB*e$6gW zxe0md^4yps?gl@1-PP44;ZUerJc*i+zR8qSB_Ccr_PRVbWTG6l8tn=(xU1*?xJ8-} zHMPqx=4)qQj)jCGSfG^V-J(?D7XU()s-2JsmXf{c^MsES$(qp4T*4@?RI5NCCVpBa z+2gz{#cuvN32h=zBZBKh$Rxjim>1{;tI%mnI~z26n-AID**wsNqFYplqVJ}?r}wC* zQ%N(>yv^OkGuer-6Uf$&a9r?D`#6%AQogk6qQ{bdR)PDQ_YU*g62)?*(wbqlrt<@( zBlHpj(?nf+L`FxpKTKPvDZCHmV(5|c#=JMU@9#H^arP0MH=2FZin2xfRljiL{!2|M zz6ZVO#Gn7iALBW^|F%o~Q-J=*S2c}Gtban@%%IP zJA-u47Eo{Gez;@g3b%dDmhuU32FX~0(FnrY6q=HWgP;{|?}JOzswV9}a=a)sE&mhc zghK3BYdbctA2~)}{}z@6_ziSjm*grZQ)BUOD7iE#HL$C#{VFi|161uNt`4^6AAmDW~l#sGymHb_}|+>aWVCOPWTzF literal 0 HcmV?d00001 From 6baa23169e125a95a2345d36bbb662851dbf928f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 3 Feb 2025 22:17:02 -0500 Subject: [PATCH 200/515] 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 201/515] 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 202/515] 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 203/515] 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 204/515] 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 205/515] 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 206/515] 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) From 80f8613a370168bb00c88258dbc83fab2f679536 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 5 Feb 2025 09:05:33 -0500 Subject: [PATCH 207/515] Update transmit.py start with random image_index --- transmit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index f7246370..a6d0de81 100644 --- a/transmit.py +++ b/transmit.py @@ -10,6 +10,7 @@ import sys from os import system from PIL import Image, ImageDraw, ImageFont, ImageColor import serial +import random def battery_saver_check(): try: @@ -791,7 +792,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 = 1; + image_index = random.randint(0, 255); while 1: # print ("LED on") output(txLed, txLedOff) From b1428951f495b178e9c089c9650a5ab07fc9330b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 5 Feb 2025 09:09:31 -0500 Subject: [PATCH 208/515] Update update add install of ssdv for FunCube image decoding --- update | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/update b/update index fcef1749..1f8e12e1 100755 --- a/update +++ b/update @@ -213,6 +213,16 @@ if [ ! -d "/home/pi/WiringPi" ]; then fi +if [ ! -d "/home/pi/ssdv" ]; then + + cd + git clone https://github.com/alanbjohnston/ssdv.git # install ssdv for FunCube images + cd ssdv + make + cd + FLAG=1 +fi + cd /home/pi/pi-power-button git checkout master From 04acaf9bbfdb58df4872a71865d96f6cf842c9af Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 5 Feb 2025 13:13:57 -0500 Subject: [PATCH 209/515] Update update option to checkout new branch --- update | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/update b/update index 1f8e12e1..ea1c565e 100755 --- a/update +++ b/update @@ -1,9 +1,20 @@ #!/bin/bash -echo -e "\nupdate script for CubeSatSim v2.0\n" +echo -e "\nupdate script for CubeSatSim v2.1\n" + +FLAG=0 +checkout=0 + +if [ -z "$1" ] ; then + checkout=0 +else + checkout=1 + branch="$1" + echo $branch + FLAG=1 +fi if [ "$1" = "n" ] ; then -# if [ -z "$2" ] ; then noreboot=1 else noreboot=0 @@ -39,6 +50,10 @@ cd /home/pi/CubeSatSim git pull --no-rebase > .updated +if [ $checkout -eq 1 ]; then + git checkout $branch +fi + make debug FILE=/home/pi/CubeSatSim/command_tx @@ -57,8 +72,6 @@ else echo "0\n" > /home/pi/CubeSatSim/command_count.txt fi -FLAG=0 - if [[ $(diff systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service) ]]; then echo "changed cubesatsim.service." sudo cp /home/pi/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service @@ -115,7 +128,7 @@ if [ ! -f "$FILE" ]; then echo "Copying SSTV image 2." cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg fi - + grep 'update' /home/pi/CubeSatSim/.updated if [[ $(grep 'update' /home/pi/CubeSatSim/.updated) ]]; then echo "update script updated, running again" @@ -358,7 +371,7 @@ if [ "$noreboot" = "0" ] ; then fi else if [ $FLAG -eq 1 ]; then - echo "reboot needed for changes to take effect" + echo "reboot needed for changes to take effect" | wall fi fi From f3ad5d8458351ffdecadf770418e716257628058 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 5 Feb 2025 13:16:58 -0500 Subject: [PATCH 210/515] Update update add git pull when switching branch --- update | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/update b/update index ea1c565e..e4d89055 100755 --- a/update +++ b/update @@ -10,6 +10,7 @@ if [ -z "$1" ] ; then else checkout=1 branch="$1" + echo -n "changing to branch " echo $branch FLAG=1 fi @@ -51,7 +52,8 @@ cd /home/pi/CubeSatSim git pull --no-rebase > .updated if [ $checkout -eq 1 ]; then - git checkout $branch + git checkout $branch + git pull --no-rebase fi make debug From a12dbd62587eafe06bb6b8dc595c2282af5a5d76 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 5 Feb 2025 13:27:12 -0500 Subject: [PATCH 211/515] Update config v2.1 --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index c006a662..f78906c5 100755 --- a/config +++ b/config @@ -210,7 +210,7 @@ function transmit_command_beacon { exit } -echo "CubeSatSim v2.0 configuration tool" +echo "CubeSatSim v2.1 configuration tool" echo # echo $1 # echo $2 From 36b123d4e3c7ac775891480e6473e2c77b0c157b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 5 Feb 2025 13:31:21 -0500 Subject: [PATCH 212/515] Update main.c v2.1 --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index de0e06b3..7db64594 100644 --- a/main.c +++ b/main.c @@ -25,7 +25,7 @@ int main(int argc, char * argv[]) { - printf("\n\nCubeSatSim v2.0 starting...\n\n"); + printf("\n\nCubeSatSim v2.1 starting...\n\n"); wiringPiSetup(); From 50abee8b1368ab1a661ca7e510244dff88348d4e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 5 Feb 2025 13:31:50 -0500 Subject: [PATCH 213/515] Update command v2.1 --- command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command b/command index 1349f45a..b7f04ee0 100755 --- a/command +++ b/command @@ -1,6 +1,6 @@ #!/bin/bash -echo -e "\nCommand and Control script for CubeSatSim v2.0\n" +echo -e "\nCommand and Control script for CubeSatSim v2.1\n" FILE=/home/pi/CubeSatSim/command_control if [ -f "$FILE" ]; then From bbcdd989ef88181c4e3715e3289ecf5d380622e7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 5 Feb 2025 13:32:17 -0500 Subject: [PATCH 214/515] Update transmit.py v2.1 --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index a6d0de81..7d07c527 100644 --- a/transmit.py +++ b/transmit.py @@ -172,7 +172,7 @@ def camera_photo(): draw.text((120, 10), telem_string, font=font2, fill='white') img.save(file) -print("CubeSatSim v2.0 transmit.py starting...") +print("CubeSatSim v2.1 transmit.py starting...") pd = 21 ptt = 20 From e17dc40aee28e4748b573657be55f8c295f801c7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 13:03:15 -0500 Subject: [PATCH 215/515] Create fc_block_decode.py --- groundstation/fc_block_decode.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 groundstation/fc_block_decode.py diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py new file mode 100644 index 00000000..b3e0b565 --- /dev/null +++ b/groundstation/fc_block_decode.py @@ -0,0 +1,23 @@ +import sys +from os import system +from time import sleep +import logging +logging.basicConfig(format='%(message)s') +# logging.warning('CC-Warning!') + +if __name__ == "__main__": + debug_mode = False + counter = 1 + if (len(sys.argv)) > 1: +# print("There are arguments!") + if ('d' == sys.argv[1]): + debug_mode = True + + print(debug_mode) + for line in sys.stdin: + if (debug_mode): + print(line, end =" ") + logging.warning(line) + + if ((line.find("data: ")) > 0): + print("\ndata block found!\n") From 14fc8eae59fddcb08eb0d77fae653e0308cbd2fb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 13:12:25 -0500 Subject: [PATCH 216/515] Update fc_block_decode.py indent --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index b3e0b565..93ef84c8 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -13,7 +13,7 @@ if __name__ == "__main__": if ('d' == sys.argv[1]): debug_mode = True - print(debug_mode) + print(debug_mode) for line in sys.stdin: if (debug_mode): print(line, end =" ") From dd842239c02ebad6171221951ac23108e87ce18c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 13:13:26 -0500 Subject: [PATCH 217/515] Update fc_block_decode.py fix indent --- groundstation/fc_block_decode.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 93ef84c8..198b6917 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -12,8 +12,7 @@ if __name__ == "__main__": # print("There are arguments!") if ('d' == sys.argv[1]): debug_mode = True - - print(debug_mode) + print(debug_mode) for line in sys.stdin: if (debug_mode): print(line, end =" ") From aea440320016f2af47ad635f429bf58b2c2cce98 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 13:16:45 -0500 Subject: [PATCH 218/515] Update fc_block_decode.py add split --- groundstation/fc_block_decode.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 198b6917..bea41511 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -20,3 +20,5 @@ if __name__ == "__main__": if ((line.find("data: ")) > 0): print("\ndata block found!\n") + data_block = line.split() + print(data_block) From 22df72af4aede7a4232fb4154b53338481b2c7e8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 13:39:46 -0500 Subject: [PATCH 219/515] Update fc_block_decode.py convert hex string to int --- groundstation/fc_block_decode.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index bea41511..2a46db24 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -20,5 +20,9 @@ if __name__ == "__main__": if ((line.find("data: ")) > 0): print("\ndata block found!\n") - data_block = line.split() + data_block_string = line.split() + print(data_block_string) + data_block = [int(number_string,16) for number_string in data_block_string] + print("\n") print(data_block) + print("\n") From 96c6935dd4f3b05590683f6401c169fa6534dc7b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 13:45:07 -0500 Subject: [PATCH 220/515] Update fc_block_decode.py drop first 7 elements --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 2a46db24..e38605af 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -22,7 +22,7 @@ if __name__ == "__main__": print("\ndata block found!\n") data_block_string = line.split() print(data_block_string) - data_block = [int(number_string,16) for number_string in data_block_string] + data_block = [int(number_string,16) for number_string in data_block_string[7:]] print("\n") print(data_block) print("\n") From e5c6272db19bf8fc7c9ac9119718e7600df76516 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 14:50:32 -0500 Subject: [PATCH 221/515] Update fc_block_decode.py print some telem --- groundstation/fc_block_decode.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index e38605af..d85ecf84 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -5,6 +5,12 @@ import logging logging.basicConfig(format='%(message)s') # logging.warning('CC-Warning!') +FC_EPS = 1 +FC_BOB = 25 +FC_SW = 50 +FC_PAYLOAD = 55 +extended = 1 + if __name__ == "__main__": debug_mode = False counter = 1 @@ -26,3 +32,16 @@ if __name__ == "__main__": print("\n") print(data_block) print("\n") + if (data_block[0] == 0xE0) or (data_block[0] == 0xE1): + if (data_block[0] == 0xE0): + print("CubeSatSim Frametype RT1+IMG1") + if (data_block[0] == 0xE1): + print("CubeSatSim Frametype RT2+IMG2") + print("Sequence number: ") + print(data_block[51] * data_block[51] * 2^16 + data_block[51] * 2^32) + print("Vx (mV): ") + print((data_block[extended + FC_EPS + 0] << 2) + (0xfc & data_block[extended + FC_EPS + 1])) + print(" ") + + else: + print("Unknown Sat Id or Frame") From 1aa365db8aa20875cabef4957c80ad2a79127f3a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 14:53:39 -0500 Subject: [PATCH 222/515] Update fc_block_decode.py fix sequence number --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index d85ecf84..5b0c96c9 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -38,7 +38,7 @@ if __name__ == "__main__": if (data_block[0] == 0xE1): print("CubeSatSim Frametype RT2+IMG2") print("Sequence number: ") - print(data_block[51] * data_block[51] * 2^16 + data_block[51] * 2^32) + print(data_block[extended + 51] + data_block[extended + 50] * 2^16 + data_block[extended + 49] * 2^32) print("Vx (mV): ") print((data_block[extended + FC_EPS + 0] << 2) + (0xfc & data_block[extended + FC_EPS + 1])) print(" ") From 8d205f513ac2a843945c9fac1a8fd8b90671f824 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:03:22 -0500 Subject: [PATCH 223/515] Update fc_block_decode.py add payload prints --- groundstation/fc_block_decode.py | 1 + 1 file changed, 1 insertion(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 5b0c96c9..794212b9 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -41,6 +41,7 @@ if __name__ == "__main__": print(data_block[extended + 51] + data_block[extended + 50] * 2^16 + data_block[extended + 49] * 2^32) print("Vx (mV): ") print((data_block[extended + FC_EPS + 0] << 2) + (0xfc & data_block[extended + FC_EPS + 1])) + print('Payload 0:{:x}, Payload 1:{:x}'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1]) print(" ") else: From 29c22844f6d3f980e2fb11748331d07328a5793d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:04:44 -0500 Subject: [PATCH 224/515] Update fc_block_decode.py missing ) --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 794212b9..f14b33ac 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -41,7 +41,7 @@ if __name__ == "__main__": print(data_block[extended + 51] + data_block[extended + 50] * 2^16 + data_block[extended + 49] * 2^32) print("Vx (mV): ") print((data_block[extended + FC_EPS + 0] << 2) + (0xfc & data_block[extended + FC_EPS + 1])) - print('Payload 0:{:x}, Payload 1:{:x}'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1]) + print('Payload 0:{:x}, Payload 1:{:x}'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1])) print(" ") else: From fd66322447f654e057adc2d660d718f19e899ec0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:15:52 -0500 Subject: [PATCH 225/515] Update fc_block_decode.py write payload to file --- groundstation/fc_block_decode.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index f14b33ac..bb70b387 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -43,6 +43,14 @@ if __name__ == "__main__": print((data_block[extended + FC_EPS + 0] << 2) + (0xfc & data_block[extended + FC_EPS + 1])) print('Payload 0:{:x}, Payload 1:{:x}'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1])) print(" ") - + if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): + try: + print("Writing payload to file") + f = open('image_file','a') + data_block[FC_PAYLOAD + extended].tofile(f) + f.close() + sleep 60 + except: + print("File error) else: print("Unknown Sat Id or Frame") From 2ae815e5e4fb43aaba1f918037cbaf63c3363921 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:17:02 -0500 Subject: [PATCH 226/515] Update fc_block_decode.py fix sleep --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index bb70b387..8fc592a8 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -49,7 +49,7 @@ if __name__ == "__main__": f = open('image_file','a') data_block[FC_PAYLOAD + extended].tofile(f) f.close() - sleep 60 + sleep(60) except: print("File error) else: From 77843a69cb4b52af0c67a117529d0cda6412735e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:17:25 -0500 Subject: [PATCH 227/515] Update fc_block_decode.py missing " --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 8fc592a8..523c816d 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -51,6 +51,6 @@ if __name__ == "__main__": f.close() sleep(60) except: - print("File error) + print("File error") else: print("Unknown Sat Id or Frame") From 31d84444bc624b0a4caef353c5c250ac2707ce63 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:19:23 -0500 Subject: [PATCH 228/515] Update fc_block_decode.py add print and : --- groundstation/fc_block_decode.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 523c816d..c5d0853a 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -47,7 +47,8 @@ if __name__ == "__main__": try: print("Writing payload to file") f = open('image_file','a') - data_block[FC_PAYLOAD + extended].tofile(f) + print("File opened") + data_block[FC_PAYLOAD + extended:].tofile(f) f.close() sleep(60) except: From a9df7c6de17c9a00209259f537fcfe48dbeb1b6b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:21:17 -0500 Subject: [PATCH 229/515] Update fc_block_decode.py add payload --- groundstation/fc_block_decode.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index c5d0853a..347db2dc 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -48,7 +48,8 @@ if __name__ == "__main__": print("Writing payload to file") f = open('image_file','a') print("File opened") - data_block[FC_PAYLOAD + extended:].tofile(f) + payload = data_block[(FC_PAYLOAD + extended):] + payload.tofile(f) f.close() sleep(60) except: From 32e1f96958cd65ceba8b4d90f4635afda6b8282f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:22:00 -0500 Subject: [PATCH 230/515] Update fc_block_decode.py print payload --- groundstation/fc_block_decode.py | 1 + 1 file changed, 1 insertion(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 347db2dc..9078fd6f 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -49,6 +49,7 @@ if __name__ == "__main__": f = open('image_file','a') print("File opened") payload = data_block[(FC_PAYLOAD + extended):] + print(payload) payload.tofile(f) f.close() sleep(60) From ef8b30702706118c7542514bae0025fd116451d8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:29:19 -0500 Subject: [PATCH 231/515] Update fc_block_decode.py bytes --- groundstation/fc_block_decode.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 9078fd6f..d70aad3f 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -46,12 +46,14 @@ if __name__ == "__main__": if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): try: print("Writing payload to file") - f = open('image_file','a') - print("File opened") - payload = data_block[(FC_PAYLOAD + extended):] +# f = open('image_file','a') +# print("File opened") + payload = bytearray(data_block[(FC_PAYLOAD + extended):]) print(payload) - payload.tofile(f) - f.close() + immutable_payload = bytes(payload) + with open("image_file", "wb") as binary_file: + binary_file.write(immutable_payload) +# f.close() sleep(60) except: print("File error") From 17b6179641bb5efc194173815a15301417c86ed8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:33:55 -0500 Subject: [PATCH 232/515] Update fc_block_decode.py try ab --- groundstation/fc_block_decode.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index d70aad3f..172923ec 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -48,10 +48,10 @@ if __name__ == "__main__": print("Writing payload to file") # f = open('image_file','a') # print("File opened") - payload = bytearray(data_block[(FC_PAYLOAD + extended):]) - print(payload) - immutable_payload = bytes(payload) - with open("image_file", "wb") as binary_file: +# payload = bytearray(data_block[(FC_PAYLOAD + extended):]) + immutable_payload = bytes(bytearray(data_block[(FC_PAYLOAD + extended):])) # payload) + print(immutable_payload) + with open("image_file", "ab") as binary_file: binary_file.write(immutable_payload) # f.close() sleep(60) From 41e70a911f0254bd0048b41a84996f296ab8047f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:36:50 -0500 Subject: [PATCH 233/515] Update fc_block_decode.py add f= --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 172923ec..6c53bf6d 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -51,9 +51,9 @@ if __name__ == "__main__": # payload = bytearray(data_block[(FC_PAYLOAD + extended):]) immutable_payload = bytes(bytearray(data_block[(FC_PAYLOAD + extended):])) # payload) print(immutable_payload) - with open("image_file", "ab") as binary_file: + with (f = open("image_file", "ab")) as binary_file: binary_file.write(immutable_payload) -# f.close() + f.close() sleep(60) except: print("File error") From 67669e1c9f609221bd312dd69e770d3fe9a916ab Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:38:02 -0500 Subject: [PATCH 234/515] Update fc_block_decode.py added close --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 6c53bf6d..4c822f71 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -51,9 +51,9 @@ if __name__ == "__main__": # payload = bytearray(data_block[(FC_PAYLOAD + extended):]) immutable_payload = bytes(bytearray(data_block[(FC_PAYLOAD + extended):])) # payload) print(immutable_payload) - with (f = open("image_file", "ab")) as binary_file: + with open("image_file", "ab") as binary_file: binary_file.write(immutable_payload) - f.close() + binary_file.close() sleep(60) except: print("File error") From 3f8c26bebc5846f504d5456afcf4b724c244d462 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:48:31 -0500 Subject: [PATCH 235/515] Update fc_block_decode.py add image_count --- groundstation/fc_block_decode.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 4c822f71..ff767e14 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -11,6 +11,8 @@ FC_SW = 50 FC_PAYLOAD = 55 extended = 1 +image_count = 0 + if __name__ == "__main__": debug_mode = False counter = 1 @@ -57,5 +59,10 @@ if __name__ == "__main__": sleep(60) except: print("File error") + else: + print("End of image") + system("sudo mv image_file image_file" + str(image_count)) + print("Image count: ") + print(image_count++) else: print("Unknown Sat Id or Frame") From 6f022c8f4ccd1aeb0ab6a799bf4dd03f83b631d8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:49:15 -0500 Subject: [PATCH 236/515] Update fc_block_decode.py remove close and sleep --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index ff767e14..c3424e9f 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -55,8 +55,8 @@ if __name__ == "__main__": print(immutable_payload) with open("image_file", "ab") as binary_file: binary_file.write(immutable_payload) - binary_file.close() - sleep(60) +# binary_file.close() +# sleep(60) except: print("File error") else: From 9f8dfa5ea9219863a1d8d8bb0c2171bc8bab13c6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:50:51 -0500 Subject: [PATCH 237/515] Update fc_block_decode.py image_count modulo 256 --- groundstation/fc_block_decode.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index c3424e9f..61aba0b3 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -63,6 +63,7 @@ if __name__ == "__main__": print("End of image") system("sudo mv image_file image_file" + str(image_count)) print("Image count: ") - print(image_count++) + print(image_count) + image_count = (image_count + 1) % 256 else: print("Unknown Sat Id or Frame") From 0aed6129adba31b94b72f1ade781379e80b72b52 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 16:20:13 -0500 Subject: [PATCH 238/515] Update fc_block_decode.py convert bin to jpeg --- groundstation/fc_block_decode.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 61aba0b3..660c8b4f 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -61,7 +61,9 @@ if __name__ == "__main__": print("File error") else: print("End of image") - system("sudo mv image_file image_file" + str(image_count)) +# system("sudo mv image_file image_file" + str(image_count)) + system("home/pi/ssdv/ssdv -d -J image_file image_file" + str(image_count) + ".jpeg") + system("sudo rm image_file") print("Image count: ") print(image_count) image_count = (image_count + 1) % 256 From def9cad9fc6538f724c267403bc9a829b5ac9c9f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 16:29:41 -0500 Subject: [PATCH 239/515] Update fc_block_decode.py copy bin file --- groundstation/fc_block_decode.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 660c8b4f..8d52f7d5 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -61,9 +61,10 @@ if __name__ == "__main__": print("File error") else: print("End of image") -# system("sudo mv image_file image_file" + str(image_count)) - system("home/pi/ssdv/ssdv -d -J image_file image_file" + str(image_count) + ".jpeg") - system("sudo rm image_file") + + system("/home/pi/ssdv/ssdv -d -J image_file image_file" + str(image_count) + ".jpeg") +# system("sudo rm image_file") + system("sudo mv image_file image_file" + str(image_count)) print("Image count: ") print(image_count) image_count = (image_count + 1) % 256 From 47eb19a20c3e0b35cb4839634c14df2b602e5553 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 16:35:42 -0500 Subject: [PATCH 240/515] Update fc_block_decode.py random image_count initialization --- groundstation/fc_block_decode.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 8d52f7d5..d5c80ba3 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -2,6 +2,7 @@ import sys from os import system from time import sleep import logging +import random logging.basicConfig(format='%(message)s') # logging.warning('CC-Warning!') @@ -11,7 +12,7 @@ FC_SW = 50 FC_PAYLOAD = 55 extended = 1 -image_count = 0 +image_count = random.randint(0, 255) if __name__ == "__main__": debug_mode = False From f1aaf5d9b85ae5ffba5352a07492d4db095a46ed Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 22:16:24 -0500 Subject: [PATCH 241/515] Update fc_block_decode.py add image display --- groundstation/fc_block_decode.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index d5c80ba3..18cf3f88 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -3,6 +3,8 @@ from os import system from time import sleep import logging import random +from PIL import Image, ImageDraw, ImageFont, ImageColor + logging.basicConfig(format='%(message)s') # logging.warning('CC-Warning!') @@ -49,21 +51,18 @@ if __name__ == "__main__": if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): try: print("Writing payload to file") -# f = open('image_file','a') -# print("File opened") -# payload = bytearray(data_block[(FC_PAYLOAD + extended):]) immutable_payload = bytes(bytearray(data_block[(FC_PAYLOAD + extended):])) # payload) print(immutable_payload) with open("image_file", "ab") as binary_file: binary_file.write(immutable_payload) -# binary_file.close() -# sleep(60) except: print("File error") else: print("End of image") system("/home/pi/ssdv/ssdv -d -J image_file image_file" + str(image_count) + ".jpeg") + image = Image.open(image_file" + str(image_count) + ".jpeg") + image.show() # system("sudo rm image_file") system("sudo mv image_file image_file" + str(image_count)) print("Image count: ") From e7f53aee7f82a10171c701918e0329fed4e6cd88 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 22:23:07 -0500 Subject: [PATCH 242/515] Update fc_block_decode.py save every frame image --- groundstation/fc_block_decode.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 18cf3f88..ffc3a0f5 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -15,6 +15,7 @@ FC_PAYLOAD = 55 extended = 1 image_count = random.randint(0, 255) +image_index = 0; if __name__ == "__main__": debug_mode = False @@ -55,13 +56,21 @@ if __name__ == "__main__": print(immutable_payload) with open("image_file", "ab") as binary_file: binary_file.write(immutable_payload) + except: print("File error") + try: + system("/home/pi/ssdv/ssdv -d -J image_file image_file" + str(image_count) + "." + str(image_index) + ".jpeg") + image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg") + image.show() + except: + print("Image display error") + image_index += 1 else: print("End of image") system("/home/pi/ssdv/ssdv -d -J image_file image_file" + str(image_count) + ".jpeg") - image = Image.open(image_file" + str(image_count) + ".jpeg") + image = Image.open("image_file" + str(image_count) + ".jpeg") image.show() # system("sudo rm image_file") system("sudo mv image_file image_file" + str(image_count)) From 6646b258108d5ba7ef88ab8a0bf9667ce3379888 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 22:36:47 -0500 Subject: [PATCH 243/515] Update fc_block_decode.py reset image_index at end of image --- groundstation/fc_block_decode.py | 1 + 1 file changed, 1 insertion(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index ffc3a0f5..605b16f4 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -77,5 +77,6 @@ if __name__ == "__main__": print("Image count: ") print(image_count) image_count = (image_count + 1) % 256 + image_index = 0 else: print("Unknown Sat Id or Frame") From 2ec0907c373a60cb2de8d563a9460917e64eb417 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 14:12:11 -0500 Subject: [PATCH 244/515] Update fc_block_decode.py remove image_file at start --- groundstation/fc_block_decode.py | 1 + 1 file changed, 1 insertion(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 605b16f4..1137af9f 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -16,6 +16,7 @@ extended = 1 image_count = random.randint(0, 255) image_index = 0; +system("sudo rm image_file") if __name__ == "__main__": debug_mode = False From e52b5dabd398db02ee612c44a4462ede1a47bfa1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 14:23:05 -0500 Subject: [PATCH 245/515] add FC telem --- groundstation/fctelem.sh | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 groundstation/fctelem.sh diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh new file mode 100755 index 00000000..0783d9ca --- /dev/null +++ b/groundstation/fctelem.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# script to run OpenWebRX SDR + +echo "Script to run Web SDR for ARISS Radio Pi" + +echo + +echo "The Chromium browser will load in a few seconds with OpenWebRX." + +echo "You can also use another web browser if you are on the same network as your Pi." + + +echo + +ip=$(hostname -I|cut -f1 -d ' ') + +echo "IP Address to use in web browser is: $ip:8073" + +echo + +ssid=$(iwgetid -r) + +echo "Note: you need to be on the Wifi network: $ssid" + +echo + +sudo killall -9 java &>/dev/null + +sudo killall -9 rtl_fm &>/dev/null + +pkill -o chromium &>/dev/null + +sudo killall -9 rtl_tcp &>/dev/null + +sudo killall -9 CubicSDR &>/dev/null + +sudo killall -9 qsstv &>/dev/null + +sudo killall -9 aplay &>/dev/null + +sudo killall -9 direwolf &>/dev/null + +sudo killall -9 zenity &>/dev/null + +sudo systemctl stop rtl_tcp + +sudo systemctl restart openwebrx + +sleep 10 + +setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8073 &>/dev/null & + +sleep 10 + +#$SHELL From a3241d23320861e8fbc452870506ac538a35f676 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 14:31:49 -0500 Subject: [PATCH 246/515] Update fctelem.sh add python web server --- groundstation/fctelem.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 0783d9ca..15744402 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -1,11 +1,11 @@ #!/bin/bash -# script to run OpenWebRX SDR +# script to run FunCube Pi Telemetry App -echo "Script to run Web SDR for ARISS Radio Pi" +echo "Script to run FunCube CubeSatSim Telemetry" echo -echo "The Chromium browser will load in a few seconds with OpenWebRX." +echo "The Chromium browser will load in a few seconds with fctelem." echo "You can also use another web browser if you are on the same network as your Pi." @@ -14,7 +14,7 @@ echo ip=$(hostname -I|cut -f1 -d ' ') -echo "IP Address to use in web browser is: $ip:8073" +echo "IP Address to use in web browser is: $ip:8000" echo @@ -44,11 +44,18 @@ sudo killall -9 zenity &>/dev/null sudo systemctl stop rtl_tcp -sudo systemctl restart openwebrx +sudo systemctl stop openwebrx + + +cd /home/pi/CubeSatSim/groundstation/public_html + +cp /home/pi/CubeSatSim/groundstation/index.html . + +python3 -m http.server sleep 10 -setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8073 &>/dev/null & +setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8000 &>/dev/null & sleep 10 From 2cbb14c4d0ab4367c561eb275899a35fb539b8dc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 14:33:04 -0500 Subject: [PATCH 247/515] Create index.html --- groundstation/index.html | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 groundstation/index.html diff --git a/groundstation/index.html b/groundstation/index.html new file mode 100644 index 00000000..d79d0fd7 --- /dev/null +++ b/groundstation/index.html @@ -0,0 +1,8 @@ + + +FunCube CubeSatSim Telemetry + + + + + From 1c48f9e61ba49ce82dd1d12fb3396611e5cfcaa6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 14:37:33 -0500 Subject: [PATCH 248/515] Update fctelem.sh make dir if not present --- groundstation/fctelem.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 15744402..2e654cda 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -46,6 +46,11 @@ sudo systemctl stop rtl_tcp sudo systemctl stop openwebrx +FILE=/home/pi/CubeSatSim/groundstation/public_html +if [ ! -f "$FILE" ]; then + echo "Making public_html directory" + mkdir /home/pi/CubeSatSim/groundstation/public_html +fi cd /home/pi/CubeSatSim/groundstation/public_html From 35c0714c9952838fbe3c5ec0f9c4c4bcf35a41e8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 14:38:29 -0500 Subject: [PATCH 249/515] Update index.html add

--- groundstation/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/index.html b/groundstation/index.html index d79d0fd7..751aebf9 100644 --- a/groundstation/index.html +++ b/groundstation/index.html @@ -1,8 +1,8 @@ FunCube CubeSatSim Telemetry - +

- +

From e6cf2fd82b34e396c690ef06329b50ec2cb764b9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 14:39:48 -0500 Subject: [PATCH 250/515] Update fctelem.sh webserver in background --- groundstation/fctelem.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 2e654cda..a06ecb47 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -56,9 +56,9 @@ cd /home/pi/CubeSatSim/groundstation/public_html cp /home/pi/CubeSatSim/groundstation/index.html . -python3 -m http.server +python3 -m http.server & -sleep 10 +# sleep 10 setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8000 &>/dev/null & From 93dc5a67328ed8faf919be0600e84bc377d7e60f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 14:40:47 -0500 Subject: [PATCH 251/515] Update fctelem.sh add python decode --- groundstation/fctelem.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index a06ecb47..9e815767 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -58,6 +58,10 @@ cp /home/pi/CubeSatSim/groundstation/index.html . python3 -m http.server & +cd /home/pi/fctelem + +./fctelem | python3 /home/pi/CubeSatSim/groundstation/fc_block_decode.py & + # sleep 10 setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8000 &>/dev/null & From b71ba0ce218de17bcf7dea90696f917a640cade1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 14:51:28 -0500 Subject: [PATCH 252/515] Update fc_block_decode.py copy image to html dir --- groundstation/fc_block_decode.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 1137af9f..12598763 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -61,18 +61,21 @@ if __name__ == "__main__": except: print("File error") try: - system("/home/pi/ssdv/ssdv -d -J image_file image_file" + str(image_count) + "." + str(image_index) + ".jpeg") - image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg") - image.show() + filename = "image_file" + str(image_count) + "." + str(image_index) + ".jpeg" + system("/home/pi/ssdv/ssdv -d -J image_file " + filename) + system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") +# image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg") +# image.show() except: print("Image display error") image_index += 1 else: print("End of image") - - system("/home/pi/ssdv/ssdv -d -J image_file image_file" + str(image_count) + ".jpeg") - image = Image.open("image_file" + str(image_count) + ".jpeg") - image.show() + filename = "image_file" + str(image_count) + ".jpeg" + system("/home/pi/ssdv/ssdv -d -J image_file " + filename) + system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") +# image = Image.open("image_file" + str(image_count) + ".jpeg") +# image.show() # system("sudo rm image_file") system("sudo mv image_file image_file" + str(image_count)) print("Image count: ") From c14e9689b583c0735124eba76d0fdbebcf470292 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 14:56:57 -0500 Subject: [PATCH 253/515] Update fctelem.sh add fctelem killall --- groundstation/fctelem.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 9e815767..55e6e9af 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -24,6 +24,8 @@ echo "Note: you need to be on the Wifi network: $ssid" echo +sudo killall -9 fctelem &>/dev/null + sudo killall -9 java &>/dev/null sudo killall -9 rtl_fm &>/dev/null From c94635407b1096e453139acf2556120a9d22ba80 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 15:11:54 -0500 Subject: [PATCH 254/515] Update fc_block_decode.py print output of ssdv --- groundstation/fc_block_decode.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 12598763..8e7243e7 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -62,7 +62,10 @@ if __name__ == "__main__": print("File error") try: filename = "image_file" + str(image_count) + "." + str(image_index) + ".jpeg" - system("/home/pi/ssdv/ssdv -d -J image_file " + filename) +# system("/home/pi/ssdv/ssdv -d -J image_file " + filename) + process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", image_file, filename], text=True) + print("\n\n RESULT: \n") + print(process) system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") # image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg") # image.show() From 2f3eab73a8cbe585a03fb1b32b41a071f4154943 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 15:18:52 -0500 Subject: [PATCH 255/515] Update fc_block_decode.py add import subprocess --- groundstation/fc_block_decode.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 8e7243e7..d4ae576d 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -4,6 +4,7 @@ from time import sleep import logging import random from PIL import Image, ImageDraw, ImageFont, ImageColor +import subprocess logging.basicConfig(format='%(message)s') # logging.warning('CC-Warning!') @@ -60,17 +61,17 @@ if __name__ == "__main__": except: print("File error") - try: - filename = "image_file" + str(image_count) + "." + str(image_index) + ".jpeg" +# try: + filename = "image_file" + str(image_count) + "." + str(image_index) + ".jpeg" # system("/home/pi/ssdv/ssdv -d -J image_file " + filename) - process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", image_file, filename], text=True) - print("\n\n RESULT: \n") - print(process) - system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") + process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", image_file, filename], text=True) + print("\n\n RESULT: \n") + print(process) + system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") # image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg") # image.show() - except: - print("Image display error") +# except: +# print("Image display error") image_index += 1 else: print("End of image") From 9de07e6566ba1eee40308b37b0e3cd5b891917cf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 15:20:54 -0500 Subject: [PATCH 256/515] Update fc_block_decode.py image_file as string --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index d4ae576d..9bca6879 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -64,7 +64,7 @@ if __name__ == "__main__": # try: filename = "image_file" + str(image_count) + "." + str(image_index) + ".jpeg" # system("/home/pi/ssdv/ssdv -d -J image_file " + filename) - process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", image_file, filename], text=True) + process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) print("\n\n RESULT: \n") print(process) system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") From 86e17bba9e5b67191bef5ea432b185bd8078a38e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 16:29:33 -0500 Subject: [PATCH 257/515] Update fctelem.sh hit return to quit --- groundstation/fctelem.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 55e6e9af..52031f1f 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -68,6 +68,12 @@ cd /home/pi/fctelem setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8000 &>/dev/null & +read val + +sudo killall -9 fctelem &>/dev/null + +sudo killall -9 fctelem + sleep 10 #$SHELL From 87b8180ff44e1e80da0bbf838ef468f5b101c678 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 16:31:48 -0500 Subject: [PATCH 258/515] Update fctelem.sh killall python3 --- groundstation/fctelem.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 52031f1f..be023e16 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -26,6 +26,8 @@ echo sudo killall -9 fctelem &>/dev/null +sudo killall -9 python3 &>/dev/null + sudo killall -9 java &>/dev/null sudo killall -9 rtl_fm &>/dev/null @@ -72,7 +74,7 @@ read val sudo killall -9 fctelem &>/dev/null -sudo killall -9 fctelem +sudo killall -9 python3 &>/dev/null sleep 10 From 2f40045d27f306e6867b01acf2fea695827b9c4a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 16:41:42 -0500 Subject: [PATCH 259/515] Update fc_block_decode.py parse image ID --- groundstation/fc_block_decode.py | 40 ++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 9bca6879..66712a48 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -64,27 +64,37 @@ if __name__ == "__main__": # try: filename = "image_file" + str(image_count) + "." + str(image_index) + ".jpeg" # system("/home/pi/ssdv/ssdv -d -J image_file " + filename) - process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) + process_output = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) print("\n\n RESULT: \n") - print(process) + print(process_output) + + for line in process_output: + if ((line.find("Image ID:")) > 0): + print("\nImage ID found!\n") + image_id_string = line.split() + print(image_id_string) + new_image_count = int(image_id_string[1]) + if (new_image_count != image_count): + image_count = new_image_coount + print("End of image") + filename = "image_file" + str(image_count) + ".jpeg" + system("/home/pi/ssdv/ssdv -d -J image_file " + filename) + system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") + system("sudo mv image_file image_file" + str(image_count)) + print("Image count: ") + print(image_count) +# image_count = (image_count + 1) % 256 + image_index = 0 + else: + image_index += 1 + system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") # image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg") # image.show() # except: # print("Image display error") - image_index += 1 + else: - print("End of image") - filename = "image_file" + str(image_count) + ".jpeg" - system("/home/pi/ssdv/ssdv -d -J image_file " + filename) - system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") -# image = Image.open("image_file" + str(image_count) + ".jpeg") -# image.show() -# system("sudo rm image_file") - system("sudo mv image_file image_file" + str(image_count)) - print("Image count: ") - print(image_count) - image_count = (image_count + 1) % 256 - image_index = 0 + print("Payload not an image!") else: print("Unknown Sat Id or Frame") From 257a94e7504ec1c13d4194235893b237f2da1234 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 16:47:22 -0500 Subject: [PATCH 260/515] Update fc_block_decode.py use io --- groundstation/fc_block_decode.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 66712a48..b4646aa2 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -5,6 +5,7 @@ import logging import random from PIL import Image, ImageDraw, ImageFont, ImageColor import subprocess +import io logging.basicConfig(format='%(message)s') # logging.warning('CC-Warning!') @@ -67,8 +68,8 @@ if __name__ == "__main__": process_output = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) print("\n\n RESULT: \n") print(process_output) - - for line in process_output: + s = io.StringIO(process_output) + for line in s: if ((line.find("Image ID:")) > 0): print("\nImage ID found!\n") image_id_string = line.split() From ea6730a44837ed5c15b31f2a58e20d20de3442ec Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 16:55:18 -0500 Subject: [PATCH 261/515] Update fc_block_decode.py add .stdout --- groundstation/fc_block_decode.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index b4646aa2..3308cd2d 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -65,10 +65,10 @@ if __name__ == "__main__": # try: filename = "image_file" + str(image_count) + "." + str(image_index) + ".jpeg" # system("/home/pi/ssdv/ssdv -d -J image_file " + filename) - process_output = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) + process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) print("\n\n RESULT: \n") - print(process_output) - s = io.StringIO(process_output) + print(process) + s = io.StringIO(process.stdout) for line in s: if ((line.find("Image ID:")) > 0): print("\nImage ID found!\n") From d0d8046303ce905fafe339fc97da095115b6b8e1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 17:02:01 -0500 Subject: [PATCH 262/515] Update fc_block_decode.py add print --- groundstation/fc_block_decode.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 3308cd2d..bdb5d3dd 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -68,6 +68,8 @@ if __name__ == "__main__": process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) print("\n\n RESULT: \n") print(process) + print("\n\n process.stdout: \n") + print(process.stdout) s = io.StringIO(process.stdout) for line in s: if ((line.find("Image ID:")) > 0): From 0464281f9cf0e53faa638abece7ba5d160881801 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 17:09:51 -0500 Subject: [PATCH 263/515] Update fc_block_decode.py use ssdv_output --- groundstation/fc_block_decode.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index bdb5d3dd..ad835bf6 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -64,14 +64,18 @@ if __name__ == "__main__": print("File error") # try: filename = "image_file" + str(image_count) + "." + str(image_index) + ".jpeg" -# system("/home/pi/ssdv/ssdv -d -J image_file " + filename) - process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) - print("\n\n RESULT: \n") - print(process) - print("\n\n process.stdout: \n") - print(process.stdout) - s = io.StringIO(process.stdout) - for line in s: + system("/home/pi/ssdv/ssdv -d -J image_file " + filename + " > ssdv_output") +# process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) +# print("\n\n RESULT: \n") +# print(process) +# print("\n\n process.stdout: \n") +# print(process.stdout) +# s = io.StringIO(process.stdout) +# for line in s: + ssdv_output_file = open("ssdv_output", "r") + for line in ssdv_output_file + print("line:") + print(line) if ((line.find("Image ID:")) > 0): print("\nImage ID found!\n") image_id_string = line.split() From d0ccdf2f7c59504a153ab1b2f01bf95ffd326a0a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 17:20:06 -0500 Subject: [PATCH 264/515] Update fc_block_decode.py missing : --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index ad835bf6..8e247734 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -73,7 +73,7 @@ if __name__ == "__main__": # s = io.StringIO(process.stdout) # for line in s: ssdv_output_file = open("ssdv_output", "r") - for line in ssdv_output_file + for line in ssdv_output_file: print("line:") print(line) if ((line.find("Image ID:")) > 0): From eb5d4e2f45a24bcc5f51430aa510155e49c60960 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 17:26:12 -0500 Subject: [PATCH 265/515] Update fc_block_decode.py added &> --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 8e247734..9b781a62 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -64,7 +64,7 @@ if __name__ == "__main__": print("File error") # try: filename = "image_file" + str(image_count) + "." + str(image_index) + ".jpeg" - system("/home/pi/ssdv/ssdv -d -J image_file " + filename + " > ssdv_output") + system("/home/pi/ssdv/ssdv -d -J image_file " + filename + " &> ssdv_output") # process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) # print("\n\n RESULT: \n") # print(process) From 7d4451509cb8f7a24c67112c5e67b81d4bb358d1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 17:32:03 -0500 Subject: [PATCH 266/515] Update fc_block_decode.py with open --- groundstation/fc_block_decode.py | 44 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 9b781a62..92e78d7c 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -72,28 +72,28 @@ if __name__ == "__main__": # print(process.stdout) # s = io.StringIO(process.stdout) # for line in s: - ssdv_output_file = open("ssdv_output", "r") - for line in ssdv_output_file: - print("line:") - print(line) - if ((line.find("Image ID:")) > 0): - print("\nImage ID found!\n") - image_id_string = line.split() - print(image_id_string) - new_image_count = int(image_id_string[1]) - if (new_image_count != image_count): - image_count = new_image_coount - print("End of image") - filename = "image_file" + str(image_count) + ".jpeg" - system("/home/pi/ssdv/ssdv -d -J image_file " + filename) - system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - system("sudo mv image_file image_file" + str(image_count)) - print("Image count: ") - print(image_count) -# image_count = (image_count + 1) % 256 - image_index = 0 - else: - image_index += 1 + with open("ssdv_output", "r") as file: + for line in file: + print("line:") + print(line) + if ((line.find("Image ID:")) > 0): + print("\nImage ID found!\n") + image_id_string = line.split() + print(image_id_string) + new_image_count = int(image_id_string[1]) + if (new_image_count != image_count): + image_count = new_image_coount + print("End of image") + filename = "image_file" + str(image_count) + ".jpeg" + system("/home/pi/ssdv/ssdv -d -J image_file " + filename) + system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") + system("sudo mv image_file image_file" + str(image_count)) + print("Image count: ") + print(image_count) + # image_count = (image_count + 1) % 256 + image_index = 0 + else: + image_index += 1 system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") # image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg") From cd4d27ecee08d9dfddac102cdb9b255f7ad23004 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 22:07:28 -0500 Subject: [PATCH 267/515] Update fc_block_decode.py full paths --- groundstation/fc_block_decode.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 92e78d7c..1fda65df 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -63,8 +63,8 @@ if __name__ == "__main__": except: print("File error") # try: - filename = "image_file" + str(image_count) + "." + str(image_index) + ".jpeg" - system("/home/pi/ssdv/ssdv -d -J image_file " + filename + " &> ssdv_output") + filename = "/home/pi/fctelem/image_file" + str(image_count) + "." + str(image_index) + ".jpeg" + system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename + " &> ssdv_output") # process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) # print("\n\n RESULT: \n") # print(process) @@ -72,7 +72,7 @@ if __name__ == "__main__": # print(process.stdout) # s = io.StringIO(process.stdout) # for line in s: - with open("ssdv_output", "r") as file: + with open("/home/pi/fctelem/ssdv_output", "r") as file: for line in file: print("line:") print(line) @@ -84,10 +84,10 @@ if __name__ == "__main__": if (new_image_count != image_count): image_count = new_image_coount print("End of image") - filename = "image_file" + str(image_count) + ".jpeg" - system("/home/pi/ssdv/ssdv -d -J image_file " + filename) + filename = "/home/pi/fctelem/image_file" + str(image_count) + ".jpeg" + system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - system("sudo mv image_file image_file" + str(image_count)) + system("sudo mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_count)) print("Image count: ") print(image_count) # image_count = (image_count + 1) % 256 From 219f17a655dab29e09a7441c88f33e620adc2780 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 22:12:09 -0500 Subject: [PATCH 268/515] Update fc_block_decode.py add prints --- groundstation/fc_block_decode.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 1fda65df..6eeb01de 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -64,7 +64,7 @@ if __name__ == "__main__": print("File error") # try: filename = "/home/pi/fctelem/image_file" + str(image_count) + "." + str(image_index) + ".jpeg" - system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename + " &> ssdv_output") + system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename + " &> /home/pi/fctelem/ssdv_output") # process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) # print("\n\n RESULT: \n") # print(process) @@ -72,7 +72,10 @@ if __name__ == "__main__": # print(process.stdout) # s = io.StringIO(process.stdout) # for line in s: + print("After ssdv") + system("cat /home/pi/fctelem/ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: + print("Starting with") for line in file: print("line:") print(line) From 633ee39208769f2bf7bc19858ebe8655ec50cdd2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 22:40:37 -0500 Subject: [PATCH 269/515] Update fc_block_decode.py added tee --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 6eeb01de..29d06758 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -64,7 +64,7 @@ if __name__ == "__main__": print("File error") # try: filename = "/home/pi/fctelem/image_file" + str(image_count) + "." + str(image_index) + ".jpeg" - system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename + " &> /home/pi/fctelem/ssdv_output") + system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename + " 2>&1 | tee -a /home/pi/fctelem/ssdv_output") # process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) # print("\n\n RESULT: \n") # print(process) From 93e9af1d22e507ad772bebb28ef49bc1b139f8e6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 22:46:32 -0500 Subject: [PATCH 270/515] Update fc_block_decode.py remove -a --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 29d06758..07068d35 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -64,7 +64,7 @@ if __name__ == "__main__": print("File error") # try: filename = "/home/pi/fctelem/image_file" + str(image_count) + "." + str(image_index) + ".jpeg" - system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename + " 2>&1 | tee -a /home/pi/fctelem/ssdv_output") + system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename + " 2>&1 | tee /home/pi/fctelem/ssdv_output") # process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) # print("\n\n RESULT: \n") # print(process) @@ -79,7 +79,7 @@ if __name__ == "__main__": for line in file: print("line:") print(line) - if ((line.find("Image ID:")) > 0): + if ((line.find("mage ID:")) > 0): print("\nImage ID found!\n") image_id_string = line.split() print(image_id_string) From 309fd5b9f02461a3d3cb9a07fd16579d2b2a1550 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 22:48:58 -0500 Subject: [PATCH 271/515] Update fc_block_decode.py base 16 --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 07068d35..6cd6ba83 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -83,7 +83,7 @@ if __name__ == "__main__": print("\nImage ID found!\n") image_id_string = line.split() print(image_id_string) - new_image_count = int(image_id_string[1]) + new_image_count = int(image_id_string[3], 16) if (new_image_count != image_count): image_count = new_image_coount print("End of image") From a118f2142b03b680ffa82f5ee62eaca02a3f2dbf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 22:50:58 -0500 Subject: [PATCH 272/515] Update fc_block_decode.py 2nd pos --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 6cd6ba83..473b0be0 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -83,7 +83,7 @@ if __name__ == "__main__": print("\nImage ID found!\n") image_id_string = line.split() print(image_id_string) - new_image_count = int(image_id_string[3], 16) + new_image_count = int(image_id_string[2], 16) if (new_image_count != image_count): image_count = new_image_coount print("End of image") From 39afaf35372b0df3fe131b8a1e999dcb584b35bd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 22:52:48 -0500 Subject: [PATCH 273/515] Update fc_block_decode.py count --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 473b0be0..a6ab1799 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -85,7 +85,7 @@ if __name__ == "__main__": print(image_id_string) new_image_count = int(image_id_string[2], 16) if (new_image_count != image_count): - image_count = new_image_coount + image_count = new_image_count print("End of image") filename = "/home/pi/fctelem/image_file" + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) From ce9a2fd0549348ac550014f55b04263762c25112 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 7 Feb 2025 22:56:47 -0500 Subject: [PATCH 274/515] Update fc_block_decode.py add prints --- groundstation/fc_block_decode.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index a6ab1799..4d8665a3 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -77,13 +77,14 @@ if __name__ == "__main__": with open("/home/pi/fctelem/ssdv_output", "r") as file: print("Starting with") for line in file: - print("line:") - print(line) +# print("line:") +# print(line) if ((line.find("mage ID:")) > 0): print("\nImage ID found!\n") image_id_string = line.split() print(image_id_string) new_image_count = int(image_id_string[2], 16) + print(new_image_count) if (new_image_count != image_count): image_count = new_image_count print("End of image") @@ -97,6 +98,8 @@ if __name__ == "__main__": image_index = 0 else: image_index += 1 + print("image_index:") + print(image_index) system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") # image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg") From 2ec570801053cab5ca1002df31876535967dfdfe Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 08:34:58 -0500 Subject: [PATCH 275/515] Update index.html remove at end --- groundstation/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/index.html b/groundstation/index.html index 751aebf9..322de592 100644 --- a/groundstation/index.html +++ b/groundstation/index.html @@ -5,4 +5,4 @@ FunCube CubeSatSim Telemetry

- + From a1a9563c8ec69779d5e543e6ab29f3899e881dff Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 08:35:12 -0500 Subject: [PATCH 276/515] Update fc_block_decode.py change to image_id and _count --- groundstation/fc_block_decode.py | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 4d8665a3..c67616de 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -16,8 +16,8 @@ FC_SW = 50 FC_PAYLOAD = 55 extended = 1 -image_count = random.randint(0, 255) -image_index = 0; +image_id = random.randint(0, 255) +image_count = 0; system("sudo rm image_file") if __name__ == "__main__": @@ -63,7 +63,7 @@ if __name__ == "__main__": except: print("File error") # try: - filename = "/home/pi/fctelem/image_file" + str(image_count) + "." + str(image_index) + ".jpeg" + filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename + " 2>&1 | tee /home/pi/fctelem/ssdv_output") # process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) # print("\n\n RESULT: \n") @@ -72,10 +72,10 @@ if __name__ == "__main__": # print(process.stdout) # s = io.StringIO(process.stdout) # for line in s: - print("After ssdv") - system("cat /home/pi/fctelem/ssdv_output") + # print("After ssdv") + # system("cat /home/pi/fctelem/ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: - print("Starting with") + # print("Starting with") for line in file: # print("line:") # print(line) @@ -83,23 +83,23 @@ if __name__ == "__main__": print("\nImage ID found!\n") image_id_string = line.split() print(image_id_string) - new_image_count = int(image_id_string[2], 16) - print(new_image_count) - if (new_image_count != image_count): - image_count = new_image_count + new_image_id = int(image_id_string[2], 16) + print(new_image_id) + if (new_image_id != image_id): + image_id = new_image_id print("End of image") - filename = "/home/pi/fctelem/image_file" + str(image_count) + ".jpeg" - system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) - system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - system("sudo mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_count)) - print("Image count: ") - print(image_count) + newfilename = "/home/pi/fctelem/image_file" + str(image_id) + ".jpeg" +# system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) + system("sudo cp " + newfilename + filename) + system("sudo mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_id)) + print("Image ID: ") + print(image_id) # image_count = (image_count + 1) % 256 - image_index = 0 + image_count = 0 else: - image_index += 1 - print("image_index:") - print(image_index) + image_count += 1 + print("image_count:") + print(image_count) system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") # image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg") From 6d02ff861065eae29a8a01a63300b1606f27219d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 08:40:00 -0500 Subject: [PATCH 277/515] Update fc_block_decode.py space in cp --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index c67616de..0152ea67 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -90,7 +90,7 @@ if __name__ == "__main__": print("End of image") newfilename = "/home/pi/fctelem/image_file" + str(image_id) + ".jpeg" # system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) - system("sudo cp " + newfilename + filename) + system("sudo cp " + newfilename + " " + filename) system("sudo mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_id)) print("Image ID: ") print(image_id) From 78a13cb695ec7ac42cde700aa1a41e88d4236ac8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 08:58:37 -0500 Subject: [PATCH 278/515] Update transmit.py log image_id --- transmit.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/transmit.py b/transmit.py index 7d07c527..043ee458 100644 --- a/transmit.py +++ b/transmit.py @@ -792,7 +792,8 @@ 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 = random.randint(0, 255); + image_id = random.randint(0, 255) + print("Initial image_id: " + str(image_id) + "\n") while 1: # print ("LED on") output(txLed, txLedOff) @@ -825,9 +826,10 @@ 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 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 + system("/home/pi/ssdv/ssdv -e -n -i " + str(image_id) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") + print("image_id: " + str(image_id) + "\n") + image_id = ( image_id + 1 ) % 256 + print("new image_id: " + str(image_id) + "\n") sleep(2) else: sleep(4.6) From 1496dd843f6a1b7442f64986a01481936d8d662d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 09:07:20 -0500 Subject: [PATCH 279/515] Update fc_block_decode.py force new image when non-payload detected --- groundstation/fc_block_decode.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 0152ea67..dca5b952 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -90,7 +90,7 @@ if __name__ == "__main__": print("End of image") newfilename = "/home/pi/fctelem/image_file" + str(image_id) + ".jpeg" # system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) - system("sudo cp " + newfilename + " " + filename) + system("sudo cp " + filename + " " + newfilename) system("sudo mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_id)) print("Image ID: ") print(image_id) @@ -109,5 +109,6 @@ if __name__ == "__main__": else: print("Payload not an image!") + image_id = 256 # set illegal image_id to force new image else: print("Unknown Sat Id or Frame") From 7fa78bb4a3160087a4fbdfef3d718d8db02254f3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 09:25:09 -0500 Subject: [PATCH 280/515] Update fctelem.sh load browser and image first --- groundstation/fctelem.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index be023e16..fa45b5f3 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -60,16 +60,18 @@ cd /home/pi/CubeSatSim/groundstation/public_html cp /home/pi/CubeSatSim/groundstation/index.html . +cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/groundstation/image_file.jpeg + python3 -m http.server & +setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8000 &>/dev/null & + cd /home/pi/fctelem ./fctelem | python3 /home/pi/CubeSatSim/groundstation/fc_block_decode.py & # sleep 10 -setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8000 &>/dev/null & - read val sudo killall -9 fctelem &>/dev/null From 71a64a116e765b65855f5dfd3e953d2c856672ec Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 09:56:55 -0500 Subject: [PATCH 281/515] Update fc_block_decode.py save first image block --- groundstation/fc_block_decode.py | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index dca5b952..8e0911bc 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -57,25 +57,15 @@ if __name__ == "__main__": print("Writing payload to file") immutable_payload = bytes(bytearray(data_block[(FC_PAYLOAD + extended):])) # payload) print(immutable_payload) - with open("image_file", "ab") as binary_file: + with open("image_file_payload", "wb") as binary_file: binary_file.write(immutable_payload) except: print("File error") # try: filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" - system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename + " 2>&1 | tee /home/pi/fctelem/ssdv_output") -# process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) -# print("\n\n RESULT: \n") -# print(process) -# print("\n\n process.stdout: \n") -# print(process.stdout) -# s = io.StringIO(process.stdout) -# for line in s: - # print("After ssdv") - # system("cat /home/pi/fctelem/ssdv_output") + system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload /home/pi/fctelem/image_file_payload.jpeg 2>&1 | tee /home/pi/fctelem/ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: - # print("Starting with") for line in file: # print("line:") # print(line) @@ -90,9 +80,9 @@ if __name__ == "__main__": print("End of image") newfilename = "/home/pi/fctelem/image_file" + str(image_id) + ".jpeg" # system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) - system("sudo cp " + filename + " " + newfilename) + system("sudo mv " + filename + " " + newfilename) system("sudo mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_id)) - print("Image ID: ") + print("New Image ID: ") print(image_id) # image_count = (image_count + 1) % 256 image_count = 0 @@ -100,8 +90,10 @@ if __name__ == "__main__": image_count += 1 print("image_count:") print(image_count) - - system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") + with open("image_file", "ab") as binary_file: + binary_file.write(immutable_payload) + system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) + system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") # image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg") # image.show() # except: From 1369808885195e9bafd447d5df41c65310f5f919 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 10:14:09 -0500 Subject: [PATCH 282/515] Update fc_block_decode.py handle null image_id --- groundstation/fc_block_decode.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 8e0911bc..83f97de7 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -16,7 +16,7 @@ FC_SW = 50 FC_PAYLOAD = 55 extended = 1 -image_id = random.randint(0, 255) +image_id = 256 # set illegal image ID for null # random.randint(0, 255) image_count = 0; system("sudo rm image_file") @@ -78,27 +78,25 @@ if __name__ == "__main__": if (new_image_id != image_id): image_id = new_image_id print("End of image") - newfilename = "/home/pi/fctelem/image_file" + str(image_id) + ".jpeg" -# system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) - system("sudo mv " + filename + " " + newfilename) - system("sudo mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_id)) + if (image_id != 256): + newfilename = "/home/pi/fctelem/image_file" + str(image_id) + ".jpeg" + # system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) + system("sudo mv " + filename + " " + newfilename) + system("sudo mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_id)) + else: + system("sudo rm /home/pi/fctelem/image_file") print("New Image ID: ") print(image_id) # image_count = (image_count + 1) % 256 image_count = 0 else: image_count += 1 - print("image_count:") + print("new image_count:") print(image_count) with open("image_file", "ab") as binary_file: binary_file.write(immutable_payload) system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") -# image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg") -# image.show() -# except: -# print("Image display error") - else: print("Payload not an image!") image_id = 256 # set illegal image_id to force new image From 5d944e2f5dd5d5d3730956e19169c753fbcabc91 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 10:21:05 -0500 Subject: [PATCH 283/515] Update fc_block_decode.py handle id 256 --- groundstation/fc_block_decode.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 83f97de7..489e88e7 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -63,7 +63,6 @@ if __name__ == "__main__": except: print("File error") # try: - filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload /home/pi/fctelem/image_file_payload.jpeg 2>&1 | tee /home/pi/fctelem/ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: for line in file: @@ -76,17 +75,17 @@ if __name__ == "__main__": new_image_id = int(image_id_string[2], 16) print(new_image_id) if (new_image_id != image_id): - image_id = new_image_id print("End of image") if (image_id != 256): - newfilename = "/home/pi/fctelem/image_file" + str(image_id) + ".jpeg" + newfilename = "/home/pi/fctelem/image_file" + str(new_image_id) + ".jpeg" # system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("sudo mv " + filename + " " + newfilename) system("sudo mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_id)) else: system("sudo rm /home/pi/fctelem/image_file") print("New Image ID: ") - print(image_id) + print(new_image_id) + image_id = new_image_id # image_count = (image_count + 1) % 256 image_count = 0 else: @@ -94,7 +93,8 @@ if __name__ == "__main__": print("new image_count:") print(image_count) with open("image_file", "ab") as binary_file: - binary_file.write(immutable_payload) + binary_file.write(immutable_payload) + filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") else: From 8a16553a99245f3123781972eccb027bae01b88d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 10:28:38 -0500 Subject: [PATCH 284/515] Update fctelem.sh move sudo to fctelem --- groundstation/fctelem.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index fa45b5f3..d448ca6e 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -68,7 +68,7 @@ setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update cd /home/pi/fctelem -./fctelem | python3 /home/pi/CubeSatSim/groundstation/fc_block_decode.py & +sudo ./fctelem | python3 /home/pi/CubeSatSim/groundstation/fc_block_decode.py & # sleep 10 From ad8485ab6f229845b2dd943f6ee783d2b364d82c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 10:33:43 -0500 Subject: [PATCH 285/515] Update fctelem.sh copy initial image --- groundstation/fctelem.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index d448ca6e..20958df4 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -51,7 +51,7 @@ sudo systemctl stop rtl_tcp sudo systemctl stop openwebrx FILE=/home/pi/CubeSatSim/groundstation/public_html -if [ ! -f "$FILE" ]; then +if [ -f "$FILE" ]; then echo "Making public_html directory" mkdir /home/pi/CubeSatSim/groundstation/public_html fi @@ -60,7 +60,7 @@ cd /home/pi/CubeSatSim/groundstation/public_html cp /home/pi/CubeSatSim/groundstation/index.html . -cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/groundstation/image_file.jpeg +cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg python3 -m http.server & From 92c3f587b287a87977288d4a019e90ec529860df Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 10:34:53 -0500 Subject: [PATCH 286/515] Update fc_block_decode.py remove extra sudos --- groundstation/fc_block_decode.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 489e88e7..a8c9bd87 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -79,8 +79,8 @@ if __name__ == "__main__": if (image_id != 256): newfilename = "/home/pi/fctelem/image_file" + str(new_image_id) + ".jpeg" # system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) - system("sudo mv " + filename + " " + newfilename) - system("sudo mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_id)) + system("mv " + filename + " " + newfilename) + system("mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_id)) else: system("sudo rm /home/pi/fctelem/image_file") print("New Image ID: ") @@ -96,7 +96,7 @@ if __name__ == "__main__": binary_file.write(immutable_payload) filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) - system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") + system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") else: print("Payload not an image!") image_id = 256 # set illegal image_id to force new image From 5d2fd446accdb3f7492cbf90f79a5b062ce6023c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 10:48:59 -0500 Subject: [PATCH 287/515] Update fc_block_decode.py sudo tee --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index a8c9bd87..7abab75a 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -63,7 +63,7 @@ if __name__ == "__main__": except: print("File error") # try: - system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload /home/pi/fctelem/image_file_payload.jpeg 2>&1 | tee /home/pi/fctelem/ssdv_output") + system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload /home/pi/fctelem/image_file_payload.jpeg 2>&1 | sudo tee /home/pi/fctelem/ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: for line in file: # print("line:") From 848d3859b2a6d28ea2adc8e134a818fa77dadd71 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 10:51:41 -0500 Subject: [PATCH 288/515] Update transmit.py add callsign --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 043ee458..3085ce59 100644 --- a/transmit.py +++ b/transmit.py @@ -826,7 +826,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_id) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") + system("/home/pi/ssdv/ssdv -e -n -c AMSAT -i " + str(image_id) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") print("image_id: " + str(image_id) + "\n") image_id = ( image_id + 1 ) % 256 print("new image_id: " + str(image_id) + "\n") From acaa90f690b68a26c51d12a9e0a679f6e130f9bd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 10:56:58 -0500 Subject: [PATCH 289/515] Update transmit.py remove -c AMSAT --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 3085ce59..043ee458 100644 --- a/transmit.py +++ b/transmit.py @@ -826,7 +826,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 -c AMSAT -i " + str(image_id) + " -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_id) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") print("image_id: " + str(image_id) + "\n") image_id = ( image_id + 1 ) % 256 print("new image_id: " + str(image_id) + "\n") From 0135020b40408d624da80018f1a9cb1e8d1398fe Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 11:21:14 -0500 Subject: [PATCH 290/515] Update fc_block_decode.py add html --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 7abab75a..a8c9bd87 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -63,7 +63,7 @@ if __name__ == "__main__": except: print("File error") # try: - system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload /home/pi/fctelem/image_file_payload.jpeg 2>&1 | sudo tee /home/pi/fctelem/ssdv_output") + system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload /home/pi/fctelem/image_file_payload.jpeg 2>&1 | tee /home/pi/fctelem/ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: for line in file: # print("line:") From 5ee5130cacf84ce35c6d43b5103bd7c0a3663ee3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 11:27:31 -0500 Subject: [PATCH 291/515] Update fc_block_decode.py append to html --- groundstation/fc_block_decode.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index a8c9bd87..9e150133 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -46,12 +46,11 @@ if __name__ == "__main__": print("CubeSatSim Frametype RT1+IMG1") if (data_block[0] == 0xE1): print("CubeSatSim Frametype RT2+IMG2") - print("Sequence number: ") - print(data_block[extended + 51] + data_block[extended + 50] * 2^16 + data_block[extended + 49] * 2^32) - print("Vx (mV): ") - print((data_block[extended + FC_EPS + 0] << 2) + (0xfc & data_block[extended + FC_EPS + 1])) - print('Payload 0:{:x}, Payload 1:{:x}'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1])) - print(" ") + sequence = data_block[extended + 51] + data_block[extended + 50] * 2^16 + data_block[extended + 49] * 2^32 + print("Sequence number: {:d}".format(sequence)) + Vx = (data_block[extended + FC_EPS + 0] << 2) + (0x03 & data_block[extended + FC_EPS + 1]) + print("Vx: {%d} mV".format(Vx)) + print('Payload {:x} {:x} \n'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1])) if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): try: print("Writing payload to file") @@ -63,7 +62,7 @@ if __name__ == "__main__": except: print("File error") # try: - system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload /home/pi/fctelem/image_file_payload.jpeg 2>&1 | tee /home/pi/fctelem/ssdv_output") + system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload /home/pi/fctelem/image_file_payload.jpeg 2>&1 | sudo tee /home/pi/fctelem/ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: for line in file: # print("line:") @@ -97,6 +96,10 @@ if __name__ == "__main__": filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") + telem_string = "\nSequence number: " + str(sequence) + with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "a") as html_file: + html_file.write(telem_string) + else: print("Payload not an image!") image_id = 256 # set illegal image_id to force new image From 86a7da341e6438cb3086b83a40c3aa26680fafdd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 11:29:38 -0500 Subject: [PATCH 292/515] Update fc_block_decode.py :d --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 9e150133..baa2ffe7 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -49,7 +49,7 @@ if __name__ == "__main__": sequence = data_block[extended + 51] + data_block[extended + 50] * 2^16 + data_block[extended + 49] * 2^32 print("Sequence number: {:d}".format(sequence)) Vx = (data_block[extended + FC_EPS + 0] << 2) + (0x03 & data_block[extended + FC_EPS + 1]) - print("Vx: {%d} mV".format(Vx)) + print("Vx: {:d} mV".format(Vx)) print('Payload {:x} {:x} \n'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1])) if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): try: From 96ab8b9736a2c7819a759bfa07ed3fb2ab84094c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 11:47:03 -0500 Subject: [PATCH 293/515] Update index.html add refresh --- groundstation/index.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/groundstation/index.html b/groundstation/index.html index 322de592..8baea30d 100644 --- a/groundstation/index.html +++ b/groundstation/index.html @@ -1,8 +1,9 @@ - + FunCube CubeSatSim Telemetry

- + +

- - From 6a82b8c80427019cfb0b873997f3784995eeb5de Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 11:50:57 -0500 Subject: [PATCH 294/515] Update fc_block_decode.py add head and foot to html --- groundstation/fc_block_decode.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index baa2ffe7..26b17f21 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -96,10 +96,13 @@ if __name__ == "__main__": filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - telem_string = "\nSequence number: " + str(sequence) - with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "a") as html_file: - html_file.write(telem_string) - + head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n' + telem_string = "\nSequence number: " + str(sequence) + "\nImage ID: " + str(image_id) + " count: " + str(image_count) + foot_string = "

\n" + with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: + html_file.write(heat_string) + html_file.write(telem_string) + html_file.write(foot_string) else: print("Payload not an image!") image_id = 256 # set illegal image_id to force new image From 21d56b5c8db2d910ca7072eb7ecc2cb6cf6eeb73 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 12:02:53 -0500 Subject: [PATCH 295/515] Update fc_block_decode.py fix whitespace --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 26b17f21..e54a4326 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -100,7 +100,7 @@ if __name__ == "__main__": telem_string = "\nSequence number: " + str(sequence) + "\nImage ID: " + str(image_id) + " count: " + str(image_count) foot_string = "

\n" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: - html_file.write(heat_string) + html_file.write(heat_string) html_file.write(telem_string) html_file.write(foot_string) else: From f536b0c4e43ea7e777e5b2e3dbd7184de35155ed Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 12:04:22 -0500 Subject: [PATCH 296/515] Update fc_block_decode.py typo --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index e54a4326..7ac4bf76 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -100,7 +100,7 @@ if __name__ == "__main__": telem_string = "\nSequence number: " + str(sequence) + "\nImage ID: " + str(image_id) + " count: " + str(image_count) foot_string = "

\n" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: - html_file.write(heat_string) + html_file.write(head_string) html_file.write(telem_string) html_file.write(foot_string) else: From 2c10a4e5997c9ec4db1b167f495874fb43570dc0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 12:10:20 -0500 Subject: [PATCH 297/515] Create fctelem.desktop --- groundstation/fctelem.desktop | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 groundstation/fctelem.desktop diff --git a/groundstation/fctelem.desktop b/groundstation/fctelem.desktop new file mode 100644 index 00000000..9ff1b302 --- /dev/null +++ b/groundstation/fctelem.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Exec=/home/pi/CubeSatSim/groundstation/fctelem.sh +Name=FunCube Telem +Comment=FunCube Telemetry Web App +Icon=/home/pi/Downloads/fctelem.png +Path=/home/pi +Terminal=true +Categories=HamRadio +Keywords=Ham Radio;SDR From 7e4109373017bf63deacaece2a05ba026467d8dd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 12:14:58 -0500 Subject: [PATCH 298/515] Update fc_block_decode.py add

--- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 7ac4bf76..26daf757 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -96,7 +96,7 @@ if __name__ == "__main__": filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n' + head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' telem_string = "\nSequence number: " + str(sequence) + "\nImage ID: " + str(image_id) + " count: " + str(image_count) foot_string = "

\n" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: From 2b827702555bd91667150e9c6beaa87fce7bc431 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 14:09:19 -0500 Subject: [PATCH 299/515] Update fc_block_decode.py formatting --- groundstation/fc_block_decode.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 26daf757..3142c567 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -36,10 +36,10 @@ if __name__ == "__main__": if ((line.find("data: ")) > 0): print("\ndata block found!\n") data_block_string = line.split() - print(data_block_string) +# print(data_block_string) data_block = [int(number_string,16) for number_string in data_block_string[7:]] - print("\n") - print(data_block) +# print("\n") +# print(data_block) print("\n") if (data_block[0] == 0xE0) or (data_block[0] == 0xE1): if (data_block[0] == 0xE0): @@ -68,11 +68,11 @@ if __name__ == "__main__": # print("line:") # print(line) if ((line.find("mage ID:")) > 0): - print("\nImage ID found!\n") +# print("\nImage ID found!\n") image_id_string = line.split() - print(image_id_string) +# print(image_id_string) new_image_id = int(image_id_string[2], 16) - print(new_image_id) +# print(new_image_id) if (new_image_id != image_id): print("End of image") if (image_id != 256): @@ -97,7 +97,8 @@ if __name__ == "__main__": system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' - telem_string = "\nSequence number: " + str(sequence) + "\nImage ID: " + str(image_id) + " count: " + str(image_count) +# telem_string = "\nSequence number: " + str(sequence) + "\nImage ID: " + str(image_id) + " count: " + str(image_count) + telem_string = "\nSequence number: {sequence} Image ID: {image_id} count: {image_count}\nVx: {Vx} mV" foot_string = "

\n" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) From d007ddeb05f7290c0fff5a2a5abdeb59f2225145 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 14:23:00 -0500 Subject: [PATCH 300/515] Update fc_block_decode.py added f --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 3142c567..a1a03efb 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -98,7 +98,7 @@ if __name__ == "__main__": system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' # telem_string = "\nSequence number: " + str(sequence) + "\nImage ID: " + str(image_id) + " count: " + str(image_count) - telem_string = "\nSequence number: {sequence} Image ID: {image_id} count: {image_count}\nVx: {Vx} mV" + telem_string = f"\nSequence number: {sequence} Image ID: {image_id} count: {image_count}\nVx: {Vx} mV" foot_string = "

\n" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) From f162b67e2e812546f0b07e749960550b250c16e7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 14:56:38 -0500 Subject: [PATCH 301/515] Update fc_block_decode.py and Vy and Vz --- groundstation/fc_block_decode.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index a1a03efb..c3f87ac2 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -48,8 +48,10 @@ if __name__ == "__main__": print("CubeSatSim Frametype RT2+IMG2") sequence = data_block[extended + 51] + data_block[extended + 50] * 2^16 + data_block[extended + 49] * 2^32 print("Sequence number: {:d}".format(sequence)) - Vx = (data_block[extended + FC_EPS + 0] << 2) + (0x03 & data_block[extended + FC_EPS + 1]) - print("Vx: {:d} mV".format(Vx)) + Vx = (data_block[extended + FC_EPS + 0] * 2^6) + (data_block[extended + FC_EPS + 1] >> 2) + Vy = (0x03 & data_block[extended + FC_EPS + 1]) * 2^12 + data_block[extended + FC_EPS + 2] * 2^4 + (data_block[extended + FC_EPS + 3] >> 4) + Vz = (0x0f & data_block[extended + FC_EPS + 3]) * 2^10 + data_block[extended + FC_EPS + 4] * 2^2 + (data_block[extended + FC_EPS + 5] >> 6) + print("Vx: {:d} mV Vy: {:d} mV Vz: {:d} mV".format(Vx, Vy, Vz)) print('Payload {:x} {:x} \n'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1])) if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): try: @@ -98,7 +100,7 @@ if __name__ == "__main__": system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' # telem_string = "\nSequence number: " + str(sequence) + "\nImage ID: " + str(image_id) + " count: " + str(image_count) - telem_string = f"\nSequence number: {sequence} Image ID: {image_id} count: {image_count}\nVx: {Vx} mV" + telem_string = f"\nSequence number: {sequence} Image ID: {image_id} count: {image_count}

Vx: {Vx} mV Vy: {Vy} mV Vz: {Vz} mV" foot_string = "

\n" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) From a151bdc22affdd8eb6bf9ba8de50006db7cbefaf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 15:20:06 -0500 Subject: [PATCH 302/515] Update fc_block_decode.py add height and width --- groundstation/fc_block_decode.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index c3f87ac2..34a172ab 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -16,6 +16,10 @@ FC_SW = 50 FC_PAYLOAD = 55 extended = 1 +head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' +foot_string = "

\n" + + image_id = 256 # set illegal image ID for null # random.randint(0, 255) image_count = 0; system("sudo rm image_file") From 4cef05bb20deafd95b00e4ae043a965f40518ab6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 15:25:22 -0500 Subject: [PATCH 303/515] Update fc_block_decode.py add digit formatting --- groundstation/fc_block_decode.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 34a172ab..e448b86a 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -44,7 +44,7 @@ if __name__ == "__main__": data_block = [int(number_string,16) for number_string in data_block_string[7:]] # print("\n") # print(data_block) - print("\n") +# print("\n") if (data_block[0] == 0xE0) or (data_block[0] == 0xE1): if (data_block[0] == 0xE0): print("CubeSatSim Frametype RT1+IMG1") @@ -102,10 +102,8 @@ if __name__ == "__main__": filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' # telem_string = "\nSequence number: " + str(sequence) + "\nImage ID: " + str(image_id) + " count: " + str(image_count) - telem_string = f"\nSequence number: {sequence} Image ID: {image_id} count: {image_count}

Vx: {Vx} mV Vy: {Vy} mV Vz: {Vz} mV" - foot_string = "

\n" + telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From 43b6757e344fc6f1922c318021a4a7b9a8e106a1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 15:33:39 -0500 Subject: [PATCH 304/515] Update fc_block_decode.py fix ** --- groundstation/fc_block_decode.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index e448b86a..ebd911cd 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -50,18 +50,18 @@ if __name__ == "__main__": print("CubeSatSim Frametype RT1+IMG1") if (data_block[0] == 0xE1): print("CubeSatSim Frametype RT2+IMG2") - sequence = data_block[extended + 51] + data_block[extended + 50] * 2^16 + data_block[extended + 49] * 2^32 + sequence = data_block[extended + 51] + data_block[extended + 50] * 2**16 + data_block[extended + 49] * 2**32 print("Sequence number: {:d}".format(sequence)) - Vx = (data_block[extended + FC_EPS + 0] * 2^6) + (data_block[extended + FC_EPS + 1] >> 2) - Vy = (0x03 & data_block[extended + FC_EPS + 1]) * 2^12 + data_block[extended + FC_EPS + 2] * 2^4 + (data_block[extended + FC_EPS + 3] >> 4) - Vz = (0x0f & data_block[extended + FC_EPS + 3]) * 2^10 + data_block[extended + FC_EPS + 4] * 2^2 + (data_block[extended + FC_EPS + 5] >> 6) + Vx = (data_block[extended + FC_EPS + 0] * 2**6) + (data_block[extended + FC_EPS + 1] >> 2) + Vy = (0x03 & data_block[extended + FC_EPS + 1]) * 2**12 + data_block[extended + FC_EPS + 2] * 2**4 + (data_block[extended + FC_EPS + 3] >> 4) + Vz = (0x0f & data_block[extended + FC_EPS + 3]) * 2**10 + data_block[extended + FC_EPS + 4] * 2**2 + (data_block[extended + FC_EPS + 5] >> 6) print("Vx: {:d} mV Vy: {:d} mV Vz: {:d} mV".format(Vx, Vy, Vz)) print('Payload {:x} {:x} \n'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1])) if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): try: print("Writing payload to file") immutable_payload = bytes(bytearray(data_block[(FC_PAYLOAD + extended):])) # payload) - print(immutable_payload) +# print(immutable_payload) with open("image_file_payload", "wb") as binary_file: binary_file.write(immutable_payload) From aff003f2293a714a573ea10fca42094399aadea8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 15:41:36 -0500 Subject: [PATCH 305/515] Update fctelem.desktop --- groundstation/fctelem.desktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fctelem.desktop b/groundstation/fctelem.desktop index 9ff1b302..6d758284 100644 --- a/groundstation/fctelem.desktop +++ b/groundstation/fctelem.desktop @@ -3,7 +3,7 @@ Type=Application Exec=/home/pi/CubeSatSim/groundstation/fctelem.sh Name=FunCube Telem Comment=FunCube Telemetry Web App -Icon=/home/pi/Downloads/fctelem.png +Icon=/home/pi/Downloads/fc-icon.png Path=/home/pi Terminal=true Categories=HamRadio From e6e8ea68bb01189e90d4a553039890f0066883ae Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 15:42:27 -0500 Subject: [PATCH 306/515] Update fctelem.desktop --- groundstation/fctelem.desktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fctelem.desktop b/groundstation/fctelem.desktop index 6d758284..c9ea58f6 100644 --- a/groundstation/fctelem.desktop +++ b/groundstation/fctelem.desktop @@ -3,7 +3,7 @@ Type=Application Exec=/home/pi/CubeSatSim/groundstation/fctelem.sh Name=FunCube Telem Comment=FunCube Telemetry Web App -Icon=/home/pi/Downloads/fc-icon.png +Icon=/home/pi/Icons/fc-icon.png Path=/home/pi Terminal=true Categories=HamRadio From 211e7f4b1ae1f8b2aa3e69df4fa4f491b2d7bc14 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 15:45:54 -0500 Subject: [PATCH 307/515] Update fc_block_decode.py print seq --- groundstation/fc_block_decode.py | 1 + 1 file changed, 1 insertion(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index ebd911cd..73429306 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -50,6 +50,7 @@ if __name__ == "__main__": print("CubeSatSim Frametype RT1+IMG1") if (data_block[0] == 0xE1): print("CubeSatSim Frametype RT2+IMG2") + print(data_block[extended + 51], data_block[extended + 50], data_block[extended + 49]) sequence = data_block[extended + 51] + data_block[extended + 50] * 2**16 + data_block[extended + 49] * 2**32 print("Sequence number: {:d}".format(sequence)) Vx = (data_block[extended + FC_EPS + 0] * 2**6) + (data_block[extended + FC_EPS + 1] >> 2) From 39f8910f5a73ed9c331696591c8777409682e320 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 15:52:24 -0500 Subject: [PATCH 308/515] Update fc_block_decode.py fix seq number --- groundstation/fc_block_decode.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 73429306..1a39115b 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -16,9 +16,20 @@ FC_SW = 50 FC_PAYLOAD = 55 extended = 1 +sequence = 0 +image_id = 0 +image_count = 0 +Vx = 0 +Vy = 0 +Vz = 0 + head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' foot_string = "

\n" - +telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV" +with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: + html_file.write(head_string) + html_file.write(telem_string) + html_file.write(foot_string) image_id = 256 # set illegal image ID for null # random.randint(0, 255) image_count = 0; @@ -51,7 +62,7 @@ if __name__ == "__main__": if (data_block[0] == 0xE1): print("CubeSatSim Frametype RT2+IMG2") print(data_block[extended + 51], data_block[extended + 50], data_block[extended + 49]) - sequence = data_block[extended + 51] + data_block[extended + 50] * 2**16 + data_block[extended + 49] * 2**32 + sequence = data_block[extended + 51] + data_block[extended + 50] * 2**8 + data_block[extended + 49] * 2**16 print("Sequence number: {:d}".format(sequence)) Vx = (data_block[extended + FC_EPS + 0] * 2**6) + (data_block[extended + FC_EPS + 1] >> 2) Vy = (0x03 & data_block[extended + FC_EPS + 1]) * 2**12 + data_block[extended + FC_EPS + 2] * 2**4 + (data_block[extended + FC_EPS + 3] >> 4) @@ -104,7 +115,7 @@ if __name__ == "__main__": system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") # telem_string = "\nSequence number: " + str(sequence) + "\nImage ID: " + str(image_id) + " count: " + str(image_count) - telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV" +# telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From b4731c4ac0a0e46781f73c565d72f3880b2a4f9e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 15:56:59 -0500 Subject: [PATCH 309/515] Update fc_block_decode.py fix telem print --- groundstation/fc_block_decode.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 1a39115b..ddd13c6a 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -114,8 +114,7 @@ if __name__ == "__main__": filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") -# telem_string = "\nSequence number: " + str(sequence) + "\nImage ID: " + str(image_id) + " count: " + str(image_count) -# telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV" + telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From 05d51f93fd89d7d6a9ee383c8062d02949a41217 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 15:58:08 -0500 Subject: [PATCH 310/515] Update fctelem.sh remove read at end and kills --- groundstation/fctelem.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 20958df4..d639d818 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -72,11 +72,11 @@ sudo ./fctelem | python3 /home/pi/CubeSatSim/groundstation/fc_block_decode.py & # sleep 10 -read val +#read val -sudo killall -9 fctelem &>/dev/null +#sudo killall -9 fctelem &>/dev/null -sudo killall -9 python3 &>/dev/null +#sudo killall -9 python3 &>/dev/null sleep 10 From 9ae5f9748dab443c2eff7fc73c262e6c50bc1044 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 15:59:07 -0500 Subject: [PATCH 311/515] Update fctelem.sh remove & --- groundstation/fctelem.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index d639d818..cc0ddd69 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -68,7 +68,7 @@ setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update cd /home/pi/fctelem -sudo ./fctelem | python3 /home/pi/CubeSatSim/groundstation/fc_block_decode.py & +sudo ./fctelem | python3 /home/pi/CubeSatSim/groundstation/fc_block_decode.py # sleep 10 From 03ed1c9812c111489bcd88fe53a2810fd7f494b9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 16:03:06 -0500 Subject: [PATCH 312/515] Update fc_block_decode.py try f --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index ddd13c6a..5efbf1d4 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -25,7 +25,7 @@ Vz = 0 head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' foot_string = "

\n" -telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV" +telem_string = f"\nSequence number: {sequence:5.f} Image ID: {image_id:3.f} count: {image_count:2.f}

Vx: {Vx:5.f} mV Vy: {Vy:5.f} mV Vz: {Vz:5.f} mV" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From c24dbf1a2337c6b3cc995f5ed49e7119f4e3b7f6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 16:04:34 -0500 Subject: [PATCH 313/515] Update fc_block_decode.py back to d --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 5efbf1d4..542c64c2 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -25,7 +25,7 @@ Vz = 0 head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' foot_string = "

\n" -telem_string = f"\nSequence number: {sequence:5.f} Image ID: {image_id:3.f} count: {image_count:2.f}

Vx: {Vx:5.f} mV Vy: {Vy:5.f} mV Vz: {Vz:5.f} mV" +telem_string = f"\nSequence number: {sequence:5.d} Image ID: {image_id:3.d} count: {image_count:2.d}

Vx: {Vx:5.d} mV Vy: {Vy:5.d} mV Vz: {Vz:5.d} mV" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From 6f0fe482e05472a19354476da6f29f2785d8585b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 16:08:33 -0500 Subject: [PATCH 314/515] Update fc_block_decode.py try .0 --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 542c64c2..c72a9339 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -25,7 +25,7 @@ Vz = 0 head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' foot_string = "

\n" -telem_string = f"\nSequence number: {sequence:5.d} Image ID: {image_id:3.d} count: {image_count:2.d}

Vx: {Vx:5.d} mV Vy: {Vy:5.d} mV Vz: {Vz:5.d} mV" +telem_string = f"\nSequence number: {sequence:5.0d} Image ID: {image_id:3.0d} count: {image_count:2.0d}

Vx: {Vx:5.0d} mV Vy: {Vy:5.0d} mV Vz: {Vz:5.0d} mV" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From 42148b929dd08e1a7f36048a97afa6400b4a7cc7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 16:12:50 -0500 Subject: [PATCH 315/515] Update fc_block_decode.py try seq float --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index c72a9339..00fdd82a 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -16,7 +16,7 @@ FC_SW = 50 FC_PAYLOAD = 55 extended = 1 -sequence = 0 +sequence = 0.0 image_id = 0 image_count = 0 Vx = 0 @@ -25,7 +25,7 @@ Vz = 0 head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' foot_string = "

\n" -telem_string = f"\nSequence number: {sequence:5.0d} Image ID: {image_id:3.0d} count: {image_count:2.0d}

Vx: {Vx:5.0d} mV Vy: {Vy:5.0d} mV Vz: {Vz:5.0d} mV" +telem_string = f"\nSequence number: {sequence:5.0f} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From b91c8a023f8b77923f172bc43688d71284bf41d8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 16:17:37 -0500 Subject: [PATCH 316/515] Update fc_block_decode.py try space --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 00fdd82a..a393f490 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -16,7 +16,7 @@ FC_SW = 50 FC_PAYLOAD = 55 extended = 1 -sequence = 0.0 +sequence = 0 image_id = 0 image_count = 0 Vx = 0 @@ -25,7 +25,7 @@ Vz = 0 head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' foot_string = "

\n" -telem_string = f"\nSequence number: {sequence:5.0f} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV" +telem_string = f"\nSequence number: {sequence: 5d} Image ID: {image_id: 3d} count: {image_count: 2d}

Vx: {Vx: 5d} mV Vy: {Vy: 5d} mV Vz: {Vz: 5d} mV" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From 45e7eaee65dd74d037c9553615ac63bf8cae3523 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 16:19:23 -0500 Subject: [PATCH 317/515] Update fc_block_decode.py add > --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index a393f490..b6d516ce 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -25,7 +25,7 @@ Vz = 0 head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' foot_string = "

\n" -telem_string = f"\nSequence number: {sequence: 5d} Image ID: {image_id: 3d} count: {image_count: 2d}

Vx: {Vx: 5d} mV Vy: {Vy: 5d} mV Vz: {Vz: 5d} mV" +telem_string = f"\nSequence number: {sequence: >5d} Image ID: {image_id: >3d} count: {image_count: >2d}

Vx: {Vx: >5d} mV Vy: {Vy: >5d} mV Vz: {Vz: >5d} mV" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From 13e3e88f7460e12ed9b42db7897444a8d66991b3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 16:24:39 -0500 Subject: [PATCH 318/515] Update fc_block_decode.py try pre --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index b6d516ce..470d2009 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -23,8 +23,8 @@ Vx = 0 Vy = 0 Vz = 0 -head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

' -foot_string = "

\n" +head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

'
+foot_string = "

\n" telem_string = f"\nSequence number: {sequence: >5d} Image ID: {image_id: >3d} count: {image_count: >2d}

Vx: {Vx: >5d} mV Vy: {Vy: >5d} mV Vz: {Vz: >5d} mV" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) From d1c68cacf7e90cab2587b17249af3f1438d620ff Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 16:26:54 -0500 Subject: [PATCH 319/515] Update fc_block_decode.py just pre --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 470d2009..681ea5d0 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -25,7 +25,7 @@ Vz = 0 head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

'
 foot_string = "

\n" -telem_string = f"\nSequence number: {sequence: >5d} Image ID: {image_id: >3d} count: {image_count: >2d}

Vx: {Vx: >5d} mV Vy: {Vy: >5d} mV Vz: {Vz: >5d} mV" +telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From 798a0982a014a1205502ae3b54a03a6ee26c5c38 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 16:44:33 -0500 Subject: [PATCH 320/515] Update fc_block_decode.py add I --- groundstation/fc_block_decode.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 681ea5d0..089e255f 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -22,10 +22,13 @@ image_count = 0 Vx = 0 Vy = 0 Vz = 0 +Ix = 0 +Iy = 0 +Iz = 0 -head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

'
+head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

  
' foot_string = "

\n" -telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV" +telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) @@ -67,6 +70,11 @@ if __name__ == "__main__": Vx = (data_block[extended + FC_EPS + 0] * 2**6) + (data_block[extended + FC_EPS + 1] >> 2) Vy = (0x03 & data_block[extended + FC_EPS + 1]) * 2**12 + data_block[extended + FC_EPS + 2] * 2**4 + (data_block[extended + FC_EPS + 3] >> 4) Vz = (0x0f & data_block[extended + FC_EPS + 3]) * 2**10 + data_block[extended + FC_EPS + 4] * 2**2 + (data_block[extended + FC_EPS + 5] >> 6) + Vb = (0x3f & data_block[extended + FC_EPS + 5]) * 2**8 + data_block[extended + FC_EPS + 6] + Ix = data_block[extended + FC_EPS + 7] * 2**2 + data_block[extended + FC_EPS + 8] >> 6 + Iy = (0x3f & data_block[extended + FC_EPS + 8]) * 2**4 + data_block[extended + FC_EPS + 9] >> 4 + Iz = (0x0f & data_block[extended + FC_EPS + 9]) * 2**6 + data_block[extended + FC_EPS + 10] >> 2 + print("Vx: {:d} mV Vy: {:d} mV Vz: {:d} mV".format(Vx, Vy, Vz)) print('Payload {:x} {:x} \n'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1])) if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): @@ -114,7 +122,7 @@ if __name__ == "__main__": filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV" + telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From e4618c4b320cb443fb8a338c6459b75fd7c22fb4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 16:45:55 -0500 Subject: [PATCH 321/515] Update fc_block_decode.py add H1 --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 089e255f..c02a0fba 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -26,7 +26,7 @@ Ix = 0 Iy = 0 Iz = 0 -head_string = '\n\nFunCube CubeSatSim Telemetry\n

\n

  
' +head_string = '\n\n

FunCube CubeSatSim Telemetry

\n

\n

  
' foot_string = "

\n" telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: From 6f6b108d1b77ab5061df46d3a9bff223ae509c9e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 16:50:39 -0500 Subject: [PATCH 322/515] Update fc_block_decode.py add Vb and Ib --- groundstation/fc_block_decode.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index c02a0fba..8a7197ea 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -22,13 +22,15 @@ image_count = 0 Vx = 0 Vy = 0 Vz = 0 +Vb = 0 Ix = 0 Iy = 0 Iz = 0 +Ib = 0 head_string = '\n\n

FunCube CubeSatSim Telemetry

\n

\n

  
' foot_string = "

\n" -telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA" +telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

Vb: {Vb:5d} mV Ib: {Ib:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) @@ -122,7 +124,7 @@ if __name__ == "__main__": filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA" + telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

Vb: {Vb:5d} mV Ib: {Ib:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From bddd41719704b7c63d59f2fe7d9c0008ce21977b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 16:56:22 -0500 Subject: [PATCH 323/515] Update fc_block_decode.py H2 --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 8a7197ea..29ed3646 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -28,7 +28,7 @@ Iy = 0 Iz = 0 Ib = 0 -head_string = '\n\n

FunCube CubeSatSim Telemetry

\n

\n

  
' +head_string = '\n\n

FunCube CubeSatSim Telemetry

\n

\n

  
' foot_string = "

\n" telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

Vb: {Vb:5d} mV Ib: {Ib:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: From 01a681cb5c99596383f5d64a2c81f457d5024b47 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 22:11:14 -0500 Subject: [PATCH 324/515] Update fc_block_decode.py line breaks --- groundstation/fc_block_decode.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 29ed3646..f5a8a414 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -28,7 +28,8 @@ Iy = 0 Iz = 0 Ib = 0 -head_string = '\n\n

FunCube CubeSatSim Telemetry

\n

\n

  
' +head_string = '\n\n

FunCube CubeSatSim Telemetry

\"' + + 'n

\n

  
' foot_string = "

\n" telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

Vb: {Vb:5d} mV Ib: {Ib:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: @@ -90,7 +91,8 @@ if __name__ == "__main__": except: print("File error") # try: - system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload /home/pi/fctelem/image_file_payload.jpeg 2>&1 | sudo tee /home/pi/fctelem/ssdv_output") + system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload " + + "/home/pi/fctelem/image_file_payload.jpeg 2>&1 | sudo tee /home/pi/fctelem/ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: for line in file: # print("line:") @@ -124,7 +126,9 @@ if __name__ == "__main__": filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

Vb: {Vb:5d} mV Ib: {Ib:5d} mA" + telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + + "Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

" + + "Vb: {Vb:5d} mV Ib: {Ib:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From 6138291b64113b35e56cc03081fa040f80d66599 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 22:13:16 -0500 Subject: [PATCH 325/515] Update fc_block_decode.py add \ --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index f5a8a414..795b7022 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -28,7 +28,7 @@ Iy = 0 Iz = 0 Ib = 0 -head_string = '\n\n

FunCube CubeSatSim Telemetry

\"' + +head_string = '\n\n

FunCube CubeSatSim Telemetry

\"' + \ 'n

\n

  
' foot_string = "

\n" telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

Vb: {Vb:5d} mV Ib: {Ib:5d} mA" From b95a31751f0b8d28466ab47bf43e55d8b5efad8d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 22:14:28 -0500 Subject: [PATCH 326/515] Update fc_block_decode.py add more \ --- groundstation/fc_block_decode.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 795b7022..c77bf0d3 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -91,7 +91,7 @@ if __name__ == "__main__": except: print("File error") # try: - system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload " + + system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload " + "/home/pi/fctelem/image_file_payload.jpeg 2>&1 | sudo tee /home/pi/fctelem/ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: for line in file: @@ -126,8 +126,8 @@ if __name__ == "__main__": filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + - "Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

" + + telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + \ + "Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

" + \ "Vb: {Vb:5d} mV Ib: {Ib:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) From afc60b161b69a886231500e09998514efc88240e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 22:16:34 -0500 Subject: [PATCH 327/515] Update fc_block_decode.py more f's --- groundstation/fc_block_decode.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index c77bf0d3..44b1e169 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -29,7 +29,7 @@ Iz = 0 Ib = 0 head_string = '\n\n

FunCube CubeSatSim Telemetry

\"' + \ - 'n

\n

  
' + '

\n

  
' foot_string = "

\n" telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

Vb: {Vb:5d} mV Ib: {Ib:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: @@ -127,8 +127,8 @@ if __name__ == "__main__": system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + \ - "Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

" + \ - "Vb: {Vb:5d} mV Ib: {Ib:5d} mA" + f"Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

" + \ + f"Vb: {Vb:5d} mV Ib: {Ib:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From ce074ad7985c7828cbe5a17f1f88709ae4e76692 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 22:37:17 -0500 Subject: [PATCH 328/515] Update fc_block_decode.py fix currents --- groundstation/fc_block_decode.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 44b1e169..1ebd3d23 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -26,12 +26,15 @@ Vb = 0 Ix = 0 Iy = 0 Iz = 0 +Ic = 0 Ib = 0 -head_string = '\n\n

FunCube CubeSatSim Telemetry

\"' + \ - '

\n

  
' +head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ + '

  
' foot_string = "

\n" -telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

Vb: {Vb:5d} mV Ib: {Ib:5d} mA" +telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + \ + f"Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

" + \ + f"Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

Vb: {Vb:5d} mV Ib: {Ib:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) @@ -74,10 +77,13 @@ if __name__ == "__main__": Vy = (0x03 & data_block[extended + FC_EPS + 1]) * 2**12 + data_block[extended + FC_EPS + 2] * 2**4 + (data_block[extended + FC_EPS + 3] >> 4) Vz = (0x0f & data_block[extended + FC_EPS + 3]) * 2**10 + data_block[extended + FC_EPS + 4] * 2**2 + (data_block[extended + FC_EPS + 5] >> 6) Vb = (0x3f & data_block[extended + FC_EPS + 5]) * 2**8 + data_block[extended + FC_EPS + 6] - Ix = data_block[extended + FC_EPS + 7] * 2**2 + data_block[extended + FC_EPS + 8] >> 6 - Iy = (0x3f & data_block[extended + FC_EPS + 8]) * 2**4 + data_block[extended + FC_EPS + 9] >> 4 - Iz = (0x0f & data_block[extended + FC_EPS + 9]) * 2**6 + data_block[extended + FC_EPS + 10] >> 2 - + Ix = data_block[extended + FC_EPS + 7] * 2**2 + (data_block[extended + FC_EPS + 8] >> 6) + Iy = (0x3f & data_block[extended + FC_EPS + 8]) * 2**4 + (data_block[extended + FC_EPS + 9] >> 4) + Iz = (0x0f & data_block[extended + FC_EPS + 9]) * 2**6 + (data_block[extended + FC_EPS + 10] >> 2) + Ic = (0x03 & data_block[extended + FC_EPS + 10]) * 2**8 + data_block[extended + FC_EPS + 11] * 2**2 + (data_block[extended + FC_EPS + 12] >> 6) + Ib = data_block[extended + FC_EPS + 12] * 2**4 + ((data_block[extended + FC_EPS + 13] >> 4) + if (Ib == 0): + Ib = (-1) * Ic print("Vx: {:d} mV Vy: {:d} mV Vz: {:d} mV".format(Vx, Vy, Vz)) print('Payload {:x} {:x} \n'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1])) if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): From eb7b0958974ce1ae11604b643871cb31476fdd05 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 22:38:06 -0500 Subject: [PATCH 329/515] Update fc_block_decode.py extra ( --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 1ebd3d23..e1dc0ca2 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -81,7 +81,7 @@ if __name__ == "__main__": Iy = (0x3f & data_block[extended + FC_EPS + 8]) * 2**4 + (data_block[extended + FC_EPS + 9] >> 4) Iz = (0x0f & data_block[extended + FC_EPS + 9]) * 2**6 + (data_block[extended + FC_EPS + 10] >> 2) Ic = (0x03 & data_block[extended + FC_EPS + 10]) * 2**8 + data_block[extended + FC_EPS + 11] * 2**2 + (data_block[extended + FC_EPS + 12] >> 6) - Ib = data_block[extended + FC_EPS + 12] * 2**4 + ((data_block[extended + FC_EPS + 13] >> 4) + Ib = data_block[extended + FC_EPS + 12] * 2**4 + (data_block[extended + FC_EPS + 13] >> 4) if (Ib == 0): Ib = (-1) * Ic print("Vx: {:d} mV Vy: {:d} mV Vz: {:d} mV".format(Vx, Vy, Vz)) From 81ace1bff2455cc0efbf2a1db787b11fbdc532bc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 22:44:14 -0500 Subject: [PATCH 330/515] Update fc_block_decode.py move units --- groundstation/fc_block_decode.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index e1dc0ca2..7434e44b 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -33,8 +33,8 @@ head_string = '\n\n

  
' foot_string = "

\n" telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + \ - f"Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

" + \ - f"Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

Vb: {Vb:5d} mV Ib: {Ib:5d} mA" + f"Vx (mv): {Vx:5d} Vy (mV): {Vy:5d} Vz (mV): {Vz:5d}

" + \ + f"Ix (mA): {Ix:5d} Iy (mA): {Iy:5d} Iz (mA): {Iz:5d}

Vbat: {Vb:5d} mV Ibat: {Ib:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) @@ -133,8 +133,8 @@ if __name__ == "__main__": system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + \ - f"Vx: {Vx:5d} mV Vy: {Vy:5d} mV Vz: {Vz:5d} mV

Ix: {Ix:5d} mA Iy: {Iy:5d} mA Iz: {Iz:5d} mA

" + \ - f"Vb: {Vb:5d} mV Ib: {Ib:5d} mA" + f"Vx (mv): {Vx:5d} Vy (mV): {Vy:5d} Vz (mV): {Vz:5d}

" + \ + f"Ix (mA): {Ix:5d} Iy (mA): {Iy:5d} Iz (mA): {Iz:5d}

Vbat: {Vb:5d} mV Ibat: {Ib:5d} mA" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From bc39e224f149b98b6367e555085ad001bf422c36 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 22:51:23 -0500 Subject: [PATCH 331/515] Update fc_block_decode.py change to 0 - Ic --- groundstation/fc_block_decode.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 7434e44b..2e7b87f6 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -33,8 +33,8 @@ head_string = '\n\n

  
' foot_string = "

\n" telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + \ - f"Vx (mv): {Vx:5d} Vy (mV): {Vy:5d} Vz (mV): {Vz:5d}

" + \ - f"Ix (mA): {Ix:5d} Iy (mA): {Iy:5d} Iz (mA): {Iz:5d}

Vbat: {Vb:5d} mV Ibat: {Ib:5d} mA" + f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ + f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) @@ -83,7 +83,7 @@ if __name__ == "__main__": Ic = (0x03 & data_block[extended + FC_EPS + 10]) * 2**8 + data_block[extended + FC_EPS + 11] * 2**2 + (data_block[extended + FC_EPS + 12] >> 6) Ib = data_block[extended + FC_EPS + 12] * 2**4 + (data_block[extended + FC_EPS + 13] >> 4) if (Ib == 0): - Ib = (-1) * Ic + Ib = 0 = Ic print("Vx: {:d} mV Vy: {:d} mV Vz: {:d} mV".format(Vx, Vy, Vz)) print('Payload {:x} {:x} \n'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1])) if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): @@ -133,9 +133,8 @@ if __name__ == "__main__": system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + \ - f"Vx (mv): {Vx:5d} Vy (mV): {Vy:5d} Vz (mV): {Vz:5d}

" + \ - f"Ix (mA): {Ix:5d} Iy (mA): {Iy:5d} Iz (mA): {Iz:5d}

Vbat: {Vb:5d} mV Ibat: {Ib:5d} mA" - with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: + f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ + f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) html_file.write(foot_string) From 19f81b9cde957916066b0079a998c712ccd79182 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 22:51:52 -0500 Subject: [PATCH 332/515] Update fc_block_decode.py - --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 2e7b87f6..66c58cd0 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -83,7 +83,7 @@ if __name__ == "__main__": Ic = (0x03 & data_block[extended + FC_EPS + 10]) * 2**8 + data_block[extended + FC_EPS + 11] * 2**2 + (data_block[extended + FC_EPS + 12] >> 6) Ib = data_block[extended + FC_EPS + 12] * 2**4 + (data_block[extended + FC_EPS + 13] >> 4) if (Ib == 0): - Ib = 0 = Ic + Ib = 0 - Ic print("Vx: {:d} mV Vy: {:d} mV Vz: {:d} mV".format(Vx, Vy, Vz)) print('Payload {:x} {:x} \n'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1])) if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): From 3c14a11e207c0c730eb715974e5856c165788d5a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 22:54:11 -0500 Subject: [PATCH 333/515] Update fc_block_decode.py put open back --- groundstation/fc_block_decode.py | 1 + 1 file changed, 1 insertion(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 66c58cd0..22808f2d 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -135,6 +135,7 @@ if __name__ == "__main__": telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + \ f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: + open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) html_file.write(foot_string) From 9db9fcfafa534cefaf541e15018e9932eee3761e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 22:55:35 -0500 Subject: [PATCH 334/515] Update fc_block_decode.py fix formatting --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 22808f2d..046b3aa4 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -134,8 +134,8 @@ if __name__ == "__main__": system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + \ f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ - f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: - open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: + f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}" + with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) html_file.write(foot_string) From b7710a08781b6e74addaf3220e8d10f5a2d887aa Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 8 Feb 2025 23:00:35 -0500 Subject: [PATCH 335/515] Update fc_block_decode.py formatting --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 046b3aa4..619fb30b 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -34,7 +34,7 @@ head_string = '\n\n

" + \ f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ - f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}" + f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) @@ -134,7 +134,7 @@ if __name__ == "__main__": system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + \ f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ - f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}" + f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From ad463a11b256f90d07c41be33e91026f293cbd9f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 09:02:55 -0500 Subject: [PATCH 336/515] Update fc_block_decode.py add frame type and count --- groundstation/fc_block_decode.py | 35 +++++++++++++++++++------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 619fb30b..ea2efe2d 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -28,20 +28,24 @@ Iy = 0 Iz = 0 Ic = 0 Ib = 0 +frame_count = 0 +frame_type = " " head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
' -foot_string = "

\n" -telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + \ +foot_string = "" +telem_string = f" Image: {image_id:3d} count: {image_count:2d}

" + \ f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ - f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}" + f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

+ \ + f" Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ + f" Seq: {sequence:d} {frame_type} frames: {frame_count:d}" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) html_file.write(foot_string) image_id = 256 # set illegal image ID for null # random.randint(0, 255) -image_count = 0; +image_count = 1; system("sudo rm image_file") if __name__ == "__main__": @@ -59,6 +63,7 @@ if __name__ == "__main__": if ((line.find("data: ")) > 0): print("\ndata block found!\n") + frame_count += 1 data_block_string = line.split() # print(data_block_string) data_block = [int(number_string,16) for number_string in data_block_string[7:]] @@ -67,9 +72,10 @@ if __name__ == "__main__": # print("\n") if (data_block[0] == 0xE0) or (data_block[0] == 0xE1): if (data_block[0] == 0xE0): - print("CubeSatSim Frametype RT1+IMG1") + frame_type = "RT1+IMG1" if (data_block[0] == 0xE1): - print("CubeSatSim Frametype RT2+IMG2") + frame_type = "RT2+IMG2" + print(frame_type) print(data_block[extended + 51], data_block[extended + 50], data_block[extended + 49]) sequence = data_block[extended + 51] + data_block[extended + 50] * 2**8 + data_block[extended + 49] * 2**16 print("Sequence number: {:d}".format(sequence)) @@ -80,8 +86,8 @@ if __name__ == "__main__": Ix = data_block[extended + FC_EPS + 7] * 2**2 + (data_block[extended + FC_EPS + 8] >> 6) Iy = (0x3f & data_block[extended + FC_EPS + 8]) * 2**4 + (data_block[extended + FC_EPS + 9] >> 4) Iz = (0x0f & data_block[extended + FC_EPS + 9]) * 2**6 + (data_block[extended + FC_EPS + 10] >> 2) - Ic = (0x03 & data_block[extended + FC_EPS + 10]) * 2**8 + data_block[extended + FC_EPS + 11] * 2**2 + (data_block[extended + FC_EPS + 12] >> 6) - Ib = data_block[extended + FC_EPS + 12] * 2**4 + (data_block[extended + FC_EPS + 13] >> 4) + Ic = (0x03 & data_block[extended + FC_EPS + 10]) * 2**8 + data_block[extended + FC_EPS + 11] + Ib = data_block[extended + FC_EPS + 12] * 2**2 + ((0xc0 & data_block[extended + FC_EPS + 13]) >> 6) if (Ib == 0): Ib = 0 - Ic print("Vx: {:d} mV Vy: {:d} mV Vz: {:d} mV".format(Vx, Vy, Vz)) @@ -93,7 +99,6 @@ if __name__ == "__main__": # print(immutable_payload) with open("image_file_payload", "wb") as binary_file: binary_file.write(immutable_payload) - except: print("File error") # try: @@ -122,7 +127,7 @@ if __name__ == "__main__": print(new_image_id) image_id = new_image_id # image_count = (image_count + 1) % 256 - image_count = 0 + image_count = 1 else: image_count += 1 print("new image_count:") @@ -132,10 +137,12 @@ if __name__ == "__main__": filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - telem_string = f"\nSequence number: {sequence:5d} Image ID: {image_id:3d} count: {image_count:2d}

" + \ - f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ - f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}" - with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: + telem_string = f" Image: {image_id:3d} count: {image_count:2d}

" + \ + f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ + f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

+ \ + f" Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ + f" Seq: {sequence:d} {frame_type} frames: {frame_count:d}" + with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) html_file.write(foot_string) From 10200b84147a0f13930bfe9082eae53ddc211abf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 09:04:10 -0500 Subject: [PATCH 337/515] Update fc_block_decode.py missing " --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index ea2efe2d..f003362c 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -36,7 +36,7 @@ head_string = '\n\n

" + \ f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ - f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

+ \ + f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ f" Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ f" Seq: {sequence:d} {frame_type} frames: {frame_count:d}" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: @@ -139,7 +139,7 @@ if __name__ == "__main__": system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") telem_string = f" Image: {image_id:3d} count: {image_count:2d}

" + \ f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ - f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

+ \ + f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ f" Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ f" Seq: {sequence:d} {frame_type} frames: {frame_count:d}" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: From 815ca7843bbd4b5fb95ee61b004dbe9109f39280 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 09:05:08 -0500 Subject: [PATCH 338/515] Update fc_block_decode.py extra chars --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index f003362c..da18d57d 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -142,7 +142,7 @@ if __name__ == "__main__": f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ f" Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ f" Seq: {sequence:d} {frame_type} frames: {frame_count:d}" - with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: + with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) html_file.write(foot_string) From 62939ef070fd4e63875f7633c622733dfbb3cb6b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 09:08:49 -0500 Subject: [PATCH 339/515] Update fc_block_decode.py --- groundstation/fc_block_decode.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index da18d57d..6f47aa90 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -34,11 +34,11 @@ frame_type = " " head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
' foot_string = "" -telem_string = f" Image: {image_id:3d} count: {image_count:2d}

" + \ +telem_string = f" Image: {image_id:3d} count: {image_count:2d}

" + \ f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ - f" Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ - f" Seq: {sequence:d} {frame_type} frames: {frame_count:d}" + f" Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ + f"

Seq: {sequence:d} {frame_type} frames: {frame_count:d}" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) @@ -137,11 +137,11 @@ if __name__ == "__main__": filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - telem_string = f" Image: {image_id:3d} count: {image_count:2d}

" + \ + telem_string = f" Image: {image_id:3d} count: {image_count:2d}

" + \ f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ - f" Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ - f" Seq: {sequence:d} {frame_type} frames: {frame_count:d}" + f" Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ + f" Seq: {sequence:d} {frame_type} frames: {frame_count:d}" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From 1dc06200bacddda92443bedf081eeb3ff7c67b24 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 09:20:18 -0500 Subject: [PATCH 340/515] Update fc_block_decode.py try variable --- groundstation/fc_block_decode.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 6f47aa90..37518ae3 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -34,11 +34,12 @@ frame_type = " " head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
' foot_string = "" -telem_string = f" Image: {image_id:3d} count: {image_count:2d}

" + \ - f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ - f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ - f" Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ - f"

Seq: {sequence:d} {frame_type} frames: {frame_count:d}" +telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ + " Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ + " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ + " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ + " Seq: {sequence:d} {frame_type} frames: {frame_count:d}" +telem_string = f"{telem_string_format}" with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From 6b630e171714a93f66233c0953939ee136f227bc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 09:23:26 -0500 Subject: [PATCH 341/515] Update fc_block_decode.py try function --- groundstation/fc_block_decode.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 37518ae3..df14156e 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -10,6 +10,10 @@ import io logging.basicConfig(format='%(message)s') # logging.warning('CC-Warning!') + +def fstr(template): + return eval(f"f'{template}'") + FC_EPS = 1 FC_BOB = 25 FC_SW = 50 @@ -39,7 +43,7 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ " Seq: {sequence:d} {frame_type} frames: {frame_count:d}" -telem_string = f"{telem_string_format}" +telem_string = fstr(telem_string_format) with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From bf71738a33bbaf6cbbaeb8b0e0f2b51b10b103af Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 09:28:03 -0500 Subject: [PATCH 342/515] Update fc_block_decode.py use fstr function --- groundstation/fc_block_decode.py | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index df14156e..bafb1bb1 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -20,20 +20,10 @@ FC_SW = 50 FC_PAYLOAD = 55 extended = 1 -sequence = 0 -image_id = 0 -image_count = 0 -Vx = 0 -Vy = 0 -Vz = 0 -Vb = 0 -Ix = 0 -Iy = 0 -Iz = 0 -Ic = 0 -Ib = 0 -frame_count = 0 -frame_type = " " +sequence, image_id, image_count = 0, 0, 0 +Vx, Vy, Vz, Vb = 0, 0, 0, 0 +Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 +frame_count, frame_type = 0, " " head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
' @@ -142,11 +132,7 @@ if __name__ == "__main__": filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") - telem_string = f" Image: {image_id:3d} count: {image_count:2d}

" + \ - f" Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ - f" Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ - f" Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ - f"

Seq: {sequence:d} {frame_type} frames: {frame_count:d}" + telem_string = fstr(telem_string_format) with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From 90b82d0984784d51b5142d6d30acaab6ba74d7a7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 09:38:27 -0500 Subject: [PATCH 343/515] Update fc_block_decode.py dir files --- groundstation/fc_block_decode.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index bafb1bb1..1a37b5fc 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -25,6 +25,10 @@ Vx, Vy, Vz, Vb = 0, 0, 0, 0 Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 frame_count, frame_type = 0, " " +html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" +image_file = "/home/pi/fctelem/image_file" +ssdv = "/home/pi/ssdv/ssdv" + head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
' foot_string = "" @@ -34,7 +38,7 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ "

Seq: {sequence:d} {frame_type} frames: {frame_count:d}" telem_string = fstr(telem_string_format) -with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: +with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) html_file.write(foot_string) From 90c705314737f070d2dc17153111ec33857f26e6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 09:54:13 -0500 Subject: [PATCH 344/515] Update fc_block_decode.py replace paths with strings --- groundstation/fc_block_decode.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 1a37b5fc..0f23628b 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -27,7 +27,7 @@ frame_count, frame_type = 0, " " html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" image_file = "/home/pi/fctelem/image_file" -ssdv = "/home/pi/ssdv/ssdv" +ssdv = "/home/pi/ssdv/ssdv -d -J " head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
' @@ -101,8 +101,8 @@ if __name__ == "__main__": except: print("File error") # try: - system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file_payload " + - "/home/pi/fctelem/image_file_payload.jpeg 2>&1 | sudo tee /home/pi/fctelem/ssdv_output") + system(ssdv + image_file + "_payload " + + image_file + "_payload.jpeg 2>&1 | sudo tee /home/pi/fctelem/ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: for line in file: # print("line:") @@ -116,12 +116,12 @@ if __name__ == "__main__": if (new_image_id != image_id): print("End of image") if (image_id != 256): - newfilename = "/home/pi/fctelem/image_file" + str(new_image_id) + ".jpeg" - # system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) + newfilename = image_file + str(new_image_id) + ".jpeg" + # system(ssdv + image_file + " " + filename) system("mv " + filename + " " + newfilename) - system("mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_id)) + system("mv " + image_file + " " + image_file + str(image_id)) else: - system("sudo rm /home/pi/fctelem/image_file") + system("sudo rm " + image_file) print("New Image ID: ") print(new_image_id) image_id = new_image_id @@ -133,11 +133,11 @@ if __name__ == "__main__": print(image_count) with open("image_file", "ab") as binary_file: binary_file.write(immutable_payload) - filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg" - system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) - system("cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") + filename = image_file + str(image_id) + "." + str(image_count) + ".jpeg" + system(ssdv + image_file + " " + filename) + system("cp " + filename + " " + html_dir + "image_file.jpeg") telem_string = fstr(telem_string_format) - with open("/home/pi/CubeSatSim/groundstation/public_html/index.html", "w") as html_file: + with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) html_file.write(foot_string) From 4a8e26d18113ccbc28102ad0b3c78f5cfc7896fd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 10:27:02 -0500 Subject: [PATCH 345/515] Update fc_block_decode.py replace image_file with var --- groundstation/fc_block_decode.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 0f23628b..b8b24ac1 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -26,11 +26,12 @@ Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 frame_count, frame_type = 0, " " html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" -image_file = "/home/pi/fctelem/image_file" +image_dir = "/home/pi/fctelem" +image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ - '

  
' + '

  
' foot_string = "" telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ @@ -96,13 +97,13 @@ if __name__ == "__main__": print("Writing payload to file") immutable_payload = bytes(bytearray(data_block[(FC_PAYLOAD + extended):])) # payload) # print(immutable_payload) - with open("image_file_payload", "wb") as binary_file: + with open(image_dir + image + "_payload", "wb") as binary_file: binary_file.write(immutable_payload) except: print("File error") # try: - system(ssdv + image_file + "_payload " + - image_file + "_payload.jpeg 2>&1 | sudo tee /home/pi/fctelem/ssdv_output") + system(ssdv + image_dir + image + "_payload " + + image_dir + image + "_payload.jpeg 2>&1 | sudo tee /home/pi/fctelem/ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: for line in file: # print("line:") @@ -116,12 +117,12 @@ if __name__ == "__main__": if (new_image_id != image_id): print("End of image") if (image_id != 256): - newfilename = image_file + str(new_image_id) + ".jpeg" - # system(ssdv + image_file + " " + filename) + newfilename = image_dir + image + str(new_image_id) + ".jpeg" + # system(ssdv + image_dir + image + " " + filename) system("mv " + filename + " " + newfilename) - system("mv " + image_file + " " + image_file + str(image_id)) + system("mv " + image_dir + image + " " + image_dir + image + str(image_id)) else: - system("sudo rm " + image_file) + system("sudo rm " + image_dir + image) print("New Image ID: ") print(new_image_id) image_id = new_image_id @@ -131,10 +132,10 @@ if __name__ == "__main__": image_count += 1 print("new image_count:") print(image_count) - with open("image_file", "ab") as binary_file: + with open(image_dir + image, "ab") as binary_file: binary_file.write(immutable_payload) - filename = image_file + str(image_id) + "." + str(image_count) + ".jpeg" - system(ssdv + image_file + " " + filename) + filename = image_dir + image + str(image_id) + "." + str(image_count) + ".jpeg" + system(ssdv + image_dir + image + " " + filename) system("cp " + filename + " " + html_dir + "image_file.jpeg") telem_string = fstr(telem_string_format) with open(html_dir + "index.html", "w") as html_file: From 0bbe9882b5eebe33c0384d332cc4ff29655879ff Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 10:30:47 -0500 Subject: [PATCH 346/515] Update fc_block_decode.py added missing / --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index b8b24ac1..796801d0 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -26,7 +26,7 @@ Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 frame_count, frame_type = 0, " " html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" -image_dir = "/home/pi/fctelem" +image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " From 3bb2bd10530149f8037e452022780b5a851d7bf3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 10:42:53 -0500 Subject: [PATCH 347/515] Update fc_block_decode.py try nbsp --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 796801d0..e9266ae2 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -36,8 +36,8 @@ foot_string = "" telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ - " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ - "

Seq: {sequence:d} {frame_type} frames: {frame_count:d}" + " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ + "     Seq: {sequence:d} {frame_type} frames: {frame_count:d}" telem_string = fstr(telem_string_format) with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) From 44224fb8b5c298039569c2c3a29991cc881f36d0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 10:44:00 -0500 Subject: [PATCH 348/515] Update fc_block_decode.py more nbsp --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index e9266ae2..23f9fcad 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -37,7 +37,7 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ - "     Seq: {sequence:d} {frame_type} frames: {frame_count:d}" + "         Seq: {sequence:d} {frame_type} frames: {frame_count:d}" telem_string = fstr(telem_string_format) with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) From f517f14cd27b8e5d7b41721fcbc37ab60182352b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 10:45:19 -0500 Subject: [PATCH 349/515] Update fc_block_decode.py more --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 23f9fcad..ebb02627 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -37,7 +37,7 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ - "         Seq: {sequence:d} {frame_type} frames: {frame_count:d}" + "                 Seq: {sequence:d} {frame_type} frames: {frame_count:d}" telem_string = fstr(telem_string_format) with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) From 50eb0862e0cb29f674d409ee6a06ea1c79231847 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 14:08:02 -0500 Subject: [PATCH 350/515] Update fctelem.sh changed to fctelem/public_html --- groundstation/fctelem.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index cc0ddd69..82a2bd6c 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -50,17 +50,19 @@ sudo systemctl stop rtl_tcp sudo systemctl stop openwebrx -FILE=/home/pi/CubeSatSim/groundstation/public_html +# FILE=/home/pi/CubeSatSim/groundstation/public_html +FILE=/home/pi/CubeSatSim/fctelem/public_html if [ -f "$FILE" ]; then echo "Making public_html directory" - mkdir /home/pi/CubeSatSim/groundstation/public_html + mkdir /home/pi/fctelem/public_html + mkdir /home/pi/fctelem/public_html/images fi -cd /home/pi/CubeSatSim/groundstation/public_html +cd /home/pi/fctelem/public_html cp /home/pi/CubeSatSim/groundstation/index.html . -cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg +cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg ./image_file.jpeg python3 -m http.server & From 798eb3867955ecc2f8bf97e84abfe2b6fadae8a8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 14:10:44 -0500 Subject: [PATCH 351/515] Update fc_block_decode.py change to fctelem/public_html --- groundstation/fc_block_decode.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index ebb02627..3d27e625 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -25,7 +25,8 @@ Vx, Vy, Vz, Vb = 0, 0, 0, 0 Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 frame_count, frame_type = 0, " " -html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" +# html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" +html_dir = "/home/pi/fctelem/public_html/" image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " @@ -137,6 +138,7 @@ if __name__ == "__main__": filename = image_dir + image + str(image_id) + "." + str(image_count) + ".jpeg" system(ssdv + image_dir + image + " " + filename) system("cp " + filename + " " + html_dir + "image_file.jpeg") + system("cp " + filename + " " + html_dir + "images/" + image + str(image_id) + "." + ".jpeg") telem_string = fstr(telem_string_format) with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) From 640c1181856663d95fdc616c85affd2ffc11cb8d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 14:18:07 -0500 Subject: [PATCH 352/515] Update fctelem.sh fix directory detect --- groundstation/fctelem.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 82a2bd6c..87386622 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -52,7 +52,7 @@ sudo systemctl stop openwebrx # FILE=/home/pi/CubeSatSim/groundstation/public_html FILE=/home/pi/CubeSatSim/fctelem/public_html -if [ -f "$FILE" ]; then +if [ ! -d "$FILE" ]; then echo "Making public_html directory" mkdir /home/pi/fctelem/public_html mkdir /home/pi/fctelem/public_html/images From a896c45f1e93f86bff016c4a3290393787b034d5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 14:21:56 -0500 Subject: [PATCH 353/515] Update fc_block_decode.py two dots --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 3d27e625..85819d2b 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -138,7 +138,7 @@ if __name__ == "__main__": filename = image_dir + image + str(image_id) + "." + str(image_count) + ".jpeg" system(ssdv + image_dir + image + " " + filename) system("cp " + filename + " " + html_dir + "image_file.jpeg") - system("cp " + filename + " " + html_dir + "images/" + image + str(image_id) + "." + ".jpeg") + system("cp " + filename + " " + html_dir + "images/" + image + str(image_id) + ".jpeg") telem_string = fstr(telem_string_format) with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) From aef6b16e7e49e6c99db0b1d84bf920468a30c96c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 14:25:29 -0500 Subject: [PATCH 354/515] Update fc_block_decode.py add link to all images --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 85819d2b..f981389a 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -33,7 +33,7 @@ ssdv = "/home/pi/ssdv/ssdv -d -J " head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
' -foot_string = "" +foot_string = " All images " telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ From d67f8639ce84340f7b3d95789b2a949c6d2e5c7d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 14:27:36 -0500 Subject: [PATCH 355/515] Update fc_block_decode.py fix " --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index f981389a..654dfda3 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -33,7 +33,7 @@ ssdv = "/home/pi/ssdv/ssdv -d -J " head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
' -foot_string = " All images " +foot_string = ' All images ' telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ From ca10f30b229f740402f366e9263c4872a7445e2a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 9 Feb 2025 19:26:49 -0500 Subject: [PATCH 356/515] Update transmit.py check for image every second --- transmit.py | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/transmit.py b/transmit.py index 043ee458..720f87f6 100644 --- a/transmit.py +++ b/transmit.py @@ -814,25 +814,27 @@ 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() - image_present = True - except: - image_present = False - - if (image_present == False): - 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_id) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") - print("image_id: " + str(image_id) + "\n") - image_id = ( image_id + 1 ) % 256 - print("new image_id: " + str(image_id) + "\n") - sleep(2) - else: - sleep(4.6) + for i in range(4): + print("Checking image_file.bin") + try: + file = open("/home/pi/CubeSatSim/image_file.bin") + file.close() + # image_present = True + sleep(1.0) + except: + # image_present = False + + # if (image_present == False): + 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_id) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") + print("image_id: " + str(image_id) + "\n") + image_id = ( image_id + 1 ) % 256 + print("new image_id: " + str(image_id) + "\n") + sleep(0.5) + # else: + sleep(0.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 27c3fc7fa1ab242360749de6ca293d32e106d4a2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 09:05:24 -0500 Subject: [PATCH 357/515] Update config added "j" for no reboot mode change --- config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config b/config index f78906c5..2f64e227 100755 --- a/config +++ b/config @@ -368,7 +368,7 @@ elif [ "$1" = "-a" ]; then echo "changing CubeSatSim to AFSK mode" sudo echo "a" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] ; then + if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then restart=1 @@ -394,7 +394,7 @@ elif [ "$1" = "-m" ]; then echo "changing CubeSatSim to CW mode" sudo echo "m" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] ; then + if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then restart=1 @@ -454,7 +454,7 @@ elif [ "$1" = "-s" ]; then echo "changing CubeSatSim to SSTV mode" sudo echo "s" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] ; then + if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then From 3abb631f5349c4d7596eb924beddbacb5f578093 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 09:27:48 -0500 Subject: [PATCH 358/515] Update transmit.py print elapsed time for camera image --- transmit.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 720f87f6..26f85ad4 100644 --- a/transmit.py +++ b/transmit.py @@ -3,7 +3,7 @@ import RPi.GPIO as GPIO from RPi.GPIO import output #import subprocess -#import time +import time from time import sleep #import os import sys @@ -825,6 +825,7 @@ if __name__ == "__main__": # image_present = False # if (image_present == False): + start = time.perf_counter() camera_photo() ## system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") ## print("Photo taken") @@ -832,6 +833,8 @@ if __name__ == "__main__": print("image_id: " + str(image_id) + "\n") image_id = ( image_id + 1 ) % 256 print("new image_id: " + str(image_id) + "\n") + print("Elapsed time: ") + print(time.perf_counter() - start) sleep(0.5) # else: sleep(0.6) From 6bdfd00e1457e5254f39f27f689571c582f57081 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 09:49:59 -0500 Subject: [PATCH 359/515] Update fc_block_decode.py print Decoded frequency --- groundstation/fc_block_decode.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 654dfda3..a3b9a347 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -149,3 +149,6 @@ if __name__ == "__main__": image_id = 256 # set illegal image_id to force new image else: print("Unknown Sat Id or Frame") + if ((line.find("ecoded Frequency:")) > 0): + print("\nFrequency found!\n") + print(line) From 9ac81cacfb688ae93f9a0fd6097dc834c1811483 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 11:08:05 -0500 Subject: [PATCH 360/515] Update fc_block_decode.py display freq and errors --- groundstation/fc_block_decode.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index a3b9a347..21fa07c1 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -24,6 +24,7 @@ sequence, image_id, image_count = 0, 0, 0 Vx, Vy, Vz, Vb = 0, 0, 0, 0 Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 frame_count, frame_type = 0, " " +frequency, errors = 0, 0 # html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" html_dir = "/home/pi/fctelem/public_html/" @@ -38,7 +39,9 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ - "                 Seq: {sequence:d} {frame_type} frames: {frame_count:d}" +# "                 Seq: {sequence:d} {frame_type} frames: {frame_count:d}" + " Freq: {frequency} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" + telem_string = fstr(telem_string_format) with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) @@ -67,6 +70,8 @@ if __name__ == "__main__": frame_count += 1 data_block_string = line.split() # print(data_block_string) + frequency = int(data_block_string[2]) + errors = int(data_block_string[5]) data_block = [int(number_string,16) for number_string in data_block_string[7:]] # print("\n") # print(data_block) @@ -149,6 +154,5 @@ if __name__ == "__main__": image_id = 256 # set illegal image_id to force new image else: print("Unknown Sat Id or Frame") - if ((line.find("ecoded Frequency:")) > 0): - print("\nFrequency found!\n") - print(line) + + From 3a9a3ff9b4533fadca7c2ce32e1e51f01169efc0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 11:11:01 -0500 Subject: [PATCH 361/515] Update update add install fctelem --- update | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/update b/update index e4d89055..638cab06 100755 --- a/update +++ b/update @@ -238,11 +238,20 @@ if [ ! -d "/home/pi/ssdv" ]; then FLAG=1 fi +if [ ! -d "/home/pi/fctelem" ]; then + + cd + wget https://github.com/alanbjohnston/go/releases/download/v0.1/fctelem.zip + unzip fctelem.zip + FLAG=1 +fi + cd /home/pi/pi-power-button git checkout master + git pull --no-rebase > .updated_p grep 'changed' /home/pi/pi-power-button/.updated_p From fb41ae92610f0977e436dbab502ddc957df123ca Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 11:13:37 -0500 Subject: [PATCH 362/515] Update update adder mkdir --- update | 2 ++ 1 file changed, 2 insertions(+) diff --git a/update b/update index 638cab06..4548a720 100755 --- a/update +++ b/update @@ -241,6 +241,8 @@ fi if [ ! -d "/home/pi/fctelem" ]; then cd + mkdir /home/pi/fctelem + cd fctelem wget https://github.com/alanbjohnston/go/releases/download/v0.1/fctelem.zip unzip fctelem.zip FLAG=1 From dc489f6dfe24b483d3b89e741d326dec7b1f0f79 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 11:18:21 -0500 Subject: [PATCH 363/515] Update fc_block_decode.py remove commented out line --- groundstation/fc_block_decode.py | 1 - 1 file changed, 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 21fa07c1..95fd7594 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -39,7 +39,6 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ -# "                 Seq: {sequence:d} {frame_type} frames: {frame_count:d}" " Freq: {frequency} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" telem_string = fstr(telem_string_format) From efdc1ed17f478ee72d3d0045b018e4d41816cc81 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 11:23:21 -0500 Subject: [PATCH 364/515] Update fc_block_decode.py frequency is a string --- groundstation/fc_block_decode.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 95fd7594..60efccdf 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -24,7 +24,7 @@ sequence, image_id, image_count = 0, 0, 0 Vx, Vy, Vz, Vb = 0, 0, 0, 0 Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 frame_count, frame_type = 0, " " -frequency, errors = 0, 0 +frequency_string, errors = " ", 0 # html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" html_dir = "/home/pi/fctelem/public_html/" @@ -39,7 +39,7 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ - " Freq: {frequency} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" + " Freq: {frequency_string} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" telem_string = fstr(telem_string_format) with open(html_dir + "index.html", "w") as html_file: @@ -69,7 +69,7 @@ if __name__ == "__main__": frame_count += 1 data_block_string = line.split() # print(data_block_string) - frequency = int(data_block_string[2]) + frequency_string = data_block_string[2] errors = int(data_block_string[5]) data_block = [int(number_string,16) for number_string in data_block_string[7:]] # print("\n") From cef752add7003787bffa56101243eb9f2897c310 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 11:35:20 -0500 Subject: [PATCH 365/515] Update transmit.py show different times --- transmit.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 26f85ad4..c465fe2d 100644 --- a/transmit.py +++ b/transmit.py @@ -827,15 +827,17 @@ if __name__ == "__main__": # if (image_present == False): start = time.perf_counter() camera_photo() + print(time.perf_counter() - start) ## system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") ## print("Photo taken") + print(time.perf_counter() - start) system("/home/pi/ssdv/ssdv -e -n -i " + str(image_id) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") print("image_id: " + str(image_id) + "\n") image_id = ( image_id + 1 ) % 256 print("new image_id: " + str(image_id) + "\n") print("Elapsed time: ") print(time.perf_counter() - start) - sleep(0.5) +# sleep(0.5) # else: sleep(0.6) elif (mode == 'e'): # code based on https://zr6aic.blogspot.com/2016/11/creating-2m-fm-repeater-with-raspberry.html From 2346d886c0566510e0673ecd1810b65e7a3bd82c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 15:51:07 -0500 Subject: [PATCH 366/515] Update transmit.py add variable sleep after camera --- transmit.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/transmit.py b/transmit.py index c465fe2d..4507ccc9 100644 --- a/transmit.py +++ b/transmit.py @@ -827,17 +827,15 @@ if __name__ == "__main__": # if (image_present == False): start = time.perf_counter() camera_photo() - print(time.perf_counter() - start) - ## system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") - ## print("Photo taken") - print(time.perf_counter() - start) system("/home/pi/ssdv/ssdv -e -n -i " + str(image_id) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") print("image_id: " + str(image_id) + "\n") image_id = ( image_id + 1 ) % 256 print("new image_id: " + str(image_id) + "\n") + elapsed_time = time.perf_counter() - start print("Elapsed time: ") - print(time.perf_counter() - start) -# sleep(0.5) + print(elapsed_time) + if (elapsed_time < 9): + sleep(9 - time.perf_counter() + start) # else: sleep(0.6) elif (mode == 'e'): # code based on https://zr6aic.blogspot.com/2016/11/creating-2m-fm-repeater-with-raspberry.html From 9880477417006c43b1b4a96491d9316618ec6ac3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 16:11:35 -0500 Subject: [PATCH 367/515] Update fc_block_decode.py clear images, write csv file --- groundstation/fc_block_decode.py | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 60efccdf..0dace137 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -13,6 +13,14 @@ logging.basicConfig(format='%(message)s') def fstr(template): return eval(f"f'{template}'") + + +def clear_tlm(): + sequence, image_id, image_count = 0, 0, 0 + Vx, Vy, Vz, Vb = 0, 0, 0, 0 + Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 + frame_count, frame_type = 0, " " + frequency_string, errors = " ", 0 FC_EPS = 1 FC_BOB = 25 @@ -20,11 +28,7 @@ FC_SW = 50 FC_PAYLOAD = 55 extended = 1 -sequence, image_id, image_count = 0, 0, 0 -Vx, Vy, Vz, Vb = 0, 0, 0, 0 -Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 -frame_count, frame_type = 0, " " -frequency_string, errors = " ", 0 +clear_tlm() # html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" html_dir = "/home/pi/fctelem/public_html/" @@ -32,6 +36,10 @@ image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " +system("sudo rm " image_dir + image) +system("sudo rm " + html_dir + "*") +system("sudo rm " + html_dir + "/images/*") + head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
' foot_string = ' All images ' @@ -40,6 +48,9 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ " Freq: {frequency_string} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" +csv_format = "{frame_count:4d}, {frequency_string:7s}, {errors:3d}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ + "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d}" + telem_string = fstr(telem_string_format) with open(html_dir + "index.html", "w") as html_file: @@ -47,9 +58,11 @@ with open(html_dir + "index.html", "w") as html_file: html_file.write(telem_string) html_file.write(foot_string) +with open(html_dir + "telem.csv.txt", "w") as csv_file: + csv_file.write(csv_format) + image_id = 256 # set illegal image ID for null # random.randint(0, 255) image_count = 1; -system("sudo rm image_file") if __name__ == "__main__": debug_mode = False @@ -153,5 +166,9 @@ if __name__ == "__main__": image_id = 256 # set illegal image_id to force new image else: print("Unknown Sat Id or Frame") + clear_tlm() + tlm_string = fstr(csv_format) + with open(html_dir + "telem.csv.txt", "a") as csv_file: + csv_file.write(tlm_string) From d6aa080d150d924ca301ddaf859dc5bd6eaf6ee2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 16:12:12 -0500 Subject: [PATCH 368/515] Update fc_block_decode.py missing + --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 0dace137..6bb436a0 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -36,7 +36,7 @@ image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " -system("sudo rm " image_dir + image) +system("sudo rm " + image_dir + image) system("sudo rm " + html_dir + "*") system("sudo rm " + html_dir + "/images/*") From 4c62c2b4a4d54f73abac6bc748eeca6269c15203 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 16:17:46 -0500 Subject: [PATCH 369/515] Update fc_block_decode.py first_byte --- groundstation/fc_block_decode.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 6bb436a0..96e604a2 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -13,14 +13,6 @@ logging.basicConfig(format='%(message)s') def fstr(template): return eval(f"f'{template}'") - - -def clear_tlm(): - sequence, image_id, image_count = 0, 0, 0 - Vx, Vy, Vz, Vb = 0, 0, 0, 0 - Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 - frame_count, frame_type = 0, " " - frequency_string, errors = " ", 0 FC_EPS = 1 FC_BOB = 25 @@ -28,7 +20,11 @@ FC_SW = 50 FC_PAYLOAD = 55 extended = 1 -clear_tlm() +sequence, image_id, image_count = 0, 0, 0 +Vx, Vy, Vz, Vb = 0, 0, 0, 0 +Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 +frame_count, frame_type = 0, " " +frequency_string, errors, first_byte = " ", 0, 0 # html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" html_dir = "/home/pi/fctelem/public_html/" @@ -48,7 +44,7 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ " Freq: {frequency_string} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" -csv_format = "{frame_count:4d}, {frequency_string:7s}, {errors:3d}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ +csv_format = "{frame_count:4d}, {frequency_string:7s}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d}" @@ -85,10 +81,8 @@ if __name__ == "__main__": frequency_string = data_block_string[2] errors = int(data_block_string[5]) data_block = [int(number_string,16) for number_string in data_block_string[7:]] -# print("\n") -# print(data_block) -# print("\n") - if (data_block[0] == 0xE0) or (data_block[0] == 0xE1): + first_byte = data_block[0] + if (first_byte == 0xE0) or (first_byte == 0xE1): if (data_block[0] == 0xE0): frame_type = "RT1+IMG1" if (data_block[0] == 0xE1): @@ -166,7 +160,12 @@ if __name__ == "__main__": image_id = 256 # set illegal image_id to force new image else: print("Unknown Sat Id or Frame") - clear_tlm() + sequence, image_id, image_count = 0, 0, 0 + Vx, Vy, Vz, Vb = 0, 0, 0, 0 + Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 + frame_count, frame_type = 0, " " + frequency_string, errors = " ", 0 + tlm_string = fstr(csv_format) with open(html_dir + "telem.csv.txt", "a") as csv_file: csv_file.write(tlm_string) From 801597576239a317472d0ffbb29a11f011619669 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 16:21:30 -0500 Subject: [PATCH 370/515] Update fc_block_decode.py changed w to w+ --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 96e604a2..ee5971ea 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -49,12 +49,12 @@ csv_format = "{frame_count:4d}, {frequency_string:7s}, {errors:3d}, {first_byte: telem_string = fstr(telem_string_format) -with open(html_dir + "index.html", "w") as html_file: +with open(html_dir + "index.html", "w+") as html_file: html_file.write(head_string) html_file.write(telem_string) html_file.write(foot_string) -with open(html_dir + "telem.csv.txt", "w") as csv_file: +with open(html_dir + "telem.csv.txt", "w+") as csv_file: csv_file.write(csv_format) image_id = 256 # set illegal image ID for null # random.randint(0, 255) From 0faeb1affc0ab620109ba990d05d9f13b8dfccb2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 16:29:27 -0500 Subject: [PATCH 371/515] Update fctelem.sh don't copy into html --- groundstation/fctelem.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 87386622..19809423 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -58,11 +58,11 @@ if [ ! -d "$FILE" ]; then mkdir /home/pi/fctelem/public_html/images fi -cd /home/pi/fctelem/public_html +#cd /home/pi/fctelem/public_html -cp /home/pi/CubeSatSim/groundstation/index.html . +#cp /home/pi/CubeSatSim/groundstation/index.html . -cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg ./image_file.jpeg +#cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg ./image_file.jpeg python3 -m http.server & From 9716d6e7a33b9b2cc776c16ad72f180bf4918ba9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 16:31:20 -0500 Subject: [PATCH 372/515] Update fc_block_decode.py copy image, csv newline --- groundstation/fc_block_decode.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index ee5971ea..1c7d65ca 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -36,6 +36,8 @@ system("sudo rm " + image_dir + image) system("sudo rm " + html_dir + "*") system("sudo rm " + html_dir + "/images/*") +system("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") + head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
' foot_string = ' All images ' @@ -45,7 +47,7 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Freq: {frequency_string} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" csv_format = "{frame_count:4d}, {frequency_string:7s}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ - "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d}" + "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d} \n" telem_string = fstr(telem_string_format) From 02805b1b85bfcfbb797600f0dead934cd1792954 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 16:36:16 -0500 Subject: [PATCH 373/515] Update fc_block_decode.py remove newline --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 1c7d65ca..4d0f39b7 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -47,7 +47,7 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Freq: {frequency_string} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" csv_format = "{frame_count:4d}, {frequency_string:7s}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ - "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d} \n" + "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d}" telem_string = fstr(telem_string_format) From 1f90b0de690e1925b6798599f8c7f86cda9a1042 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 17:08:12 -0500 Subject: [PATCH 374/515] Update fc_block_decode.py csv under images --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 4d0f39b7..b90f7a3f 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -56,7 +56,7 @@ with open(html_dir + "index.html", "w+") as html_file: html_file.write(telem_string) html_file.write(foot_string) -with open(html_dir + "telem.csv.txt", "w+") as csv_file: +with open(html_dir + "/images/telem.csv.txt", "w+") as csv_file: csv_file.write(csv_format) image_id = 256 # set illegal image ID for null # random.randint(0, 255) @@ -169,7 +169,7 @@ if __name__ == "__main__": frequency_string, errors = " ", 0 tlm_string = fstr(csv_format) - with open(html_dir + "telem.csv.txt", "a") as csv_file: + with open(html_dir + "/images/telem.csv.txt", "a") as csv_file: csv_file.write(tlm_string) From 59763e944963244856ab9bfd25950c95765ff3c3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 17:12:17 -0500 Subject: [PATCH 375/515] Update fc_block_decode.py end after initla --- groundstation/fc_block_decode.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index b90f7a3f..3b946f28 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -62,6 +62,8 @@ with open(html_dir + "/images/telem.csv.txt", "w+") as csv_file: image_id = 256 # set illegal image ID for null # random.randint(0, 255) image_count = 1; +return + if __name__ == "__main__": debug_mode = False counter = 1 @@ -171,5 +173,6 @@ if __name__ == "__main__": tlm_string = fstr(csv_format) with open(html_dir + "/images/telem.csv.txt", "a") as csv_file: csv_file.write(tlm_string) + csv_file.write("\n") From 387724c4e041cb88b099140df8d2ab7e97ebde0b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 17:14:57 -0500 Subject: [PATCH 376/515] Update fc_block_decode.py fix indent --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 3b946f28..d78e28ae 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -172,7 +172,7 @@ if __name__ == "__main__": tlm_string = fstr(csv_format) with open(html_dir + "/images/telem.csv.txt", "a") as csv_file: - csv_file.write(tlm_string) + csv_file.write(tlm_string) csv_file.write("\n") From 5db844d820bd46b89cad7f0c4357e53b30bb2e82 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 17:16:54 -0500 Subject: [PATCH 377/515] Update fc_block_decode.py exit --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index d78e28ae..335b1421 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -62,7 +62,7 @@ with open(html_dir + "/images/telem.csv.txt", "w+") as csv_file: image_id = 256 # set illegal image ID for null # random.randint(0, 255) image_count = 1; -return +sys.exit() if __name__ == "__main__": debug_mode = False From ad56247257572ff8550b08d10668fc388ccc6bff Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 17:17:48 -0500 Subject: [PATCH 378/515] Update fc_block_decode.py add newline --- groundstation/fc_block_decode.py | 1 + 1 file changed, 1 insertion(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 335b1421..fe370c6d 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -58,6 +58,7 @@ with open(html_dir + "index.html", "w+") as html_file: with open(html_dir + "/images/telem.csv.txt", "w+") as csv_file: csv_file.write(csv_format) + csv_file.write("\n") image_id = 256 # set illegal image ID for null # random.randint(0, 255) image_count = 1; From 8de3e2c618d7c04c49b4450f83948bbbe5f7c249 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 17:19:50 -0500 Subject: [PATCH 379/515] Update fc_block_decode.py continue --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index fe370c6d..157ac6ee 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -63,7 +63,7 @@ with open(html_dir + "/images/telem.csv.txt", "w+") as csv_file: image_id = 256 # set illegal image ID for null # random.randint(0, 255) image_count = 1; -sys.exit() +# sys.exit() if __name__ == "__main__": debug_mode = False From e038c9fd1a72463d84458ba4f576f99956eb5b49 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 17:29:51 -0500 Subject: [PATCH 380/515] Update fc_block_decode.py remove csv --- groundstation/fc_block_decode.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 157ac6ee..11f8817f 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -171,9 +171,9 @@ if __name__ == "__main__": frame_count, frame_type = 0, " " frequency_string, errors = " ", 0 - tlm_string = fstr(csv_format) - with open(html_dir + "/images/telem.csv.txt", "a") as csv_file: - csv_file.write(tlm_string) - csv_file.write("\n") +# tlm_string = fstr(csv_format) +# with open(html_dir + "/images/telem.csv.txt", "a") as csv_file: +# csv_file.write(tlm_string) +# csv_file.write("\n") From d5ff8920d482a8bb84b530a44ca94b7bf688bd65 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 21:41:15 -0500 Subject: [PATCH 381/515] Update fctelem.sh comment out http server --- groundstation/fctelem.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 19809423..28a147e8 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -64,7 +64,7 @@ fi #cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg ./image_file.jpeg -python3 -m http.server & +# python3 -m http.server & setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8000 &>/dev/null & From 2d421d632ac35e703fca16a9e229d35e65bd7b38 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 21:46:34 -0500 Subject: [PATCH 382/515] Update fctelem.sh put python3 server and copies back in --- groundstation/fctelem.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 28a147e8..87386622 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -58,13 +58,13 @@ if [ ! -d "$FILE" ]; then mkdir /home/pi/fctelem/public_html/images fi -#cd /home/pi/fctelem/public_html +cd /home/pi/fctelem/public_html -#cp /home/pi/CubeSatSim/groundstation/index.html . +cp /home/pi/CubeSatSim/groundstation/index.html . -#cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg ./image_file.jpeg +cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg ./image_file.jpeg -# python3 -m http.server & +python3 -m http.server & setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8000 &>/dev/null & From 5cf7f50a80faef2944cecbf1466bbe2cd1230cfb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 11 Feb 2025 21:53:15 -0500 Subject: [PATCH 383/515] Update fc_block_decode.py put csv back in --- groundstation/fc_block_decode.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 11f8817f..a571bb8c 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -33,10 +33,10 @@ image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " system("sudo rm " + image_dir + image) -system("sudo rm " + html_dir + "*") -system("sudo rm " + html_dir + "/images/*") +#system("sudo rm " + html_dir + "*") +#system("sudo rm " + html_dir + "/images/*") -system("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") +#system("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
' @@ -171,9 +171,9 @@ if __name__ == "__main__": frame_count, frame_type = 0, " " frequency_string, errors = " ", 0 -# tlm_string = fstr(csv_format) -# with open(html_dir + "/images/telem.csv.txt", "a") as csv_file: -# csv_file.write(tlm_string) -# csv_file.write("\n") + tlm_string = fstr(csv_format) + with open(html_dir + "/images/telem.csv.txt", "a") as csv_file: + csv_file.write(tlm_string) + csv_file.write("\n") From 86d411b5632ace4276465f0b3ae75faf62d5ec38 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 12 Feb 2025 08:33:24 -0500 Subject: [PATCH 384/515] Update fc_block_decode.py frequency string 12 char --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index a571bb8c..598169ab 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -46,7 +46,7 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ " Freq: {frequency_string} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" -csv_format = "{frame_count:4d}, {frequency_string:7s}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ +csv_format = "{frame_count:4d}, {frequency_string:12s}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d}" From d6a76f6ae2416b49ca6a7be5107e0c6c9ced01bf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 12 Feb 2025 08:49:49 -0500 Subject: [PATCH 385/515] Update fc_block_decode.py convert frequency to float --- groundstation/fc_block_decode.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 598169ab..0250a1dd 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -24,7 +24,7 @@ sequence, image_id, image_count = 0, 0, 0 Vx, Vy, Vz, Vb = 0, 0, 0, 0 Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 frame_count, frame_type = 0, " " -frequency_string, errors, first_byte = " ", 0, 0 +frequency_string, frequency, errors, first_byte = " ", 0, 0, 0 # html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" html_dir = "/home/pi/fctelem/public_html/" @@ -45,7 +45,7 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ - " Freq: {frequency_string} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" + " Freq: {frequency:10f} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" csv_format = "{frame_count:4d}, {frequency_string:12s}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d}" @@ -84,6 +84,8 @@ if __name__ == "__main__": data_block_string = line.split() # print(data_block_string) frequency_string = data_block_string[2] + print(frequency_string) + frequency = int(frequency_string[:len(frequency_string) - 2] errors = int(data_block_string[5]) data_block = [int(number_string,16) for number_string in data_block_string[7:]] first_byte = data_block[0] From 92505e430d3d9481b545de8dc4e87684aa62ebab Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 12 Feb 2025 08:51:00 -0500 Subject: [PATCH 386/515] Update fc_block_decode.py convert frequency to float --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 0250a1dd..3ba988be 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -85,7 +85,7 @@ if __name__ == "__main__": # print(data_block_string) frequency_string = data_block_string[2] print(frequency_string) - frequency = int(frequency_string[:len(frequency_string) - 2] + frequency = float(frequency_string[:len(frequency_string) - 2]) errors = int(data_block_string[5]) data_block = [int(number_string,16) for number_string in data_block_string[7:]] first_byte = data_block[0] From d9fa7a9dc112348c036c60c67f919d14501554c4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 12 Feb 2025 08:54:39 -0500 Subject: [PATCH 387/515] Update fc_block_decode.py frequency to csv --- groundstation/fc_block_decode.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 3ba988be..226efd24 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -45,8 +45,8 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ - " Freq: {frequency:10f} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" -csv_format = "{frame_count:4d}, {frequency_string:12s}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ + " Freq: {frequency:10.1f} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" +csv_format = "{frame_count:4d}, {frequency:10.1f}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d}" @@ -86,6 +86,7 @@ if __name__ == "__main__": frequency_string = data_block_string[2] print(frequency_string) frequency = float(frequency_string[:len(frequency_string) - 2]) + print(frequency) errors = int(data_block_string[5]) data_block = [int(number_string,16) for number_string in data_block_string[7:]] first_byte = data_block[0] From 06de1ec262495b701dfc685a753036a38e753f77 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 14 Feb 2025 16:34:15 -0500 Subject: [PATCH 388/515] Update fc_block_decode.py try adding csv string to index --- groundstation/fc_block_decode.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 226efd24..05d1605b 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -162,6 +162,11 @@ if __name__ == "__main__": with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) + with open(html_dir + "/images/telem.csv.txt", "r") as csv_file: + csv_file.read(old_tlm_string) + html_file.write(old_tlm_string) + html_file.write(tlm_string) + html_file.write("\n") html_file.write(foot_string) else: print("Payload not an image!") From 7688acf93b8ceee89ef4aeabcb584cc4bfb280c1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 14 Feb 2025 16:39:13 -0500 Subject: [PATCH 389/515] Update fc_block_decode.py write line from csv --- groundstation/fc_block_decode.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 05d1605b..f9e68d02 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -162,11 +162,13 @@ if __name__ == "__main__": with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) + html_file.write("
") with open(html_dir + "/images/telem.csv.txt", "r") as csv_file: - csv_file.read(old_tlm_string) - html_file.write(old_tlm_string) + for line in csv_file: + html_file.write(line) + html_file.write("
") html_file.write(tlm_string) - html_file.write("\n") + html_file.write("
") html_file.write(foot_string) else: print("Payload not an image!") From 5c584f62caab9c919e573317cdbeafdfe6d7aebe Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 14 Feb 2025 16:41:23 -0500 Subject: [PATCH 390/515] Update fc_block_decode.py add tlm_string --- groundstation/fc_block_decode.py | 1 + 1 file changed, 1 insertion(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index f9e68d02..dc21925e 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -167,6 +167,7 @@ if __name__ == "__main__": for line in csv_file: html_file.write(line) html_file.write("
") + tlm_string = fstr(csv_format) html_file.write(tlm_string) html_file.write("
") html_file.write(foot_string) From fb5c4dfade0b3db63bd5003b27ce51e00ab8b182 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 14 Feb 2025 16:59:16 -0500 Subject: [PATCH 391/515] Update fc_block_decode.py add pre --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index dc21925e..975c8073 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -162,14 +162,14 @@ if __name__ == "__main__": with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) - html_file.write("
") + html_file.write("

")
 									with open(html_dir + "/images/telem.csv.txt", "r") as csv_file:
 										for line in csv_file:
 											html_file.write(line)
 											html_file.write("
") tlm_string = fstr(csv_format) html_file.write(tlm_string) - html_file.write("
") + html_file.write("

") html_file.write(foot_string) else: print("Payload not an image!") From 2548b1c0655c8c2eddf9dbca4b80cda7e557c512 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 15 Feb 2025 13:27:58 -0500 Subject: [PATCH 392/515] Update bands.json add sstv --- groundstation/bands.json | 1 + 1 file changed, 1 insertion(+) diff --git a/groundstation/bands.json b/groundstation/bands.json index ea638154..a5505220 100644 --- a/groundstation/bands.json +++ b/groundstation/bands.json @@ -174,6 +174,7 @@ "frequencies": { "packet": 434900000, "pocsag": 439987500 + "sstv": { "frequency": 434900000, "underlying": "nfm" }, } }, { From b39a51d51d52359b2ed934d3410dd75ed4220a52 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 15 Feb 2025 13:28:46 -0500 Subject: [PATCH 393/515] Update bands.json fix sstv --- groundstation/bands.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/bands.json b/groundstation/bands.json index a5505220..dde2db0a 100644 --- a/groundstation/bands.json +++ b/groundstation/bands.json @@ -173,8 +173,8 @@ "upper_bound": 440000000, "frequencies": { "packet": 434900000, - "pocsag": 439987500 - "sstv": { "frequency": 434900000, "underlying": "nfm" }, + "pocsag": 439987500, + "sstv": { "frequency": 434900000, "underlying": "nfm" } } }, { From d0da8b1581ca60a6d8e01f3dd1c80c2dcc571d91 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 15 Feb 2025 13:41:19 -0500 Subject: [PATCH 394/515] Update fctelem.sh don't kill rtl-sdr apps --- groundstation/fctelem.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 87386622..6de395d3 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -28,27 +28,27 @@ sudo killall -9 fctelem &>/dev/null sudo killall -9 python3 &>/dev/null -sudo killall -9 java &>/dev/null +#sudo killall -9 java &>/dev/null -sudo killall -9 rtl_fm &>/dev/null +#sudo killall -9 rtl_fm &>/dev/null pkill -o chromium &>/dev/null -sudo killall -9 rtl_tcp &>/dev/null +#sudo killall -9 rtl_tcp &>/dev/null -sudo killall -9 CubicSDR &>/dev/null +#sudo killall -9 CubicSDR &>/dev/null -sudo killall -9 qsstv &>/dev/null +#sudo killall -9 qsstv &>/dev/null -sudo killall -9 aplay &>/dev/null +#sudo killall -9 aplay &>/dev/null -sudo killall -9 direwolf &>/dev/null +#sudo killall -9 direwolf &>/dev/null -sudo killall -9 zenity &>/dev/null +#sudo killall -9 zenity &>/dev/null -sudo systemctl stop rtl_tcp +#sudo systemctl stop rtl_tcp -sudo systemctl stop openwebrx +#sudo systemctl stop openwebrx # FILE=/home/pi/CubeSatSim/groundstation/public_html FILE=/home/pi/CubeSatSim/fctelem/public_html From d0948d833693e2c249595476a8d8ea4ec98ebfbc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 15 Feb 2025 13:52:03 -0500 Subject: [PATCH 395/515] Update fctelem.sh don't stop browser --- groundstation/fctelem.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 6de395d3..d7fd52ab 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -26,13 +26,13 @@ echo sudo killall -9 fctelem &>/dev/null -sudo killall -9 python3 &>/dev/null +#sudo killall -9 python3 &>/dev/null #sudo killall -9 java &>/dev/null #sudo killall -9 rtl_fm &>/dev/null -pkill -o chromium &>/dev/null +#pkill -o chromium &>/dev/null #sudo killall -9 rtl_tcp &>/dev/null From b9021ed744080f221d06fdb688fb15e9b257bd89 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 15 Feb 2025 15:01:02 -0500 Subject: [PATCH 396/515] Update fctelem.sh put back python3 kill --- groundstation/fctelem.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index d7fd52ab..bfcbb5ff 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -26,7 +26,7 @@ echo sudo killall -9 fctelem &>/dev/null -#sudo killall -9 python3 &>/dev/null +sudo killall -9 python3 &>/dev/null #sudo killall -9 java &>/dev/null From c259026dce316e08a65a8b37e2e8f18e5d9a17dc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 15 Feb 2025 16:46:23 -0500 Subject: [PATCH 397/515] Update update add fctelem v0.2 check and update --- update | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/update b/update index 4548a720..bdefc8f8 100755 --- a/update +++ b/update @@ -230,6 +230,7 @@ fi if [ ! -d "/home/pi/ssdv" ]; then + echo "Installing SSDV for FunCube mode" cd git clone https://github.com/alanbjohnston/ssdv.git # install ssdv for FunCube images cd ssdv @@ -239,11 +240,20 @@ if [ ! -d "/home/pi/ssdv" ]; then fi if [ ! -d "/home/pi/fctelem" ]; then - + echo "Installing fctelem binary v0.2 for FunCube mode" cd mkdir /home/pi/fctelem cd fctelem - wget https://github.com/alanbjohnston/go/releases/download/v0.1/fctelem.zip + wget https://github.com/alanbjohnston/go/releases/download/v0.2/fctelem.zip + unzip fctelem.zip + FLAG=1 +elif [ ! -f "/home/pi/fctelem/v0.2" ]; then + echo "Updating fctelem binary to version v0.2 for FunCube mode" + cd + cd /home/pi/fctelem + sudo mv fctelem fctelem.bk + sudo mv fcdecode.conf fcdecode.conf.bk + wget https://github.com/alanbjohnston/go/releases/download/v0.2/fctelem.zip unzip fctelem.zip FLAG=1 fi @@ -252,8 +262,6 @@ cd /home/pi/pi-power-button git checkout master - - git pull --no-rebase > .updated_p grep 'changed' /home/pi/pi-power-button/.updated_p From 2c024cb575e54cd6d6b855761ca491ff6453aed0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 16 Feb 2025 10:49:07 -0500 Subject: [PATCH 398/515] Update fc_block_decode.py readable csv label --- groundstation/fc_block_decode.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 975c8073..21c17219 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -12,7 +12,7 @@ logging.basicConfig(format='%(message)s') def fstr(template): - return eval(f"f'{template}'") + return eval(f"f'{template}'") FC_EPS = 1 FC_BOB = 25 @@ -46,6 +46,8 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ " Freq: {frequency:10.1f} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" +label_string = "frm, freq off, err, h, seq, frame, img, c, Vx, Vy, Vz, Ix, Iy, Iz, Vb, Ib " +label_string_html = label_string.replace(" "," ") csv_format = "{frame_count:4d}, {frequency:10.1f}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d}" @@ -57,7 +59,8 @@ with open(html_dir + "index.html", "w+") as html_file: html_file.write(foot_string) with open(html_dir + "/images/telem.csv.txt", "w+") as csv_file: - csv_file.write(csv_format) +# csv_file.write(csv_format) + csv_file.write(label_string_html) csv_file.write("\n") image_id = 256 # set illegal image ID for null # random.randint(0, 255) From 5b00e5c62b33ceb66942d1a8478f5f792a3198d5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 16 Feb 2025 10:50:42 -0500 Subject: [PATCH 399/515] Update fc_block_decode.py add ; --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 21c17219..3047cdcf 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -47,7 +47,7 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Freq: {frequency:10.1f} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" label_string = "frm, freq off, err, h, seq, frame, img, c, Vx, Vy, Vz, Ix, Iy, Iz, Vb, Ib " -label_string_html = label_string.replace(" "," ") +label_string_html = label_string.replace(" "," ") csv_format = "{frame_count:4d}, {frequency:10.1f}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d}" From 20ad7208bca5e1ee4a5a832da61c80b29579b8c1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 16 Feb 2025 10:53:51 -0500 Subject: [PATCH 400/515] Update fc_block_decode.py just label string --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 3047cdcf..e362c348 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -60,7 +60,7 @@ with open(html_dir + "index.html", "w+") as html_file: with open(html_dir + "/images/telem.csv.txt", "w+") as csv_file: # csv_file.write(csv_format) - csv_file.write(label_string_html) + csv_file.write(label_string) csv_file.write("\n") image_id = 256 # set illegal image ID for null # random.randint(0, 255) From e2a5fef43625b91d81f29edc1c8726b99d2a762a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 16 Feb 2025 11:00:28 -0500 Subject: [PATCH 401/515] Update fc_block_decode.py fix alignment, move all images link --- groundstation/fc_block_decode.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index e362c348..39b35dda 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -39,14 +39,14 @@ system("sudo rm " + image_dir + image) #system("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ - '

  
' -foot_string = ' All images ' + '

  
All images ' +foot_string = '' telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ " Freq: {frequency:10.1f} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" -label_string = "frm, freq off, err, h, seq, frame, img, c, Vx, Vy, Vz, Ix, Iy, Iz, Vb, Ib " +label_string = " frm, freq off, err, h, seq, frame, img, c, Vx, Vy, Vz, Ix, Iy, Iz, Vb, Ib " label_string_html = label_string.replace(" "," ") csv_format = "{frame_count:4d}, {frequency:10.1f}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d}" From ed6c70eb6d5b87988d2e0d1ada994d09ae19478b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 16 Feb 2025 11:04:07 -0500 Subject: [PATCH 402/515] Update fc_block_decode.py add title --- groundstation/fc_block_decode.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 39b35dda..ee9b3ed0 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -38,13 +38,13 @@ system("sudo rm " + image_dir + image) #system("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") -head_string = '\n\n

FunCube CubeSatSim Telemetry

' + \ - '

  
All images ' +head_string = 'FunCube CubeSatSim Telemetry\n\n

FunCube CubeSatSim Telemetry

' + \ + '

  
All images
' foot_string = '' telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ " Ix(mA): {Ix:5d} Iy(mA): {Iy:5d} Iz(mA): {Iz:5d}

" + \ - " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ + " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ " Freq: {frequency:10.1f} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" label_string = " frm, freq off, err, h, seq, frame, img, c, Vx, Vy, Vz, Ix, Iy, Iz, Vb, Ib " label_string_html = label_string.replace(" "," ") From f693494196bc99bc1ebe79d03bb2bec3908890a3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 16 Feb 2025 11:12:08 -0500 Subject: [PATCH 403/515] Update fc_block_decode.py clear images at start, keep count in filename --- groundstation/fc_block_decode.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index ee9b3ed0..d02f5792 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -34,7 +34,7 @@ ssdv = "/home/pi/ssdv/ssdv -d -J " system("sudo rm " + image_dir + image) #system("sudo rm " + html_dir + "*") -#system("sudo rm " + html_dir + "/images/*") +system("sudo rm " + html_dir + "/images/*") #system("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") @@ -160,7 +160,8 @@ if __name__ == "__main__": filename = image_dir + image + str(image_id) + "." + str(image_count) + ".jpeg" system(ssdv + image_dir + image + " " + filename) system("cp " + filename + " " + html_dir + "image_file.jpeg") - system("cp " + filename + " " + html_dir + "images/" + image + str(image_id) + ".jpeg") +# system("cp " + filename + " " + html_dir + "images/" + image + str(image_id) + ".jpeg") + system("cp " + filename + " " + html_dir + "images/") telem_string = fstr(telem_string_format) with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) From 3bede50e13f719595f0d4e4f9a2e3ae24be198e4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 16 Feb 2025 11:26:07 -0500 Subject: [PATCH 404/515] Update fc_block_decode.py only save valid images --- groundstation/fc_block_decode.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index d02f5792..825cdb44 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -26,17 +26,17 @@ Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 frame_count, frame_type = 0, " " frequency_string, frequency, errors, first_byte = " ", 0, 0, 0 -# html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" -html_dir = "/home/pi/fctelem/public_html/" +# = "/home/pi/CubeSatSim/groundstation/public_html/" + = "/home/pi/fctelem/public_html/" image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " system("sudo rm " + image_dir + image) -#system("sudo rm " + html_dir + "*") -system("sudo rm " + html_dir + "/images/*") +#system("sudo rm " + + "*") +system("sudo rm " + + "/images/*") -#system("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") +#system("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + + "image_file.jpeg") head_string = 'FunCube CubeSatSim Telemetry\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
All images
' @@ -140,10 +140,13 @@ if __name__ == "__main__": if (new_image_id != image_id): print("End of image") if (image_id != 256): + print("Saving complete image") newfilename = image_dir + image + str(new_image_id) + ".jpeg" # system(ssdv + image_dir + image + " " + filename) system("mv " + filename + " " + newfilename) - system("mv " + image_dir + image + " " + image_dir + image + str(image_id)) + system("mv " + image_dir + image + " " + image_dir + image + str(image_id)) + # system("cp " + filename + " " + html_dir + "images/" + image + str(image_id) + ".jpeg") + system("cp " + filename + " " + html_dir + "images/") else: system("sudo rm " + image_dir + image) print("New Image ID: ") @@ -160,8 +163,6 @@ if __name__ == "__main__": filename = image_dir + image + str(image_id) + "." + str(image_count) + ".jpeg" system(ssdv + image_dir + image + " " + filename) system("cp " + filename + " " + html_dir + "image_file.jpeg") -# system("cp " + filename + " " + html_dir + "images/" + image + str(image_id) + ".jpeg") - system("cp " + filename + " " + html_dir + "images/") telem_string = fstr(telem_string_format) with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) From 3ada66f3df36d26d4e78bc0d2c511a4443b555b0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 16 Feb 2025 11:31:18 -0500 Subject: [PATCH 405/515] Update fc_block_decode.py put back html_dir --- groundstation/fc_block_decode.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 825cdb44..ce11711d 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -26,17 +26,17 @@ Ix, Iy, Iz, Ic, Ib = 0, 0, 0, 0, 0 frame_count, frame_type = 0, " " frequency_string, frequency, errors, first_byte = " ", 0, 0, 0 -# = "/home/pi/CubeSatSim/groundstation/public_html/" - = "/home/pi/fctelem/public_html/" +#html_dir = "/home/pi/CubeSatSim/groundstation/public_html/" +html_dir = "/home/pi/fctelem/public_html/" image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " system("sudo rm " + image_dir + image) -#system("sudo rm " + + "*") -system("sudo rm " + + "/images/*") +#system("sudo rm " + html_dir + "*") +system("sudo rm " + html_dir + "/images/*") -#system("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + + "image_file.jpeg") +#system("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") head_string = 'FunCube CubeSatSim Telemetry\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
All images
' From 284ae92bd4b330a082408268e3652c3ae966bbc5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Feb 2025 08:34:54 -0500 Subject: [PATCH 406/515] Update update add sudo to unzip --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index bdefc8f8..aaee6986 100755 --- a/update +++ b/update @@ -245,7 +245,7 @@ if [ ! -d "/home/pi/fctelem" ]; then mkdir /home/pi/fctelem cd fctelem wget https://github.com/alanbjohnston/go/releases/download/v0.2/fctelem.zip - unzip fctelem.zip + sudo unzip fctelem.zip FLAG=1 elif [ ! -f "/home/pi/fctelem/v0.2" ]; then echo "Updating fctelem binary to version v0.2 for FunCube mode" From 6102337b2840176680e7c52251c40e4d86897b25 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Feb 2025 08:43:42 -0500 Subject: [PATCH 408/515] Update update mv fctelem.zip --- update | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/update b/update index aaee6986..a42a0fd6 100755 --- a/update +++ b/update @@ -245,7 +245,7 @@ if [ ! -d "/home/pi/fctelem" ]; then mkdir /home/pi/fctelem cd fctelem wget https://github.com/alanbjohnston/go/releases/download/v0.2/fctelem.zip - sudo unzip fctelem.zip + unzip fctelem.zip FLAG=1 elif [ ! -f "/home/pi/fctelem/v0.2" ]; then echo "Updating fctelem binary to version v0.2 for FunCube mode" @@ -253,6 +253,7 @@ elif [ ! -f "/home/pi/fctelem/v0.2" ]; then cd /home/pi/fctelem sudo mv fctelem fctelem.bk sudo mv fcdecode.conf fcdecode.conf.bk + sudo mv fctelem.zip fctelem.zip.1 wget https://github.com/alanbjohnston/go/releases/download/v0.2/fctelem.zip unzip fctelem.zip FLAG=1 From 5c0122fbb2950e2fd690cfe49a86f4e970feab5b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Feb 2025 16:29:32 -0500 Subject: [PATCH 409/515] Update fc_block_decode.py if not an image payload, don't set id to 256 --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index ce11711d..956cbbca 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -178,7 +178,7 @@ if __name__ == "__main__": html_file.write(foot_string) else: print("Payload not an image!") - image_id = 256 # set illegal image_id to force new image + # image_id = 256 # set illegal image_id to force new image else: print("Unknown Sat Id or Frame") sequence, image_id, image_count = 0, 0, 0 From db89ea3c12cacde00aae263b222062bd47a3c50e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Feb 2025 16:39:22 -0500 Subject: [PATCH 410/515] Update fc_block_decode.py save image --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 956cbbca..3d862902 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -141,12 +141,12 @@ if __name__ == "__main__": print("End of image") if (image_id != 256): print("Saving complete image") + system("cp " + filename + " " + html_dir + "images/") newfilename = image_dir + image + str(new_image_id) + ".jpeg" # system(ssdv + image_dir + image + " " + filename) system("mv " + filename + " " + newfilename) system("mv " + image_dir + image + " " + image_dir + image + str(image_id)) # system("cp " + filename + " " + html_dir + "images/" + image + str(image_id) + ".jpeg") - system("cp " + filename + " " + html_dir + "images/") else: system("sudo rm " + image_dir + image) print("New Image ID: ") From a432645cfd3be3f2da2caf0a376023f4ea469d4b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Feb 2025 16:48:39 -0500 Subject: [PATCH 411/515] Update fc_block_decode.py add system_and_print --- groundstation/fc_block_decode.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 3d862902..587a7840 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -12,7 +12,11 @@ logging.basicConfig(format='%(message)s') def fstr(template): - return eval(f"f'{template}'") + return eval(f"f'{template}'") + +def system_and_print(string) + print(string) + system(string) FC_EPS = 1 FC_BOB = 25 @@ -32,11 +36,11 @@ image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " -system("sudo rm " + image_dir + image) -#system("sudo rm " + html_dir + "*") -system("sudo rm " + html_dir + "/images/*") +system_and_print("sudo rm " + image_dir + image) +#system_and_print("sudo rm " + html_dir + "*") +system_and_print("sudo rm " + html_dir + "/images/*") -#system("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") +#system_and_print("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") head_string = 'FunCube CubeSatSim Telemetry\n\n

FunCube CubeSatSim Telemetry

' + \ '

  
All images
' @@ -125,7 +129,7 @@ if __name__ == "__main__": except: print("File error") # try: - system(ssdv + image_dir + image + "_payload " + + system_and_print(ssdv + image_dir + image + "_payload " + image_dir + image + "_payload.jpeg 2>&1 | sudo tee /home/pi/fctelem/ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: for line in file: @@ -141,14 +145,14 @@ if __name__ == "__main__": print("End of image") if (image_id != 256): print("Saving complete image") - system("cp " + filename + " " + html_dir + "images/") + system_and_print("cp " + filename + " " + html_dir + "images/") newfilename = image_dir + image + str(new_image_id) + ".jpeg" - # system(ssdv + image_dir + image + " " + filename) - system("mv " + filename + " " + newfilename) - system("mv " + image_dir + image + " " + image_dir + image + str(image_id)) - # system("cp " + filename + " " + html_dir + "images/" + image + str(image_id) + ".jpeg") + # system_and_print(ssdv + image_dir + image + " " + filename) + system_and_print("mv " + filename + " " + newfilename) + system_and_print("mv " + image_dir + image + " " + image_dir + image + str(image_id)) + # system_and_print("cp " + filename + " " + html_dir + "images/" + image + str(image_id) + ".jpeg") else: - system("sudo rm " + image_dir + image) + system_and_print("sudo rm " + image_dir + image) print("New Image ID: ") print(new_image_id) image_id = new_image_id @@ -161,8 +165,8 @@ if __name__ == "__main__": with open(image_dir + image, "ab") as binary_file: binary_file.write(immutable_payload) filename = image_dir + image + str(image_id) + "." + str(image_count) + ".jpeg" - system(ssdv + image_dir + image + " " + filename) - system("cp " + filename + " " + html_dir + "image_file.jpeg") + system_and_print(ssdv + image_dir + image + " " + filename) + system_and_print("cp " + filename + " " + html_dir + "image_file.jpeg") telem_string = fstr(telem_string_format) with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) From 797a5eb60197af67170fa7acd01c194e40cb1a23 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Feb 2025 16:50:37 -0500 Subject: [PATCH 412/515] Update fc_block_decode.py missing : --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 587a7840..4ee0f21c 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -14,7 +14,7 @@ logging.basicConfig(format='%(message)s') def fstr(template): return eval(f"f'{template}'") -def system_and_print(string) +def system_and_print(string): print(string) system(string) From 1d146aff14f96bd09c4b9c15a3a6c55be0501d39 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Feb 2025 17:24:39 -0500 Subject: [PATCH 413/515] Update fc_block_decode.py cleanup - don't save temp files --- groundstation/fc_block_decode.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 4ee0f21c..75f7acad 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -121,7 +121,7 @@ if __name__ == "__main__": print('Payload {:x} {:x} \n'.format(data_block[FC_PAYLOAD + extended], data_block[FC_PAYLOAD + extended + 1])) if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): try: - print("Writing payload to file") + print("Writing this image payload block to file " + image + "_payload") immutable_payload = bytes(bytearray(data_block[(FC_PAYLOAD + extended):])) # payload) # print(immutable_payload) with open(image_dir + image + "_payload", "wb") as binary_file: @@ -129,8 +129,10 @@ if __name__ == "__main__": except: print("File error") # try: + print("Processing payload with ssdv, saving image to " + image + "_paylad.jpeg and log to ssdv_output") system_and_print(ssdv + image_dir + image + "_payload " + image_dir + image + "_payload.jpeg 2>&1 | sudo tee /home/pi/fctelem/ssdv_output") + print("Parsing ssdv_output") with open("/home/pi/fctelem/ssdv_output", "r") as file: for line in file: # print("line:") @@ -145,11 +147,12 @@ if __name__ == "__main__": print("End of image") if (image_id != 256): print("Saving complete image") - system_and_print("cp " + filename + " " + html_dir + "images/") - newfilename = image_dir + image + str(new_image_id) + ".jpeg" + system_and_print("cp " html_dir + "image_file.jpeg" + " " + html_dir + "images/" + image + str(image_id) + "." + str(image_count) + ".jpeg") + system_and_print("sudo rm " + image_dir + image) + # newfilename = image_dir + image + str(new_image_id) + ".jpeg" # system_and_print(ssdv + image_dir + image + " " + filename) - system_and_print("mv " + filename + " " + newfilename) - system_and_print("mv " + image_dir + image + " " + image_dir + image + str(image_id)) + # system_and_print("mv " + filename + " " + newfilename) + # system_and_print("mv " + image_dir + image + " " + image_dir + image + str(image_id)) # system_and_print("cp " + filename + " " + html_dir + "images/" + image + str(image_id) + ".jpeg") else: system_and_print("sudo rm " + image_dir + image) @@ -162,12 +165,16 @@ if __name__ == "__main__": image_count += 1 print("new image_count:") print(image_count) + print("Appending block to file " + image) with open(image_dir + image, "ab") as binary_file: binary_file.write(immutable_payload) - filename = image_dir + image + str(image_id) + "." + str(image_count) + ".jpeg" - system_and_print(ssdv + image_dir + image + " " + filename) - system_and_print("cp " + filename + " " + html_dir + "image_file.jpeg") +# filename = image_dir + image + str(image_id) + "." + str(image_count) + ".jpeg" + print("Running ssdv with all blocks in file " + image + " saving as " + html_dir + "image_file.jpeg") +# system_and_print(ssdv + image_dir + image + " " + filename) + system_and_print(ssdv + image_dir + image + " " + html_dir + "image_file.jpeg") system_and_print("cp " + filename + " " + html_dir + "image_file.jpeg") +# system_and_print("cp " + filename + " " + html_dir + "image_file.jpeg") telem_string = fstr(telem_string_format) + print("Writing index.html file") with open(html_dir + "index.html", "w") as html_file: html_file.write(head_string) html_file.write(telem_string) From eaa8a65acd88bd871aced855e9e629128dab6a85 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Feb 2025 17:30:26 -0500 Subject: [PATCH 414/515] Update fc_block_decode.py tabs --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 75f7acad..93aab0ac 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -147,7 +147,7 @@ if __name__ == "__main__": print("End of image") if (image_id != 256): print("Saving complete image") - system_and_print("cp " html_dir + "image_file.jpeg" + " " + html_dir + "images/" + image + str(image_id) + "." + str(image_count) + ".jpeg") + system_and_print("cp " html_dir + "image_file.jpeg " + html_dir + "images/" + image + str(image_id) + "." + str(image_count) + ".jpeg") system_and_print("sudo rm " + image_dir + image) # newfilename = image_dir + image + str(new_image_id) + ".jpeg" # system_and_print(ssdv + image_dir + image + " " + filename) From 588114c1bd1adca735c7756db024d355a87e8ca4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Feb 2025 17:31:14 -0500 Subject: [PATCH 415/515] Update fc_block_decode.py added + --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 93aab0ac..5bc2770a 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -147,7 +147,7 @@ if __name__ == "__main__": print("End of image") if (image_id != 256): print("Saving complete image") - system_and_print("cp " html_dir + "image_file.jpeg " + html_dir + "images/" + image + str(image_id) + "." + str(image_count) + ".jpeg") + system_and_print("cp " + html_dir + "image_file.jpeg " + html_dir + "images/" + image + str(image_id) + "." + str(image_count) + ".jpeg") system_and_print("sudo rm " + image_dir + image) # newfilename = image_dir + image + str(new_image_id) + ".jpeg" # system_and_print(ssdv + image_dir + image + " " + filename) From 1a60e14d811f455371a102528246085d882b0e11 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Feb 2025 17:33:18 -0500 Subject: [PATCH 416/515] Update fc_block_decode.py extra line --- groundstation/fc_block_decode.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 5bc2770a..ef706fca 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -171,7 +171,8 @@ if __name__ == "__main__": # filename = image_dir + image + str(image_id) + "." + str(image_count) + ".jpeg" print("Running ssdv with all blocks in file " + image + " saving as " + html_dir + "image_file.jpeg") # system_and_print(ssdv + image_dir + image + " " + filename) - system_and_print(ssdv + image_dir + image + " " + html_dir + "image_file.jpeg") system_and_print("cp " + filename + " " + html_dir + "image_file.jpeg") + system_and_print(ssdv + image_dir + image + " " + html_dir + "image_file.jpeg") +# system_and_print("cp " + filename + " " + html_dir + "image_file.jpeg") # system_and_print("cp " + filename + " " + html_dir + "image_file.jpeg") telem_string = fstr(telem_string_format) print("Writing index.html file") From 2c1169f2081170aac741622eb8ea4210c315e469 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Feb 2025 17:43:12 -0500 Subject: [PATCH 417/515] Update fc_block_decode.py more cleanup --- groundstation/fc_block_decode.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index ef706fca..7a411acc 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -149,17 +149,11 @@ if __name__ == "__main__": print("Saving complete image") system_and_print("cp " + html_dir + "image_file.jpeg " + html_dir + "images/" + image + str(image_id) + "." + str(image_count) + ".jpeg") system_and_print("sudo rm " + image_dir + image) - # newfilename = image_dir + image + str(new_image_id) + ".jpeg" - # system_and_print(ssdv + image_dir + image + " " + filename) - # system_and_print("mv " + filename + " " + newfilename) - # system_and_print("mv " + image_dir + image + " " + image_dir + image + str(image_id)) - # system_and_print("cp " + filename + " " + html_dir + "images/" + image + str(image_id) + ".jpeg") else: system_and_print("sudo rm " + image_dir + image) print("New Image ID: ") print(new_image_id) image_id = new_image_id - # image_count = (image_count + 1) % 256 image_count = 1 else: image_count += 1 @@ -168,12 +162,8 @@ if __name__ == "__main__": print("Appending block to file " + image) with open(image_dir + image, "ab") as binary_file: binary_file.write(immutable_payload) -# filename = image_dir + image + str(image_id) + "." + str(image_count) + ".jpeg" print("Running ssdv with all blocks in file " + image + " saving as " + html_dir + "image_file.jpeg") -# system_and_print(ssdv + image_dir + image + " " + filename) system_and_print(ssdv + image_dir + image + " " + html_dir + "image_file.jpeg") -# system_and_print("cp " + filename + " " + html_dir + "image_file.jpeg") -# system_and_print("cp " + filename + " " + html_dir + "image_file.jpeg") telem_string = fstr(telem_string_format) print("Writing index.html file") with open(html_dir + "index.html", "w") as html_file: From b20a1f673de38e90ee1b97abad7de4e0cf6b31d8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Feb 2025 21:59:10 -0500 Subject: [PATCH 418/515] Update transmit.py cleanup --- transmit.py | 68 ++++++++++------------------------------------------- 1 file changed, 13 insertions(+), 55 deletions(-) diff --git a/transmit.py b/transmit.py index 4507ccc9..c4dfdf2e 100644 --- a/transmit.py +++ b/transmit.py @@ -23,6 +23,14 @@ def battery_saver_check(): except: print("battery saver not activated") # txc = True + +def blink(times): + powerPin = 16 + for i in range(times): + GPIO.output(powerPin, 0) # blink two times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) def increment_mode(): print("increment mode") @@ -39,76 +47,26 @@ def increment_mode(): print(mode) if (mode == 'a'): mode = 'f' - GPIO.output(powerPin, 0) # blink two times - sleep(0.1) - GPIO.output(powerPin, 1) - sleep(0.1) - GPIO.output(powerPin, 0) - sleep(0.1) - GPIO.output(powerPin, 1) + blink(2) sleep(2.5) elif (mode == 'f'): mode = 'b' - GPIO.output(powerPin, 0) # blink three times - sleep(0.1) - GPIO.output(powerPin, 1) - sleep(0.1) - GPIO.output(powerPin, 0) - sleep(0.1) - GPIO.output(powerPin, 1) - sleep(0.1) - GPIO.output(powerPin, 0) - sleep(0.1) - GPIO.output(powerPin, 1) + blink(3) sleep(2.5) elif (mode == 'b'): mode = 's' - GPIO.output(powerPin, 0) # blink four times - sleep(0.1) - GPIO.output(powerPin, 1) - sleep(0.1) - GPIO.output(powerPin, 0) - sleep(0.1) - GPIO.output(powerPin, 1) - sleep(0.1) - GPIO.output(powerPin, 0) - sleep(0.1) - GPIO.output(powerPin, 1) - sleep(0.1) - GPIO.output(powerPin, 0) - sleep(0.1) - GPIO.output(powerPin, 1) + blink(4) sleep(2.5) elif (mode == 's'): mode = 'm' - GPIO.output(powerPin, 0) # blink five times - sleep(0.1) - GPIO.output(powerPin, 1) - sleep(0.1) - GPIO.output(powerPin, 0) - sleep(0.1) - GPIO.output(powerPin, 1) - sleep(0.1) - GPIO.output(powerPin, 0) - sleep(0.1); - GPIO.output(powerPin, 1) - sleep(0.1) - GPIO.output(powerPin, 0) - sleep(0.1) - GPIO.output(powerPin, 1) - sleep(0.1) - GPIO.output(powerPin, 0) - sleep(0.1) - GPIO.output(powerPin, 1) + blink(5) sleep(2.5) else: mode = 'a' - GPIO.output(powerPin, 0) # blink one time - sleep(0.1) - GPIO.output(powerPin, 1) + blink(1) sleep(2.5) try: From b0b9d38bb6ed7a9bf0348fab6d04a0525469884a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 08:52:10 -0500 Subject: [PATCH 419/515] Update transmit.py don't print checking file --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index c4dfdf2e..aa723a76 100644 --- a/transmit.py +++ b/transmit.py @@ -773,7 +773,7 @@ if __name__ == "__main__": sleep(4.2) else: # FunCube mode image for i in range(4): - print("Checking image_file.bin") +# print("Checking image_file.bin") try: file = open("/home/pi/CubeSatSim/image_file.bin") file.close() From d89d423297339f9bc46e4c41a4258511309a229b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 14:16:32 -0500 Subject: [PATCH 420/515] Update transmit.py change device from 1 to Card --- transmit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index aa723a76..3d908552 100644 --- a/transmit.py +++ b/transmit.py @@ -819,7 +819,8 @@ if __name__ == "__main__": ## system("arecord -D plughw:CARD=Device,DEV=0 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") sleep(1) - system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") +# system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") + system("sudo arecord -D plughw:CARD=Device,DEV=0 -r48000 -fS16_LE -c1 | nc localhost 8011 &") GPIO.output(powerPin, 1) sleep(0.5) GPIO.output(powerPin, 0) From e30c143d6aae68fc5aef2574254330f30a444ff6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 14:22:05 -0500 Subject: [PATCH 421/515] Update transmit.py don't turn off power LED for e --- transmit.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/transmit.py b/transmit.py index 3d908552..6220d9dc 100644 --- a/transmit.py +++ b/transmit.py @@ -807,7 +807,7 @@ if __name__ == "__main__": GPIO.setup(txLed, GPIO.OUT) GPIO.setup(powerPin, GPIO.OUT) GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected - GPIO.output(powerPin, 0) + GPIO.output(powerPin, 1) # was 0 while True: sleep(0.5) if (GPIO.input(squelch) == False): @@ -821,9 +821,9 @@ if __name__ == "__main__": sleep(1) # system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") system("sudo arecord -D plughw:CARD=Device,DEV=0 -r48000 -fS16_LE -c1 | nc localhost 8011 &") - GPIO.output(powerPin, 1) - sleep(0.5) - GPIO.output(powerPin, 0) +# GPIO.output(powerPin, 1) +# sleep(0.5) +# GPIO.output(powerPin, 0) while (GPIO.input(squelch) == False): sleep(1) print("No carrier detected, stopping repeater") From 68cbe07e24a58ceb953b652524784ec8adef7391 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 14:24:31 -0500 Subject: [PATCH 422/515] Update transmit.py remove power pin from e --- transmit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transmit.py b/transmit.py index 6220d9dc..3e297eae 100644 --- a/transmit.py +++ b/transmit.py @@ -805,9 +805,9 @@ if __name__ == "__main__": output(ptt, 1) GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 GPIO.setup(txLed, GPIO.OUT) - GPIO.setup(powerPin, GPIO.OUT) +# GPIO.setup(powerPin, GPIO.OUT) GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected - GPIO.output(powerPin, 1) # was 0 +# GPIO.output(powerPin, 1) # was 0 while True: sleep(0.5) if (GPIO.input(squelch) == False): From 5d0be00edfb5fff83e9d2d424b714a6e401c8580 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 14:43:21 -0500 Subject: [PATCH 423/515] Update transmit.py add 2 sec delay in e --- transmit.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/transmit.py b/transmit.py index 3e297eae..59ebd1c7 100644 --- a/transmit.py +++ b/transmit.py @@ -819,6 +819,8 @@ if __name__ == "__main__": ## system("arecord -D plughw:CARD=Device,DEV=0 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") sleep(1) + print("Sleeping 2") + sleep(1) # system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") system("sudo arecord -D plughw:CARD=Device,DEV=0 -r48000 -fS16_LE -c1 | nc localhost 8011 &") # GPIO.output(powerPin, 1) From dff7fde57e3c9f8ac1575eeb93e2c39e3e3c644f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 15:51:21 -0500 Subject: [PATCH 424/515] Update transmit.py crossband -290 MHz --- transmit.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 59ebd1c7..2c40a9bc 100644 --- a/transmit.py +++ b/transmit.py @@ -797,7 +797,7 @@ if __name__ == "__main__": # else: sleep(0.6) elif (mode == 'e'): # code based on https://zr6aic.blogspot.com/2016/11/creating-2m-fm-repeater-with-raspberry.html - print("Repeater") + print("Cross Band Repeater") print("Stopping command and control") system("sudo systemctl stop command") print("turn on FM rx") @@ -808,6 +808,8 @@ if __name__ == "__main__": # GPIO.setup(powerPin, GPIO.OUT) GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected # GPIO.output(powerPin, 1) # was 0 + tx = rx - 290 + print("Transmit frequency: ",tx) while True: sleep(0.5) if (GPIO.input(squelch) == False): From b9258890ff3d0a180fd72e894d4639b62c53c935 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 15:54:19 -0500 Subject: [PATCH 425/515] Update transmit.py change to txf --- transmit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transmit.py b/transmit.py index 2c40a9bc..4adde3ea 100644 --- a/transmit.py +++ b/transmit.py @@ -808,7 +808,7 @@ if __name__ == "__main__": # GPIO.setup(powerPin, GPIO.OUT) GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected # GPIO.output(powerPin, 1) # was 0 - tx = rx - 290 + txf = float(rx) - 290.0 print("Transmit frequency: ",tx) while True: sleep(0.5) @@ -819,7 +819,7 @@ if __name__ == "__main__": output(txLed, txLedOn) # system("arecord -D plughw:CARD=Device,DEV=0 | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") ## system("arecord -D plughw:CARD=Device,DEV=0 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") - system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") + system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + str(txf) + "e3 &") sleep(1) print("Sleeping 2") sleep(1) From a7cd85cf76d89870bd05c65aac1793982f990248 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:04:32 -0500 Subject: [PATCH 426/515] Update transmit.py cross band repeater shift 434.9 to 145 --- transmit.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/transmit.py b/transmit.py index 4adde3ea..55c757e3 100644 --- a/transmit.py +++ b/transmit.py @@ -808,8 +808,8 @@ if __name__ == "__main__": # GPIO.setup(powerPin, GPIO.OUT) GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected # GPIO.output(powerPin, 1) # was 0 - txf = float(rx) - 290.0 - print("Transmit frequency: ",tx) + txf = float(tx) - 289.9 + print("Transmit frequency: ",txf) while True: sleep(0.5) if (GPIO.input(squelch) == False): @@ -820,9 +820,7 @@ if __name__ == "__main__": # system("arecord -D plughw:CARD=Device,DEV=0 | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") ## system("arecord -D plughw:CARD=Device,DEV=0 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + str(txf) + "e3 &") - sleep(1) - print("Sleeping 2") - sleep(1) + sleep(0.5) # system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") system("sudo arecord -D plughw:CARD=Device,DEV=0 -r48000 -fS16_LE -c1 | nc localhost 8011 &") # GPIO.output(powerPin, 1) From a99043ae1ccb8dbf5a5c3622a4da16aef8caa641 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:08:27 -0500 Subject: [PATCH 427/515] Update transmit.py add 1 sec between keys --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 55c757e3..7fe1c380 100644 --- a/transmit.py +++ b/transmit.py @@ -811,7 +811,7 @@ if __name__ == "__main__": txf = float(tx) - 289.9 print("Transmit frequency: ",txf) while True: - sleep(0.5) + sleep(1) if (GPIO.input(squelch) == False): print("Carrier detected, starting repeater") GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 From 630e015d9e2f7369ff1ed34690be17b78cd00068 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:14:52 -0500 Subject: [PATCH 428/515] Update transmit.py shift 290.9 --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 7fe1c380..7991313c 100644 --- a/transmit.py +++ b/transmit.py @@ -808,7 +808,7 @@ if __name__ == "__main__": # GPIO.setup(powerPin, GPIO.OUT) GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected # GPIO.output(powerPin, 1) # was 0 - txf = float(tx) - 289.9 + txf = float(tx) - 290.9 print("Transmit frequency: ",txf) while True: sleep(1) From e8a031b5c9b6ff183fe12c1daf298d82f1d239cc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:16:13 -0500 Subject: [PATCH 429/515] Update transmit.py shift 288.9 --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 7991313c..e1c9336c 100644 --- a/transmit.py +++ b/transmit.py @@ -808,7 +808,7 @@ if __name__ == "__main__": # GPIO.setup(powerPin, GPIO.OUT) GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected # GPIO.output(powerPin, 1) # was 0 - txf = float(tx) - 290.9 + txf = float(tx) - 288.9 print("Transmit frequency: ",txf) while True: sleep(1) From 4aae8058a2069d7db1994fa66bc87040f077ba65 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:21:51 -0500 Subject: [PATCH 430/515] Update fc_block_decode.py print datetime --- groundstation/fc_block_decode.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 7a411acc..a3eaa36e 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -6,6 +6,7 @@ import random from PIL import Image, ImageDraw, ImageFont, ImageColor import subprocess import io +import datetime logging.basicConfig(format='%(message)s') # logging.warning('CC-Warning!') @@ -36,6 +37,8 @@ image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " +print(datetime.now()) + system_and_print("sudo rm " + image_dir + image) #system_and_print("sudo rm " + html_dir + "*") system_and_print("sudo rm " + html_dir + "/images/*") From 81411902c3bfb4fd7c132372e287694e2e42f00a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:25:23 -0500 Subject: [PATCH 431/515] Update fc_block_decode.py datetime --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index a3eaa36e..04360bad 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -37,7 +37,7 @@ image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " -print(datetime.now()) +print(datetime.datetime) system_and_print("sudo rm " + image_dir + image) #system_and_print("sudo rm " + html_dir + "*") From a9b40bb339a423cadfd68d01b8a1868b54e3c348 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:27:33 -0500 Subject: [PATCH 432/515] Update update add create html directory --- update | 1 + 1 file changed, 1 insertion(+) diff --git a/update b/update index a42a0fd6..6276a70e 100755 --- a/update +++ b/update @@ -243,6 +243,7 @@ if [ ! -d "/home/pi/fctelem" ]; then echo "Installing fctelem binary v0.2 for FunCube mode" cd mkdir /home/pi/fctelem + mkdir /home/pi/fctelem/public_html cd fctelem wget https://github.com/alanbjohnston/go/releases/download/v0.2/fctelem.zip unzip fctelem.zip From 92de39940f5f8381b7cbd1f48b4768988c9e0f97 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:30:17 -0500 Subject: [PATCH 433/515] Update fc_block_decode.py added now() --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 04360bad..cbfe2f12 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -37,7 +37,7 @@ image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " -print(datetime.datetime) +print(datetime.datetime.now()) system_and_print("sudo rm " + image_dir + image) #system_and_print("sudo rm " + html_dir + "*") From 8a53e16ebaffb87dd940d7ee56528d23f55e25d6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:32:26 -0500 Subject: [PATCH 434/515] Update fc_block_decode.py removed extra / --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index cbfe2f12..a8792e23 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -41,7 +41,7 @@ print(datetime.datetime.now()) system_and_print("sudo rm " + image_dir + image) #system_and_print("sudo rm " + html_dir + "*") -system_and_print("sudo rm " + html_dir + "/images/*") +system_and_print("sudo rm " + html_dir + "images/*") #system_and_print("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") @@ -65,7 +65,7 @@ with open(html_dir + "index.html", "w+") as html_file: html_file.write(telem_string) html_file.write(foot_string) -with open(html_dir + "/images/telem.csv.txt", "w+") as csv_file: +with open(html_dir + "images/telem.csv.txt", "w+") as csv_file: # csv_file.write(csv_format) csv_file.write(label_string) csv_file.write("\n") From 848820a3f6fc9369a43021efa2b856f8b3ed1045 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:41:20 -0500 Subject: [PATCH 435/515] Update fc_block_decode.py add date time to csv --- groundstation/fc_block_decode.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index a8792e23..b772f5a1 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -37,7 +37,7 @@ image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " -print(datetime.datetime.now()) +date_time = datetime.datetime.now() system_and_print("sudo rm " + image_dir + image) #system_and_print("sudo rm " + html_dir + "*") @@ -53,9 +53,9 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ " Freq: {frequency:10.1f} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" -label_string = " frm, freq off, err, h, seq, frame, img, c, Vx, Vy, Vz, Ix, Iy, Iz, Vb, Ib " +label_string = " date time , frm, freq off, err, h, seq, frame, img, c, Vx, Vy, Vz, Ix, Iy, Iz, Vb, Ib " label_string_html = label_string.replace(" "," ") -csv_format = "{frame_count:4d}, {frequency:10.1f}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ +csv_format = "{date_time:21s}, {frame_count:4d}, {frequency:10.1f}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d}" @@ -177,6 +177,7 @@ if __name__ == "__main__": for line in csv_file: html_file.write(line) html_file.write("
") + date_time = datetime.datetime.now() tlm_string = fstr(csv_format) html_file.write(tlm_string) html_file.write("

") From d895ad196d67106a8923b1c710bfc5f7b33ffbef Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:46:47 -0500 Subject: [PATCH 436/515] Update fc_block_decode.py convert date time to string --- groundstation/fc_block_decode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index b772f5a1..2ae9c157 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -37,7 +37,7 @@ image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " -date_time = datetime.datetime.now() +date_time = str(datetime.datetime.now()) system_and_print("sudo rm " + image_dir + image) #system_and_print("sudo rm " + html_dir + "*") @@ -177,7 +177,7 @@ if __name__ == "__main__": for line in csv_file: html_file.write(line) html_file.write("
") - date_time = datetime.datetime.now() + date_time = str(datetime.datetime.now()) tlm_string = fstr(csv_format) html_file.write(tlm_string) html_file.write("

") From 38812a9e41b468e238d22ab33ee4b11fd8be3732 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:51:13 -0500 Subject: [PATCH 437/515] Update fc_block_decode.py date_time first 21 chars --- groundstation/fc_block_decode.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 2ae9c157..757a2853 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -37,7 +37,8 @@ image_dir = "/home/pi/fctelem/" image = "image_file" ssdv = "/home/pi/ssdv/ssdv -d -J " -date_time = str(datetime.datetime.now()) +date_time_string = str(datetime.datetime.now()) +date_time = date_time_string[:21] system_and_print("sudo rm " + image_dir + image) #system_and_print("sudo rm " + html_dir + "*") @@ -177,7 +178,8 @@ if __name__ == "__main__": for line in csv_file: html_file.write(line) html_file.write("
") - date_time = str(datetime.datetime.now()) + date_time_string = str(datetime.datetime.now()) + date_time = date_time_string[:21] tlm_string = fstr(csv_format) html_file.write(tlm_string) html_file.write("

") From 1a22bbd9cc962cb0f0fef3badd2b205b25a43b57 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 22 Feb 2025 16:53:30 -0500 Subject: [PATCH 438/515] Update fc_block_decode.py spacing fix --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 757a2853..decbdddf 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -54,7 +54,7 @@ telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vbat(mV): {Vb:5d} Ibat(mA): {Ib:5d}

" + \ " Freq: {frequency:10.1f} errors: {errors} Seq: {sequence:d} {frame_type} frames: {frame_count:d}" -label_string = " date time , frm, freq off, err, h, seq, frame, img, c, Vx, Vy, Vz, Ix, Iy, Iz, Vb, Ib " +label_string = "date time , frm, freq off, err, h, seq, frame, img, c, Vx, Vy, Vz, Ix, Iy, Iz, Vb, Ib " label_string_html = label_string.replace(" "," ") csv_format = "{date_time:21s}, {frame_count:4d}, {frequency:10.1f}, {errors:3d}, {first_byte: 2x}, {sequence:5d}, {frame_type:9s}, {image_id:3d}, {image_count:2d}, " + \ "{Vx:5d}, {Vy:5d}, {Vz:5d}, {Ix:5d}, {Iy:5d}, {Iz:5d}, {Vb:5d}, {Ib:5d}" From bbf1d8d415ca34f77ee9d99e4d58e27467c0d00e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 24 Feb 2025 17:04:05 -0500 Subject: [PATCH 439/515] Update update add fcdctl install to set fcdpp gain --- update | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/update b/update index 6276a70e..ce63446d 100755 --- a/update +++ b/update @@ -260,6 +260,13 @@ elif [ ! -f "/home/pi/fctelem/v0.2" ]; then FLAG=1 fi +if [ ! -d "/home/pi/fcdctl" ]; then + echo "Installing fcdctl to set FunCubeDongle Pro gain" + git clone https://github.com/csete/fcdctl.git + cd fcdctl + make fcdpp +fi + cd /home/pi/pi-power-button git checkout master From c59019dc6c9ad69dd53d2ac83a2a764e2fa8d8b0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 25 Feb 2025 13:49:36 -0500 Subject: [PATCH 440/515] Update update add libusb for fcdctl --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index ce63446d..f350f979 100755 --- a/update +++ b/update @@ -35,7 +35,7 @@ if [ "$1" = "u" ]; then fi -sudo apt-get install -y python3-smbus +sudo apt-get install -y python3-smbus libusb-1.0 sudo sed -i 's/update.sh/update /g' /etc/motd From 85d97813ef310b533c4a9785f387987c903a9900 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 21 May 2025 10:24:28 -0400 Subject: [PATCH 441/515] Update transmit.py don't stop C2C in repeater mode --- transmit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transmit.py b/transmit.py index e1c9336c..de96cf3e 100644 --- a/transmit.py +++ b/transmit.py @@ -798,8 +798,8 @@ if __name__ == "__main__": sleep(0.6) elif (mode == 'e'): # code based on https://zr6aic.blogspot.com/2016/11/creating-2m-fm-repeater-with-raspberry.html print("Cross Band Repeater") - print("Stopping command and control") - system("sudo systemctl stop command") +# print("Stopping command and control") +# system("sudo systemctl stop command") print("turn on FM rx") output(pd, 1) output(ptt, 1) From 392ff768cc8c0c742d4353fc10a831e51350fce6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 21 May 2025 10:36:15 -0400 Subject: [PATCH 442/515] Update dtmf_aprs_cc.py add repeater and fc modes --- dtmf_aprs_cc.py | 77 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index befe58c7..c67e5300 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -71,6 +71,25 @@ if __name__ == "__main__": system("echo '\nCW Mode!!\n'") mode = 'm' change_mode = True + + if ((line.find("MODE=e")) > 0): + system("echo '\nRepeater Mode!!\n'") + mode = 'e' + change_mode = True + counter = (counter + 1) % 2 + if ((line.find("DTMF>APDW15:t6#")) > 0): + system("echo '\nRepeater Mode!!\n'") + mode = 'e' + change_mode = True + if ((line.find("MODE=j")) > 0): + system("echo '\nFunCube Mode!!\n'") + mode = 'j' + change_mode = True + counter = (counter + 1) % 2 + if ((line.find("DTMF>APDW15:t7#")) > 0): + system("echo '\nFunCube Mode!!\n'") + mode = 'j' + change_mode = True if ((line.find("MODE=n")) > 0): system("echo '\nTransmit Commands Mode!!\n'") mode = 'n' @@ -80,7 +99,6 @@ if __name__ == "__main__": system("echo '\nTransmit Commands Mode!!\n'") mode = 'n' change_mode = True -# Currently, C2C does not support Repeater mode e if ((line.find("MODE=o")) > 0): system("echo '\nBeacon Mode toggle!!\n'") mode = 'o' @@ -160,6 +178,63 @@ if __name__ == "__main__": sleep(0.1) GPIO.output(powerPin, 1) sleep(1) + + elif (mode == 'e'): + GPIO.output(powerPin, 0) # blink six times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1); + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(1) + + elif (mode == 'j'): + GPIO.output(powerPin, 0) # blink seven times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1); + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(1) + elif (mode == 'a'): mode = 'a' GPIO.output(powerPin, 0) # blink one time From 2dc441dd08341d81c8f88d57062336fc6fc96943 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 21 May 2025 11:02:00 -0400 Subject: [PATCH 443/515] Update transmit.py add beacon mode on/off to repeater --- transmit.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index de96cf3e..83bcaf45 100644 --- a/transmit.py +++ b/transmit.py @@ -810,9 +810,11 @@ if __name__ == "__main__": # GPIO.output(powerPin, 1) # was 0 txf = float(tx) - 288.9 print("Transmit frequency: ",txf) + if (command_tx != True): + print("Beacon mode off so no repeater transmission") while True: sleep(1) - if (GPIO.input(squelch) == False): + if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) From df04fea8c6f0f0e7e1528f0ae12c8f44d561a6e8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 21 May 2025 15:58:24 -0400 Subject: [PATCH 444/515] Update dtmf_aprs_cc.py don't use counter --- dtmf_aprs_cc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index c67e5300..12d69af3 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -109,7 +109,8 @@ if __name__ == "__main__": mode = 'o' change_mode = True - if (debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other APRS command since Direwolf prints them twice +# if (debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other APRS command since Direwolf prints them twice + if (debug_mode == False) and (change_mode == True): # skip every other APRS command since Direwolf prints them twice GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(powerPin, GPIO.OUT) From 475d3c468ed546d498ba232c6c293f8ecff14955 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 09:29:00 -0400 Subject: [PATCH 445/515] Update command add uptime check before waiting 20s --- command | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/command b/command index b7f04ee0..fdd55ef6 100755 --- a/command +++ b/command @@ -35,9 +35,17 @@ else fi -echo "Waiting 20 seconds for USB" +uptime=`cat /proc/uptime | awk '{printf "%0.f", $1}'` -sleep 20 +echo -n "Uptime since boot is " +echo $value + +if [[ "$uptime" -lt "60" ]]; then + + echo "Waiting 20 seconds for USB" + + sleep 20 +fi FILE=/home/pi/CubeSatSim/command_control_direwolf if [[ $(arecord -l | grep "USB Audio Device") ]] && [ -f "$FILE" ]; then From 443ba3ad57da9a94934b176172b2ed61e04a90e2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 09:32:48 -0400 Subject: [PATCH 446/515] Update command print uptime in log --- command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command b/command index fdd55ef6..0527403a 100755 --- a/command +++ b/command @@ -38,7 +38,7 @@ fi uptime=`cat /proc/uptime | awk '{printf "%0.f", $1}'` echo -n "Uptime since boot is " -echo $value +echo $uptime if [[ "$uptime" -lt "60" ]]; then From cd84ed4b8087afbba2c7c858b503aaf6f4b13adf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 09:41:04 -0400 Subject: [PATCH 447/515] Update transmit.py start and stop C2C in repeater mode --- transmit.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/transmit.py b/transmit.py index 83bcaf45..450e65d1 100644 --- a/transmit.py +++ b/transmit.py @@ -812,10 +812,14 @@ if __name__ == "__main__": print("Transmit frequency: ",txf) if (command_tx != True): print("Beacon mode off so no repeater transmission") + while True: sleep(1) if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") + if (no_command == False): + system("sudo systemctl stop command") + print("stopping C2C") GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) @@ -839,6 +843,9 @@ if __name__ == "__main__": system("sudo /etc/init.d/alsa-utils stop") system("sudo /etc/init.d/alsa-utils start") print("Finished resetting audio") + if (no_command == False): + system("sudo systemctl restart command") + print("restarting C2C") else: print("FSK") print("turn on FM rx") From 622e0f58076958fd8f085cb468c1d363fa7dec15 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 10:37:36 -0400 Subject: [PATCH 448/515] Update transmit.py add 2s delay --- transmit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/transmit.py b/transmit.py index 450e65d1..d91c133b 100644 --- a/transmit.py +++ b/transmit.py @@ -820,6 +820,7 @@ if __name__ == "__main__": if (no_command == False): system("sudo systemctl stop command") print("stopping C2C") + sleep(2) GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) From 12a1a021796f78136008c3d94f8cf53f3abcfa47 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 10:41:51 -0400 Subject: [PATCH 449/515] Update transmit.py check for C2C for 2s --- transmit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transmit.py b/transmit.py index d91c133b..3613e473 100644 --- a/transmit.py +++ b/transmit.py @@ -818,9 +818,9 @@ if __name__ == "__main__": if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") if (no_command == False): - system("sudo systemctl stop command") - print("stopping C2C") sleep(2) + print("stopping C2C") + system("sudo systemctl stop command") GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) From 24107b9cd3dd434e36fae12429684652dd05530d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 10:44:26 -0400 Subject: [PATCH 450/515] Update config restart transmit after C2C change --- config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config b/config index 2f64e227..8cf523a3 100755 --- a/config +++ b/config @@ -745,6 +745,8 @@ elif [ "$1" = "-T" ]; then # reboot=1 echo "restarting command and control" sudo systemctl restart command + echo "restarting transmit" + sudo systemctl restart transmit ## sudo reboot now fi @@ -761,6 +763,8 @@ elif [ "$1" = "-T" ]; then echo "restarting command and control" # reboot=1 sudo systemctl restart command + echo "restarting transmit" + sudo systemctl restart transmit ## sudo reboot now fi From 5337e3613c11b9ab48b177a098ece2a41a0f7df6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 10:51:41 -0400 Subject: [PATCH 451/515] Update transmit.py wait 5s --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 3613e473..77470b30 100644 --- a/transmit.py +++ b/transmit.py @@ -818,7 +818,7 @@ if __name__ == "__main__": if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") if (no_command == False): - sleep(2) + sleep(5) # wait 5 seconds before repeater mode in case it is C2C command print("stopping C2C") system("sudo systemctl stop command") GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 From 81a2b2d76110839893b0f367282d82ceee6ed0cf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 11:23:52 -0400 Subject: [PATCH 452/515] Update transmit.py repeater mode cw ID on 2m --- transmit.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/transmit.py b/transmit.py index 77470b30..6f821354 100644 --- a/transmit.py +++ b/transmit.py @@ -270,7 +270,8 @@ if __name__ == "__main__": rx_value = '0' sq = '0' tx = '434.9000' - rx = '435.0000' + rx = '435.0000' + txr = '146.0000' try: file = open("/home/pi/CubeSatSim/sim.cfg") @@ -286,8 +287,13 @@ if __name__ == "__main__": txf = float(config[6]) # print(txf) # print( "{:.4f}".format(txf)) - tx = "{:.4f}".format(txf) - print(tx) + + if (mode == 'e'): + txr = txf - 288.9 # Cross Band Repeater mode transmit frequency in 2m band + tx = "{:.4f}".format(txr) + else: + tx = "{:.4f}".format(txf) + print("Transmit frequency: ",tx) if len(config) > 7: rxf = float(config[7]) # print(rxf) @@ -377,7 +383,8 @@ if __name__ == "__main__": # if (mode != ) and (command_tx == True): # if (command_tx == True): - if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'j')) and (command_tx == True) and (skip == False): +## if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'j')) and (command_tx == True) and (skip == False): + if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 'e') or (mode == 's') or (mode == 'j')) and (command_tx == True) and (skip == False): # battery_saver_mode GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) @@ -797,7 +804,7 @@ if __name__ == "__main__": # else: sleep(0.6) elif (mode == 'e'): # code based on https://zr6aic.blogspot.com/2016/11/creating-2m-fm-repeater-with-raspberry.html - print("Cross Band Repeater") + print("Cross Band Repeater Mode") # print("Stopping command and control") # system("sudo systemctl stop command") print("turn on FM rx") @@ -808,8 +815,8 @@ if __name__ == "__main__": # GPIO.setup(powerPin, GPIO.OUT) GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected # GPIO.output(powerPin, 1) # was 0 - txf = float(tx) - 288.9 - print("Transmit frequency: ",txf) +# txf = float(tx) - 288.9 +# print("Transmit frequency: ",txf) if (command_tx != True): print("Beacon mode off so no repeater transmission") @@ -826,7 +833,7 @@ if __name__ == "__main__": output(txLed, txLedOn) # system("arecord -D plughw:CARD=Device,DEV=0 | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") ## system("arecord -D plughw:CARD=Device,DEV=0 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") - system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + str(txf) + "e3 &") + system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") sleep(0.5) # system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") system("sudo arecord -D plughw:CARD=Device,DEV=0 -r48000 -fS16_LE -c1 | nc localhost 8011 &") From a6fcea01e2165fde4bf3f2904ab221ccab74eb98 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 11:31:18 -0400 Subject: [PATCH 454/515] Update transmit.py fixed spaces --- transmit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transmit.py b/transmit.py index 6f821354..6834d7d3 100644 --- a/transmit.py +++ b/transmit.py @@ -284,7 +284,7 @@ if __name__ == "__main__": sq = 0 # turn off squelch for Pacsat print(sq) if len(config) > 6: - txf = float(config[6]) + txf = float(config[6]) # print(txf) # print( "{:.4f}".format(txf)) @@ -293,7 +293,7 @@ if __name__ == "__main__": tx = "{:.4f}".format(txr) else: tx = "{:.4f}".format(txf) - print("Transmit frequency: ",tx) + print("Transmit frequency: ",tx) if len(config) > 7: rxf = float(config[7]) # print(rxf) From 59e8ed71e20ee274cc9382627f2e985154c520d8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 11:38:17 -0400 Subject: [PATCH 455/515] Update transmit.py always do repeater cw --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 6834d7d3..99935623 100644 --- a/transmit.py +++ b/transmit.py @@ -384,7 +384,7 @@ if __name__ == "__main__": # if (mode != ) and (command_tx == True): # if (command_tx == True): ## if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'j')) and (command_tx == True) and (skip == False): - if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 'e') or (mode == 's') or (mode == 'j')) and (command_tx == True) and (skip == False): + if (((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'j')) and (command_tx == True) and (skip == False)) or (mode == 'e'): # battery_saver_mode GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) From ef0c9c03b0084ccbfc9d20297477c67e10bf4b7d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 11:39:47 -0400 Subject: [PATCH 456/515] Update transmit.py change to 145 MHz for Repeater default --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 99935623..b2aad8bf 100644 --- a/transmit.py +++ b/transmit.py @@ -289,7 +289,7 @@ if __name__ == "__main__": # print( "{:.4f}".format(txf)) if (mode == 'e'): - txr = txf - 288.9 # Cross Band Repeater mode transmit frequency in 2m band + txr = txf - 289.9 # Cross Band Repeater mode transmit frequency in 2m band tx = "{:.4f}".format(txr) else: tx = "{:.4f}".format(txf) From 69d61a11c5b52c8ca418bb90559e6eb045aee0a4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 13:52:09 -0400 Subject: [PATCH 457/515] Update transmit.py try 3s delay in repeater --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index b2aad8bf..73914b63 100644 --- a/transmit.py +++ b/transmit.py @@ -825,7 +825,7 @@ if __name__ == "__main__": if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") if (no_command == False): - sleep(5) # wait 5 seconds before repeater mode in case it is C2C command + sleep(3) # wait 3 seconds before repeater mode in case it is C2C command print("stopping C2C") system("sudo systemctl stop command") GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 From 45ac1b9aef4a6081add654bc179bfb9092a6bfe1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 13:57:19 -0400 Subject: [PATCH 458/515] Update transmit.py try 145.9 --- transmit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transmit.py b/transmit.py index 73914b63..c1bde01e 100644 --- a/transmit.py +++ b/transmit.py @@ -271,7 +271,7 @@ if __name__ == "__main__": sq = '0' tx = '434.9000' rx = '435.0000' - txr = '146.0000' + txr = '144.9000' try: file = open("/home/pi/CubeSatSim/sim.cfg") @@ -289,7 +289,7 @@ if __name__ == "__main__": # print( "{:.4f}".format(txf)) if (mode == 'e'): - txr = txf - 289.9 # Cross Band Repeater mode transmit frequency in 2m band + txr = txf - 290.0 # Cross Band Repeater mode transmit frequency in 2m band tx = "{:.4f}".format(txr) else: tx = "{:.4f}".format(txf) From b6c8a9291df08a74689a892ebbe944a2c5fe9943 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 14:08:06 -0400 Subject: [PATCH 459/515] Update transmit.py don't program FM on repeater mode, no cw if beacon off --- transmit.py | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/transmit.py b/transmit.py index c1bde01e..9a0ce770 100644 --- a/transmit.py +++ b/transmit.py @@ -355,24 +355,25 @@ if __name__ == "__main__": card = "Headphones" # default using pcm audio output of Pi Zero # card = "Device" # using USB sound card for audio output - print("Programming FM module!\n"); - output(pd, 1) - output (ptt, 1) - try: - ser = serial.Serial("/dev/ttyAMA0", 9600) - print(ser.portstr) -# uhf_string = "AT+DMOSETGROUP=0," + rx +"," + tx + ",0,3,0,0\r\n" - uhf_string = "AT+DMOSETGROUP=0," + rx + "," + tx + "," + rxpl_value + "," + sq + "," + txpl_value + ",0\r\n" - print(uhf_string) - for i in range(6): -# ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n") - ser.write(uhf_string.encode()) - sleep(0.1) - ser.close() - ser = serial.Serial("/dev/ttyAMA0", 115200) # reset back to 115200 for cubesatsim code for payload sensor data - except: - print("Error in serial write") - output(pd, 0) + if (mode != 'e'): + print("Programming FM module!\n"); + output(pd, 1) + output (ptt, 1) + try: + ser = serial.Serial("/dev/ttyAMA0", 9600) + print(ser.portstr) + # uhf_string = "AT+DMOSETGROUP=0," + rx +"," + tx + ",0,3,0,0\r\n" + uhf_string = "AT+DMOSETGROUP=0," + rx + "," + tx + "," + rxpl_value + "," + sq + "," + txpl_value + ",0\r\n" + print(uhf_string) + for i in range(6): + # ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n") + ser.write(uhf_string.encode()) + sleep(0.1) + ser.close() + ser = serial.Serial("/dev/ttyAMA0", 115200) # reset back to 115200 for cubesatsim code for payload sensor data + except: + print("Error in serial write") + output(pd, 0) # if (mode != 'x') and (skip == False): # sleep(10) # delay so cubesatsim code catches up @@ -384,7 +385,7 @@ if __name__ == "__main__": # if (mode != ) and (command_tx == True): # if (command_tx == True): ## if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'j')) and (command_tx == True) and (skip == False): - if (((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'j')) and (command_tx == True) and (skip == False)) or (mode == 'e'): + if (((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'j')) and (command_tx == True) and (skip == False)) or ((mode == 'e') and (command_tx == True)): # battery_saver_mode GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) From 52be832b7a70e85fd4bc9afac13cd8174f778300 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 14:35:06 -0400 Subject: [PATCH 460/515] Update transmit.py try 2s --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 9a0ce770..bea6bc94 100644 --- a/transmit.py +++ b/transmit.py @@ -826,7 +826,7 @@ if __name__ == "__main__": if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") if (no_command == False): - sleep(3) # wait 3 seconds before repeater mode in case it is C2C command + sleep(2) # wait 2 seconds before repeater mode in case it is C2C command print("stopping C2C") system("sudo systemctl stop command") GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 From 8ef731e71f75c349489a262730deda28c0069bec Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 14:54:12 -0400 Subject: [PATCH 461/515] Update transmit.py 3s, add 3s after release --- transmit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transmit.py b/transmit.py index bea6bc94..97bc03c4 100644 --- a/transmit.py +++ b/transmit.py @@ -822,11 +822,11 @@ if __name__ == "__main__": print("Beacon mode off so no repeater transmission") while True: - sleep(1) + sleep(3) # wait 3 seconds for a C2C command if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") if (no_command == False): - sleep(2) # wait 2 seconds before repeater mode in case it is C2C command + sleep(3) # wait 3 seconds before repeater mode in case it is C2C command print("stopping C2C") system("sudo systemctl stop command") GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 From 9995635ae857d12d2a6058f3d9666767a8c20781 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 14:59:16 -0400 Subject: [PATCH 462/515] Update transmit.py remove 3s at start, leave 3s at end --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 97bc03c4..8b168457 100644 --- a/transmit.py +++ b/transmit.py @@ -826,7 +826,7 @@ if __name__ == "__main__": if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") if (no_command == False): - sleep(3) # wait 3 seconds before repeater mode in case it is C2C command +# sleep(3) # wait 3 seconds before repeater mode in case it is C2C command print("stopping C2C") system("sudo systemctl stop command") GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 From 55dd2e607accc2c05c46983f6bd2b213aa612f20 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 15:10:05 -0400 Subject: [PATCH 463/515] Update transmit.py 4s tail period --- transmit.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index 8b168457..f71d5352 100644 --- a/transmit.py +++ b/transmit.py @@ -822,7 +822,9 @@ if __name__ == "__main__": print("Beacon mode off so no repeater transmission") while True: - sleep(3) # wait 3 seconds for a C2C command + print("Waiting for C2C") + sleep(4) # wait 4 seconds for a C2C command + print("Ready to detect carrier") if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") if (no_command == False): From 213c4795a7253278ac8488cc8f179c556be5bc94 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 15:25:26 -0400 Subject: [PATCH 464/515] Update transmit.py move to 4s tail --- transmit.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/transmit.py b/transmit.py index f71d5352..a4d054fe 100644 --- a/transmit.py +++ b/transmit.py @@ -820,11 +820,9 @@ if __name__ == "__main__": # print("Transmit frequency: ",txf) if (command_tx != True): print("Beacon mode off so no repeater transmission") - + + print("Ready to detect carrier") while True: - print("Waiting for C2C") - sleep(4) # wait 4 seconds for a C2C command - print("Ready to detect carrier") if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") if (no_command == False): @@ -836,7 +834,7 @@ if __name__ == "__main__": output(txLed, txLedOn) # system("arecord -D plughw:CARD=Device,DEV=0 | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") ## system("arecord -D plughw:CARD=Device,DEV=0 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") - system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") + system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1 &") sleep(0.5) # system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") system("sudo arecord -D plughw:CARD=Device,DEV=0 -r48000 -fS16_LE -c1 | nc localhost 8011 &") @@ -856,7 +854,11 @@ if __name__ == "__main__": print("Finished resetting audio") if (no_command == False): system("sudo systemctl restart command") - print("restarting C2C") + print("restarting C2C") + print("Waiting for C2C") + sleep(4) # wait 4 seconds for a C2C command + print("Ready to detect carrier") + else: print("FSK") print("turn on FM rx") From 7fc65a89540f0bf07df71b55af1bc571f0f1d30c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 15:37:01 -0400 Subject: [PATCH 465/515] Update transmit.py back to first 4s --- transmit.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/transmit.py b/transmit.py index a4d054fe..4246a498 100644 --- a/transmit.py +++ b/transmit.py @@ -826,7 +826,7 @@ if __name__ == "__main__": if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") if (no_command == False): -# sleep(3) # wait 3 seconds before repeater mode in case it is C2C command + sleep(4) # wait 3 seconds before repeater mode in case it is C2C command print("stopping C2C") system("sudo systemctl stop command") GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 @@ -855,8 +855,8 @@ if __name__ == "__main__": if (no_command == False): system("sudo systemctl restart command") print("restarting C2C") - print("Waiting for C2C") - sleep(4) # wait 4 seconds for a C2C command +# print("Waiting for C2C") +# sleep(4) # wait 4 seconds for a C2C command print("Ready to detect carrier") else: From 2f27464ca0d21c2d9bd89aea8151678bc6ad7e46 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 22 May 2025 15:43:07 -0400 Subject: [PATCH 466/515] Update transmit.py 3s at start --- transmit.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/transmit.py b/transmit.py index 4246a498..b079cc52 100644 --- a/transmit.py +++ b/transmit.py @@ -826,7 +826,7 @@ if __name__ == "__main__": if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") if (no_command == False): - sleep(4) # wait 3 seconds before repeater mode in case it is C2C command + sleep(3) # wait 3 seconds before repeater mode in case it is C2C command print("stopping C2C") system("sudo systemctl stop command") GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 @@ -845,9 +845,9 @@ if __name__ == "__main__": sleep(1) print("No carrier detected, stopping repeater") output(txLed, txLedOff) - system("sudo killall -9 arecord") - system("sudo killall -9 nc") - system("sudo killall -9 rpitx") + system("sudo killall -9 arecord > /dev/null 2>&1") + system("sudo killall -9 nc > /dev/null 2>&1") + system("sudo killall -9 rpitx > /dev/null 2>&1") print("Resetting audio") system("sudo /etc/init.d/alsa-utils stop") system("sudo /etc/init.d/alsa-utils start") From f1c607340a2367436c06e5364b19ea101bd7066f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 10:19:29 -0400 Subject: [PATCH 467/515] Update direwolf-cc.conf added shared_mic --- direwolf-cc.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf-cc.conf b/direwolf-cc.conf index 8419355f..26f8805b 100644 --- a/direwolf-cc.conf +++ b/direwolf-cc.conf @@ -1,2 +1,2 @@ -ADEVICE hw:CARD=Device,DEV=0 default +ADEVICE shared_mic hw:CARD=Loopback,DEV=1 DTMF From b064d0bcade47d6dbfa547d484a1c0f0a6e750fd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 10:21:38 -0400 Subject: [PATCH 468/515] Create asoundrc with dsnoop --- asoundrc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 asoundrc diff --git a/asoundrc b/asoundrc new file mode 100644 index 00000000..70e18d2c --- /dev/null +++ b/asoundrc @@ -0,0 +1,46 @@ +pcm.!default { + type asym + playback.pcm "softvol" + capture.pcm "shared_mic" +} + +ctl.!default { + type hw + card 1 +} + +# Playback with software volume and mixing +pcm.softvol { + type softvol + slave.pcm "shared_speaker" + control { + name "Master" + card 1 + } +} + +pcm.shared_speaker { + type dmix + ipc_key 1024 + slave { + pcm "hw:1,0" + rate 48000 + period_time 0 + period_size 1024 + buffer_size 4096 + } +} + +# Recording with input mixing +pcm.shared_mic { + type dsnoop + ipc_key 2048 + slave { + pcm "hw:1,0" +# channels 1 + rate 48000 + period_time 0 + period_size 1024 + buffer_size 4096 + } +} From 33e1a3fdc9b7db1efbfd7d0e1f50b62f84e5de18 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 10:25:12 -0400 Subject: [PATCH 469/515] Update transmit.py repeater mode shared_mic dsnoop --- transmit.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/transmit.py b/transmit.py index b079cc52..5923afc4 100644 --- a/transmit.py +++ b/transmit.py @@ -825,10 +825,6 @@ if __name__ == "__main__": while True: if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") - if (no_command == False): - sleep(3) # wait 3 seconds before repeater mode in case it is C2C command - print("stopping C2C") - system("sudo systemctl stop command") GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) @@ -837,7 +833,7 @@ if __name__ == "__main__": system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1 &") sleep(0.5) # system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") - system("sudo arecord -D plughw:CARD=Device,DEV=0 -r48000 -fS16_LE -c1 | nc localhost 8011 &") + system("sudo arecord -D shared_mic -r48000 -fS16_LE -c1 | nc localhost 8011 &") # GPIO.output(powerPin, 1) # sleep(0.5) # GPIO.output(powerPin, 0) @@ -852,12 +848,7 @@ if __name__ == "__main__": system("sudo /etc/init.d/alsa-utils stop") system("sudo /etc/init.d/alsa-utils start") print("Finished resetting audio") - if (no_command == False): - system("sudo systemctl restart command") - print("restarting C2C") -# print("Waiting for C2C") -# sleep(4) # wait 4 seconds for a C2C command - print("Ready to detect carrier") + print("Ready to detect carrier") else: print("FSK") From 692a3421acdbcc24bd146fdb1ab5a65458d3e48c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 10:27:59 -0400 Subject: [PATCH 470/515] Update command added snd-aloop --- command | 2 ++ 1 file changed, 2 insertions(+) diff --git a/command b/command index 0527403a..f4c96b1d 100755 --- a/command +++ b/command @@ -2,6 +2,8 @@ echo -e "\nCommand and Control script for CubeSatSim v2.1\n" +sudo modprobe snd-aloop + FILE=/home/pi/CubeSatSim/command_control if [ -f "$FILE" ]; then echo "Radio command and control is ON" From 80492c6c2669ce6af41f4b3a9b3a20bcc940e9aa Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 10:55:25 -0400 Subject: [PATCH 471/515] Update update with .asoundrc check and update --- update | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/update b/update index f350f979..6c8b2646 100755 --- a/update +++ b/update @@ -119,6 +119,21 @@ else FLAG=1 fi +FILE=/root/.asoundrc +if [ -f "$FILE" ]; then + if [[ $(diff /home/pi/CubeSatSim/asoundrc /root/.asoundrc) ]]; then + echo "changed .asoundrc for root user." + sudo cp /home/pi/CubeSatSim/asoundrc /root/.asoundrc + FLAG=1 + else + echo "no change to .asoundrc for root user." + fi +else + echo "creating .asoundrc for root user." + sudo cp /home/pi/CubeSatSim/asoundrc /root/.asoundrc + FLAG=1 +fi + FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg if [ ! -f "$FILE" ]; then echo "Copying SSTV image 1." From 74e8d6da30b83087ef4b36bb617e13ba3a11808d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 11:01:21 -0400 Subject: [PATCH 472/515] Update update add sudo su for root .asoundrc --- update | 2 ++ 1 file changed, 2 insertions(+) diff --git a/update b/update index 6c8b2646..a7273cf1 100755 --- a/update +++ b/update @@ -119,6 +119,7 @@ else FLAG=1 fi +sudo su FILE=/root/.asoundrc if [ -f "$FILE" ]; then if [[ $(diff /home/pi/CubeSatSim/asoundrc /root/.asoundrc) ]]; then @@ -133,6 +134,7 @@ else sudo cp /home/pi/CubeSatSim/asoundrc /root/.asoundrc FLAG=1 fi +su pi FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg if [ ! -f "$FILE" ]; then From c9570bac116489159995fbd3280a41450b64cbb9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 11:12:50 -0400 Subject: [PATCH 473/515] Update update changed to /etc/asound.conf --- update | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/update b/update index a7273cf1..73223bdb 100755 --- a/update +++ b/update @@ -119,22 +119,20 @@ else FLAG=1 fi -sudo su -FILE=/root/.asoundrc +FILE=/etc/asound.conf if [ -f "$FILE" ]; then - if [[ $(diff /home/pi/CubeSatSim/asoundrc /root/.asoundrc) ]]; then - echo "changed .asoundrc for root user." - sudo cp /home/pi/CubeSatSim/asoundrc /root/.asoundrc + if [[ $(diff /home/pi/CubeSatSim/asoundrc /etc/asound.conf) ]]; then + echo "changed /etc/asound.conf." + sudo cp /home/pi/CubeSatSim/asoundrc /etc/asound.conf FLAG=1 else - echo "no change to .asoundrc for root user." + echo "no change to /etc/asound.conf." fi else - echo "creating .asoundrc for root user." - sudo cp /home/pi/CubeSatSim/asoundrc /root/.asoundrc + echo "creating /etc/asound.conf." + sudo cp /home/pi/CubeSatSim/asoundrc /etc/asound.conf FLAG=1 fi -su pi FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg if [ ! -f "$FILE" ]; then From bd3ff8fe724c7621b5a2129e1546cc45f5999db2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 11:13:45 -0400 Subject: [PATCH 474/515] Update update more asound.conf --- update | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/update b/update index 73223bdb..fb7f8c44 100755 --- a/update +++ b/update @@ -121,16 +121,16 @@ fi FILE=/etc/asound.conf if [ -f "$FILE" ]; then - if [[ $(diff /home/pi/CubeSatSim/asoundrc /etc/asound.conf) ]]; then + if [[ $(diff /home/pi/CubeSatSim/asound.conf /etc/asound.conf) ]]; then echo "changed /etc/asound.conf." - sudo cp /home/pi/CubeSatSim/asoundrc /etc/asound.conf + sudo cp /home/pi/CubeSatSim/asound.conf /etc/asound.conf FLAG=1 else echo "no change to /etc/asound.conf." fi else echo "creating /etc/asound.conf." - sudo cp /home/pi/CubeSatSim/asoundrc /etc/asound.conf + sudo cp /home/pi/CubeSatSim/asound.conf /etc/asound.conf FLAG=1 fi From df451a81cb4a778fe5c5e3cd08204f2802c8adb5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 11:14:27 -0400 Subject: [PATCH 475/515] Rename asoundrc to asound.conf --- asoundrc => asound.conf | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename asoundrc => asound.conf (100%) diff --git a/asoundrc b/asound.conf similarity index 100% rename from asoundrc rename to asound.conf From f9c2ced703e280c7f5d5c50199fadedb106ec4da Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 11:18:54 -0400 Subject: [PATCH 476/515] Update asound.conf changed to card 2 --- asound.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/asound.conf b/asound.conf index 70e18d2c..783b59f7 100644 --- a/asound.conf +++ b/asound.conf @@ -6,7 +6,7 @@ pcm.!default { ctl.!default { type hw - card 1 + card 2 } # Playback with software volume and mixing @@ -15,7 +15,7 @@ pcm.softvol { slave.pcm "shared_speaker" control { name "Master" - card 1 + card 2 } } @@ -23,7 +23,7 @@ pcm.shared_speaker { type dmix ipc_key 1024 slave { - pcm "hw:1,0" + pcm "hw:2,0" rate 48000 period_time 0 period_size 1024 @@ -36,7 +36,7 @@ pcm.shared_mic { type dsnoop ipc_key 2048 slave { - pcm "hw:1,0" + pcm "hw:2,0" # channels 1 rate 48000 period_time 0 From 3a810d0df97f54a6de24285472f0a59945ec5160 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 May 2025 09:12:02 -0400 Subject: [PATCH 477/515] Update update fix libusb install --- update | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/update b/update index fb7f8c44..6dd73073 100755 --- a/update +++ b/update @@ -35,7 +35,8 @@ if [ "$1" = "u" ]; then fi -sudo apt-get install -y python3-smbus libusb-1.0 +#sudo apt-get install -y python3-smbus libusb-1.0 +sudo apt-get install -y python3-smbus libusb* sudo sed -i 's/update.sh/update /g' /etc/motd From 9c37b47f929eddaf557503c264ee0557ae5a058b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 May 2025 09:23:38 -0400 Subject: [PATCH 478/515] Update update back to libusb-1.0 --- update | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/update b/update index 6dd73073..fb7f8c44 100755 --- a/update +++ b/update @@ -35,8 +35,7 @@ if [ "$1" = "u" ]; then fi -#sudo apt-get install -y python3-smbus libusb-1.0 -sudo apt-get install -y python3-smbus libusb* +sudo apt-get install -y python3-smbus libusb-1.0 sudo sed -i 's/update.sh/update /g' /etc/motd From fb2bcd804df30c57a7b13de3064053b60b216baa Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 May 2025 09:27:18 -0400 Subject: [PATCH 479/515] Update update cd before fcdctl --- update | 1 + 1 file changed, 1 insertion(+) diff --git a/update b/update index fb7f8c44..73019e76 100755 --- a/update +++ b/update @@ -277,6 +277,7 @@ fi if [ ! -d "/home/pi/fcdctl" ]; then echo "Installing fcdctl to set FunCubeDongle Pro gain" + cd git clone https://github.com/csete/fcdctl.git cd fcdctl make fcdpp From 9a98ea5742f2dbc394dab65ea2a8ca293bfca8df Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 May 2025 13:07:49 -0400 Subject: [PATCH 480/515] Update update fixed libusb and 7-modes --- update | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/update b/update index 73019e76..ef87ec0d 100755 --- a/update +++ b/update @@ -35,7 +35,7 @@ if [ "$1" = "u" ]; then fi -sudo apt-get install -y python3-smbus libusb-1.0 +# sudo apt-get install -y python3-smbus libusb-1.0 sudo sed -i 's/update.sh/update /g' /etc/motd @@ -277,6 +277,9 @@ fi if [ ! -d "/home/pi/fcdctl" ]; then echo "Installing fcdctl to set FunCubeDongle Pro gain" + sudo rm /var/lib/dpkg/info/python3-pip.list + sudo apt install python3-pip --reinstall + sudo apt-get install -y python3-smbus libusb-1.0 cd git clone https://github.com/csete/fcdctl.git cd fcdctl @@ -285,7 +288,7 @@ fi cd /home/pi/pi-power-button -git checkout master +# git checkout master git pull --no-rebase > .updated_p @@ -293,12 +296,13 @@ git checkout master if [[ $(grep 'changed' /home/pi/pi-power-button/.updated_p) ]]; then echo "updating pi-power-button." + + git checkout 7-modes script/install FLAG=1 - else echo "nothing to do for pi-power-button." fi From c67c759d324a40eb465aebd6be7e07d9b296d612 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 May 2025 13:10:17 -0400 Subject: [PATCH 481/515] Update update fixed fcdctl install --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index ef87ec0d..b12c73c9 100755 --- a/update +++ b/update @@ -275,7 +275,7 @@ elif [ ! -f "/home/pi/fctelem/v0.2" ]; then FLAG=1 fi -if [ ! -d "/home/pi/fcdctl" ]; then +if [ ! -d "/home/pi/fcdctl/fcdctl" ]; then echo "Installing fcdctl to set FunCubeDongle Pro gain" sudo rm /var/lib/dpkg/info/python3-pip.list sudo apt install python3-pip --reinstall From e063ac688d4e7bf0b1d67fdf2ce20c26616128de Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 May 2025 13:16:45 -0400 Subject: [PATCH 482/515] Update update fix fcdctl update --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index b12c73c9..e4d95acb 100755 --- a/update +++ b/update @@ -275,7 +275,7 @@ elif [ ! -f "/home/pi/fctelem/v0.2" ]; then FLAG=1 fi -if [ ! -d "/home/pi/fcdctl/fcdctl" ]; then +if [ ! -f "/home/pi/fcdctl/fcdctl" ]; then echo "Installing fcdctl to set FunCubeDongle Pro gain" sudo rm /var/lib/dpkg/info/python3-pip.list sudo apt install python3-pip --reinstall From 22826263196327535f7bfb9cbbfb251af13eb302 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 31 May 2025 16:05:52 -0400 Subject: [PATCH 483/515] Update transmit.py add C to CW ID if C2C enabled --- transmit.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/transmit.py b/transmit.py index 5923afc4..51a39434 100644 --- a/transmit.py +++ b/transmit.py @@ -399,14 +399,18 @@ if __name__ == "__main__": # output (ptt, 1) # output(pd, 0) # else: - if (True): + if (no_command): if (debug_mode == 1): -# system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3") system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3") else: -# system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1") system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") - + else: + if (debug_mode == 1): + system("echo 'hi hi de " + callsign + " C" + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3") + else: + system("echo 'hi hi de " + callsign + " C" + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") + + output(txLed, txLedOff) sleep(1) From ab08e868873c55ccab620d5b83f8c2076a5d8210 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 31 May 2025 16:25:56 -0400 Subject: [PATCH 484/515] Update install copy updates into install --- install | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/install b/install index 7294539d..374a68e5 100755 --- a/install +++ b/install @@ -56,7 +56,7 @@ sudo dpkg -i debian-template/wiringpi-2.61-1.deb cd #changed to python3-smbus -sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev libopenjp2-7 libtiff5 python3-pil python3-serial +sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev libopenjp2-7 libtiff5 python3-pil python3-serial libusb-1.0 sudo pip3 install --upgrade setuptools @@ -95,13 +95,35 @@ git clone https://github.com/alanbjohnston/pi-power-button.git cd pi-power-button -git checkout master +git checkout 7-modes ./script/install +cd +echo "Installing SSDV for FunCube mode" +git clone https://github.com/alanbjohnston/ssdv.git # install ssdv for FunCube images +cd ssdv +make cd +echo "Installing fctelem binary v0.2 for FunCube mode" +mkdir /home/pi/fctelem +mkdir /home/pi/fctelem/public_html +cd fctelem +wget https://github.com/alanbjohnston/go/releases/download/v0.2/fctelem.zip +unzip fctelem.zip + +cd +echo "Installing fcdctl to set FunCubeDongle Pro gain" +# sudo rm /var/lib/dpkg/info/python3-pip.list +# sudo apt install python3-pip --reinstall +# sudo apt-get install -y python3-smbus libusb-1.0 +cd +git clone https://github.com/csete/fcdctl.git +cd fcdctl +make fcdpp + git clone https://github.com/alanbjohnston/PiSSTVpp.git cd PiSSTVpp @@ -143,6 +165,8 @@ sudo cp ~/CubeSatSim/systemd/command.service /etc/systemd/system/command.service sudo systemctl enable command +sudo cp /home/pi/CubeSatSim/asound.conf /etc/asound.conf + sudo cp /boot/config.txt /boot/config.txt.0 sudo cp /boot/cmdline.txt /boot/cmdline.txt.0 From 3717993ae58e9e5180fca195d1b51cfb4497e4cf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 31 May 2025 16:29:15 -0400 Subject: [PATCH 485/515] Update install change version to v2.1 --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 374a68e5..535fad29 100755 --- a/install +++ b/install @@ -1,6 +1,6 @@ #!/bin/bash -echo -e "\ninstallation script for CubeSatSim v2.0\n" +echo -e "\ninstallation script for CubeSatSim v2.1\n" FILE=/home/pi/CubeSatSim/sim.cfg if [ -f "$FILE" ]; then From 1afbb83910ae04332c3b10e5f1ae735e37d04d5b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 31 May 2025 16:31:23 -0400 Subject: [PATCH 486/515] Update telem.c version 2.1 --- telem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telem.c b/telem.c index 7afceef2..1fc534a5 100644 --- a/telem.c +++ b/telem.c @@ -15,7 +15,7 @@ int main(int argc, char *argv[]) { } } - printf("CubeSatSim v2.0 INA219 Voltage and Current Telemetry\n"); + printf("CubeSatSim v2.1 INA219 Voltage and Current Telemetry\n"); map[MINUS_X] = MINUS_Y; map[PLUS_Z] = MINUS_X; map[MINUS_Y] = PLUS_Z; From e28ebc129ade56cfb4d1dfb6ad59839c95eb8ed9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 31 May 2025 16:44:01 -0400 Subject: [PATCH 487/515] Update main.c support just BAT2 present --- main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 7db64594..e3418019 100644 --- a/main.c +++ b/main.c @@ -629,16 +629,24 @@ int main(int argc, char * argv[]) { token = strtok(NULL, space); } } - if (voltage[map[BAT]] == 0.0) - batteryVoltage = 4.5; + if (voltage[map[BAT]] == 0.0) // No BAT Board + if (voltage[map[BAT2]] == 0.0) // No BAT2 Board + batteryVoltage = 4.5; + else: + batteryVoltage = voltage[map[BAT2]]; // only BAT2 Board present + if (sim_mode && !sim_config) { // if Voltage sensor on Battery board is present, exit simulated telemetry mode + sim_mode = FALSE; + fprintf(stderr, "Turning off sim_mode since battery sensor 2 is present\n"); + } + } else { - batteryVoltage = voltage[map[BAT]]; + batteryVoltage = voltage[map[BAT]]; // BAT Board present if (sim_mode && !sim_config) { // if Voltage sensor on Battery board is present, exit simulated telemetry mode sim_mode = FALSE; fprintf(stderr, "Turning off sim_mode since battery sensor is present\n"); } } - batteryCurrent = current[map[BAT]]; + batteryCurrent = current[map[BAT]] + current[map[BAT2]]; // Sum BAT and BAT2 currents } From 240621bddc2582b834b77f18cfebdf6bd07832e9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 09:08:11 -0400 Subject: [PATCH 488/515] Update cubicsdr.sh merged in FIABv4 changes --- groundstation/cubicsdr.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/groundstation/cubicsdr.sh b/groundstation/cubicsdr.sh index 3f4b6b62..55ba8412 100755 --- a/groundstation/cubicsdr.sh +++ b/groundstation/cubicsdr.sh @@ -29,6 +29,8 @@ sudo killall -9 rtl_tcp &>/dev/null sudo killall -9 CubicSDR &>/dev/null +sudo killall -9 sdrpp &>/dev/null + #sudo kill `ps -aux | grep cubicsdr-packet | grep -v grep | awk '{ print $2 }'` &>/dev/null && killall inotifywait &>/dev/null #sudo kill `ps -aux | grep packet | grep -v grep | awk '{ print $2 }'` &>/dev/null && killall inotifywait &>/dev/null From b20583d71f961c0655d7a0f76e505130863b7d00 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 09:09:37 -0400 Subject: [PATCH 489/515] Update fox.sh merged with FIABv4 --- groundstation/fox.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/groundstation/fox.sh b/groundstation/fox.sh index 3c1daf1a..0ca2c1e5 100755 --- a/groundstation/fox.sh +++ b/groundstation/fox.sh @@ -19,6 +19,8 @@ sudo killall -9 java &>/dev/null sudo killall -9 CubicSDR &>/dev/null +sudo killall -9 sdrpp &>/dev/null + sudo killall -9 direwolf &>/dev/null sudo killall -9 aplay &>/dev/null From b4e695b495a7cb2499110fd8f651d8065ce0c0f4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 09:10:50 -0400 Subject: [PATCH 490/515] Update packet.sh merged with FIABv4 --- groundstation/packet.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/groundstation/packet.sh b/groundstation/packet.sh index 87620bdc..133ff021 100755 --- a/groundstation/packet.sh +++ b/groundstation/packet.sh @@ -24,6 +24,8 @@ sudo killall -9 java &>/dev/null sudo killall -9 CubicSDR &>/dev/null +sudo killall -9 sdrpp &>/dev/null + sudo killall -9 zenity &>/dev/null echo @@ -175,7 +177,8 @@ else echo -e "Auto decoding APRS packets on $frequency Hz" - direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0 & + # direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0 & + direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf & fi @@ -186,6 +189,6 @@ echo "$value" > /dev/null set -- $value #rtl_fm -M fm -f 144.39M -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1 -rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1) | aplay -D hw:0,0 -r 48000 -t raw -f S16_LE -c 1 +rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1) | aplay -r 48000 -t raw -f S16_LE -c 1 sleep 5 From d8922fb706ff242af8457ad38cb3feeb6892e9c4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 09:12:24 -0400 Subject: [PATCH 491/515] Update rtl-tcp.sh merged FIABv4 --- groundstation/rtl-tcp.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/groundstation/rtl-tcp.sh b/groundstation/rtl-tcp.sh index c8af8906..84b35f01 100755 --- a/groundstation/rtl-tcp.sh +++ b/groundstation/rtl-tcp.sh @@ -37,6 +37,8 @@ sudo killall -9 rtl_fm &>/dev/null sudo killall -9 CubicSDR &>/dev/null +sudo killall -9 sdrpp &>/dev/null + sudo killall -9 rtl_tcp &>/dev/null sudo killall -9 qsstv &>/dev/null @@ -48,7 +50,7 @@ sudo killall -9 aplay &>/dev/null sudo killall -9 zenity &>/dev/null -sudo /bin/sh -c '/usr/local/bin/rtl_tcp -a $(hostname -I|cut -f1 -d " ")' +sudo /bin/sh -c 'rtl_tcp -a $(hostname -I|cut -f1 -d " ")' sleep 5 From 739582204c3b20fde35433f028895c537faf3a0b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 09:13:40 -0400 Subject: [PATCH 492/515] Update sdr.sh merged FIABv4 --- groundstation/sdr.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/groundstation/sdr.sh b/groundstation/sdr.sh index 0783d9ca..016f4f20 100755 --- a/groundstation/sdr.sh +++ b/groundstation/sdr.sh @@ -34,6 +34,8 @@ sudo killall -9 rtl_tcp &>/dev/null sudo killall -9 CubicSDR &>/dev/null +sudo killall -9 sdrpp &>/dev/null + sudo killall -9 qsstv &>/dev/null sudo killall -9 aplay &>/dev/null From 090081ccc51efe8ad24fddac9e2ec18a9230ada6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 09:14:57 -0400 Subject: [PATCH 493/515] Update sstv_decode_prompt.sh merge FIABv4 --- groundstation/sstv_decode_prompt.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/groundstation/sstv_decode_prompt.sh b/groundstation/sstv_decode_prompt.sh index 76eb611f..ec5ab709 100755 --- a/groundstation/sstv_decode_prompt.sh +++ b/groundstation/sstv_decode_prompt.sh @@ -26,6 +26,8 @@ sudo killall -9 java &>/dev/null sudo killall -9 CubicSDR &>/dev/null +sudo killall -9 sdrpp &>/dev/null + sudo killall -9 zenity &>/dev/null #echo "s" >> .mode @@ -128,7 +130,7 @@ set -- $value #rtl_fm -M fm -f 434.9M -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1 #rtl_fm -M fm -f 434.9M -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1) | aplay -D hw:0,0 -r 48000 -t raw -f S16_LE -c 1 -rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1) | aplay -D hw:0,0 -r 48000 -t raw -f S16_LE -c 1 +rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1) | aplay -r 48000 -t raw -f S16_LE -c 1 sleep 5 From 048a53b668109bf9bd80cf5cc0eae23899f97b7e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 09:16:18 -0400 Subject: [PATCH 494/515] Update direwolf.conf merge FIABv4 --- groundstation/direwolf/direwolf.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/groundstation/direwolf/direwolf.conf b/groundstation/direwolf/direwolf.conf index ce8b6823..e59e356f 100644 --- a/groundstation/direwolf/direwolf.conf +++ b/groundstation/direwolf/direwolf.conf @@ -1 +1,2 @@ -ADEVICE plughw:CARD=Loopback,DEV=1 plughw:CARD=b1,DEV=0 +#ADEVICE plughw:CARD=Loopback,DEV=1 default +ADEVICE plughw:CARD=Loopback,DEV=0 default From bbf93df799b08d7872d9f2631f73ad9d64ba5fbb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 11:09:54 -0400 Subject: [PATCH 495/515] Update loc.sh add venv source python --- groundstation/loc.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/groundstation/loc.sh b/groundstation/loc.sh index 5a1b6881..bdbedc77 100755 --- a/groundstation/loc.sh +++ b/groundstation/loc.sh @@ -5,6 +5,8 @@ sudo killall -9 java &>/dev/null sudo killall -9 gpredict &>/dev/null +source /home/pi/venv/bin/activate + python3 /home/pi/CubeSatSim/groundstation/loc-foxtelem.py #/usr/bin/gpredict From 279d190a8f915480da6602ec70a25d66f9e0615d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 13:55:42 -0400 Subject: [PATCH 496/515] Update direwolf.conf remove output device --- groundstation/direwolf/direwolf.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/groundstation/direwolf/direwolf.conf b/groundstation/direwolf/direwolf.conf index e59e356f..7bf93998 100644 --- a/groundstation/direwolf/direwolf.conf +++ b/groundstation/direwolf/direwolf.conf @@ -1,2 +1 @@ -#ADEVICE plughw:CARD=Loopback,DEV=1 default -ADEVICE plughw:CARD=Loopback,DEV=0 default +ADEVICE plughw:CARD=Loopback,DEV=1 From 2c76ee5db935cea7779c0bf51d9b80d998f576c6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 14:34:42 -0400 Subject: [PATCH 497/515] Update fctelem.sh add FCD check and gain set --- groundstation/fctelem.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index bfcbb5ff..485a08c9 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -50,6 +50,17 @@ sudo killall -9 python3 &>/dev/null #sudo systemctl stop openwebrx + +if [[ $(/home/pi/fcdctl/fcdctl -l | grep "No FCD found") ]]; then + echo "No FunCube Dongle Found!" + echo "Plug in FCD and try running again" + sleep 30 + exit +else + echo "FCD Found! Setting Gain" + /home/pi/fcdctl/fcdctl -g 0 -m 1 -i 0 +fi + # FILE=/home/pi/CubeSatSim/groundstation/public_html FILE=/home/pi/CubeSatSim/fctelem/public_html if [ ! -d "$FILE" ]; then From 4d8e3e389b1dfe25c411098da751b1b4b7ba5363 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 14:37:07 -0400 Subject: [PATCH 498/515] Update fctelem.sh FCD set LNA and Mixer On, gain 0 --- groundstation/fctelem.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 485a08c9..6bd71b1f 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -58,7 +58,8 @@ if [[ $(/home/pi/fcdctl/fcdctl -l | grep "No FCD found") ]]; then exit else echo "FCD Found! Setting Gain" - /home/pi/fcdctl/fcdctl -g 0 -m 1 -i 0 + /home/pi/fcdctl/fcdctl -g 1 -m 1 -i 0 + echo fi # FILE=/home/pi/CubeSatSim/groundstation/public_html From 35fbabbd3e5f38c9a8692ed80997772a576df381 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 15:00:54 -0400 Subject: [PATCH 499/515] Update fctelem.sh read fctelem.cfg --- groundstation/fctelem.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 6bd71b1f..81fd8e77 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -58,7 +58,23 @@ if [[ $(/home/pi/fcdctl/fcdctl -l | grep "No FCD found") ]]; then exit else echo "FCD Found! Setting Gain" - /home/pi/fcdctl/fcdctl -g 1 -m 1 -i 0 + + FILE=/home/pi/fctelem/fctelem.cfg + if [ -f "$FILE" ]; then + +# config_string=$(> FILE + fi + + /home/pi/fcdctl/fcdctl $config_string + + # /home/pi/fcdctl/fcdctl -g 1 -m 1 -i 0 echo fi From d0970d17f670682fcec491927bc3d4fb7c285bc2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 15:08:07 -0400 Subject: [PATCH 500/515] Update fctelem.sh add frequency prompt --- groundstation/fctelem.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 81fd8e77..8f830da0 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -78,6 +78,43 @@ else echo fi + +requency=$(zenity --list 2>/dev/null --width=410 --height=220 --title="FunCube Telem Decoding" --text="Choose the frequency for FunCube decoding:" --column="kHz" --column="Use" 434900 "CubeSatSim" Other "Choose another frequency") + +echo $frequency + +if [ -z "$frequency" ]; then + + echo "No choice made. Exiting." + sleep 3 + exit + +fi + +if [ "$frequency" = "434900" ]; then + +frequency=434900000 +echo "Frequency is" $frequency +echo +echo "If your CubeSatSim is transmitting in SSTV mode (mode 5) you should get images." +echo "Note: if you see and hear an SSTV signal but don't get any images, the CubeSatSim signal might have a frequency offset. Try rebooting the CubeSatSim to fix." + +elif [ "$frequency" = "Other" ]; then + +echo + +echo "Enter the frequency in kiloHertz" + +echo + +read -r frequency + +frequency=$frequency"000" + +fi + + + # FILE=/home/pi/CubeSatSim/groundstation/public_html FILE=/home/pi/CubeSatSim/fctelem/public_html if [ ! -d "$FILE" ]; then From 5384ce0c8b4361805f7eb526d2afb3f3313ca88a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 15:09:26 -0400 Subject: [PATCH 501/515] Update fctelem.sh typo frequency --- groundstation/fctelem.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 8f830da0..ccc92953 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -79,7 +79,7 @@ else fi -requency=$(zenity --list 2>/dev/null --width=410 --height=220 --title="FunCube Telem Decoding" --text="Choose the frequency for FunCube decoding:" --column="kHz" --column="Use" 434900 "CubeSatSim" Other "Choose another frequency") +frequency=$(zenity --list 2>/dev/null --width=410 --height=220 --title="FunCube Telem Decoding" --text="Choose the frequency for FunCube decoding:" --column="kHz" --column="Use" 434900 "CubeSatSim" Other "Choose another frequency") echo $frequency From b42df4392ab3eb963a723a86df65199969eba9c4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 15:16:00 -0400 Subject: [PATCH 502/515] Update fctelem.sh fix menu --- groundstation/fctelem.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index ccc92953..f9f71b81 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -79,7 +79,7 @@ else fi -frequency=$(zenity --list 2>/dev/null --width=410 --height=220 --title="FunCube Telem Decoding" --text="Choose the frequency for FunCube decoding:" --column="kHz" --column="Use" 434900 "CubeSatSim" Other "Choose another frequency") +frequency=$(zenity --list 2>/dev/null --width=410 --height=200 --title="FunCube Telem Decoding" --text="Choose the frequency for FunCube decoding:" --column="kHz" --column="Use" 434900 "CubeSatSim" Other "Choose another frequency") echo $frequency @@ -93,26 +93,28 @@ fi if [ "$frequency" = "434900" ]; then -frequency=434900000 -echo "Frequency is" $frequency -echo -echo "If your CubeSatSim is transmitting in SSTV mode (mode 5) you should get images." -echo "Note: if you see and hear an SSTV signal but don't get any images, the CubeSatSim signal might have a frequency offset. Try rebooting the CubeSatSim to fix." + frequency=434900000 elif [ "$frequency" = "Other" ]; then -echo + echo + + echo "Enter the frequency in kiloHertz" + + echo + + read -r frequency + + frequency=$frequency"000" -echo "Enter the frequency in kiloHertz" +fi +echo "Frequency is" $frequency +echo +echo "If your CubeSatSim is transmitting in FunCube mode (mode 7) you should get some frames after 30 seconds" echo -read -r frequency - -frequency=$frequency"000" - -fi - +sleep 3 # FILE=/home/pi/CubeSatSim/groundstation/public_html From e8c17d4428a1fd64969e54c6c71120acb671c1a8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 15:17:08 -0400 Subject: [PATCH 503/515] Update fctelem.sh fix popup --- groundstation/fctelem.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index f9f71b81..3990e632 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -79,7 +79,7 @@ else fi -frequency=$(zenity --list 2>/dev/null --width=410 --height=200 --title="FunCube Telem Decoding" --text="Choose the frequency for FunCube decoding:" --column="kHz" --column="Use" 434900 "CubeSatSim" Other "Choose another frequency") +frequency=$(zenity --list 2>/dev/null --width=410 --height=180 --title="FunCube Telem Decoding" --text="Choose the frequency for FunCube decoding:" --column="kHz" --column="Use" 434900 "CubeSatSim" Other "Choose another frequency") echo $frequency From 8b3a4d868a6f8cfdc2c8b156a4c12c971444ed41 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 21:39:12 -0400 Subject: [PATCH 504/515] Update fctelem.sh set frequency --- groundstation/fctelem.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index 3990e632..a1abe0a9 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -116,6 +116,7 @@ echo sleep 3 +echo "connectport=64516 connectaddress='localhost' autotuneoffset=100000 outdir='/home/pi/go/app/fctelem/data' frequency=$frequency" > fcdecode.conf # FILE=/home/pi/CubeSatSim/groundstation/public_html FILE=/home/pi/CubeSatSim/fctelem/public_html From 9ee7f27262e6106548f5ae848e6d54f1a4736247 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 21:45:11 -0400 Subject: [PATCH 505/515] Update fctelem.sh add conf path --- groundstation/fctelem.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh index a1abe0a9..fed1aeca 100755 --- a/groundstation/fctelem.sh +++ b/groundstation/fctelem.sh @@ -116,7 +116,7 @@ echo sleep 3 -echo "connectport=64516 connectaddress='localhost' autotuneoffset=100000 outdir='/home/pi/go/app/fctelem/data' frequency=$frequency" > fcdecode.conf +echo "connectport=64516 connectaddress='localhost' autotuneoffset=100000 outdir='/home/pi/go/app/fctelem/data' frequency=$frequency" > /home/pi/fctelem/fcdecode.conf # FILE=/home/pi/CubeSatSim/groundstation/public_html FILE=/home/pi/CubeSatSim/fctelem/public_html From f29ae21d75732b667a8c84ab31802f32ceff1688 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 21:52:30 -0400 Subject: [PATCH 506/515] Update fc_block_decode.py add config string --- groundstation/fc_block_decode.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index decbdddf..4d62950f 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -44,10 +44,14 @@ system_and_print("sudo rm " + image_dir + image) #system_and_print("sudo rm " + html_dir + "*") system_and_print("sudo rm " + html_dir + "images/*") +with open('/home/pi/fctelem/fcdecode.conf', 'r') as config: + config_string = config.read() + print(config_string) + #system_and_print("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") head_string = 'FunCube CubeSatSim Telemetry\n\n

FunCube CubeSatSim Telemetry

' + \ - '

  
All images
' + config_string + '

  
All images
' foot_string = '' telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ From 083ec0899c1915eb37abe6b6b89eab0c760e1ae5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 21:55:47 -0400 Subject: [PATCH 507/515] Update fc_block_decode.py change to fctelem.conf --- groundstation/fc_block_decode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 4d62950f..22930798 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -44,7 +44,7 @@ system_and_print("sudo rm " + image_dir + image) #system_and_print("sudo rm " + html_dir + "*") system_and_print("sudo rm " + html_dir + "images/*") -with open('/home/pi/fctelem/fcdecode.conf', 'r') as config: +with open('/home/pi/fctelem/fctelem.conf', 'r') as config: config_string = config.read() print(config_string) From e9a0d8c93bba25968fac8fef57ccddc9b99b58d6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 21:59:45 -0400 Subject: [PATCH 508/515] Update fc_block_decode.py .cfg --- groundstation/fc_block_decode.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 22930798..4745d2a4 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -44,9 +44,12 @@ system_and_print("sudo rm " + image_dir + image) #system_and_print("sudo rm " + html_dir + "*") system_and_print("sudo rm " + html_dir + "images/*") -with open('/home/pi/fctelem/fctelem.conf', 'r') as config: +try: +with open('/home/pi/fctelem/fctelem.cfg', 'r') as config: config_string = config.read() print(config_string) +catch: + print("Error loading fctelem.cfg") #system_and_print("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") From 6527a3797020bcf61795cbfff6a555024f546e7f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 22:03:31 -0400 Subject: [PATCH 509/515] Update fc_block_decode.py fixed tabs --- groundstation/fc_block_decode.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 4745d2a4..16487ccd 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -45,11 +45,11 @@ system_and_print("sudo rm " + image_dir + image) system_and_print("sudo rm " + html_dir + "images/*") try: -with open('/home/pi/fctelem/fctelem.cfg', 'r') as config: - config_string = config.read() - print(config_string) -catch: - print("Error loading fctelem.cfg") + with open('/home/pi/fctelem/fctelem.cfg', 'r') as config: + config_string = config.read() + print(config_string) +except: + print("Error loading fctelem.cfg") #system_and_print("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") From 8bc46b205c9b87835336ccba676b4b760411feb5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 8 Jun 2025 22:05:52 -0400 Subject: [PATCH 510/515] Update fc_block_decode.py add fcdctl display --- groundstation/fc_block_decode.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 16487ccd..b9fd7f6d 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -54,7 +54,8 @@ except: #system_and_print("cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg " + html_dir + "image_file.jpeg") head_string = 'FunCube CubeSatSim Telemetry\n\n

FunCube CubeSatSim Telemetry

' + \ - config_string + '

  
All images
' + 'fcdctl ' + config_string + '

  
All images
' foot_string = '' telem_string_format = " Image: {image_id:3d} count: {image_count:2d}

" + \ " Vx(mV): {Vx:5d} Vy(mV): {Vy:5d} Vz(mV): {Vz:5d}

" + \ From 0dadbc9ae57ab23dbb2ef7c0201d60b10539fbed Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 9 Jun 2025 09:54:44 -0400 Subject: [PATCH 511/515] Update main.c missing { --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index e3418019..677610ab 100644 --- a/main.c +++ b/main.c @@ -632,7 +632,7 @@ int main(int argc, char * argv[]) { if (voltage[map[BAT]] == 0.0) // No BAT Board if (voltage[map[BAT2]] == 0.0) // No BAT2 Board batteryVoltage = 4.5; - else: + else { batteryVoltage = voltage[map[BAT2]]; // only BAT2 Board present if (sim_mode && !sim_config) { // if Voltage sensor on Battery board is present, exit simulated telemetry mode sim_mode = FALSE; From 34c7db6a49a870494e63965465ae1a48af6ad057 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 9 Jun 2025 10:14:11 -0400 Subject: [PATCH 512/515] Update main.c print thresholds --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 677610ab..fcf8e600 100644 --- a/main.c +++ b/main.c @@ -823,9 +823,9 @@ int main(int argc, char * argv[]) { fclose(cpuTempSensor); } - #ifdef DEBUG_LOGGING -// fprintf(stderr, "INFO: Battery voltage: %5.2f V Threshold %5.2f V Current: %6.1f mA Threshold: %6.1f mA\n", batteryVoltage, voltageThreshold, batteryCurrent, currentThreshold); - #endif +// #ifdef DEBUG_LOGGING + fprintf(stderr, "INFO: Battery voltage: %5.2f V Threshold %5.2f V Current: %6.1f mA Threshold: %6.1f mA\n", batteryVoltage, voltageThreshold, batteryCurrent, currentThreshold); +// #endif if ((batteryCurrent > currentThreshold) && (batteryVoltage < (voltageThreshold + 0.15)) && !sim_mode && !hab_mode) { From 29b823f5ee643473673eabe931c953dd56b9c086 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 9 Jun 2025 11:22:20 -0400 Subject: [PATCH 513/515] Update main.c change battery_saver_mode variable --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index fcf8e600..7ef1b269 100644 --- a/main.c +++ b/main.c @@ -2270,7 +2270,8 @@ if (setting == ON) { FILE *command = popen("touch /home/pi/CubeSatSim/battery_saver", "r"); pclose(command); fprintf(stderr,"Turning Safe Mode ON\n"); - fprintf(stderr,"Turning Battery saver mode ON\n"); + fprintf(stderr,"Turning Battery saver mode ON\n"); + battery_saver_mode = ON; if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r"); pclose(command); @@ -2287,6 +2288,7 @@ if (setting == ON) { FILE *command = popen("rm /home/pi/CubeSatSim/battery_saver", "r"); pclose(command); fprintf(stderr,"Turning Battery saver mode OFF\n"); + battery_saver_mode = OFF; if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r"); pclose(command); From c38c3e6dcf895bcd30f8381060d294dfdd37b651 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 9 Jun 2025 11:42:37 -0400 Subject: [PATCH 514/515] Update transmit.py don't turn off C2C if squelch is 8 --- transmit.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/transmit.py b/transmit.py index 51a39434..907f8fcc 100644 --- a/transmit.py +++ b/transmit.py @@ -316,11 +316,11 @@ if __name__ == "__main__": print # print(callsign) print(sq) - if sq == '8': - print("squelch set to 8, no command input!") - no_command = True - else: - no_command = False +# if sq == '8': +# print("squelch set to 8, no command input!") +# no_command = True +# else: + no_command = False print(no_command) except: callsign = "AMSAT" From e5b7b12341962deef62d11bdf73a04ee8e8d8727 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 9 Jun 2025 13:25:52 -0400 Subject: [PATCH 515/515] Update transmit.py extra space before C --- transmit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transmit.py b/transmit.py index 907f8fcc..778a525c 100644 --- a/transmit.py +++ b/transmit.py @@ -406,9 +406,9 @@ if __name__ == "__main__": system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") else: if (debug_mode == 1): - system("echo 'hi hi de " + callsign + " C" + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3") + system("echo 'hi hi de " + callsign + " C" + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3") else: - system("echo 'hi hi de " + callsign + " C" + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") + system("echo 'hi hi de " + callsign + " C" + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") output(txLed, txLedOff)