1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Björn Stenberg
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
25 #include "backlight.h"
32 #include "mp3_playback.h"
41 #include "powermgmt.h"
50 #include "statusbar.h"
51 #include "screen_access.h"
59 #if CONFIG_CODEC == SWCODEC
63 /* only used in set_time screen */
64 #if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
65 static int clamp_value_wrap(int value
, int max
, int min
)
75 #if (CONFIG_STORAGE & STORAGE_MMC)
76 int mmc_remove_request(void)
78 struct queue_event ev
;
81 screens
[i
].clear_display();
82 splash(0, ID2P(LANG_REMOVE_MMC
));
86 queue_wait_w_tmo(&button_queue
, &ev
, HZ
/2);
89 case SYS_HOTSWAP_EXTRACTED
:
90 return SYS_HOTSWAP_EXTRACTED
;
92 case SYS_USB_DISCONNECTED
:
93 return SYS_USB_DISCONNECTED
;
99 /* the charging screen is only used for archos targets */
100 #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) && defined(CPU_SH)
102 #ifdef HAVE_LCD_BITMAP
103 static void charging_display_info(bool animate
)
105 unsigned char charging_logo
[36];
106 const int pox_x
= (LCD_WIDTH
- sizeof(charging_logo
)) / 2;
107 const int pox_y
= 32;
108 static unsigned phase
= 3;
111 #ifdef NEED_ATA_POWER_BATT_MEASURE
112 if (ide_powered()) /* FM and V2 can only measure when ATA power is on */
115 int battv
= battery_voltage();
116 lcd_putsf(0, 7, " Batt: %d.%02dV %d%% ", battv
/ 1000,
117 (battv
% 1000) / 10, battery_level());
120 #ifdef ARCHOS_RECORDER
121 lcd_puts(0, 2, "Charge mode:");
124 if (charge_state
== CHARGING
)
125 s
= str(LANG_BATTERY_CHARGE
);
126 else if (charge_state
== TOPOFF
)
127 s
= str(LANG_BATTERY_TOPOFF_CHARGE
);
128 else if (charge_state
== TRICKLE
)
129 s
= str(LANG_BATTERY_TRICKLE_CHARGE
);
134 if (!charger_enabled())
136 #endif /* ARCHOS_RECORDER */
139 memset(charging_logo
+3, 0x00, 32);
140 charging_logo
[0] = 0x3C;
141 charging_logo
[1] = 0x24;
142 charging_logo
[2] = charging_logo
[35] = 0xFF;
145 { /* draw the outline */
147 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
+ 8,
148 sizeof(charging_logo
), 8);
149 lcd_set_drawmode(DRMODE_FG
);
151 charging_logo
[0] = charging_logo
[1] = 0x00;
152 memset(charging_logo
+2, 0x80, 34);
153 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
, sizeof(charging_logo
), 8);
155 memset(charging_logo
+2, 0x01, 34);
156 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
+ 16,
157 sizeof(charging_logo
), 8);
158 lcd_set_drawmode(DRMODE_SOLID
);
161 { /* animate the middle part */
162 for (i
= 3; i
<MIN(sizeof(charging_logo
)-1, phase
); i
++)
164 if ((i
-phase
) % 8 == 0)
165 { /* draw a "bubble" here */
167 bitpos
= (phase
+ i
/8) % 15; /* "bounce" effect */
169 bitpos
= 14 - bitpos
;
170 charging_logo
[i
] = BIT_N(bitpos
);
173 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
+ 8,
174 sizeof(charging_logo
), 8);
179 #else /* not HAVE_LCD_BITMAP */
181 static unsigned long logo_chars
[4];
182 static const unsigned char logo_pattern
[] = {
183 0x07, 0x04, 0x1c, 0x14, 0x1c, 0x04, 0x07, 0, /* char 1 */
184 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 2 */
185 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 3 */
186 0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1f, 0, /* char 4 */
189 static void logo_lock_patterns(bool on
)
195 for (i
= 0; i
< 4; i
++)
196 logo_chars
[i
] = lcd_get_locked_pattern();
200 for (i
= 0; i
< 4; i
++)
201 lcd_unlock_pattern(logo_chars
[i
]);
205 static void charging_display_info(bool animate
)
209 static unsigned phase
= 3;
212 battv
= battery_voltage();
213 lcd_putsf(4, 1, " %d.%02dV", battv
/ 1000, (battv
% 1000) / 10);
215 memcpy(buf
, logo_pattern
, 32); /* copy logo patterns */
217 if (!animate
) /* build the screen */
219 lcd_double_height(false);
220 lcd_puts(0, 0, "[Charging]");
221 for (i
= 0; i
< 4; i
++)
222 lcd_putc(i
, 1, logo_chars
[i
]);
224 else /* animate the logo */
226 for (i
= 3; i
< MIN(19, phase
); i
++)
228 if ((i
- phase
) % 5 == 0)
229 { /* draw a "bubble" here */
230 ypos
= (phase
+ i
/5) % 9; /* "bounce" effect */
233 buf
[5 - ypos
+ 8 * (i
/5)] |= 0x10u
>> (i
%5);
239 for (i
= 0; i
< 4; i
++)
240 lcd_define_pattern(logo_chars
[i
], buf
+ 8 * i
);
244 #endif /* (not) HAVE_LCD_BITMAP */
246 /* blocks while charging, returns on event:
247 1 if charger cable was removed
248 2 if Off/Stop key was pressed
249 3 if On key was pressed
250 4 if USB was connected */
252 int charging_screen(void)
257 ide_power_enable(false); /* power down the disk, else would be spinning */
260 backlight_set_timeout(global_settings
.backlight_timeout
);
261 #ifdef HAVE_REMOTE_LCD
262 remote_backlight_set_timeout(global_settings
.remote_backlight_timeout
);
264 backlight_set_timeout_plugged(global_settings
.backlight_timeout_plugged
);
266 #ifdef HAVE_LCD_CHARCELLS
267 logo_lock_patterns(true);
269 charging_display_info(false);
273 gui_syncstatusbar_draw(&statusbars
, false);
274 charging_display_info(true);
275 button
= get_action(CONTEXT_STD
,HZ
/3);
276 if (button
== ACTION_STD_OK
)
278 else if (usb_detect() == USB_INSERTED
)
280 else if (!charger_inserted())
284 #ifdef HAVE_LCD_CHARCELLS
285 logo_lock_patterns(false);
289 #endif /* CONFIG_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING && defined(CPU_SH) */
292 void charging_splash(void)
294 splash(2*HZ
, str(LANG_BATTERY_CHARGE
));
295 button_clear_queue();
300 #if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
302 /* little helper function for voice output */
303 static void say_time(int cursorpos
, const struct tm
*tm
)
308 if (!global_settings
.talk_menu
)
326 value
= tm
->tm_year
+ 1900;
333 if (cursorpos
== 4) /* month */
334 talk_id(LANG_MONTH_JANUARY
+ tm
->tm_mon
, false);
336 talk_value(value
, unit
, false);
343 #define SEPARATOR ":"
346 #define IDX_MINUTES 1
347 #define IDX_SECONDS 2
353 #define OFF_MINUTES 3
354 #define OFF_SECONDS 6
358 bool set_time_screen(const char* title
, struct tm
*tm
)
362 unsigned int statusbar_height
= 0;
363 unsigned char offsets_ptr
[] =
364 { OFF_HOURS
, OFF_MINUTES
, OFF_SECONDS
, OFF_YEAR
, 0, OFF_DAY
};
368 offsets_ptr
[IDX_HOURS
] = OFF_SECONDS
;
369 offsets_ptr
[IDX_SECONDS
] = OFF_HOURS
;
370 offsets_ptr
[IDX_YEAR
] = OFF_DAY
;
371 offsets_ptr
[IDX_DAY
] = OFF_YEAR
;
374 if(global_settings
.statusbar
)
375 statusbar_height
= STATUSBAR_HEIGHT
;
377 /* speak selection when screen is entered */
378 say_time(cursorpos
, tm
);
382 unsigned int i
, s
, realyear
, min
, max
;
383 unsigned char *ptr
[6];
384 unsigned char buffer
[20];
386 static unsigned char daysinmonth
[] =
387 {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
389 /* for easy acess in the drawing loop */
390 for (i
= 0; i
< 6; i
++)
391 ptr
[i
] = buffer
+ offsets_ptr
[i
];
392 ptr
[IDX_MONTH
] = str(LANG_MONTH_JANUARY
+ tm
->tm_mon
); /* month name */
394 /* calculate the number of days in febuary */
395 realyear
= tm
->tm_year
+ 1900;
396 if((realyear
% 4 == 0 && !(realyear
% 100 == 0)) || realyear
% 400 == 0)
401 /* fix day if month or year changed */
402 if (tm
->tm_mday
> daysinmonth
[tm
->tm_mon
])
403 tm
->tm_mday
= daysinmonth
[tm
->tm_mon
];
405 /* calculate day of week */
408 /* put all the numbers we want from the tm struct into
409 an easily printable buffer */
410 snprintf(buffer
, sizeof(buffer
),
411 "%02d " "%02d " "%02d " "%04d " "%02d",
412 tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
,
413 tm
->tm_year
+1900, tm
->tm_mday
);
415 /* convert spaces in the buffer to '\0' to make it possible to work
416 directly on the buffer */
417 for(i
=0; i
< sizeof(buffer
); i
++)
426 unsigned int separator_width
, weekday_width
;
427 unsigned int j
, width
, prev_line_height
;
428 struct viewport viewports
[NB_SCREENS
];
429 /* 6 possible cursor possitions, 2 values stored for each: x, y */
430 unsigned int cursor
[6][2];
431 struct viewport
*vp
= &viewports
[s
];
432 struct screen
*screen
= &screens
[s
];
433 static unsigned char rtl_idx
[] =
434 { IDX_SECONDS
, IDX_MINUTES
, IDX_HOURS
, IDX_DAY
, IDX_MONTH
, IDX_YEAR
};
436 viewport_set_defaults(vp
, s
);
437 screen
->set_viewport(vp
);
438 nb_lines
= viewport_get_nb_lines(vp
);
440 /* minimum lines needed is 2 + title line */
443 vp
->font
= FONT_SYSFIXED
;
444 nb_lines
= viewport_get_nb_lines(vp
);
447 /* recalculate the positions and offsets */
449 screen
->getstringsize(title
, NULL
, &prev_line_height
);
451 prev_line_height
= 0;
453 screen
->getstringsize(SEPARATOR
, &separator_width
, NULL
);
456 screen
->getstringsize(str(LANG_WEEKDAY_SUNDAY
+ tm
->tm_wday
),
457 &weekday_width
, NULL
);
458 screen
->getstringsize(" ", &separator_width
, NULL
);
460 for(i
=0, j
=0; i
< 6; i
++)
462 if(i
==3) /* second row */
464 j
= weekday_width
+ separator_width
;
465 prev_line_height
*= 2;
467 screen
->getstringsize(ptr
[i
], &width
, NULL
);
468 cursor
[i
][INDEX_Y
] = prev_line_height
+ statusbar_height
;
469 cursor
[i
][INDEX_X
] = j
;
470 j
+= width
+ separator_width
;
473 /* draw the screen */
474 screen
->set_viewport(vp
);
475 screen
->clear_viewport();
476 /* display the screen title */
477 screen
->puts_scroll(0, 0, title
);
479 /* these are not selectable, so we draw them outside the loop */
480 /* name of the week day */
481 screen
->putsxy(0, cursor
[3][INDEX_Y
],
482 str(LANG_WEEKDAY_SUNDAY
+ tm
->tm_wday
));
484 pos
= lang_is_rtl() ? rtl_idx
[cursorpos
] : cursorpos
;
485 /* draw the selected item with drawmode set to
486 DRMODE_SOLID|DRMODE_INVERSEVID, all other selectable
487 items with drawmode DRMODE_SOLID */
491 vp
->drawmode
= (DRMODE_SOLID
|DRMODE_INVERSEVID
);
493 screen
->putsxy(cursor
[i
][INDEX_X
],
494 cursor
[i
][INDEX_Y
], ptr
[i
]);
496 vp
->drawmode
= DRMODE_SOLID
;
498 screen
->putsxy(cursor
[i
/4 +1][INDEX_X
] - separator_width
,
499 cursor
[0][INDEX_Y
], SEPARATOR
);
502 /* print help text */
504 screen
->puts(0, 4, str(LANG_TIME_SET_BUTTON
));
506 screen
->puts(0, 5, str(LANG_TIME_REVERT
));
507 screen
->update_viewport();
508 screen
->set_viewport(NULL
);
511 /* set the most common numbers */
514 /* calculate the minimum and maximum for the number under cursor */
518 valptr
= &tm
->tm_hour
;
521 valptr
= &tm
->tm_min
;
524 valptr
= &tm
->tm_sec
;
529 valptr
= &tm
->tm_year
;
533 valptr
= &tm
->tm_mon
;
537 max
= daysinmonth
[tm
->tm_mon
];
538 valptr
= &tm
->tm_mday
;
542 #ifdef HAVE_TOUCHSCREEN
543 enum touchscreen_mode old_mode
= touchscreen_get_mode();
545 touchscreen_set_mode(TOUCHSCREEN_BUTTON
);
547 button
= get_action(CONTEXT_SETTINGS_TIME
, TIMEOUT_BLOCK
);
548 #ifdef HAVE_TOUCHSCREEN
549 touchscreen_set_mode(old_mode
);
552 case ACTION_STD_PREV
:
553 cursorpos
= clamp_value_wrap(--cursorpos
, 5, 0);
554 say_time(cursorpos
, tm
);
556 case ACTION_STD_NEXT
:
557 cursorpos
= clamp_value_wrap(++cursorpos
, 5, 0);
558 say_time(cursorpos
, tm
);
560 case ACTION_SETTINGS_INC
:
561 case ACTION_SETTINGS_INCREPEAT
:
562 *valptr
= clamp_value_wrap(++(*valptr
), max
, min
);
563 say_time(cursorpos
, tm
);
565 case ACTION_SETTINGS_DEC
:
566 case ACTION_SETTINGS_DECREPEAT
:
567 *valptr
= clamp_value_wrap(--(*valptr
), max
, min
);
568 say_time(cursorpos
, tm
);
575 case ACTION_STD_CANCEL
:
581 if (default_event_handler(button
) == SYS_USB_CONNECTED
)
588 #endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */
590 #if (CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF)
591 bool shutdown_screen(void)
595 long time_entered
= current_tick
;
599 splash(0, str(LANG_CONFIRM_SHUTDOWN
));
601 while(!done
&& TIME_BEFORE(current_tick
,time_entered
+HZ
*2))
603 button
= get_action(CONTEXT_STD
,HZ
);
606 case ACTION_STD_CANCEL
:
610 /* do nothing here, because ACTION_NONE might be caused
611 * by timeout or button release. In case of timeout the loop
612 * is terminated by TIME_BEFORE */
617 if(default_event_handler(button
) == SYS_USB_CONNECTED
)
627 static const int id3_headers
[]=
632 LANG_ID3_ALBUMARTIST
,
643 #if CONFIG_CODEC == SWCODEC
650 struct id3view_info
{
651 struct mp3entry
* id3
;
653 int info_id
[ARRAYLEN(id3_headers
)];
656 static const char* id3_get_info(int selected_item
, void* data
,
657 char *buffer
, size_t buffer_len
)
659 struct id3view_info
*info
= (struct id3view_info
*)data
;
660 struct mp3entry
* id3
=info
->id3
;
661 int info_no
=selected_item
/2;
662 if(!(selected_item
%2))
664 return(str(id3_headers
[info
->info_id
[info_no
]]));
670 switch(info
->info_id
[info_no
])
672 case 0:/*LANG_ID3_TITLE*/
675 case 1:/*LANG_ID3_ARTIST*/
678 case 2:/*LANG_ID3_ALBUM*/
681 case 3:/*LANG_ID3_ALBUMARTIST*/
682 val
=id3
->albumartist
;
684 case 4:/*LANG_ID3_GROUPING*/
687 case 5:/*LANG_ID3_DISCNUM*/
688 if (id3
->disc_string
)
689 val
= id3
->disc_string
;
690 else if (id3
->discnum
)
692 snprintf(buffer
, buffer_len
, "%d", id3
->discnum
);
696 case 6:/*LANG_ID3_TRACKNUM*/
697 if (id3
->track_string
)
698 val
= id3
->track_string
;
699 else if (id3
->tracknum
)
701 snprintf(buffer
, buffer_len
, "%d", id3
->tracknum
);
705 case 7:/*LANG_ID3_COMMENT*/
708 case 8:/*LANG_ID3_GENRE*/
709 val
= id3
->genre_string
;
711 case 9:/*LANG_ID3_YEAR*/
712 if (id3
->year_string
)
713 val
= id3
->year_string
;
716 snprintf(buffer
, buffer_len
, "%d", id3
->year
);
720 case 10:/*LANG_ID3_LENGTH*/
721 format_time(buffer
, buffer_len
, id3
->length
);
724 case 11:/*LANG_ID3_PLAYLIST*/
725 snprintf(buffer
, buffer_len
, "%d/%d",
726 playlist_get_display_index(), playlist_amount());
729 case 12:/*LANG_ID3_BITRATE*/
730 snprintf(buffer
, buffer_len
, "%d kbps%s", id3
->bitrate
,
731 id3
->vbr
? str(LANG_ID3_VBR
) : (const unsigned char*) "");
734 case 13:/*LANG_ID3_FREQUENCY*/
735 snprintf(buffer
, buffer_len
, "%ld Hz", id3
->frequency
);
738 #if CONFIG_CODEC == SWCODEC
739 case 14:/*LANG_ID3_TRACK_GAIN*/
740 val
=id3
->track_gain_string
;
742 case 15:/*LANG_ID3_ALBUM_GAIN*/
743 val
=id3
->album_gain_string
;
745 case 16:/*LANG_ID3_PATH*/
747 case 14:/*LANG_ID3_PATH*/
752 return val
&& *val
? val
: NULL
;
756 bool browse_id3(void)
758 struct gui_synclist id3_lists
;
759 struct mp3entry
* id3
= audio_current_track();
762 struct id3view_info info
;
765 for (i
= 0; i
< ARRAYLEN(id3_headers
); i
++)
769 if (id3_get_info((i
*2)+1, &info
, temp
, 8) != NULL
)
770 info
.info_id
[info
.count
++] = i
;
773 gui_synclist_init(&id3_lists
, &id3_get_info
, &info
, true, 2, NULL
);
774 gui_synclist_set_nb_items(&id3_lists
, info
.count
*2);
775 gui_synclist_draw(&id3_lists
);
777 key
= get_action(CONTEXT_LIST
,HZ
/2);
778 if(key
!=ACTION_NONE
&& key
!=ACTION_UNKNOWN
779 && !gui_synclist_do_button(&id3_lists
, &key
,LIST_WRAP_UNLESS_HELD
))
781 return(default_event_handler(key
) == SYS_USB_CONNECTED
);
786 static const char* runtime_get_data(int selected_item
, void* data
,
787 char* buffer
, size_t buffer_len
)
791 switch (selected_item
)
793 case 0: return str(LANG_RUNNING_TIME
);
794 case 1: t
= global_status
.runtime
; break;
795 case 2: return str(LANG_TOP_TIME
);
796 case 3: t
= global_status
.topruntime
; break;
801 snprintf(buffer
, buffer_len
, "%dh %dm %ds",
802 t
/ 3600, (t
% 3600) / 60, t
% 60);
806 static int runtime_speak_data(int selected_item
, void* data
)
810 (selected_item
< 2) ? LANG_RUNNING_TIME
: LANG_TOP_TIME
,
811 TALK_ID((selected_item
< 2) ? global_status
.runtime
812 : global_status
.topruntime
, UNIT_TIME
));
817 bool view_runtime(void)
819 static const char *lines
[]={ID2P(LANG_CLEAR_TIME
)};
820 static const struct text_message message
={lines
, 1};
822 struct gui_synclist lists
;
824 gui_synclist_init(&lists
, runtime_get_data
, NULL
, false, 2, NULL
);
825 #if !defined(HAVE_LCD_CHARCELLS)
826 gui_synclist_set_title(&lists
, str(LANG_RUNNING_TIME
), NOICON
);
828 gui_synclist_set_title(&lists
, NULL
, NOICON
);
830 if(global_settings
.talk_menu
)
831 gui_synclist_set_voice_callback(&lists
, runtime_speak_data
);
832 gui_synclist_set_icon_callback(&lists
, NULL
);
833 gui_synclist_set_nb_items(&lists
, 4);
834 gui_synclist_speak_item(&lists
);
838 if (charger_inserted())
840 global_status
.runtime
= 0;
845 global_status
.runtime
+= ((current_tick
- lasttime
) / HZ
);
847 lasttime
= current_tick
;
848 gui_synclist_draw(&lists
);
849 list_do_action(CONTEXT_STD
, HZ
,
850 &lists
, &action
, LIST_WRAP_UNLESS_HELD
);
851 if(action
== ACTION_STD_CANCEL
)
853 if(action
== ACTION_STD_OK
) {
854 if(gui_syncyesno_run(&message
, NULL
, NULL
)==YESNO_YES
)
856 if (!(gui_synclist_get_sel_pos(&lists
)/2))
857 global_status
.runtime
= 0;
859 global_status
.topruntime
= 0;
860 gui_synclist_speak_item(&lists
);
863 if(default_event_handler(action
) == SYS_USB_CONNECTED
)
869 #ifdef HAVE_TOUCHSCREEN
870 static int get_sample(struct touchscreen_calibration
*cal
, int x
, int y
, int i
,
871 struct screen
* screen
)
877 screen
->drawline(x
- 10, y
, x
- 2, y
);
878 screen
->drawline(x
+ 2, y
, x
+ 10, y
);
879 screen
->drawline(x
, y
- 10, x
, y
- 2);
880 screen
->drawline(x
, y
+ 2, x
, y
+ 10);
883 /* Wait for a touchscreen press */
886 action
= get_action(CONTEXT_STD
, TIMEOUT_BLOCK
);
887 if(action
== ACTION_TOUCHSCREEN
)
889 if(action_get_touchscreen_press(&ts_x
, &ts_y
) == BUTTON_REL
)
892 else if(action
== ACTION_STD_CANCEL
)
907 short points
[3][2] = {
908 {LCD_WIDTH
/10, LCD_HEIGHT
/10},
909 {7*LCD_WIDTH
/8, LCD_HEIGHT
/2},
910 {LCD_WIDTH
/2, 7*LCD_HEIGHT
/8}
912 struct screen
* screen
= &screens
[SCREEN_MAIN
];
913 enum touchscreen_mode old_mode
= touchscreen_get_mode();
914 struct touchscreen_calibration cal
;
916 int statusbar
= global_settings
.statusbar
; /* hide the statusbar */
917 global_settings
.statusbar
= STATUSBAR_OFF
;
919 touchscreen_disable_mapping(); /* set raw mode */
920 touchscreen_set_mode(TOUCHSCREEN_POINT
);
923 screen
->clear_display();
925 if(get_sample(&cal
, points
[i
][0], points
[i
][1], i
, screen
))
933 touchscreen_calibrate(&cal
);
935 touchscreen_reset_mapping();
936 memcpy(&global_settings
.ts_calibration_data
, &calibration_parameters
, sizeof(struct touchscreen_parameter
));
937 touchscreen_set_mode(old_mode
);
938 global_settings
.statusbar
= statusbar
;
943 int reset_mapping(void)
945 touchscreen_reset_mapping();
946 memcpy(&global_settings
.ts_calibration_data
, &calibration_parameters
, sizeof(struct touchscreen_parameter
));