From ad41894b2b896c7d5e73b75500eb92a80e55849d Mon Sep 17 00:00:00 2001 From: brian crabtree Date: Thu, 5 Jul 2018 14:27:19 -0400 Subject: [PATCH] hide battery errors, save norns state on sleep, stop tape (#451) * hide (harmless) battery errors) * save state on sleep * stop tape --- lua/menu.lua | 2 ++ matron/src/hardware/battery.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/menu.lua b/lua/menu.lua index b84d0c862..add393616 100644 --- a/lua/menu.lua +++ b/lua/menu.lua @@ -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) diff --git a/matron/src/hardware/battery.c b/matron/src/hardware/battery.c index b1bd6c044..6c850ff5b 100644 --- a/matron/src/hardware/battery.c +++ b/matron/src/hardware/battery.c @@ -59,7 +59,7 @@ 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; } @@ -67,7 +67,7 @@ void *battery_check(void *x) { 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; } @@ -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; }