Ejemplo n.º 1
0
int main()
{
	rcc_clock_enable();
	delay_config();
	usart6_init(115200);
	
	STM_EVAL_LEDInit(LED3);
	STM_EVAL_LEDInit(LED4);
	STM_EVAL_LEDInit(LED5);
	STM_EVAL_LEDInit(LED6);
	
	//android远程控制初始化
	remote_control_init();
	//红外测距模块ADC初始化
	adc_tim_trig_config(500, 8400);
	//电机初始化
	motor_init();
	//光电开关初始化
	light_senser_init();
	//编码器初始化
	capture_config();
	//系统运行时间初始化
	micros_time_init();
#ifndef DEBUG_HAHA
//	//等待开始信号
//	usart_wait_signal();
//	//发送应答信号
//	usart_send_signal();
	while(remote_flag == 0);
	if(car_mode == MODE_SINGLE){
		usart_sendByte(USART6, '1');
	}
	else{
		usart_sendByte(USART6, '0');
	}
	//设置小车前进速度
	car_set_global_speed();
#endif
	STM_EVAL_LEDOn(LED3);
	while(1){
#ifdef DEBUG_HAHA
		my_debug();
#else
		control_process();
#endif
	}
}
Ejemplo n.º 2
0
const char *
mfn_kill(MFUNARGS)
{
    int i = atoi(argv[0]);
    if (i > 0) {
	if (in_timequeue(i)) {
	    if (!control_process(perms, i)) {
		ABORT_MPI("KILL",NOPERM_MESG);
	    }
	    i = dequeue_process(i);
	} else {
	    i = 0;
	}
    } else if (i == 0) {
	i = dequeue_prog(perms, 0);
    } else {
	ABORT_MPI("KILL","Invalid process ID");
    }
    sprintf(buf, "%d", i);
    return buf;
}
Ejemplo n.º 3
0
void 
prim_kill(PRIM_PROTOTYPE)
{
    /* i -- i */
    CHECKOP(1);
    oper1 = POP();
    if (oper1->type != PROG_INTEGER)
	abort_interp("Non-integer argument (1)");
    if (oper1->data.number == fr->pid) {
	do_abort_silent();
    } else {
	if (mlev < LMAGE) {
	    if (!control_process(ProgUID, oper1->data.number)) {
		abort_interp(tp_noperm_mesg);
            }
        }
        result = dequeue_process(oper1->data.number);
    }
    CLEAR(oper1);
    PushInt(result);
}
Ejemplo n.º 4
0
int cgiMain() {
	int result;
#ifdef DEBUG
	fprintf(stderr, "========== LED.CGI Start ===========.\n");
#endif
	// 初始化 session
	session_start(g_session_datadir);

	do {
		if (session_get("USERNAME") != NULL) {
			if (strcmp(session_get("USERNAME"), g_login_username) == 0) {
				result = control_process();
				break;
			}
		}
		result = login_process();
	} while (0);

#ifdef DEBUG
	fprintf(cgiOut, "========== LED.CGI End ===========.\n");
#endif

	return result;
}
Ejemplo n.º 5
0
void
do_dequeue(int descr, dbref player, const char *arg1)
{
	char buf[BUFFER_LEN];
	int count;
	dbref match;
	struct match_data md;
	timequeue tmp, ptr = tqhead;


	if (*arg1 == '\0') {
		notify_nolisten(player, "What event do you want to dequeue?", 1);
	} else {
		if (!string_compare(arg1, "all")) {
			if (!Wizard(OWNER(player))) {
				notify_nolisten(player, "Permission denied", 1);
				return;
			}
			while (ptr) {
				tmp = ptr;
				tqhead = ptr = ptr->next;
				free_timenode(tmp);
				process_count--;
			}
			tqhead = NULL;
			muf_event_dequeue(NOTHING, 0);
			notify_nolisten(player, "Time queue cleared.", 1);
		} else {
			if (!number(arg1)) {
				init_match(descr, player, arg1, NOTYPE, &md);
				match_absolute(&md);
				match_everything(&md);

				match = noisy_match_result(&md);
				if (match == NOTHING) {
					notify_nolisten(player, "I don't know what you want to dequeue!", 1);
					return;
				}
				if (!valid_objref(match)) {
					notify_nolisten(player, "I don't recognize that object.", 1);
					return;
				}
				if ((!Wizard(OWNER(player))) && (OWNER(match) != OWNER(player))) {
					notify_nolisten(player, "Permission denied.", 1);
					return;
				}
				count = dequeue_prog(match, 0);
				if (!count) {
					notify_nolisten(player, "That program wasn't in the time queue.", 1);
					return;
				}
				if (count > 1) {
					snprintf(buf, sizeof(buf), "%d processes dequeued.", count);
				} else {
					snprintf(buf, sizeof(buf), "Process dequeued.");
				}
				notify_nolisten(player, buf, 1);
			} else {
				if ((count = atoi(arg1))) {
					if (!(control_process(player, count))) {
						notify_nolisten(player, "Permission denied.", 1);
						return;
					}
					if (!(dequeue_process(count))) {
						notify_nolisten(player, "No such process!", 1);
						return;
					}
					process_count--;
					notify_nolisten(player, "Process dequeued.", 1);
				} else {
					notify_nolisten(player, "What process do you want to dequeue?", 1);
				}
			}
		}
	}
	return;
}