예제 #1
0
/// find X MIN endstop
void home_x_negative() {
	#if defined X_MIN_PIN
		TARGET t = startpoint;

		t.X = -1000000;
    if (SEARCH_FAST_X > SEARCH_FEEDRATE_X) // Preprocessor can't check this :-/
      t.F = SEARCH_FAST_X;
    else
      t.F = SEARCH_FEEDRATE_X;
		enqueue_home(&t, 0x1, 1);

    if (SEARCH_FAST_X > SEARCH_FEEDRATE_X) {
			// back off slowly
			t.X = +1000000;
			t.F = SEARCH_FEEDRATE_X;
			enqueue_home(&t, 0x1, 0);
    }

		// set X home
		queue_wait(); // we have to wait here, see G92
		#ifdef X_MIN
			startpoint.X = next_target.target.X = (int32_t)(X_MIN * 1000.0);
		#else
			startpoint.X = next_target.target.X = 0;
		#endif
		dda_new_startpoint();
	#endif
}
예제 #2
0
int main()
{
    Queue* q = queue_new("example", "localhost", 6379, 0, NULL);
    queue_connect(q);
    printf("Current Queue Length: %lld\n", queue_length(q));

    /*
    char *data = calloc(20, sizeof(char));
    strncpy(data, "\"ac\"", 7);
    Task *t = task_new(data, "0");

    Job *j = queue_enqueue(q, t);

    printf("Got job: %s\n", j->urn);

    task_destroy(t);
    job_destroy(j);
    */

    Task* t = queue_wait(q, 0);


    printf("Received: %s URN: %s \n", t->data, t->urn);


    task_destroy(t);    
    queue_destroy(q);
    return 0;
}
예제 #3
0
/// find Z MAX endstop
void home_z_positive() {
	#if defined Z_MAX_PIN && ! defined Z_MAX
		#warning Z_MAX_PIN defined, but not Z_MAX. home_z_positive() disabled.
	#endif
	#if defined Z_MAX_PIN && defined Z_MAX
		TARGET t = startpoint;

		t.Z = +1000000;
    if (SEARCH_FAST_Z > SEARCH_FEEDRATE_Z)
      t.F = SEARCH_FAST_Z;
    else
      t.F = SEARCH_FEEDRATE_Z;
		enqueue_home(&t, 0x4, 1);

    if (SEARCH_FAST_Z > SEARCH_FEEDRATE_Z) {
			t.Z = -1000000;
			t.F = SEARCH_FEEDRATE_Z;
			enqueue_home(&t, 0x4, 0);
    }

		// set Z home
		queue_wait();
		// set position to MAX
		startpoint.Z = next_target.target.Z = (int32_t)(Z_MAX * 1000.);
		dda_new_startpoint();
		// go to zero
		t.Z = 0;
		t.F = MAXIMUM_FEEDRATE_Z;
		enqueue(&t);
	#endif
}
예제 #4
0
/// find Z MIN endstop
void home_z_negative() {
	#if defined Z_MIN_PIN
		TARGET t = startpoint;

		t.Z = -1000000;
    if (SEARCH_FAST_Z > SEARCH_FEEDRATE_Z)
      t.F = SEARCH_FAST_Z;
    else
      t.F = SEARCH_FEEDRATE_Z;
		enqueue_home(&t, 0x4, 1);

    if (SEARCH_FAST_Z > SEARCH_FEEDRATE_Z) {
			t.Z = +1000000;
			t.F = SEARCH_FEEDRATE_Z;
			enqueue_home(&t, 0x4, 0);
    }

		// set Z home
		queue_wait();
		#ifdef Z_MIN
			startpoint.Z = next_target.target.Z = (int32_t)(Z_MIN * 1000.);
		#else
			startpoint.Z = next_target.target.Z = 0;
		#endif
		dda_new_startpoint();
		z_disable();
	#endif
}
예제 #5
0
/// find Y MAX endstop
void home_y_positive() {
	#if defined Y_MAX_PIN && ! defined Y_MAX
		#warning Y_MAX_PIN defined, but not Y_MAX. home_y_positive() disabled.
	#endif
	#if defined Y_MAX_PIN && defined Y_MAX
		TARGET t = startpoint;

		t.Y = +1000000;
    if (SEARCH_FAST_Y > SEARCH_FEEDRATE_Y)
      t.F = SEARCH_FAST_Y;
    else
      t.F = SEARCH_FEEDRATE_Y;
		enqueue_home(&t, 0x2, 1);

    if (SEARCH_FAST_Y > SEARCH_FEEDRATE_Y) {
			t.Y = -1000000;
			t.F = SEARCH_FEEDRATE_Y;
			enqueue_home(&t, 0x2, 0);
    }

		// set Y home
		queue_wait();
		// set position to MAX
		startpoint.Y = next_target.target.Y = (int32_t)(Y_MAX * 1000.);
		dda_new_startpoint();
		// go to zero
		t.Y = 0;
		t.F = MAXIMUM_FEEDRATE_Y;
		enqueue(&t);
	#endif
}
예제 #6
0
static void *waitq_thread(void *arg)
{
    Conn *start = NULL;
    Exec *e = arg;
    for (;;) {
        Conn *c = queue_get(e->waitq);
        if (c->io->stop) {
            start = NULL;
            conn_free(c);
        } else if (sys_iready(c->io, 0)) {
            start = NULL;
            queue_put(e->runq, c);
        } else if (sys_millis() - c->time > KEEP_ALIVE_MS) {
            start = NULL;
            conn_free(c);
        } else {
            if (start == c)                 /* we are in the wait-loop */
                queue_wait(e->waitq, 10);   /* wait for new connections */

            if (start == NULL)
                start = c;

            queue_put(e->waitq, c);
        }
    }

    return NULL;
}
예제 #7
0
/// find X_MAX endstop
void home_x_positive() {
	#if defined X_MAX_PIN && ! defined X_MAX
		#warning X_MAX_PIN defined, but not X_MAX. home_x_positive() disabled.
	#endif
	#if defined X_MAX_PIN && defined X_MAX
		TARGET t = startpoint;

		t.X = +1000000;
		#ifdef SLOW_HOMING
			// hit home soft
			t.F = SEARCH_FEEDRATE_X;
		#else
			// hit home hard
			t.F = MAXIMUM_FEEDRATE_X;
		#endif
		enqueue_home(&t, 0x1, 1);

		#ifndef SLOW_HOMING
			// back off slowly
			t.X = -1000000;
			t.F = SEARCH_FEEDRATE_X;
			enqueue_home(&t, 0x1, 0);
		#endif

		// set X home
		queue_wait();
		// set position to MAX
		startpoint.X = next_target.target.X = (int32_t)(X_MAX * 1000.);
		dda_new_startpoint();
		// go to zero
		t.X = 0;
		t.F = MAXIMUM_FEEDRATE_X;
		enqueue(&t);
	#endif
}
예제 #8
0
파일: home.c 프로젝트: rainbow12/3D_Control
/// find X MIN endstop
void home_x_negative() {

		TARGET t = startpoint;

		t.X = -1000000;

		// hit home hard
		t.F = SEARCH_FEEDRATE_X;

		enqueue_home(&t, 0x1, 1);

		// back off slowly
		t.X = +1000000;
		t.F = SEARCH_FEEDRATE_X;
		enqueue_home(&t, 0x1, 0);


		// set X home
		queue_wait(); // we have to wait here, see G92

		startpoint.X = next_target.target.X = 0;

		dda_new_startpoint();

}
예제 #9
0
/// fund Y MIN endstop
void home_y_negative() {
	#if defined Y_MIN_PIN
		TARGET t = startpoint;

		t.Y = -1000000;
    if (SEARCH_FAST_Y > SEARCH_FEEDRATE_Y)
      t.F = SEARCH_FAST_Y;
    else
      t.F = SEARCH_FEEDRATE_Y;
		enqueue_home(&t, 0x2, 1);

    if (SEARCH_FAST_Y > SEARCH_FEEDRATE_Y) {
			t.Y = +1000000;
			t.F = SEARCH_FEEDRATE_Y;
			enqueue_home(&t, 0x2, 0);
    }

		// set Y home
		queue_wait();
		#ifdef	Y_MIN
			startpoint.Y = next_target.target.Y = (int32_t)(Y_MIN * 1000.);
		#else
			startpoint.Y = next_target.target.Y = 0;
		#endif
		dda_new_startpoint();
	#endif
}
예제 #10
0
/// find X_MAX endstop
void home_x_positive() {
	#if defined X_MAX_PIN && ! defined X_MAX
		#warning X_MAX_PIN defined, but not X_MAX. home_x_positive() disabled.
	#endif
	#if defined X_MAX_PIN && defined X_MAX
		TARGET t = startpoint;

		t.X = +1000000;
    if (SEARCH_FAST_X > SEARCH_FEEDRATE_X)
      t.F = SEARCH_FAST_X;
    else
      t.F = SEARCH_FEEDRATE_X;
		enqueue_home(&t, 0x1, 1);

    if (SEARCH_FAST_X > SEARCH_FEEDRATE_X) {
			t.X = -1000000;
			t.F = SEARCH_FEEDRATE_X;
			enqueue_home(&t, 0x1, 0);
    }

		// set X home
		queue_wait();
		// set position to MAX
		startpoint.X = next_target.target.X = (int32_t)(X_MAX * 1000.);
		dda_new_startpoint();
		// go to zero
		t.X = 0;
		t.F = MAXIMUM_FEEDRATE_X;
		enqueue(&t);
	#endif
}
예제 #11
0
/// fund Y MIN endstop
void home_y_negative() {
	#if defined Y_MIN_PIN
		TARGET t = startpoint;

		t.Y = -1000000;
		#ifdef SLOW_HOMING
			// hit home soft
			t.F = SEARCH_FEEDRATE_Y;
		#else
			// hit home hard
			t.F = MAXIMUM_FEEDRATE_Y;
		#endif
		enqueue_home(&t, 0x2, 1);

		#ifndef SLOW_HOMING
			// back off slowly
			t.Y = +1000000;
			t.F = SEARCH_FEEDRATE_Y;
			enqueue_home(&t, 0x2, 0);
		#endif

		// set Y home
		queue_wait();
		#ifdef	Y_MIN
			startpoint.Y = next_target.target.Y = (int32_t)(Y_MIN * 1000.);
		#else
			startpoint.Y = next_target.target.Y = 0;
		#endif
		dda_new_startpoint();
	#endif
}
예제 #12
0
파일: home.c 프로젝트: rainbow12/3D_Control
/// find Z MIN endstop
void home_z_negative() {
		TARGET t = startpoint;

		t.Z = -1000000;

		// hit home hard
		t.F = SEARCH_FEEDRATE_Z;

		enqueue_home(&t, 0x4, 1);

		// back off slowly
		t.Z = +1000000;
		t.F = SEARCH_FEEDRATE_Z;
		enqueue_home(&t, 0x4, 0);


		// set Z home
		queue_wait();

		startpoint.Z = next_target.target.Z = 0;

		dda_new_startpoint();
		z_disable();

}
예제 #13
0
파일: main.c 프로젝트: zonbrisad/LEF
int main() {
  queue_element qel;
  queue_init(&que);

  init_hw();

  printf_P(PSTR("\n----- EventQueue/Button Tester ver %s -----\n"), VERSION);

  while(1) {
    queue_wait(&que, &qel);

    //printf_P(PSTR("Event received src %d\n"), qel.source);
    switch (qel.source) {
      case EVENT_CMD:       sev_cmd_exec(1);
                            break;
      case EVENT_TIMER0:    printf("Timer 0 event\n"); break;
      case EVENT_TIMER1:    printf("Timer 1 event\n"); break;
      case EVENT_BUT_DOWN:  printf("Button pressed event\n");
                            ARD_LED_TOGGLE();
                            blink = 0;
                            break;
      case EVENT_BUT_UP:    printf("Button released event\n"); break;
      case EVENT_BUT_LONG:  printf("Button hold down event\n");
                            blink = 1;                                // start blinking
                            sev_timer_start_single(&eTimer3, 400);    // start single timeout
                            break;
      case EVENT_1S:        printf_P(PSTR("Software timer 1s\n")); break;
      case EVENT_2S:        printf_P(PSTR("Software timer 2s\n")); break;
      case EVENT_4S:        printf_P(PSTR("Software timer 4s\n"));
                            blink = 0;
                            break;
    }
  }
}
예제 #14
0
/// find Z MIN endstop
void home_z_negative() {
	#if defined Z_MIN_PIN
		TARGET t = startpoint;

		t.Z = -1000000;
		#ifdef SLOW_HOMING
			// hit home soft
			t.F = SEARCH_FEEDRATE_Z;
		#else
			// hit home hard
			t.F = MAXIMUM_FEEDRATE_Z;
		#endif
		enqueue_home(&t, 0x4, 1);

		#ifndef SLOW_HOMING
			// back off slowly
			t.Z = +1000000;
			t.F = SEARCH_FEEDRATE_Z;
			enqueue_home(&t, 0x4, 0);
		#endif

		// set Z home
		queue_wait();
		#ifdef Z_MIN
			startpoint.Z = next_target.target.Z = (int32_t)(Z_MIN * 1000.);
		#else
			startpoint.Z = next_target.target.Z = 0;
		#endif
		dda_new_startpoint();
		z_disable();
	#endif
}
예제 #15
0
static void mpr121_thread(void)
{
    struct queue_event ev;

    while(1)
    {
        queue_wait(&mpr121_queue, &ev);
        /* handle usb connect and ignore all messages except rmi interrupts */
        if(ev.id == SYS_USB_CONNECTED)
        {
            usb_acknowledge(SYS_USB_CONNECTED_ACK);
            continue;
        }
        else if(ev.id != MPR121_INTERRUPT)
            continue;
        /* clear interrupt and get status */
        unsigned status;
        touchpad_btns = 0;
        if(!mpr121_get_touch_status(&status))
        {
            /* ELE3: up
             * ELE4: back
             * ELE5: menu
             * ELE6: down
             * ELE7: play */
            if(status & 0x8) touchpad_btns |= BUTTON_UP;
            if(status & 0x10) touchpad_btns |= BUTTON_BACK;
            if(status & 0x20) touchpad_btns |= BUTTON_MENU;
            if(status & 0x40) touchpad_btns |= BUTTON_DOWN;
            if(status & 0x80) touchpad_btns |= BUTTON_PLAY;
        }
        /* enable interrupt */
        imx233_pinctrl_setup_irq(0, 18, true, true, false, &mpr121_irq_cb, 0);
    }
}
예제 #16
0
/// find X MIN endstop
void home_x_negative() {
	#if defined X_MIN_PIN
		TARGET t = startpoint;

		t.X = -1000000;
		#ifdef SLOW_HOMING
			// hit home soft
			t.F = SEARCH_FEEDRATE_X;
		#else
			// hit home hard
			t.F = MAXIMUM_FEEDRATE_X;
		#endif
		enqueue_home(&t, 0x1, 1);

		#ifndef SLOW_HOMING
			// back off slowly
			t.X = +1000000;
			t.F = SEARCH_FEEDRATE_X;
			enqueue_home(&t, 0x1, 0);
		#endif

		// set X home
		queue_wait(); // we have to wait here, see G92
		#ifdef X_MIN
			startpoint.X = next_target.target.X = (int32_t)(X_MIN * 1000.0);
		#else
			startpoint.X = next_target.target.X = 0;
		#endif
		dda_new_startpoint();
	#endif
}
예제 #17
0
void sim_thread(void)
{
    struct queue_event ev;
    long last_broadcast_tick = current_tick;
    int num_acks_to_expect;
    
    while (1)
    {
        queue_wait(&sim_queue, &ev);
        switch(ev.id)
        {
            case SIM_SCREENDUMP:
                screen_dump();
#ifdef HAVE_REMOTE_LCD
                remote_screen_dump();
#endif
                break;
            case SIM_USB_INSERTED:
            /* from firmware/usb.c: */
                /* Tell all threads that they have to back off the storage.
                   We subtract one for our own thread. Expect an ACK for every
                   listener for each broadcast they received. If it has been too
                   long, the user might have entered a screen that didn't ACK
                   when inserting the cable, such as a debugging screen. In that
                   case, reset the count or else USB would be locked out until
                   rebooting because it most likely won't ever come. Simply
                   resetting to the most recent broadcast count is racy. */
                if(TIME_AFTER(current_tick, last_broadcast_tick + HZ*5))
                {
                    num_acks_to_expect = 0;
                    last_broadcast_tick = current_tick;
                }

                num_acks_to_expect += queue_broadcast(SYS_USB_CONNECTED, 0) - 1;
                DEBUGF("USB inserted. Waiting for %d acks...\n",
                       num_acks_to_expect);
                break;
            case SYS_USB_CONNECTED_ACK:
                if(num_acks_to_expect > 0 && --num_acks_to_expect == 0)
                {
                    DEBUGF("All threads have acknowledged the connect.\n");
                }
                else
                {
                    DEBUGF("usb: got ack, %d to go...\n",
                           num_acks_to_expect);
                }
                break;
            case SIM_USB_EXTRACTED:
                /* in usb.c, this is only done for exclusive storage
                 * do it here anyway but don't depend on the acks */
                queue_broadcast(SYS_USB_DISCONNECTED, 0);
                break;
            default:
                DEBUGF("sim_tasks: unhandled event: %ld\n", ev.id);
                break;
        }
    }
}
void ff_circular_queue_wait_write(struct ff_circular_queue *cq)
{
	queue_lock(cq);

	while (cq->size >= cq->capacity && !cq->abort)
		queue_wait(cq);

	queue_unlock(cq);
}
예제 #19
0
파일: events.c 프로젝트: gitpan/ponie
static void*
event_thread(void *data)
{
    QUEUE* event_q = (QUEUE*) data;
    parrot_event* event;
    QUEUE_ENTRY *entry;
    int running = 1;

    LOCK(event_q->queue_mutex);
    /*
     * we might already have an event in the queue
     */
    if (peek_entry(event_q))
        running = process_events(event_q);
    while (running) {
        entry = peek_entry(event_q);
        if (!entry) {
            /* wait infinite until entry arrives */
            queue_wait(event_q);
        }
        else if (entry->type == QUEUE_ENTRY_TYPE_TIMED_EVENT) {
            /* do a_timedwait for entry */
            struct timespec abs_time;
            FLOATVAL when;
            event = (parrot_event* )entry->data;
            when = event->u.timer_event.abs_time;
            abs_time.tv_sec = (time_t) when;
            abs_time.tv_nsec = (when - abs_time.tv_sec) *
                (1000L*1000L*1000L);
            queue_timedwait(event_q, &abs_time);
        }
        else {
            /* we shouldn't get here probably
             */
            internal_exception(1, "Spurious event");

        }
        /*
         * one or more entries arrived - we hold the mutex again
         * so we have to use the nonsync_pop_entry to pop off event entries
         */
        running = process_events(event_q);
    } /* event loop */
    /*
     * the main interpreter is dying
     * TODO empty the queue
     */
    UNLOCK(event_q->queue_mutex);
    queue_destroy(event_q);
    stop_io_thread();
    edebug((stderr, "event thread stopped\n"));
    return NULL;
}
예제 #20
0
파일: sim_tasks.c 프로젝트: 4nykey/rockbox
void usb_wait_for_disconnect(struct event_queue *q)
{
    struct queue_event ev;

    /* Don't return until we get SYS_USB_DISCONNECTED */
    while(1)
    {
        queue_wait(q, &ev);
        if(ev.id == SYS_USB_DISCONNECTED)
            return;
    }
}
예제 #21
0
void usb_wait_for_disconnect(struct event_queue *q)
{
#ifdef USB_FULL_INIT
    struct queue_event ev;

    /* Don't return until we get SYS_USB_DISCONNECTED */
    while(1)
    {
        queue_wait(q, &ev);
        if(ev.id == SYS_USB_DISCONNECTED)
            return;
    }
#endif /* USB_FULL_INIT */
    (void)q;
}
예제 #22
0
static enum codec_command_action
codec_get_command_callback(intptr_t *param)
{
    yield();

    if (LIKELY(queue_empty(&codec_queue)))
        return CODEC_ACTION_NULL; /* As you were */

    /* Process the message - return requested action and data (if any should
       be expected) */
    while (1)
    {
        enum codec_command_action action = CODEC_ACTION_NULL;
        struct queue_event ev;
        queue_wait(&codec_queue, &ev);

        switch (ev.id)
        {
        case Q_CODEC_RUN:   /* Already running */
            LOGFQUEUE("codec < Q_CODEC_RUN");
            break;

        case Q_CODEC_PAUSE: /* Stay here and wait */
            LOGFQUEUE("codec < Q_CODEC_PAUSE");
            codec_queue_ack(Q_CODEC_PAUSE);
            continue;

        case Q_CODEC_SEEK:  /* Audio wants codec to seek */
            LOGFQUEUE("codec < Q_CODEC_SEEK %ld", ev.data);
            *param = ev.data;
            action = CODEC_ACTION_SEEK_TIME;
            break;

        case Q_CODEC_STOP:  /* Must only return 0 in main loop */
            LOGFQUEUE("codec < Q_CODEC_STOP");
            action = CODEC_ACTION_HALT;
            break;

        default:            /* This is in error in this context. */
            ev.id = Q_NULL;
            logf("codec bad req %ld (%s)", ev.id, __func__);
        }

        codec_queue_ack(ev.id);
        return action;
    }
}
예제 #23
0
/* Codec thread function */
static void NORETURN_ATTR codec_thread(void)
{
    struct queue_event ev;

    while (1)
    {
        cancel_cpu_boost();

        queue_wait(&codec_queue, &ev);

        switch (ev.id)
        {
        case Q_CODEC_LOAD:
            LOGFQUEUE("codec < Q_CODEC_LOAD");
            load_codec((const struct codec_load_info *)ev.data);
            break;

        case Q_CODEC_RUN:
            LOGFQUEUE("codec < Q_CODEC_RUN");
            run_codec();
            break;

        case Q_CODEC_PAUSE:
            LOGFQUEUE("codec < Q_CODEC_PAUSE");
            break;

        case Q_CODEC_SEEK:
            LOGFQUEUE("codec < Q_CODEC_SEEK: %lu", (unsigned long)ev.data);
            seek_codec(ev.data);
            break;

        case Q_CODEC_UNLOAD:
            LOGFQUEUE("codec < Q_CODEC_UNLOAD");
            unload_codec();
            break;

        case Q_CODEC_DO_CALLBACK:
            LOGFQUEUE("codec < Q_CODEC_DO_CALLBACK");
            do_callback((void (*)(void))ev.data);
            break;

        default:
            LOGFQUEUE("codec < default : %ld", ev.id);
        }
    }
}
예제 #24
0
/// find Z MAX endstop
void home_z_positive() {
	queue_wait();

	#if defined Z_MAX_PIN
		uint8_t	denoise_count = 0;

		// home Z
		z_enable();
		// hit home hard
		z_direction(1);
		while (denoise_count < 8) {
			// denoise
			if (z_max())
				denoise_count++;
			else
				denoise_count = 0;
			// step
			z_step();
			delay(5);
			unstep();
			// wait until next step time
			delay((uint32_t) (60.0 * 1000000.0 / STEPS_PER_MM_Z / ((float) MAXIMUM_FEEDRATE_Z)));
		}
		denoise_count = 0;

		// back off slowly
		z_direction(0);
		while (z_max() != 0) {
			// step
			z_step();
			delay(5);
			unstep();
			// wait until next step time
			delay((uint32_t) (60.0 * 1000000.0 / STEPS_PER_MM_Z / ((float) SEARCH_FEEDRATE_Z)));
		}

		// set Z home
		TARGET t = {0, 0, 0, 0, 0};
		// set position to MAX
		startpoint.Z = current_position.Z = (int32_t) (Z_MAX * STEPS_PER_MM_Z);
		// go to zero
		t.F = MAXIMUM_FEEDRATE_Z;
		enqueue(&t);
	#endif
}
예제 #25
0
static void NORETURN_ATTR audio_thread(void)
{
    struct queue_event ev;
    ev.id = Q_NULL; /* something not in switch below */

    pcm_postinit();

    while (1)
    {
        switch (ev.id)
        {
        /* Starts the playback engine branch */
        case Q_AUDIO_PLAY:
            LOGFQUEUE("audio < Q_AUDIO_PLAY");
            audio_playback_handler(&ev);
            continue;

        /* Playback has to handle these, even if not playing */
        case Q_AUDIO_REMAKE_AUDIO_BUFFER:
#ifdef HAVE_DISK_STORAGE
        case Q_AUDIO_UPDATE_WATERMARK:
#endif
            audio_playback_handler(&ev);
            break;

#ifdef AUDIO_HAVE_RECORDING
        /* Starts the recording engine branch */
        case Q_AUDIO_INIT_RECORDING:
            LOGFQUEUE("audio < Q_AUDIO_INIT_RECORDING");
            audio_recording_handler(&ev);
            continue;
#endif

        /* All return upon USB */
        case SYS_USB_CONNECTED:
            LOGFQUEUE("audio < SYS_USB_CONNECTED");
            voice_stop();
            usb_acknowledge(SYS_USB_CONNECTED_ACK);
            usb_wait_for_disconnect(&audio_queue);
            break;
        }

        queue_wait(&audio_queue, &ev);
    }
}
예제 #26
0
/// find Y MAX endstop
void home_y_positive() {
	queue_wait();

	#if defined Y_MAX_PIN
		uint8_t	denoise_count = 0;

		// home Y
		y_enable();
		// hit home hard
		y_direction(1);
		while (denoise_count < 8) {
			// denoise
			if (y_max())
				denoise_count++;
			else
				denoise_count = 0;
			// step
			y_step();
			delay(5);
			unstep();
			// wait until neyt step time
			delay((uint32_t) (60.0 * 1000000.0 / STEPS_PER_MM_Y / ((float) MAXIMUM_FEEDRATE_Y)));
		}
		denoise_count = 0;

		// back off slowly
		y_direction(0);
		while (y_max() != 0) {
			// step
			y_step();
			delay(5);
			unstep();
			// wait until next step time
			delay((uint32_t) (60.0 * 1000000.0 / STEPS_PER_MM_Y / ((float) SEARCH_FEEDRATE_Y)));
		}

		// set Y home
		TARGET t = {0, 0, 0, 0, 0};
		// set position to MAX
		startpoint.Y = current_position.Y = (int32_t) (Y_MAX * STEPS_PER_MM_Y);
		// go to zero
		t.F = MAXIMUM_FEEDRATE_Y;
		enqueue(&t);
	#endif
}
예제 #27
0
/// find X_MAX endstop
void home_x_positive() {
	queue_wait();

	#if defined X_MAX_PIN
		uint8_t	denoise_count = 0;

		// home X
		x_enable();
		// hit home hard
		x_direction(1);
		while (denoise_count < 8) {
			// denoise
			if (x_max())
				denoise_count++;
			else
				denoise_count = 0;
			// step
			x_step();
			delay(5);
			unstep();
			// wait until next step time
			delay((uint32_t) (60.0 * 1000000.0 / STEPS_PER_M_X * 1000.0 / ((float) MAXIMUM_FEEDRATE_X)));
		}
		denoise_count = 0;

		// back off slowly
		x_direction(0);
		while (x_max() != 0) {
			// step
			x_step();
			delay(5);
			unstep();
			// wait until next step time
			delay((uint32_t) (60.0 * 1000000.0 / STEPS_PER_M_X * 1000.0 / ((float) SEARCH_FEEDRATE_X)));
		}

		// set X home
		TARGET t = {0, 0, 0, 0, 0};
		// set position to MAX
		startpoint.X = current_position.X = (int32_t)(X_MAX * 1000.0);
		// go to zero
		t.F = MAXIMUM_FEEDRATE_X;
		enqueue(&t);
	#endif
}
예제 #28
0
void sim_thread(void)
{
    struct queue_event ev;
    
    while (1)
    {
        queue_wait(&sim_queue, &ev);
        switch(ev.id)
        {
            case SIM_SCREENDUMP:
                screen_dump();
#ifdef HAVE_REMOTE_LCD
                remote_screen_dump();
#endif
                break;
        }
    }
}
예제 #29
0
static void codec_seek_complete_callback(void)
{
    logf("seek_complete");

    /* Clear DSP */
    dsp_configure(ci.dsp, DSP_FLUSH, 0);

    /* Post notification to audio thread */
    LOGFQUEUE("audio > Q_AUDIO_CODEC_SEEK_COMPLETE");
    audio_queue_post(Q_AUDIO_CODEC_SEEK_COMPLETE, 0);

    /* Wait for urgent or go message */
    do
    {
        queue_wait(&codec_queue, NULL);
    }
    while (codec_check_queue__have_msg() == 0);
}
예제 #30
0
/// find Z MIN endstop
void home_z_negative() {
	queue_wait();

	#if defined Z_MIN_PIN
		uint8_t	denoise_count = 0;

		// home Z
		z_enable();
		// hit home hard
		z_direction(0);
		while (denoise_count < 8) {
			// denoise
			if (z_min())
				denoise_count++;
			else
				denoise_count = 0;
			// step
			z_step();
			delay(5);
			unstep();
			// wait until next step time
			delay((uint32_t) (60.0 * 1000000.0 / STEPS_PER_MM_Z / ((float) MAXIMUM_FEEDRATE_Z)));
		}
		denoise_count = 0;

		// back off slowly
		z_direction(1);
		while (z_min() != 0) {
			// step
			z_step();
			delay(5);
			unstep();
			// wait until next step time
			delay((uint32_t) (60.0 * 1000000.0 / STEPS_PER_MM_Z / ((float) SEARCH_FEEDRATE_Z)));
		}

		// set Z home
		startpoint.Z = current_position.Z = 0;
		z_disable();
	#endif
}