fprintf(stderr,"Battery is being charged - switch battery saver off\n");
if(battery_saver_mode==ON)
battery_saver(OFF);
if(battery_saver_mode==ON){
battery_saver(OFF);
fprintf(stderr,"Safe Mode off!\n");
SafeMode=0;
}
}
if((batteryCurrent>currentThreshold)&&(batteryVoltage<voltageThreshold)&&!sim_mode&&!hab_mode)// currentThreshold ensures that this won't happen when running on DC power.
{
@ -1267,18 +1276,18 @@ void get_tlm(void) {
// printf("Str str: %s \n", str);
// fflush(stdout);
strcat(str, cw_footer3);
// strcat(str, cw_footer3);
// printf("Str: %s \n", str);
// fflush(stdout);
printf("CW string to execute: %s\n", str);
fflush(stdout);
// printf("CW string to execute:: %s\n", str);
// fflush(stdout);
FILE*cw_file=popen(str,"r");
pclose(cw_file);
// FILE * cw_file = popen(cwready, "r");
// FILE * cw_file = popen(str, "r");
// pclose(cw_file);
FILE*cw_file=popen(cwready,"r");
pclose(cw_file);
while((cw_file=fopen("/home/pi/CubeSatSim/cwready","r"))!=NULL){// wait for rpitx to be done
fclose(cw_file);
// printf("Sleeping while waiting for rpitx \n");
@ -1328,7 +1337,7 @@ void get_tlm(void) {
*/
strcat(str,footer_str1);
// strcat(str, call);
if(battery_saver_mode==ON)
if(battery_saver_mode==ON)
strcat(str,footer_str);// add extra packet for rpitx transmission
else
strcat(str,footer_str2);
@ -2416,11 +2425,12 @@ if ((uart_fd = serialOpen("/dev/ttyAMA0", 9600)) >= 0) { // was 9600