Exemplo n.º 1
0
void menu_params_apply_remote_enable(const menuitem_t *item) {
	if(*item->parm.menuitem_enum.value)
		remote_on();
	else
		remote_off();
}
Exemplo n.º 2
0
void start_up() {
	// Check and create our 400PLUS folder
	status.folder_exists = check_create_folder();

	// Recover persisting information
	persist_read();

	// Read settings from file
	settings_read();

	// If configured, start debug mode
	if (settings.debug_on_poweron)
		start_debug_mode();

	// If configured, restore AEB
	if (settings.persist_aeb)
		send_to_intercom(IC_SET_AE_BKT, persist.aeb);

	// Enable IR remote
	// i'm not sure where to call this? perhaps this isn't the right place.
	if (settings.remote_enable)
		remote_on();

	// Enable extended ISOs
	// Enable (hidden) CFn.8 for ISO H
	send_to_intercom(IC_SET_CF_EXTEND_ISO, 1);

	// Enable realtime ISO change
	send_to_intercom(IC_SET_REALTIME_ISO_0, 0);
	send_to_intercom(IC_SET_REALTIME_ISO_1, 0);

	// Set current language
	enqueue_action(lang_pack_init);

	// Read custom modes configuration from file
	enqueue_action(cmodes_read);

	// And optionally apply a custom mode
	enqueue_action(cmode_recall);

    // turn off the blue led after it was lighten by our hack_task_MainCtrl()
	eventproc_EdLedOff();

#ifdef MEMSPY
	debug_log("starting memspy task");
	CreateTask("memspy", 0x1e, 0x1000, memspy_task, 0);
#endif

#if 0
	debug_log("=== DUMPING DDD ===");
	printf_DDD_log( (void*)(int)(0x00007604+0x38) );

	debug_log("maindlg @ 0x%08X, handler @ 0x%08X", hMainDialog, hMainDialog->event_handler);

	debug_log("dumping");
	long *addr   = (long*) 0x7F0000;

	int file = FIO_OpenFile("A:/dump.bin", O_CREAT | O_WRONLY , 644);

	if (file != -1) {
		FIO_WriteFile(file, addr, 0xFFFF);
		FIO_CloseFile(file);
		beep();
	}
#endif
}
Exemplo n.º 3
0
static void remote_thread(void)
{
    int rc_thread_sleep_count = 10;
    int rc_thread_wait_timeout = TIMEOUT_BLOCK;

    while (1)
    {
        semaphore_wait(&rc_thread_wakeup, rc_thread_wait_timeout);

        /* Error handling (most likely due to remote not present) */
        if (rc_status & RC_ERROR_MASK)
        {
            if (--rc_thread_sleep_count == 0)
                rc_status |= RC_POWER_OFF;
        }

        /* Power-off (thread sleeps) */
        if (rc_status & RC_POWER_OFF)
        {
            remote_off();

            rc_thread_sleep_count = 10;
            rc_thread_wait_timeout = TIMEOUT_BLOCK;

            continue;
        }

        /* Detection */
        if (!(rc_status & RC_DETECTED))
        {
            rc_thread_wait_timeout = HZ;

            if (headphones_inserted())
            {
                remote_on();

                if (rc_status & RC_AWAKE)
                {
                    rc_thread_sleep_count = 10;
                    rc_thread_wait_timeout = HZ/20; /* ~50ms for updates */
                }
            }
            else
            {
                if (--rc_thread_sleep_count == 0)
                    rc_status &= ~RC_POWER_OFF;
            }

            continue;
        }

        /* Update the remote (one per wakeup cycle) */
        if (headphones_inserted() && (rc_status & RC_AWAKE))
        {
            if (rc_status & RC_SCREEN_ON)
            {
                /* In order of importance */
                if (rc_status & RC_UPDATE_CONTROLLER)
                {
                    remote_update_controller();
                    rc_status &= ~RC_UPDATE_CONTROLLER;
                }
                else if (rc_status & RC_UPDATE_LCD)
                {
                    remote_update_lcd();
                    rc_status &= ~RC_UPDATE_LCD;
                }
                else
                {
                    remote_nop();
                }
            }
            else
            {
                remote_nop();
            }
        }
    }
}