Exemple #1
0
void RecoverAPPInfo(void)
{
	UWORD i;
	char str[30];

	DataFlash_Function(Read_DataFlash,Type_APPData);

	if( (Backup_APP_Data.CheckSum==DataCheckSum((UBYTE *)&Backup_APP_Data,sizeof(Backup_APP_Data)))&&(Backup_APP_Data.CheckSum) )
		SaveRecall_APP_Info(0);
	else {
		Backup_APP_Data.Data_Ready = 0;
		for(i=0 ; i<10 ; i++) {
			OptionInfo[i].ModuleFlag	= 0;
			OptionInfo[i].SoftVer		= 0;
			OptionInfo[i].SoftNum		= 0;
			OptionInfo[i].Un_install	= 0;
			OptionInfo[i].PID			= 0;
			OptionInfo[i].VID			= 0;
			OptionInfo[i].SNumber1	= 0;
			OptionInfo[i].SNumber2	= 0;
			OptionInfo[i].MBR_Data	= 0;
		}
		Debug_printf("Loading APP Data default!!\n");
		sprintf(str,"APP_Data_Record=0x%x\n",Backup_APP_Data.CheckSum);
		Debug_printf(str);
		sprintf(str,"APP_Data_Real=0x%x\n",DataCheckSum((UBYTE *)&Backup_APP_Data,sizeof(Backup_APP_Data)) );
		Debug_printf(str);
	}
}
Exemple #2
0
bool App_testEndstops(void )
{
    OS_ERR       err;

    Debug_printf(Debug_Level_1, "Test all endstops\n");

    applicationState = ApplicationState_Test;

    endschalterXPlusTest  = FALSE;
    endschalterXMinusTest = FALSE;
    endschalterYPlusTest  = FALSE;
    endschalterYMinusTest = FALSE;
    endschalterZPlusTest  = FALSE;
    endschalterZMinusTest = FALSE;

    while(!(endschalterXPlusTest && endschalterXMinusTest
            && endschalterYPlusTest && endschalterYMinusTest
            && endschalterZPlusTest && endschalterZMinusTest
            && (applicationState == ApplicationState_Test)
           ))
        OSTimeDlyHMSM(0u, 0u, 0u, 100u, OS_OPT_TIME_HMSM_STRICT, &err);

    applicationState = ApplicationState_Idle;

    Debug_printf(Debug_Level_1, "All endstops successfully tested\n");

    return TRUE;
}
Exemple #3
0
bool App_testButtons(void )
{
    OS_ERR       err;

    Debug_printf(Debug_Level_1, "Press all buttons\n");

    applicationState = ApplicationState_Test;

    buttonXPlusTest  = FALSE;
    buttonXMinusTest = FALSE;
    buttonYPlusTest  = FALSE;
    buttonYMinusTest = FALSE;
    buttonZPlusTest  = FALSE;
    buttonZMinusTest = FALSE;
    buttonOkTest     = FALSE;

    while(!(buttonXPlusTest && buttonXMinusTest
            && buttonYPlusTest && buttonYMinusTest
            && buttonZPlusTest && buttonZMinusTest
            && buttonOkTest && (applicationState == ApplicationState_Test)
           ))
        OSTimeDlyHMSM(0u, 0u, 0u, 100u, OS_OPT_TIME_HMSM_STRICT, &err);

    applicationState = ApplicationState_Idle;

    Debug_printf(Debug_Level_1, "All buttons successfully tested\n");

    return TRUE;
}
Exemple #4
0
void RecoverLastOP(void)
{
	char str[30];

	if(FRAM_READ_MEM((UBYTE *)&FRAM_Data,sizeof(FRAM_Data))==(-1)) {
		Debug_printf("FRAM reading error!!\n");
		FRAM_Data.Data_Ready = 0;
	}
#if 0
	FRAM_Data.CheckSum = 0;
#endif
//Adam_test Don't read FRAM
	if((FRAM_Data.CheckSum==DataCheckSum((UBYTE *)&FRAM_Data,sizeof(FRAM_Data)))&&(FRAM_Data.CheckSum) ) {
		SaveRecall_FRAM_Data(0);

		if(!(SYSType&GPIB_CONNECTED)) {
			GPIBPAR.ONOFF=2;
#if 0 /*When No GPIB Card and PC send *RST,INTERFACE maybe USB-> RS232*/
			if((!RS232.ONOFF)&&(!UTILITY.USB_ONOFF)) {
				RS232.ONOFF = 0x1;
				UTILITY.INTERFACE = INTERFACE_RS232;
			}
#else
			if(UTILITY.INTERFACE == INTERFACE_GPIB) {
				UTILITY.USB_ONOFF = 0x1;
				UTILITY.INTERFACE = INTERFACE_USB;
			}
#endif
		} else {
			if(GPIBPAR.ONOFF==2)
				GPIBPAR.ONOFF = 0;
		}

		UTILITY.LOAD_CTL	= 0;/*for Run Prog*/
		UTILITY.SHORT_CTL= 0;

		EXT_DGIO.TSTATUS=0xff;

		EDGIO_Control(T_SYNC_ENABLE, Switch_OFF);
	} else {
		FRAM_Data.Data_Ready = 0;
		EXT_DGIO.RSTATUS |= 0x1;
		EXT_DGIO.TSTATUS  = 0xff;
		EDGIO_Control(T_SYNC_ENABLE, Switch_OFF);
		Debug_printf("Loading USER SETUP default!!\n");
		sprintf(str,"FRAM_Data_Record=0x%x\n",FRAM_Data.CheckSum);
		Debug_printf(str);
		sprintf(str,"FRAM_Data_Real=0x%x\n",DataCheckSum((UBYTE *)&FRAM_Data,sizeof(FRAM_Data)) );
		Debug_printf(str);
		sprintf(str,"Ftype=%d\n",Ftype);/* 0:FM25L04   1:FM25CL64*/
		Debug_printf(str);
	}
}
Exemple #5
0
void SaveRecall_NSeq_Data(BYTE dire)/* 0: Backup Data Recover to NSeq Data   1: NSeq Data To Backup Data*/
{
	UWORD i,j,k;

	if(dire) {
		Add_System_Info(&P3k_Backup_NSeq_Data.MACHTYPE);
		P3k_Backup_NSeq_Data.NSeq_Enable	= P3k_NSeq_Data.NSeq_Enable;
		P3k_Backup_NSeq_Data.NSeq_Number	= P3k_NSeq_Data.NSeq_Number;
		P3k_Backup_NSeq_Data.NSeq_Start		= P3k_NSeq_Data.NSeq_Start;
		k = 0;

		for(i=0 ; i<10 ; i++) {
			P3k_Backup_NSeq_Data.NSeq_Seq[i] = P3k_NSeq_Data.NSeq_Seq[i];

			if(P3k_NSeq_Data.NSeq_Seq[i].NSeq_Max_Step) {
				for(j=0 ; j<P3k_NSeq_Data.NSeq_Seq[i].NSeq_Max_Step ; j++) {
					if(k>=1024) {
						Debug_printf("SaveRecall_NSeq_Data Error\n");
						return;
					} else
						P3k_Backup_NSeq_Data.NSeq_Step[k++] = P3k_NSeq_Data.NSeq_Step[i][j+1];
				}
			}
		}
		P3k_Backup_NSeq_Data.Data_Ready = 200;
		P3k_Backup_NSeq_Data.CheckSum = DataCheckSum((UBYTE *)&P3k_Backup_NSeq_Data,sizeof(P3k_Backup_NSeq_Data));
	} else {
		if(P3k_Backup_NSeq_Data.Data_Ready==200) {
			P3k_NSeq_Data.NSeq_Enable	= P3k_Backup_NSeq_Data.NSeq_Enable;
			P3k_NSeq_Data.NSeq_Number	= P3k_Backup_NSeq_Data.NSeq_Number;
			P3k_NSeq_Data.NSeq_Start	= P3k_Backup_NSeq_Data.NSeq_Start;
			k = 0;

			for(i=0 ; i<10 ; i++) {
				P3k_NSeq_Data.NSeq_Seq[i] = P3k_Backup_NSeq_Data.NSeq_Seq[i];

				if(P3k_NSeq_Data.NSeq_Seq[i].NSeq_Max_Step) {
					for(j=0 ; j<P3k_NSeq_Data.NSeq_Seq[i].NSeq_Max_Step ; j++) {
						if(k >= 1024) {
							Debug_printf("SaveRecall_NSeq_Data Error\n");
							return;
						} else
							P3k_NSeq_Data.NSeq_Step[i][j+1] = P3k_Backup_NSeq_Data.NSeq_Step[k++];
					}
				}
			}
		}
	}
}
Exemple #6
0
void UART4_IRQHandler(void)
{
	u8 res;
	if(USART_GetITStatus(UART4,USART_IT_RXNE) != RESET)//接收数据
	{
		res = USART_ReceiveData(UART4);//读取接收数据
		Debug_printf("%c",res);
		if(USART4_RX_CNT<USART4_MAX_RECV_LEN)
		{
				USART4_RX_BUF[USART4_RX_CNT] = res;
				USART4_RX_CNT++;
		}
		else//接收错误
		{
			USART4_RX_CNT = 0;
		}
	}
	
	if ( USART_GetITStatus( UART4, USART_IT_IDLE ) == SET )      //数据帧接收完毕
	{
        if((USART4_RX_CNT&0x8000)==0)//接收未完成
				{
            USART4_RX_CNT|=0x8000;	//接收完成了
						osal_SetInterruptEvent(SIM900A_INTERRUPT_EVENT);
        }		
				res = USART_ReceiveData( UART4 );  //由软件序列清除中断标志位(先读USART_SR,然后读USART_DR
  }
}
Exemple #7
0
void RecoverUserDefaultData(void)
{
	char str[50];

	DataFlash_Function(Read_DataFlash,Type_DefData);

	if( (Backup_Default_Data.CheckSum==DataCheckSum((UBYTE *)&Backup_Default_Data,sizeof(Backup_Default_Data)))&&(Backup_Default_Data.CheckSum) )
		Backup_Default_Data.Backup_Data_Ready = 200;
	else {
		Backup_Default_Data.Backup_Data_Ready = 0;
		Backup_Default_Data.Def_Data_Ready = 0;
		Debug_printf("Loading Default Data default!!\n");
		sprintf(str,"Default_Data_Record=0x%x\n",Backup_Default_Data.CheckSum);
		Debug_printf(str);
		sprintf(str,"Default_Data_Real=0x%x\n",DataCheckSum((UBYTE *)&Backup_Default_Data,sizeof(Backup_Default_Data)) );
		Debug_printf(str);
	}
}
Exemple #8
0
void RecoverLastRunProg(void)
{
	char str[30];

	DataFlash_Function(Read_DataFlash,Type_ProgData);

	if( (P3k_Backup_Prog_Data.CheckSum==DataCheckSum((UBYTE *)&P3k_Backup_Prog_Data,sizeof(P3k_Backup_Prog_Data)))&&(P3k_Backup_Prog_Data.CheckSum) )
		SaveRecall_Prog_Data(0);
	else {
		P3k_Backup_Prog_Data.Data_Ready = 0;
		Debug_printf("Loading Prog Data default!!\n");
		sprintf(str,"Prog_Data_Record=0x%x\n",P3k_Backup_Prog_Data.CheckSum);
		Debug_printf(str);
		sprintf(str,"Prog_Data_Real=0x%x\n",DataCheckSum((UBYTE *)&P3k_Backup_Prog_Data,sizeof(P3k_Backup_Prog_Data)) );
		Debug_printf(str);
	}
	p3k_Disp_PROG = p3k_Chan_PROG;
}
Exemple #9
0
void RecoverLastFSeq(void)
{
	char str[30];

	DataFlash_Function(Read_DataFlash,Type_FSeqData);

	if( (P3k_Backup_FSeq_Data.CheckSum==DataCheckSum((UBYTE *)&P3k_Backup_FSeq_Data,sizeof(P3k_Backup_FSeq_Data)))&&(P3k_Backup_FSeq_Data.CheckSum) )
		SaveRecall_FSeq_Data(0);
	else {
		P3k_Backup_FSeq_Data.Data_Ready = 0;
		Debug_printf("Loading FSeq Data default!!\n");
		sprintf(str,"FSeq_Data_Record=0x%x\n",P3k_Backup_FSeq_Data.CheckSum);
		Debug_printf(str);
		sprintf(str,"FSeq_Data_Real=0x%x\n",DataCheckSum((UBYTE *)&P3k_Backup_FSeq_Data,sizeof(P3k_Backup_FSeq_Data)) );
		Debug_printf(str);
	}
	P3k_FSeq_Disp = P3k_FSeq_Data;
}
Exemple #10
0
void RecoverLastSetupData(void)
{
	char str[30];

	p3k_file_util_str *File = &p3k_File_Utility_BAR;

	///FIO_ANOM_0311_FLAG_W(PF12,pFIO_FLAG_C);
	DataFlash_Function(Read_DataFlash,Type_SetupData);
	///FIO_ANOM_0311_FLAG_W(PF12,pFIO_FLAG_S);

	if( (Backup_Setup_Data[File->SMEMORY_ADDR].CheckSum==DataCheckSum((UBYTE *)&Backup_Setup_Data[File->SMEMORY_ADDR],sizeof(Backup_Setup_Data[File->SMEMORY_ADDR])))&&(Backup_Setup_Data[File->SMEMORY_ADDR].CheckSum) )
		SaveRecall_Setup_Data(0);
	else {
		Backup_Setup_Data[File->SMEMORY_ADDR].Data_Ready = 0;
		Debug_printf("Loading Setup Data default!!\n");
		sprintf(str,"Setup_Data_Record=0x%x\n",Backup_Setup_Data[File->SMEMORY_ADDR].CheckSum);
		Debug_printf(str);
		sprintf(str,"Setup_Data_Real=0x%x\n",DataCheckSum((UBYTE *)&Backup_Setup_Data[File->SMEMORY_ADDR],sizeof(Backup_Setup_Data[File->SMEMORY_ADDR])) );
		Debug_printf(str);
	}
}
Exemple #11
0
void RecoverLastSerialNumber(void)
{
	DataFlash_Function(Read_DataFlash,Type_SerialNumber);

	if( (P3k_Backup_SN.CheckSum==DataCheckSum((UBYTE *)&P3k_Backup_SN,sizeof(P3k_Backup_SN)))&&(P3k_Backup_SN.CheckSum) ) {
		memcpy((void*)P3k_Serial_Number.Product_Serial_Number, (void*)P3k_Backup_SN.Serial_Number.Product_Serial_Number,10);
		P3k_Serial_Number.Version = P3k_Backup_SN.Serial_Number.Version;
		P3k_Serial_Number.version_flag= P3k_Backup_SN.Serial_Number.version_flag;
		P3k_Backup_SN.Backup_Data_Ready = 200;
	} else {
		P3k_Backup_SN.Backup_Data_Ready = 0;
		P3k_Backup_SN.Serial_Number_Ready = 0;
		Debug_printf("Loading Serial Number default!!\n");
		sprintf((char *)P3k_Serial_Number.Product_Serial_Number, "00000001");
	}

}
Exemple #12
0
void BackupStatus(void)
{
	UWORD Backup_TimeOut = 300;

	if((p3k_File_Utility_BAR.USB_Data_Type == F_Setup_Data) && (BackupBusyFlag))
		return;

	SaveRecall_FRAM_Data(1);

	while(BackupBusyFlag) {
		OSTimeDly(1);
		Backup_TimeOut--;
		if(Backup_TimeOut==0) {
			printf("BackupMasterMemo TimeOut\n");
			break;
		}
	}
	BackupBusyFlag = 1;

	if(FRAM_WRITE_MEM((UBYTE *)&FRAM_Data, sizeof(FRAM_Data))==(-1))
		Debug_printf("FRAM writing error!!\n");

	BackupBusyFlag = 0;
}
Exemple #13
0
void DataFlash_Function(UBYTE SelectMode,UBYTE Data_Type)
{
	long Input_DataPage,Input_DataSize;
	UBYTE *Input_DataPtr;
	unsigned char USB_File_Type;

	p3k_file_util_str *File_Ptr = &p3k_File_Utility_BAR;

	USB_File_Type = p3k_File_Utility_BAR.USB_Data_Type;

	/*SelectMode = 0 Read  DataFlash*/
	/*SelectMode = 1 Write DataFlash*/

	if(Type_SetupData == Data_Type) {
		if(USB_File_Type == F_Setup_Data) {
			Input_DataPage = 2600;								/* 2600~3050 */
			Input_DataSize = sizeof(Backup_Setup_Data);
			Input_DataPtr  = (UBYTE *)&Backup_Setup_Data;		/* 171520 Bytes /335 Page */
		} else {
			Input_DataPage = 2600 + (File_Ptr->SMEMORY_ADDR * 4);
			Input_DataSize = sizeof(Backup_Setup_Data[File_Ptr->SMEMORY_ADDR]);
			Input_DataPtr = (unsigned char *)&Backup_Setup_Data[File_Ptr->SMEMORY_ADDR];
		}
#if 0
		Input_DataPage = 2600;								/* 2600~2935 */
		Input_DataSize = sizeof(Backup_Setup_Data);
		Input_DataPtr  = (UBYTE *)&Backup_Setup_Data;		/* 171520 Bytes /335 Page */
#endif
	} else if(Type_CalData==Data_Type) {
		Input_DataPage = 3200;								/*3200~3201*/
		Input_DataSize = sizeof(p3k_Cal_data);
		Input_DataPtr  = (UBYTE *)&p3k_Cal_data;			/*1024 Byte/2 Page*/
	} else if(Type_APPData==Data_Type) {
		Input_DataPage = 3203;								/*3203~3203*/
		Input_DataSize = sizeof(Backup_APP_Data);
		Input_DataPtr  = (UBYTE *)&Backup_APP_Data;			/*512 Byte/1 Page*/
	} else if(Type_ProgData==Data_Type) {
		Input_DataPage = 3210;								/*3210~3238*/
		Input_DataSize = sizeof(P3k_Backup_Prog_Data);
		Input_DataPtr  = (UBYTE *)&P3k_Backup_Prog_Data;	/*14848 Byte/29 Page*/
	} else if(Type_NSeqData==Data_Type) {
		Input_DataPage = 3240;								/*3240~3278*/
		Input_DataSize = sizeof(P3k_Backup_NSeq_Data);
		Input_DataPtr  = (UBYTE *)&P3k_Backup_NSeq_Data;	/*19968 Byte/39 Page*/
	} else if(Type_FSeqData==Data_Type) {
		Input_DataPage = 3280;								/*3280~3298*/
		Input_DataSize = sizeof(P3k_Backup_FSeq_Data);
		Input_DataPtr  = (UBYTE *)&P3k_Backup_FSeq_Data;	/*9728 Byte/19 Page*/
	} else if(Type_DefData==Data_Type) {
		Input_DataPage = 3300;								/*3300~3308*/
		Input_DataSize = sizeof(Backup_Default_Data);
		Input_DataPtr  = (UBYTE *)&Backup_Default_Data;		/*4608 Byte/9 Page*/
	} else if(Type_SerialNumber==Data_Type) {
		Input_DataPage = 3310;								/*3310~3311*/
		Input_DataSize = sizeof(P3k_Backup_SN);
		Input_DataPtr  = (UBYTE *)&P3k_Backup_SN;		/*512 Byte/1 Page*/
#if Enable_OCP_function
	} else if(Type_funcOCP==Data_Type) {
		Input_DataPage = 3311;								/*3311~?*/
		Input_DataSize = sizeof(P3K_OCP_Data);
		Input_DataPtr  = (UBYTE *)&P3K_OCP_Data;		/*512 Byte/1 Page*/	
#endif
#if Enable_OPP_function
	} else if(Type_funcOPP==Data_Type) {
		Input_DataPage = 3312;								/*3311~?*/
		Input_DataSize = sizeof(P3K_OPP_Data);
		Input_DataPtr  = (UBYTE *)&P3K_OPP_Data;		/*512 Byte/1 Page*/
#endif
#if 0//Enable_LED_function
		} else if(Type_funcLED==Data_Type) {
			Input_DataPage = 3313;								/*3313~3346*/
			Input_DataSize = sizeof(P3k_FLed_Data);
			Input_DataPtr  = (UBYTE *)&P3k_FLed_Data;		/*512 Byte/1 Page*/
#endif

	} else {
		Debug_printf("DataFlash_Function Error\n");
		Input_DataPage = 3200;
		Input_DataSize = sizeof(p3k_Cal_data);
		Input_DataPtr  = (UBYTE *)&p3k_Cal_data;
	}
	DataFlash_Save_Recall(SelectMode,Input_DataPage,Input_DataSize,Input_DataPtr);
}
Exemple #14
0
void RecoverCalData_DataFlash(char check_done)
{
#define default_cpp_gain	1.05 //107.24 //108.24
#define default_opp_gain	1.05 //107.24
#define default_ocp_gain	1.453  //109.22
	char str[100],i;
	p3k_cal_Data_str *Cal_tmp = &p3k_Cal_data;

	DataFlash_Function(Read_DataFlash,Type_CalData);
//	p3k_Cal_data.CheckSum = 0;

	if((check_done)&&((p3k_Cal_data.CheckSum==DataCheckSum((UBYTE *)&p3k_Cal_data,sizeof(p3k_Cal_data)))&&(p3k_Cal_data.CheckSum)))
		p3k_Cal_data.Data_Ready = 200;
	else {
		p3k_Cal_data.Data_Ready = 0;
		Debug_printf("Loading Cal Data default!!\n");
		sprintf(str,"Record CheckSum=0x%x\n",p3k_Cal_data.CheckSum);
		Debug_printf(str);
		sprintf(str,"Real CheckSum=0x%x\n",DataCheckSum((UBYTE *)&p3k_Cal_data,sizeof(p3k_Cal_data)));
		Debug_printf(str);

		for(i=IRange_Low ; i<=IRange_High ; i++) {
			/*  Mode	     Range*/

			Cal_tmp->CC_offseAdj[i] = Calibration_Adj_defalut;
			Cal_tmp->CR_offseAdj[i] = Calibration_Adj_defalut;
			Cal_tmp->CP_offseAdj[i] = Calibration_Adj_defalut;
			Cal_tmp->CV_offseAdj[i] = Calibration_Adj_defalut;

			Cal_tmp->CC_Data[i].Cal_Value_Gain		= Default_Cal_Gain;
			Cal_tmp->CR_Data[i].Cal_Value_Gain		= 1.351;			//Default_Cal_Gain;
			Cal_tmp->CV_Data[i].Cal_Value_Gain		= Default_Cal_Gain;
			Cal_tmp->CP_Data[i].Cal_Value_Gain		= Default_Cal_Gain;

			Cal_tmp->CC_Data[i].Cal_Value_Offset	= Default_Cal_Offset;
			Cal_tmp->CR_Data[i].Cal_Value_Offset	= Default_Cal_Offset;
			Cal_tmp->CV_Data[i].Cal_Value_Offset	= Default_Cal_Offset;
			Cal_tmp->CP_Data[i].Cal_Value_Offset	= Default_Cal_Offset;

			Cal_tmp->Curr[i].Meas_Value_Gain		= 41666;
			Cal_tmp->Curr[i].Meas_Value_Offset		= 6383;

			Cal_tmp->Protection[i].CPP 				= Default_Cal_Prot_DA_Rating;
			Cal_tmp->Protection[i].OCP 				= Default_Cal_Prot_DA_OCP;
			Cal_tmp->Protection[i].OPP 				= Default_Cal_Prot_DA_OPP;
			Cal_tmp->Protection[i].CxCV				= Default_Cal_CXCV;

			Cal_tmp->Protection[i].OCP_Gain 			= default_ocp_gain;
			Cal_tmp->Protection[i].OPP_Gain			= default_opp_gain;
			Cal_tmp->Protection[i].CxCV_Gain			= Default_Cal_Gain;

			Cal_tmp->Protection[i].OCP_Offset		= Default_Cal_Offset;
			Cal_tmp->Protection[i].OPP_Offset		= Default_Cal_Offset;
			Cal_tmp->Protection[i].CxCV_Offset		= Default_Cal_Offset;
			if(1) { //if(check_done==0){
				Cal_tmp->Protection[i].CPP_Gain		= default_cpp_gain;
				Cal_tmp->Protection[i].CPP_Offset	= Default_Cal_Offset;
			}
			Cal_tmp->Front_IMON[i]					= 12;
			Cal_tmp->Rear_IMON[i]					= 32;
			Cal_tmp->Ext_V_CC[i]					= 33000;//30660;
			Cal_tmp->Ext_R_CC[i]					= 33000;//30660;
		}

		for(i=VRange_Low ; i<=VRange_High ; i++) {
			Cal_tmp->Volt[i].Meas_Value_Gain	= 44380;//22359;
			Cal_tmp->Volt[i].Meas_Value_Offset	= 6383;
		}

		Cal_tmp->Ext_V_Sense.Meas_Value_Gain = 58000;
		Cal_tmp->Ext_V_Sense.Meas_Value_Offset= 0;
		Cal_tmp->Ext_R_Sense.Meas_Value_Gain = 58000;
		Cal_tmp->Ext_R_Sense.Meas_Value_Offset= 0;

		Cal_tmp->PSensor.XH_Value =	Default_Cal_OS_Ref;
		Cal_tmp->PSensor.YH_Value =	Default_Cal_OS_Ref;
		Cal_tmp->PSensor.ZH_Value =	Default_Cal_OS_Ref;
		Cal_tmp->PSensor.XL_Value =	Default_Cal_OS_Ref;
		Cal_tmp->PSensor.YL_Value =	Default_Cal_OS_Ref;
		Cal_tmp->PSensor.ZL_Value =	Default_Cal_OS_Ref;
		Cal_tmp->Cal_complete = 0;
	}
}
Exemple #15
0
void App_TaskButton (void *p_arg)
{
    OS_ERR       err;
    CPU_INT08U count;
    ButtonValue value;
    (void)p_arg;                                                    /* Prevent Compiler Warning */

    buttonInit();
        
    while(DEF_TRUE) {
        for(count=0; count<=10; count++)
        {
            Button_task();        // reads the button values
            OSTimeDlyHMSM(0u, 0u, 0u, 10u, OS_OPT_TIME_HMSM_STRICT, &err);
            if(count==10)
            {
                while (Button_getPress(&value) != (int8)(-1))
                {
                    if (applicationState == ApplicationState_Idle)
                    {
                        int32 movement;
                        if (value.id == BUTTON_Xplus)
                        {
                            movement = value.count * BUTTON_STEP_UM;
                            App_setXDirectionUM(movement);
                            Debug_printf(Debug_Level_2, "X: %imm\n", movement);
                        }
                        else if (value.id == BUTTON_Xminus)
                        {
                            movement = -value.count * BUTTON_STEP_UM;
                            App_setXDirectionUM(movement);
                            Debug_printf(Debug_Level_2, "X: %imm\n", movement);
                        }
                        if (value.id == BUTTON_Yplus)
                        {
                            movement = value.count * BUTTON_STEP_UM;
                            App_setYDirectionUM(movement);
                            Debug_printf(Debug_Level_2, "Y: %imm\n", movement);
                        }
                        else if (value.id == BUTTON_Yminus)
                        {
                            movement = -value.count * BUTTON_STEP_UM;
                            App_setYDirectionUM(movement);
                            Debug_printf(Debug_Level_2, "Y: %imm\n", movement);
                        }
                        if (value.id == BUTTON_Zplus)
                        {
                            movement = value.count * BUTTON_STEP_UM;
                            App_setZDirectionUM(movement);
                            Debug_printf(Debug_Level_2, "Z: %imm\n", movement);
                        }
                        else if (value.id == BUTTON_Zminus)
                        {
                            movement = -value.count * BUTTON_STEP_UM;
                            App_setZDirectionUM(movement);
                            Debug_printf(Debug_Level_2, "Z: %imm\n", movement);
                        }
                        else if (value.id == BUTTON_OK)
                        {
                            Debug_printf(Debug_Level_2, "OK pressed\n");
                            testing = TRUE;
                        }
                    }
                    else if (applicationState == ApplicationState_Test)
                    {
                        if (value.id == BUTTON_Xplus)
                        {
                            buttonXPlusTest = TRUE;
                            Debug_printf(Debug_Level_2, "X+ pressed\n");
                        }
                        else if (value.id == BUTTON_Xminus)
                        {
                            buttonXMinusTest = TRUE;
                            Debug_printf(Debug_Level_2, "X- pressed\n");
                        }
                        if (value.id == BUTTON_Yplus)
                        {
                            buttonYPlusTest = TRUE;
                            Debug_printf(Debug_Level_2, "Y+ pressed\n");
                        }
                        else if (value.id == BUTTON_Yminus)
                        {
                            buttonYMinusTest = TRUE;
                            Debug_printf(Debug_Level_2, "Y- pressed\n");
                        }
                        if (value.id == BUTTON_Zplus)
                        {
                            buttonZPlusTest = TRUE;
                            Debug_printf(Debug_Level_2, "Z+ pressed\n");
                        }
                        else if (value.id == BUTTON_Zminus)
                        {
                            buttonZMinusTest = TRUE;
                            Debug_printf(Debug_Level_2, "Z- pressed\n");
                        }
                        else if (value.id == BUTTON_OK)
                        {
                            buttonOkTest = TRUE;
                            Debug_printf(Debug_Level_2, "OK pressed\n");
                        }
                        else if (value.id == ENDSCHALTER_Xplus)
                        {
                            endschalterXPlusTest = TRUE;
                            Debug_printf(Debug_Level_2, "Endschalter X+\n");
                        }
                        else if (value.id == ENDSCHALTER_Xminus)
                        {
                            endschalterXMinusTest = TRUE;
                            Debug_printf(Debug_Level_2, "Endschalter X-\n");
                        }
                        else if (value.id == ENDSCHALTER_Yplus)
                        {
                            endschalterYPlusTest = TRUE;
                            Debug_printf(Debug_Level_2, "Endschalter Y+\n");
                        }
                        else if (value.id == ENDSCHALTER_Yminus)
                        {
                            endschalterYMinusTest = TRUE;
                            Debug_printf(Debug_Level_2, "Endschalter Y-\n");
                        }
                        else if (value.id == ENDSCHALTER_Zplus)
                        {
                            endschalterZPlusTest = TRUE;
                            Debug_printf(Debug_Level_2, "Endschalter Z+\n");
                        }
                        else if (value.id == ENDSCHALTER_Zminus)
                        {
                            endschalterZMinusTest = TRUE;
                            Debug_printf(Debug_Level_2, "Endschalter Z-\n");
                        }
                    }
                }
            }
        }
    }
}