Don't call touchscreen functions when we don't have a touchscreen

Change-Id: Ia8c05f45c289729031d6333445d932bb5ac242ca
This commit is contained in:
Amaury Pouly 2017-09-17 00:27:10 +02:00
parent a486ee4fb8
commit 3d815406f4

View file

@ -1091,7 +1091,9 @@ bool dbg_hw_info_button(void)
int vddio_val = orig_vddio_val; int vddio_val = orig_vddio_val;
int vddio_brownout = orig_vddio_brownout; int vddio_brownout = orig_vddio_brownout;
#endif #endif
#ifdef HAVE_TOUCHSCREEN
touchscreen_set_mode(TOUCHSCREEN_POINT); touchscreen_set_mode(TOUCHSCREEN_POINT);
#endif
while(1) while(1)
{ {
@ -1115,14 +1117,18 @@ bool dbg_hw_info_button(void)
imx233_power_set_regulator(REGULATOR_VDDIO, orig_vddio_val, orig_vddio_brownout); imx233_power_set_regulator(REGULATOR_VDDIO, orig_vddio_val, orig_vddio_brownout);
#endif #endif
lcd_setfont(FONT_UI); lcd_setfont(FONT_UI);
#ifdef HAVE_TOUCHSCREEN
touchscreen_set_mode(TOUCHSCREEN_BUTTON); touchscreen_set_mode(TOUCHSCREEN_BUTTON);
#endif
return true; return true;
case ACT_CANCEL: case ACT_CANCEL:
#if IMX233_SUBTARGET >= 3700 #if IMX233_SUBTARGET >= 3700
imx233_power_set_regulator(REGULATOR_VDDIO, orig_vddio_val, orig_vddio_brownout); imx233_power_set_regulator(REGULATOR_VDDIO, orig_vddio_val, orig_vddio_brownout);
#endif #endif
lcd_setfont(FONT_UI); lcd_setfont(FONT_UI);
#ifdef HAVE_TOUCHSCREEN
touchscreen_set_mode(TOUCHSCREEN_BUTTON); touchscreen_set_mode(TOUCHSCREEN_BUTTON);
#endif
return false; return false;
} }
@ -1483,8 +1489,10 @@ bool dbg_hw_info(void)
int len = ARRAYLEN(debug_screens); int len = ARRAYLEN(debug_screens);
int top_visible = 0; int top_visible = 0;
int highlight = 0; int highlight = 0;
#ifdef HAVE_TOUCHSCREEN
enum touchscreen_mode old_mode = touchscreen_get_mode(); enum touchscreen_mode old_mode = touchscreen_get_mode();
touchscreen_set_mode(TOUCHSCREEN_BUTTON); touchscreen_set_mode(TOUCHSCREEN_BUTTON);
#endif
while(1) while(1)
{ {
int button = my_get_action(HZ / 10); int button = my_get_action(HZ / 10);
@ -1503,7 +1511,9 @@ bool dbg_hw_info(void)
lcd_setfont(FONT_UI); lcd_setfont(FONT_UI);
break; break;
case ACT_CANCEL: case ACT_CANCEL:
#ifdef HAVE_TOUCHSCREEN
touchscreen_set_mode(old_mode); touchscreen_set_mode(old_mode);
#endif
return false; return false;
} }
// adjust top visible if needed // adjust top visible if needed
@ -1534,7 +1544,9 @@ bool dbg_hw_info(void)
lcd_update(); lcd_update();
yield(); yield();
} }
#ifdef HAVE_TOUCHSCREEN
touchscreen_set_mode(old_mode); touchscreen_set_mode(old_mode);
#endif
return false; return false;
} }