Ejemplo n.º 1
0
float getPositionMine(int group){
	if(dyPid[group].inputChannel==DYPID_NON_USED||
			((pidGroups[group].Enabled == FALSE) && (vel[group].enabled==FALSE)))
		return 0;

	LONG pos = 0;
	//print_I("\nGetting PID value from group: ");p_int_I(chan->channel);print_I(" of mode: ");printMode(chan->inputMode);print_I(" From channel: ");p_int_I(chan->inputChannel);print_I("\n");
	switch(dyPid[group].inputMode){
	case IS_COUNTER_INPUT_INT:
	case IS_COUNTER_INPUT_DIR:
	case IS_COUNTER_INPUT_HOME:
		pos=GetCounterByChannel( dyPid[group].inputChannel );
		break;
	case IS_ANALOG_IN:
		pos=GetValFromAsync(dyPid[group].inputChannel);
		break;
	case IS_DI:
		pos = GetDigitalValFromAsync(dyPid[group].inputChannel);
		break;
	}
	return ((float)pos);
}
Ejemplo n.º 2
0
float getPositionMine(int group){
	if(dyPid[group].inputChannel==DYPID_NON_USED || !pidGroups[group].config.Enabled)
		return 0;

	int32_t pos = 0;

	switch(dyPid[group].inputMode){
	case IS_COUNTER_INPUT_INT:
	case IS_COUNTER_INPUT_DIR:
	case IS_COUNTER_INPUT_HOME:
		pos=GetCounterByChannel( dyPid[group].inputChannel );
		break;
	case IS_ANALOG_IN:
		pos=GetValFromAsync(dyPid[group].inputChannel);
		break;
	case IS_DI:
		pos = GetDigitalValFromAsync(dyPid[group].inputChannel);
		break;
            default:
                return 0;
	}
	//println_W("Get PID ");p_int_W(group);print_W(" is ");p_int_W(pos);
	return ((float)pos);
}