static void console_task( void* unused ) { console_init(); int dirty = 0; TASK_LOOP { // show the console only when there are no Canon dialogs on the screen if (console_visible && (display_idle() || is_pure_play_photo_or_movie_mode())) { if (dirty) console_draw(0); dirty = 1; } else if (dirty) { canon_gui_enable_front_buffer(1); dirty = 0; } else if (console_visible && !gui_menu_shown()) console_draw(1); if (!gui_menu_shown() && strlen(console_status_text)) { console_show_status(); } msleep(200); } }
/** * SET: show/hide console (while running, or 10 seconds after finished) * */ static unsigned int script_keypress_cbr(unsigned int key) { if (gui_menu_shown()) return 1; if (script_state == SCRIPT_RUNNING) { //~ if (handle_picoc_lib_keys(event)==0) return 0; } //~ extern int console_visible; if (script_state != SCRIPT_IDLE) // toggle show/hide { if (key == MODULE_KEY_PRESS_SET && display_idle()) { console_toggle(); return 0; } } /* if (script_state == SCRIPT_JUST_FINISHED) // after script finished, hide the console on first key press { if (key == MODULE_KEY_UNPRESS_SET) { return 0; } if (console_visible) { console_hide(); return 1; } }*/ return 1; }
/******************************************************************************* * Hlavni funkce *******************************************************************************/ int main(void) { unsigned int cnt = 0; last_ch = 0; last_opto = 0; isrunning = 0; OPTO_dir_in(); initialize_hardware(); keyboard_init(); set_led_d6(1); // rozsviceni D6 set_led_d5(1); // rozsviceni D5 //term_send_crlf(); //term_send_str(" >"); /* nastaveni casovace na periodu 10 ms */ CCTL0 = CCIE; // enable interrupt CCR0 = 0x80; TACTL = TASSEL_1 + MC_2; stopwatch_reset(); while (1) { delay_ms(1); cnt++; if (cnt >= 500) cnt = 0; if (cnt == 0) { cnt = 0; flip_led_d6(); // negace portu na ktere je LED } if (cnt % 10 == 1) { keyboard_idle(); // obsluha klavesnice terminal_idle(); // obsluha terminalu } if (cnt % 100 == 2) { display_idle(); } opto_idle(); } //CCTL0 &= ~CCIE; // disable interrupt }
/** * SET: show/hide console (while running, or 10 seconds after finished) * */ int handle_picoc_keys(struct event * event) { if (IS_FAKE(event)) return 1; // only process real buttons, not emulated presses if (gui_menu_shown()) return 1; if (script_state == SCRIPT_RUNNING) { //~ if (handle_picoc_lib_keys(event)==0) return 0; } extern int console_visible; if (script_state != SCRIPT_IDLE) // toggle show/hide { if (event->param == BGMT_PRESS_SET && display_idle()) { console_toggle(); return 0; } } if (script_state == SCRIPT_JUST_FINISHED) // after script finished, hide the console on first key press { if (event->param == BGMT_UNPRESS_SET) { return 0; } if (console_visible && event->param != GMT_OLC_INFO_CHANGED && #ifdef GMT_GUICMD_PRESS_BUTTON_SOMETHING event->param != GMT_GUICMD_PRESS_BUTTON_SOMETHING && #endif 1) { console_hide(); return 1; } } return 1; }