Compare commits
3 Commits
86740e1d6b
...
main
Author | SHA1 | Date | |
---|---|---|---|
69f24c63bd
|
|||
54c23fc67b
|
|||
e579ea1dfc
|
@ -326,6 +326,13 @@ will take you to the main menu. The following is a short description of each scr
|
||||
[tzset(3)][13].
|
||||
- `Clear data` - **DELETE ALL DATA** on the device. When the operation is complete,
|
||||
the database will be empty. **NO BACKUP IS MADE** so be careful.
|
||||
|
||||
As a final note on the usage of the "Stats by", "Data points", and "Average
|
||||
range" screens, pressing the up and down buttons to move across different DST
|
||||
stats can cause some weird-looking behavior. If this causes you trouble, simply
|
||||
back out of the stats screen and enter back in from a different start date. As
|
||||
this is the expected behavior of the various sqlite3 and libc date and time
|
||||
functions, it will not be fixed (because it's not broken).
|
||||
|
||||
[11]: https://man.freebsd.org/cgi/man.cgi?query=fstyp&manpath=FreeBSD+14.0-RELEASE+and+Ports
|
||||
[12]: https://man.freebsd.org/cgi/man.cgi?query=tzset&manpath=FreeBSD+14.0-RELEASE+and+Ports
|
||||
|
@ -24,19 +24,25 @@ static bool power_screen_dispatch(PowerScreen *screen,
|
||||
if (state->sel_down) {
|
||||
switch (screen->choice) {
|
||||
case POWER_SCREEN_RESTART_PROGRAM:
|
||||
request_restart();
|
||||
request_exit(true);
|
||||
break;
|
||||
case POWER_SCREEN_REBOOT:
|
||||
LOG_VERBOSE("Rebooting...");
|
||||
reboot(RB_AUTOBOOT);
|
||||
abort();
|
||||
// how did we even get here???
|
||||
if (system("reboot") != 0) {
|
||||
warnx("reboot(8) failed");
|
||||
// just force it if doing it cleanly failed
|
||||
reboot(RB_AUTOBOOT);
|
||||
}
|
||||
request_exit(false);
|
||||
break;
|
||||
case POWER_SCREEN_POWEROFF:
|
||||
LOG_VERBOSE("Powering off...");
|
||||
reboot(RB_POWEROFF);
|
||||
abort();
|
||||
// how did we even get here???
|
||||
if (system("poweroff") != 0) {
|
||||
warnx("poweroff(8) failed");
|
||||
// just force it if doing it cleanly failed
|
||||
reboot(RB_POWEROFF);
|
||||
}
|
||||
request_exit(false);
|
||||
break;
|
||||
default:
|
||||
warnx("invalid power screen choice");
|
||||
@ -44,6 +50,7 @@ static bool power_screen_dispatch(PowerScreen *screen,
|
||||
LCD_DISPLAY_ON);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
screen->choice = (screen->choice + state->up_down - state->down_down) %
|
||||
POWER_SCREEN_NCHOICE;
|
||||
|
@ -476,7 +476,7 @@ static bool set_tz_screen_finish(SetTZScreen *screen,
|
||||
LOG_VERBOSE("Set timezone to: \"%s\"\n", buf);
|
||||
}
|
||||
free(buf);
|
||||
request_restart();
|
||||
request_exit(true);
|
||||
}
|
||||
if (state->up_down || state->back_down ||
|
||||
state->sel_down || state->down_down) {
|
||||
|
@ -535,9 +535,9 @@ bool mkdirs(const char *path, mode_t mode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void request_restart() {
|
||||
void request_exit(bool restart) {
|
||||
RUNNING = false;
|
||||
SHOULD_RESTART = true;
|
||||
SHOULD_RESTART = restart;
|
||||
}
|
||||
|
||||
bool timed_wait(pid_t pid, int *out_status, useconds_t micro) {
|
||||
|
@ -251,10 +251,11 @@ bool export_database_as_csv(sqlite3 *db, const char *dest);
|
||||
bool mkdirs(const char *path, mode_t mode);
|
||||
|
||||
/*
|
||||
* Request that this program re-invoke itself with the same arguments. Used to
|
||||
* re-initialize configuration values.
|
||||
* Request that this program exit. If RESTART request instead that it re-invoke
|
||||
* itself with the same arguments.
|
||||
*/
|
||||
void request_restart(void);
|
||||
void request_exit(bool restart);
|
||||
|
||||
/*
|
||||
* waitpid(2) for PID for MICRO microseconds. If STATUS is not NULL, store the
|
||||
* exit status there. Use the various WIF* macros to test the status. This
|
||||
|
Reference in New Issue
Block a user