diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/lcd-remote-2bit-vi.c | 62 |
1 files changed, 3 insertions, 59 deletions
diff --git a/firmware/drivers/lcd-remote-2bit-vi.c b/firmware/drivers/lcd-remote-2bit-vi.c index 74e098010e..281cbc2189 100644 --- a/firmware/drivers/lcd-remote-2bit-vi.c +++ b/firmware/drivers/lcd-remote-2bit-vi.c | |||
@@ -73,9 +73,7 @@ static const char scroll_tick_table[16] = { | |||
73 | 73 | ||
74 | /* remote hotplug */ | 74 | /* remote hotplug */ |
75 | #ifndef SIMULATOR | 75 | #ifndef SIMULATOR |
76 | static struct event_queue remote_scroll_queue; | 76 | struct event_queue remote_scroll_queue; |
77 | #define REMOTE_INIT_LCD 1 | ||
78 | #define REMOTE_DEINIT_LCD 2 | ||
79 | #endif | 77 | #endif |
80 | 78 | ||
81 | /*** parameter handling ***/ | 79 | /*** parameter handling ***/ |
@@ -1131,51 +1129,6 @@ void lcd_remote_puts_scroll_style_offset(int x, int y, const unsigned char *stri | |||
1131 | scrolling_lines &= ~(1<<y); | 1129 | scrolling_lines &= ~(1<<y); |
1132 | } | 1130 | } |
1133 | 1131 | ||
1134 | #ifndef SIMULATOR | ||
1135 | /* Monitor remote hotswap */ | ||
1136 | static void remote_tick(void) | ||
1137 | { | ||
1138 | static bool last_status = false; | ||
1139 | static int countdown = 0; | ||
1140 | static int init_delay = 0; | ||
1141 | bool current_status; | ||
1142 | |||
1143 | current_status = remote_detect(); | ||
1144 | |||
1145 | /* Only report when the status has changed */ | ||
1146 | if (current_status != last_status) | ||
1147 | { | ||
1148 | last_status = current_status; | ||
1149 | countdown = current_status ? 20*HZ : 1; | ||
1150 | } | ||
1151 | else | ||
1152 | { | ||
1153 | /* Count down until it gets negative */ | ||
1154 | if (countdown >= 0) | ||
1155 | countdown--; | ||
1156 | |||
1157 | if (current_status) | ||
1158 | { | ||
1159 | if (!(countdown % 8)) | ||
1160 | { | ||
1161 | if (--init_delay <= 0) | ||
1162 | { | ||
1163 | queue_post(&remote_scroll_queue, REMOTE_INIT_LCD, 0); | ||
1164 | init_delay = 6; | ||
1165 | } | ||
1166 | } | ||
1167 | } | ||
1168 | else | ||
1169 | { | ||
1170 | if (countdown == 0) | ||
1171 | { | ||
1172 | queue_post(&remote_scroll_queue, REMOTE_DEINIT_LCD, 0); | ||
1173 | } | ||
1174 | } | ||
1175 | } | ||
1176 | } | ||
1177 | #endif | ||
1178 | |||
1179 | static void scroll_thread(void) | 1132 | static void scroll_thread(void) |
1180 | { | 1133 | { |
1181 | struct font* pf; | 1134 | struct font* pf; |
@@ -1279,23 +1232,14 @@ static void scroll_thread(void) | |||
1279 | } | 1232 | } |
1280 | 1233 | ||
1281 | /* LCD init */ | 1234 | /* LCD init */ |
1282 | #ifdef SIMULATOR | ||
1283 | void lcd_remote_init(void) | ||
1284 | { | ||
1285 | create_thread(scroll_thread, scroll_stack, | ||
1286 | sizeof(scroll_stack), scroll_name IF_PRIO(, PRIORITY_USER_INTERFACE)); | ||
1287 | } | ||
1288 | #else | ||
1289 | void lcd_remote_init(void) | 1235 | void lcd_remote_init(void) |
1290 | { | 1236 | { |
1237 | #ifndef SIMULATOR | ||
1291 | /* Call device specific init */ | 1238 | /* Call device specific init */ |
1292 | lcd_remote_init_device(); | 1239 | lcd_remote_init_device(); |
1293 | |||
1294 | lcd_remote_clear_display(); | ||
1295 | /* private queue */ | 1240 | /* private queue */ |
1296 | queue_init(&remote_scroll_queue, false); | 1241 | queue_init(&remote_scroll_queue, false); |
1297 | tick_add_task(remote_tick); | 1242 | #endif |
1298 | create_thread(scroll_thread, scroll_stack, | 1243 | create_thread(scroll_thread, scroll_stack, |
1299 | sizeof(scroll_stack), scroll_name IF_PRIO(, PRIORITY_USER_INTERFACE)); | 1244 | sizeof(scroll_stack), scroll_name IF_PRIO(, PRIORITY_USER_INTERFACE)); |
1300 | } | 1245 | } |
1301 | #endif | ||