add telem file write

sr-frs-aprs-payload
alanbjohnston 3 years ago committed by GitHub
parent 2c2411e6f9
commit 6da665d387
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,7 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
FILE *telem_file;
#include "main.h"
@ -120,6 +121,14 @@ int main(int argc, char * argv[]) {
}
}
// Open telemetry file with STEM Payload Data
telem_file = fopen("/home/pi/CubeSatSim/telem.txt", "a");
if (telem_file == NULL)
printf("Error opening telem file\n");
fclose(telem_file);
printf("Opened telem file\n");
// Open configuration file with callsign and reset count
FILE * config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r");
if (config_file == NULL) {
@ -1079,6 +1088,20 @@ void get_tlm(void) {
} else { // APRS using rpitx
if (payload == ON) {
telem_file = fopen("/home/pi/CubeSatSim/telem.txt", "a");
printf("Writing payload string\n");
time_t timeStamp;
time(&timeStamp); // get timestamp
// printf("Timestamp: %s\n", ctime(&timeStamp));
char timeStampNoNl[31];
snprintf(timeStampNoNl, 30, "%.24s", ctime(&timeStamp));
printf("TimeStamp: %s\n", timeStampNoNl);
fprintf(telem_file, "%s %s\n", timeStampNoNl, sensor_payload); // write telemetry string to telem.txt file
fclose(telem_file);
}
strcat(str, footer_str1);
// strcat(str, call);
strcat(str, footer_str);

Loading…
Cancel
Save

Powered by TurnKey Linux.