From 064c8d8a5ca387505ca2649dfc0eb440d6f8968a Mon Sep 17 00:00:00 2001 From: "bernet.andre@gmail.com" Date: Sat, 13 Apr 2013 08:52:05 +0000 Subject: [PATCH] [taranis] trainer detection and main view icons --- src/taranis/board_taranis.h | 3 ++- src/view_main.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/taranis/board_taranis.h b/src/taranis/board_taranis.h index cb3bb865a..5eeb4e406 100644 --- a/src/taranis/board_taranis.h +++ b/src/taranis/board_taranis.h @@ -84,7 +84,8 @@ uint8_t usbPlugged(void); #define BOOTLOADER_REQUEST() (0) #define usbBootloader() -#define SLAVE_MODE() (0/*pwrCheck() == e_power_trainer*/) +#define SLAVE_MODE() (g_model.trainerMode == 1) +#define TRAINER_CONNECTED() (GPIO_ReadInputDataBit(GPIOTRNDET, PIN_TRNDET) == Bit_RESET) void delaysInit(); diff --git a/src/view_main.cpp b/src/view_main.cpp index dba121155..6de3bf0e7 100644 --- a/src/view_main.cpp +++ b/src/view_main.cpp @@ -263,11 +263,11 @@ void displayTopBar() x -= 12; } - if (SLAVE_MODE()) { + if (TRAINER_CONNECTED() && SLAVE_MODE()) { LCD_NOTIF_ICON(x, ICON_TRAINEE); x -= 12; } - else if (0) { + else if (TRAINER_CONNECTED() && !SLAVE_MODE()) { LCD_NOTIF_ICON(x, ICON_TRAINER); x -= 12; }