summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/settings.c14
-rw-r--r--apps/settings_menu.c23
2 files changed, 26 insertions, 11 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 5d1ffef4a4..5b2991a8ef 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -785,7 +785,7 @@ void set_option(char* string, int* variable, char* options[],
785 lcd_stop_scroll(); 785 lcd_stop_scroll();
786} 786}
787 787
788#ifdef HAVE_RTC 788#ifdef HAVE_LCD_BITMAP
789#define INDEX_X 0 789#define INDEX_X 0
790#define INDEX_Y 1 790#define INDEX_Y 1
791#define INDEX_WIDTH 2 791#define INDEX_WIDTH 2
@@ -857,14 +857,14 @@ void set_time(char* string, int timedate[])
857 reffub[2] = '\0'; 857 reffub[2] = '\0';
858 lcd_getstringsize(reffub, FONT_UI, &width, &height); 858 lcd_getstringsize(reffub, FONT_UI, &width, &height);
859 cursor[0][INDEX_X] = 0; 859 cursor[0][INDEX_X] = 0;
860 cursor[0][INDEX_Y] = 1 + prev_line_height + 1; 860 cursor[0][INDEX_Y] = prev_line_height;
861 cursor[0][INDEX_WIDTH] = width; 861 cursor[0][INDEX_WIDTH] = width;
862 862
863 strncpy(reffub, buffer + 3, 2); 863 strncpy(reffub, buffer + 3, 2);
864 reffub[2] = '\0'; 864 reffub[2] = '\0';
865 lcd_getstringsize(reffub, FONT_UI, &width, &height); 865 lcd_getstringsize(reffub, FONT_UI, &width, &height);
866 cursor[1][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width; 866 cursor[1][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width;
867 cursor[1][INDEX_Y] = 1 + prev_line_height + 1; 867 cursor[1][INDEX_Y] = prev_line_height;
868 cursor[1][INDEX_WIDTH] = width; 868 cursor[1][INDEX_WIDTH] = width;
869 869
870 strncpy(reffub, buffer + 6, 2); 870 strncpy(reffub, buffer + 6, 2);
@@ -872,7 +872,7 @@ void set_time(char* string, int timedate[])
872 lcd_getstringsize(reffub, FONT_UI, &width, &height); 872 lcd_getstringsize(reffub, FONT_UI, &width, &height);
873 cursor[2][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width + 873 cursor[2][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width +
874 cursor[1][INDEX_WIDTH] + separator_width; 874 cursor[1][INDEX_WIDTH] + separator_width;
875 cursor[2][INDEX_Y] = 1 + prev_line_height + 1; 875 cursor[2][INDEX_Y] = prev_line_height;
876 cursor[2][INDEX_WIDTH] = width; 876 cursor[2][INDEX_WIDTH] = width;
877 877
878 lcd_getstringsize(buffer, FONT_UI, &width, &prev_line_height); 878 lcd_getstringsize(buffer, FONT_UI, &width, &prev_line_height);
@@ -895,7 +895,7 @@ void set_time(char* string, int timedate[])
895 reffub[4] = '\0'; 895 reffub[4] = '\0';
896 lcd_getstringsize(reffub, FONT_UI, &width, &height); 896 lcd_getstringsize(reffub, FONT_UI, &width, &height);
897 cursor[3][INDEX_X] = weekday_width + separator_width; 897 cursor[3][INDEX_X] = weekday_width + separator_width;
898 cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height + 1; 898 cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height;
899 cursor[3][INDEX_WIDTH] = width; 899 cursor[3][INDEX_WIDTH] = width;
900 900
901 strncpy(reffub, buffer + 9, 3); 901 strncpy(reffub, buffer + 9, 3);
@@ -903,7 +903,7 @@ void set_time(char* string, int timedate[])
903 lcd_getstringsize(reffub, FONT_UI, &width, &height); 903 lcd_getstringsize(reffub, FONT_UI, &width, &height);
904 cursor[4][INDEX_X] = weekday_width + separator_width + 904 cursor[4][INDEX_X] = weekday_width + separator_width +
905 cursor[3][INDEX_WIDTH] + separator_width; 905 cursor[3][INDEX_WIDTH] + separator_width;
906 cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height + 1; 906 cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height;
907 cursor[4][INDEX_WIDTH] = width; 907 cursor[4][INDEX_WIDTH] = width;
908 908
909 strncpy(reffub, buffer + 13, 2); 909 strncpy(reffub, buffer + 13, 2);
@@ -912,7 +912,7 @@ void set_time(char* string, int timedate[])
912 cursor[5][INDEX_X] = weekday_width + separator_width + 912 cursor[5][INDEX_X] = weekday_width + separator_width +
913 cursor[3][INDEX_WIDTH] + separator_width + 913 cursor[3][INDEX_WIDTH] + separator_width +
914 cursor[4][INDEX_WIDTH] + separator_width; 914 cursor[4][INDEX_WIDTH] + separator_width;
915 cursor[5][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height + 1; 915 cursor[5][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height;
916 cursor[5][INDEX_WIDTH] = width; 916 cursor[5][INDEX_WIDTH] = width;
917 917
918 lcd_invertrect(cursor[cursorpos][INDEX_X], 918 lcd_invertrect(cursor[cursorpos][INDEX_X],
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 678eda437e..5ad7a1e79c 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -116,12 +116,12 @@ static Menu deep_discharge(void)
116} 116}
117#endif 117#endif
118 118
119#ifdef HAVE_RTC 119#ifdef HAVE_LCD_BITMAP
120static Menu timedate_set(void) 120static Menu timedate_set(void)
121{ 121{
122 int timedate[7]; /* hour,minute,second,year,month,day,dayofweek */ 122 int timedate[7]; /* hour,minute,second,year,month,day,dayofweek */
123 123
124 124#ifdef HAVE_RTC
125 timedate[0] = rtc_read(0x03); /* hour */ 125 timedate[0] = rtc_read(0x03); /* hour */
126 timedate[1] = rtc_read(0x02); /* minute */ 126 timedate[1] = rtc_read(0x02); /* minute */
127 timedate[2] = rtc_read(0x01); /* second */ 127 timedate[2] = rtc_read(0x01); /* second */
@@ -141,10 +141,24 @@ static Menu timedate_set(void)
141 timedate[4] = ((timedate[4] & 0x10) >> 4) * 10 + (timedate[4] & 0x0f); 141 timedate[4] = ((timedate[4] & 0x10) >> 4) * 10 + (timedate[4] & 0x0f);
142 /* day */ 142 /* day */
143 timedate[5] = ((timedate[5] & 0x30) >> 4) * 10 + (timedate[5] & 0x0f); 143 timedate[5] = ((timedate[5] & 0x30) >> 4) * 10 + (timedate[5] & 0x0f);
144 144#else /* SIMULATOR */
145 /* hour */
146 timedate[0] = 0;
147 /* minute */
148 timedate[1] = 0;
149 /* second */
150 timedate[2] = 0;
151 /* year */
152 timedate[3] = 0;
153 /* month */
154 timedate[4] = 1;
155 /* day */
156 timedate[5] = 1;
157#endif
145 158
146 set_time(str(LANG_TIME),timedate); 159 set_time(str(LANG_TIME),timedate);
147 160
161#ifdef HAVE_RTC
148 if(timedate[0] != -1) { 162 if(timedate[0] != -1) {
149 /* hour */ 163 /* hour */
150 timedate[0] = ((timedate[0]/10) << 4 | timedate[0]%10) & 0x3f; 164 timedate[0] = ((timedate[0]/10) << 4 | timedate[0]%10) & 0x3f;
@@ -168,6 +182,7 @@ static Menu timedate_set(void)
168 rtc_write(0x04, timedate[6] | (rtc_read(0x04) & 0xf8)); /* dayofweek */ 182 rtc_write(0x04, timedate[6] | (rtc_read(0x04) & 0xf8)); /* dayofweek */
169 rtc_write(0x00, 0x00); /* 0.1 + 0.01 seconds */ 183 rtc_write(0x00, 0x00); /* 0.1 + 0.01 seconds */
170 } 184 }
185#endif
171 return MENU_OK; 186 return MENU_OK;
172} 187}
173#endif 188#endif
@@ -319,7 +334,7 @@ static Menu system_settings_menu(void)
319#ifdef HAVE_CHARGE_CTRL 334#ifdef HAVE_CHARGE_CTRL
320 { str(LANG_DISCHARGE), deep_discharge }, 335 { str(LANG_DISCHARGE), deep_discharge },
321#endif 336#endif
322#ifdef HAVE_RTC 337#ifdef HAVE_LCD_BITMAP
323 { str(LANG_TIME), timedate_set }, 338 { str(LANG_TIME), timedate_set },
324#endif 339#endif
325 { str(LANG_RESET), reset_settings }, 340 { str(LANG_RESET), reset_settings },