Skip to content

Commit

Permalink
hide battery errors, save norns state on sleep, stop tape (#451)
Browse files Browse the repository at this point in the history
* hide (harmless) battery errors)
* save state on sleep
* stop tape
  • Loading branch information
tehn authored and antonhornquist committed Jul 5, 2018
1 parent 4e908e3 commit ad41894
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lua/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,8 @@ m.key[pSLEEP] = function(n,z)
--TODO fade out screen then run the shutdown script
m.sleep = true
menu.redraw()
norns.state.save()
if tape.mode == tREC then tape_stop_rec() end
norns.audio.output_level(-100)
gain_hp(0)
--norns.audio.set_audio_level(0)
Expand Down
6 changes: 3 additions & 3 deletions matron/src/hardware/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ void *battery_check(void *x) {
if (read(fd[0], &buf, 4) > 0) {
percent = atoi(buf);
} else {
fprintf(stderr, "failed to read battery percentage\n");
//fprintf(stderr, "failed to read battery percentage\n");
percent = -1;
}

lseek(fd[1], 0, SEEK_SET);
if (read(fd[1], &buf, 1) > 0) {
n = (buf[0] == 'C'); // Charging
} else {
fprintf(stderr, "failed to read battery charging status\n");
//fprintf(stderr, "failed to read battery charging status\n");
n = 0;
}

Expand All @@ -82,7 +82,7 @@ void *battery_check(void *x) {
if (read(fd[2], &buf, 7) > 0) {
n = atoi(buf) / 1000;
} else {
fprintf(stderr, "failed to read battery current\n");
//fprintf(stderr, "failed to read battery current\n");
n = -1;
}

Expand Down

0 comments on commit ad41894

Please sign in to comment.