summaryrefslogtreecommitdiff
path: root/apps/plugins/test_grey.c
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2010-06-16 09:12:46 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2010-06-16 09:12:46 +0000
commit23b9df2890480e2a6e20f13f041f8f8bc2a2ccef (patch)
tree05b11edf01b3f73ff971971d0a8ec027e77c1606 /apps/plugins/test_grey.c
parent0d48448500129669c35f3316d86a98a41c0c8452 (diff)
downloadrockbox-23b9df2890480e2a6e20f13f041f8f8bc2a2ccef.tar.gz
rockbox-23b9df2890480e2a6e20f13f041f8f8bc2a2ccef.zip
Add interpolation so output file contains lcdlinear[] matrix dump
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26869 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/test_grey.c')
-rw-r--r--apps/plugins/test_grey.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/apps/plugins/test_grey.c b/apps/plugins/test_grey.c
index be28bedfb3..31f63100aa 100644
--- a/apps/plugins/test_grey.c
+++ b/apps/plugins/test_grey.c
@@ -85,7 +85,7 @@ PLUGIN_HEADER
85 85
86#elif CONFIG_KEYPAD == MPIO_HD200_PAD 86#elif CONFIG_KEYPAD == MPIO_HD200_PAD
87#define GREY_QUIT (BUTTON_REC|BUTTON_PLAY) 87#define GREY_QUIT (BUTTON_REC|BUTTON_PLAY)
88#define GREY_OK BUTTON_SELECT 88#define GREY_OK BUTTON_PLAY
89#define GREY_PREV BUTTON_PREV 89#define GREY_PREV BUTTON_PREV
90#define GREY_NEXT BUTTON_NEXT 90#define GREY_NEXT BUTTON_NEXT
91#define GREY_UP BUTTON_VOL_UP 91#define GREY_UP BUTTON_VOL_UP
@@ -158,7 +158,7 @@ enum plugin_status plugin_start(const void* parameter)
158{ 158{
159 bool done = false; 159 bool done = false;
160 int cur_step = 1; 160 int cur_step = 1;
161 int button, i, l, fd; 161 int button, i, j, l, fd;
162 unsigned char filename[MAX_PATH]; 162 unsigned char filename[MAX_PATH];
163 163
164 /* standard stuff */ 164 /* standard stuff */
@@ -182,6 +182,8 @@ enum plugin_status plugin_start(const void* parameter)
182 grey_clear_display(); 182 grey_clear_display();
183 grey_show(true); 183 grey_show(true);
184 184
185 rb->lcd_setfont(FONT_SYSFIXED);
186
185 while (!done) 187 while (!done)
186 { 188 {
187 fill_rastered(-3, -3, 2, 2, cur_step - 1); 189 fill_rastered(-3, -3, 2, 2, cur_step - 1);
@@ -235,14 +237,29 @@ enum plugin_status plugin_start(const void* parameter)
235 break; 237 break;
236 238
237 case GREY_OK: 239 case GREY_OK:
240
241 /* dump result in form suitable for lcdlinear[] */
238 rb->create_numbered_filename(filename, "/", "test_grey_", 242 rb->create_numbered_filename(filename, "/", "test_grey_",
239 ".txt", 2 IF_CNFN_NUM_(, NULL)); 243 ".txt", 2 IF_CNFN_NUM_(, NULL));
240 fd = rb->open(filename, O_RDWR|O_CREAT|O_TRUNC, 0666); 244 fd = rb->open(filename, O_RDWR|O_CREAT|O_TRUNC, 0666);
241 if (fd >= 0) 245 if (fd >= 0)
242 { 246 {
247 rb->fdprintf(fd, "Adjusted grey shades\n");
243 for (i = 0; i <= STEPS; i++) 248 for (i = 0; i <= STEPS; i++)
244 rb->fdprintf(fd, "%3d: %3d\n", input_levels[i], 249 rb->fdprintf(fd, "%3d: %3d\n", input_levels[i],
245 lcd_levels[i]); 250 lcd_levels[i]);
251 rb->fdprintf(fd,"\n\nInterpolated lcdlinear matrix\n");
252
253 for (i = 1; i <= STEPS; i++)
254 {
255 for (j=0; j < STEPS; j++)
256 {
257 rb->fdprintf(fd, "%3d, ",
258 lcd_levels[i-1] +
259 ((lcd_levels[i] - lcd_levels[i-1])*j)/STEPS);
260 }
261 rb->fdprintf(fd, "\n");
262 }
246 rb->close(fd); 263 rb->close(fd);
247 } 264 }
248 /* fall through */ 265 /* fall through */