mirror of
https://github.com/FunKey-Project/FunKey-ProdScreens.git
synced 2025-12-12 08:48:51 +01:00
added BRIGHTNESS validation screen
This commit is contained in:
parent
3c3fc40c10
commit
c22119a090
1
Makefile
1
Makefile
@ -3,6 +3,7 @@ S_FILES=funkey_prod_screens.c \
|
||||
prodScreen_failScreen.c \
|
||||
prodScreen_waitBattery.c \
|
||||
prodScreen_displayTest.c \
|
||||
prodScreen_brightnessTest.c \
|
||||
prodScreen_buttonsTest.c \
|
||||
prodScreen_speakerTest.c \
|
||||
prodScreen_ledTest.c \
|
||||
|
||||
@ -19,6 +19,7 @@ static s_prod_test prod_tests[] = {
|
||||
{"FAIL", launch_prod_screen_fail, 0},
|
||||
{"WAIT_BATTERY", launch_prod_screen_waitbattery, 0},
|
||||
{"DISPLAY", launch_prod_screen_display, 0},
|
||||
{"BRIGHTNESS", launch_prod_screen_brightness, 0},
|
||||
{"BUTTONS", launch_prod_screen_buttons, 0},
|
||||
{"SPEAKER", launch_prod_screen_speaker, 0},
|
||||
{"LED", launch_prod_screen_LED, 0},
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#include "prodScreen_failScreen.h"
|
||||
#include "prodScreen_waitBattery.h"
|
||||
#include "prodScreen_displayTest.h"
|
||||
#include "prodScreen_brightnessTest.h"
|
||||
#include "prodScreen_buttonsTest.h"
|
||||
#include "prodScreen_speakerTest.h"
|
||||
#include "prodScreen_ledTest.h"
|
||||
|
||||
110
prodScreen_brightnessTest.c
Normal file
110
prodScreen_brightnessTest.c
Normal file
@ -0,0 +1,110 @@
|
||||
#include "funkey_prod_screens.h"
|
||||
|
||||
|
||||
/// -------------- FUNCTIONS IMPLEMENTATION --------------
|
||||
static int wait_event_loop(){
|
||||
|
||||
SDL_Event event;
|
||||
int stop_menu_loop = 0;
|
||||
int res = EXIT_FAILURE;
|
||||
|
||||
/// -------- Main loop ---------
|
||||
while (!stop_menu_loop)
|
||||
{
|
||||
/// -------- Handle Keyboard Events ---------
|
||||
while (SDL_PollEvent(&event))
|
||||
switch(event.type)
|
||||
{
|
||||
case SDL_QUIT:
|
||||
stop_menu_loop = 1;
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
switch (event.key.keysym.sym)
|
||||
{
|
||||
|
||||
case SDLK_m:
|
||||
stop_menu_loop = 1;
|
||||
res = ERROR_MANUAL_FAIL;
|
||||
break;
|
||||
|
||||
case SDLK_n:
|
||||
case SDLK_ESCAPE:
|
||||
stop_menu_loop = 1;
|
||||
res = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* To inverstigate but with Buildroot, we need this: */
|
||||
SDL_Flip(hw_surface);
|
||||
|
||||
/* Sleep for some time */
|
||||
SDL_Delay(SLEEP_PERIOD_MS);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int launch_prod_screen_brightness(int argc, char *argv[]){
|
||||
SDL_Surface *text_surface = NULL;
|
||||
SDL_Rect text_pos;
|
||||
|
||||
/* Fill screen white */
|
||||
SDL_FillRect(hw_surface, NULL, SDL_MapRGBA(hw_surface->format, bg_color.r, bg_color.g, bg_color.b, 0) );
|
||||
|
||||
/* Write Title */
|
||||
text_surface = TTF_RenderText_Shaded(font_title, "FunKey PCBA Tests", text_color, bg_color);
|
||||
text_pos.x = SCREEN_HORIZONTAL_SIZE/2 - text_surface->w/2;
|
||||
text_pos.y = Y_PADDING;
|
||||
SDL_BlitSurface(text_surface, NULL, hw_surface, &text_pos);
|
||||
SDL_FreeSurface(text_surface);
|
||||
|
||||
/* Write "SPEAKER ok ? */
|
||||
text_surface = TTF_RenderText_Shaded(font_title, "BRIGHTNESS OK ?", text_color, bg_color);
|
||||
text_pos.x = SCREEN_HORIZONTAL_SIZE/2 - text_surface->w/2;
|
||||
text_pos.y = SCREEN_VERTICAL_SIZE/2 - text_surface->h/2;
|
||||
SDL_BlitSurface(text_surface, NULL, hw_surface, &text_pos);
|
||||
SDL_FreeSurface(text_surface);
|
||||
|
||||
/* Write:
|
||||
"Press
|
||||
L=FAIL
|
||||
*/
|
||||
SDL_Color red_color={220,20,20};
|
||||
text_surface = TTF_RenderText_Shaded(font_info, "Press", red_color, bg_color);
|
||||
text_pos.x = X_PADDING;
|
||||
text_pos.y = SCREEN_VERTICAL_SIZE - Y_PADDING - 2*text_surface->h;
|
||||
SDL_BlitSurface(text_surface, NULL, hw_surface, &text_pos);
|
||||
SDL_FreeSurface(text_surface);
|
||||
text_surface = TTF_RenderText_Shaded(font_info, "L=FAIL", red_color, bg_color);
|
||||
text_pos.x = X_PADDING;
|
||||
text_pos.y = SCREEN_VERTICAL_SIZE - Y_PADDING - text_surface->h;
|
||||
SDL_BlitSurface(text_surface, NULL, hw_surface, &text_pos);
|
||||
SDL_FreeSurface(text_surface);
|
||||
|
||||
/* Write:
|
||||
Press
|
||||
R=OK"
|
||||
*/
|
||||
SDL_Color green_color={20,220,20};
|
||||
text_surface = TTF_RenderText_Shaded(font_info, "Press", green_color, bg_color);
|
||||
text_pos.x = SCREEN_HORIZONTAL_SIZE - text_surface->w - X_PADDING;
|
||||
text_pos.y = SCREEN_VERTICAL_SIZE - Y_PADDING - 2*text_surface->h;
|
||||
SDL_BlitSurface(text_surface, NULL, hw_surface, &text_pos);
|
||||
SDL_FreeSurface(text_surface);
|
||||
text_surface = TTF_RenderText_Shaded(font_info, "R=OK", green_color, bg_color);
|
||||
text_pos.x = SCREEN_HORIZONTAL_SIZE - text_surface->w - X_PADDING;
|
||||
text_pos.y = SCREEN_VERTICAL_SIZE - Y_PADDING - text_surface->h;
|
||||
SDL_BlitSurface(text_surface, NULL, hw_surface, &text_pos);
|
||||
SDL_FreeSurface(text_surface);
|
||||
|
||||
/* Render screen */
|
||||
//SDL_Flip(hw_surface);
|
||||
|
||||
///
|
||||
int res = wait_event_loop();
|
||||
return res;
|
||||
}
|
||||
6
prodScreen_brightnessTest.h
Normal file
6
prodScreen_brightnessTest.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef __PROD_SCREEN_BRIGHTNESS__
|
||||
#define __PROD_SCREEN_BRIGHTNESS__
|
||||
|
||||
int launch_prod_screen_brightness(int argc, char *argv[]);
|
||||
|
||||
#endif //__PROD_SCREEN_BRIGHTNESS__
|
||||
Loading…
x
Reference in New Issue
Block a user