Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update main.c added echo broadcast to wall for shutdown and reboots #322

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,11 @@ int main(int argc, char * argv[]) {
fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage);
digitalWrite(txLed, txLedOff);
digitalWrite(onLed, onLedOff);


FILE * file6;
file6 = popen("echo 'shutdown due to low battery voltage!' | wall", "r");
pclose(file6);

sleep(1);
digitalWrite(onLed, onLedOn);
sleep(1);
Expand All @@ -810,7 +814,6 @@ int main(int argc, char * argv[]) {
sleep(1);
digitalWrite(onLed, onLedOff);

FILE * file6; // = popen("/home/pi/CubeSatSim/log > shutdown_log.txt", "r");
file6 = popen("sudo shutdown -h now > /dev/null 2>&1", "r");
pclose(file6);
sleep(10);
Expand Down Expand Up @@ -2140,6 +2143,8 @@ if (setting == ON) {
fprintf(stderr,"Turning Safe Mode ON\n");
fprintf(stderr,"Turning Battery saver mode ON\n");
if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) {
command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r");
pclose(command)
command = popen("sudo reboot now", "r");
pclose(command);
sleep(60);
Expand All @@ -2154,6 +2159,8 @@ if (setting == ON) {
pclose(command);
fprintf(stderr,"Turning Battery saver mode OFF\n");
if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) {
command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r");
pclose(command)
command = popen("sudo reboot now", "r");
pclose(command);
sleep(60);
Expand Down