summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/lang/english.lang5
-rw-r--r--apps/main.c2
-rw-r--r--apps/recorder/recording.c3
-rw-r--r--apps/settings.c10
-rw-r--r--apps/settings.h2
-rw-r--r--apps/settings_menu.c9
6 files changed, 26 insertions, 5 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index c1541cf947..f272bea888 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -1376,3 +1376,8 @@ id: LANG_RECORDING_SIZE
1376desc: Display of recorded file size 1376desc: Display of recorded file size
1377eng: "Size:" 1377eng: "Size:"
1378new: 1378new:
1379
1380id: LANG_CPU_SLEEP
1381desc: in system_settings_menu()
1382eng: "Power Saving"
1383new:
diff --git a/apps/main.c b/apps/main.c
index 614a7fcf14..e33e2bd5a5 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -103,12 +103,12 @@ void init(void)
103 font_init(); 103 font_init();
104 show_logo(); 104 show_logo();
105 105
106 set_irq_level(0);
106#ifdef DEBUG 107#ifdef DEBUG
107 debug_init(); 108 debug_init();
108#else 109#else
109 serial_setup(); 110 serial_setup();
110#endif 111#endif
111 set_irq_level(0);
112 112
113 i2c_init(); 113 i2c_init();
114 114
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 8fb31d8edf..5196735af3 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -180,8 +180,7 @@ bool recording_screen(void)
180 180
181 while(!done) 181 while(!done)
182 { 182 {
183 yield(); 183 button = button_get_w_tmo(HZ / peak_meter_fps);
184 button = button_get(false);
185 switch(button) 184 switch(button)
186 { 185 {
187 case BUTTON_OFF: 186 case BUTTON_OFF:
diff --git a/apps/settings.c b/apps/settings.c
index bc78e823dd..c7ab9e411c 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -21,6 +21,7 @@
21#include <stdio.h> 21#include <stdio.h>
22#include "config.h" 22#include "config.h"
23#include "kernel.h" 23#include "kernel.h"
24#include "thread.h"
24#include "settings.h" 25#include "settings.h"
25#include "disk.h" 26#include "disk.h"
26#include "panic.h" 27#include "panic.h"
@@ -102,7 +103,7 @@ offset abs
1020x23 0x37 <rec. left gain (bit 0-3)> 1030x23 0x37 <rec. left gain (bit 0-3)>
1030x24 0x38 <rec. right gain (bit 0-3)> 1040x24 0x38 <rec. right gain (bit 0-3)>
1040x25 0x39 <disk poweroff flag (bit 0), MP3 buffer margin (bit 1-3), 1050x25 0x39 <disk poweroff flag (bit 0), MP3 buffer margin (bit 1-3),
105 Trickle charge flag (bit 4)> 106 Trickle charge flag (bit 4), CPU sleep flag (bit 5)>
1060x26 0x40 <runtime low byte> 1070x26 0x40 <runtime low byte>
1070x27 0x41 <runtime high byte> 1080x27 0x41 <runtime high byte>
1080x28 0x42 <topruntime low byte> 1090x28 0x42 <topruntime low byte>
@@ -350,7 +351,8 @@ int settings_save( void )
350 config_block[0x25] = (unsigned char) 351 config_block[0x25] = (unsigned char)
351 ((global_settings.disk_poweroff & 1) | 352 ((global_settings.disk_poweroff & 1) |
352 ((global_settings.buffer_margin & 7) << 1) | 353 ((global_settings.buffer_margin & 7) << 1) |
353 ((global_settings.trickle_charge & 1) << 4)); 354 ((global_settings.trickle_charge & 1) << 4) |
355 ((global_settings.cpu_sleep & 1) << 5));
354 356
355 { 357 {
356 static long lasttime = 0; 358 static long lasttime = 0;
@@ -513,6 +515,8 @@ void settings_apply(void)
513 global_settings.lang_file); 515 global_settings.lang_file);
514 lang_load(buf); 516 lang_load(buf);
515 } 517 }
518
519 cpu_sleep(global_settings.cpu_sleep);
516} 520}
517 521
518/* 522/*
@@ -636,6 +640,7 @@ void settings_load(void)
636 global_settings.disk_poweroff = config_block[0x25] & 1; 640 global_settings.disk_poweroff = config_block[0x25] & 1;
637 global_settings.buffer_margin = (config_block[0x25] >> 1) & 7; 641 global_settings.buffer_margin = (config_block[0x25] >> 1) & 7;
638 global_settings.trickle_charge = (config_block[0x25] >> 4) & 1; 642 global_settings.trickle_charge = (config_block[0x25] >> 4) & 1;
643 global_settings.cpu_sleep = (config_block[0x25] >> 5) & 1;
639 } 644 }
640 645
641 if (config_block[0x27] != 0xff) 646 if (config_block[0x27] != 0xff)
@@ -881,6 +886,7 @@ void settings_reset(void) {
881 global_settings.lang_file[0] = 0; 886 global_settings.lang_file[0] = 0;
882 global_settings.runtime = 0; 887 global_settings.runtime = 0;
883 global_settings.topruntime = 0; 888 global_settings.topruntime = 0;
889 global_settings.cpu_sleep = true;
884} 890}
885 891
886 892
diff --git a/apps/settings.h b/apps/settings.h
index be41ef8ec9..529797ced3 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -147,6 +147,8 @@ struct user_settings
147 int bidir_limit; /* bidir scroll length limit */ 147 int bidir_limit; /* bidir scroll length limit */
148 int scroll_delay; /* delay (in 1/10s) before starting scroll */ 148 int scroll_delay; /* delay (in 1/10s) before starting scroll */
149 int scroll_step; /* pixels to advance per update */ 149 int scroll_step; /* pixels to advance per update */
150
151 bool cpu_sleep; /* Use sleep instruction when idle? */
150}; 152};
151 153
152/* prototypes */ 154/* prototypes */
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index baffb81926..37b2b094a7 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -27,6 +27,7 @@
27#include "mpeg.h" 27#include "mpeg.h"
28#include "button.h" 28#include "button.h"
29#include "kernel.h" 29#include "kernel.h"
30#include "thread.h"
30#include "sprintf.h" 31#include "sprintf.h"
31#include "settings.h" 32#include "settings.h"
32#include "settings_menu.h" 33#include "settings_menu.h"
@@ -539,6 +540,13 @@ static bool poweroff(void)
539} 540}
540#endif 541#endif
541 542
543static bool cpu_sleep_set(void)
544{
545 bool result = set_bool(str(LANG_CPU_SLEEP), &global_settings.cpu_sleep);
546 cpu_sleep(global_settings.cpu_sleep);
547 return result;
548}
549
542static bool buffer_margin(void) 550static bool buffer_margin(void)
543{ 551{
544 return set_int(str(LANG_MP3BUFFER_MARGIN), "s", 552 return set_int(str(LANG_MP3BUFFER_MARGIN), "s",
@@ -731,6 +739,7 @@ static bool system_settings_menu(void)
731#ifdef HAVE_ATA_POWER_OFF 739#ifdef HAVE_ATA_POWER_OFF
732 { str(LANG_POWEROFF), poweroff }, 740 { str(LANG_POWEROFF), poweroff },
733#endif 741#endif
742 { str(LANG_CPU_SLEEP), cpu_sleep_set },
734#ifndef SIMULATOR 743#ifndef SIMULATOR
735 { str(LANG_BATTERY_CAPACITY), battery_capacity }, 744 { str(LANG_BATTERY_CAPACITY), battery_capacity },
736#endif 745#endif