diff options
-rw-r--r-- | apps/settings.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/apps/settings.c b/apps/settings.c index 9d0a9f62b3..5a532bf95e 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -126,7 +126,7 @@ modified unless the header & checksum test fails. | |||
126 | 126 | ||
127 | Rest of config block, only saved to disk: | 127 | Rest of config block, only saved to disk: |
128 | 128 | ||
129 | 0xB1 (int) battery capacity | 129 | 0xB4 battery capacity |
130 | 0xB5 scroll step in pixels | 130 | 0xB5 scroll step in pixels |
131 | 0xB6 scroll start and endpoint delay | 131 | 0xB6 scroll start and endpoint delay |
132 | 0xB7 bidir scroll setting (bidi if 0-200% longer than screen width) | 132 | 0xB7 bidir scroll setting (bidi if 0-200% longer than screen width) |
@@ -369,7 +369,7 @@ int settings_save( void ) | |||
369 | config_block[0x29]=(unsigned char)(global_settings.topruntime >> 8); | 369 | config_block[0x29]=(unsigned char)(global_settings.topruntime >> 8); |
370 | } | 370 | } |
371 | 371 | ||
372 | memcpy(&config_block[0xb1], &global_settings.battery_capacity, 4); | 372 | config_block[0xb4]=(global_settings.battery_capacity - 1000) / 50; |
373 | config_block[0xb5]=(unsigned char)global_settings.scroll_step; | 373 | config_block[0xb5]=(unsigned char)global_settings.scroll_step; |
374 | config_block[0xb6]=(unsigned char)global_settings.scroll_delay; | 374 | config_block[0xb6]=(unsigned char)global_settings.scroll_delay; |
375 | config_block[0xb7]=(unsigned char)global_settings.bidir_limit; | 375 | config_block[0xb7]=(unsigned char)global_settings.bidir_limit; |
@@ -652,7 +652,7 @@ void settings_load(void) | |||
652 | global_settings.topruntime = | 652 | global_settings.topruntime = |
653 | config_block[0x28] | (config_block[0x29] << 8); | 653 | config_block[0x28] | (config_block[0x29] << 8); |
654 | 654 | ||
655 | memcpy(&global_settings.battery_capacity, &config_block[0xb1], 4); | 655 | global_settings.battery_capacity = config_block[0xb4]*50 + 1000; |
656 | 656 | ||
657 | if (config_block[0xb5] != 0xff) | 657 | if (config_block[0xb5] != 0xff) |
658 | global_settings.scroll_step = config_block[0xb5]; | 658 | global_settings.scroll_step = config_block[0xb5]; |
@@ -959,8 +959,6 @@ bool set_int(char* string, | |||
959 | case BUTTON_RIGHT | BUTTON_REPEAT: | 959 | case BUTTON_RIGHT | BUTTON_REPEAT: |
960 | #endif | 960 | #endif |
961 | *variable += step; | 961 | *variable += step; |
962 | if(*variable > max ) | ||
963 | *variable = max; | ||
964 | break; | 962 | break; |
965 | 963 | ||
966 | #ifdef HAVE_RECORDER_KEYPAD | 964 | #ifdef HAVE_RECORDER_KEYPAD |
@@ -971,8 +969,6 @@ bool set_int(char* string, | |||
971 | case BUTTON_LEFT | BUTTON_REPEAT: | 969 | case BUTTON_LEFT | BUTTON_REPEAT: |
972 | #endif | 970 | #endif |
973 | *variable -= step; | 971 | *variable -= step; |
974 | if(*variable < min ) | ||
975 | *variable = min; | ||
976 | break; | 972 | break; |
977 | 973 | ||
978 | #ifdef HAVE_RECORDER_KEYPAD | 974 | #ifdef HAVE_RECORDER_KEYPAD |
@@ -987,7 +983,14 @@ bool set_int(char* string, | |||
987 | case SYS_USB_CONNECTED: | 983 | case SYS_USB_CONNECTED: |
988 | usb_screen(); | 984 | usb_screen(); |
989 | return true; | 985 | return true; |
986 | |||
990 | } | 987 | } |
988 | if(*variable > max ) | ||
989 | *variable = max; | ||
990 | |||
991 | if(*variable < min ) | ||
992 | *variable = min; | ||
993 | |||
991 | if ( function && button != BUTTON_NONE) | 994 | if ( function && button != BUTTON_NONE) |
992 | function(*variable); | 995 | function(*variable); |
993 | } | 996 | } |