void G_ISLEM() {
islem = buffer[i++] - 48;
if (buffer != ' ' && buffer != '\r') {
islem = (islem * 10) + (buffer[i++] - 48);
}
if (islem == 1)
G1(); //G1 KORDINATA GIT
if(islem==4) G4(); //G04 BEKLEME YAP
if (islem == 54)
G54(); //G54 BIRINCI IS MERKEZI
if (islem == 55)
G55(); //G55 IKINCI IS MERKEZI
if (islem == 56)
G56(); //G56 UCUNCU IS MERKEZI
if (islem == 58)
G58(); //G58 HOME SWICE GIT
}
//*********************************************************************
void M2() { //IS SONU;
HAL_GPIO_WritePin(M90_M91_GPIO_Port, M90_M91_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(M92_M93_GPIO_Port, M92_M93_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(M94_M95_GPIO_Port, M94_M95_Pin, GPIO_PIN_RESET);
if (sayfano == 1) {
if (FLAG.bits.G54 == 1)
g54_stop_index = i;
if (FLAG.bits.G55 == 1)
g55_stop_index = i;
if (FLAG.bits.G56 == 1)
g56_stop_index = i;
}
FLAG.bits.btn_calis = 0;
FLAG.bits.is_bitti = 1;
EKRANI_BTN(6);
}
void M8() { //SOGUTMA SIVISI AC;
HAL_GPIO_WritePin(M8_M9_GPIO_Port, M8_M9_Pin, GPIO_PIN_SET);
}
void M9() { //SOGUTMA SIVISI KAPA;
HAL_GPIO_WritePin(M8_M9_GPIO_Port, M8_M9_Pin, GPIO_PIN_RESET);
}
void M90() { //BIRINCIKAFA_ASAGI;
FLAG.bits.basma_tamamlandi=0;
if(FLAG.bits.btn_calis==0){EKRANA_CIZ(1);return;}
Count_Systick=0;
if(HAL_GPIO_ReadPin(KAFA1_SENS_Y_GPIO_Port, KAFA1_SENS_Y_Pin)== 1) //yukarda degilse hata
{HATAKODU=1;return;}
while (HAL_GPIO_ReadPin(MALZEME_SENS1_GPIO_Port, MALZEME_SENS1_Pin) == 0) { //malzeme yoksa 5 sn dolmasını bekle
if (Count_Systick >= 5000 ) {HATAKODU = 2; break;}
}
if(HATAKODU !=0) return;
Count_Systick=0;
HAL_GPIO_WritePin(M90_M91_GPIO_Port, M90_M91_Pin, GPIO_PIN_SET);
EKRANA_CIZ(3);
islenecek_index=i;
while(HAL_GPIO_ReadPin(KAFA1_SENS_A_GPIO_Port, KAFA1_SENS_A_Pin)== 1){ //5 sn asagı inmesini bekle
if(Count_Systick >= 5000 ){HATAKODU=3;break;}
}
}
void M91() { //BIRINCIKAFA_YUKARI;
if(FLAG.bits.btn_calis==0) return;
HAL_GPIO_WritePin(M90_M91_GPIO_Port, M90_M91_Pin, GPIO_PIN_RESET);
Count_Systick=0;
while(HAL_GPIO_ReadPin(KAFA1_SENS_Y_GPIO_Port, KAFA1_SENS_Y_Pin)== 1){ //5 sn yukarı cıkmasını bekle
if(Count_Systick >= 5000 ){HATAKODU=4;break;}
}
Count_Systick=0;
if(FLAG.bits.btn_calis==1)HAL_GPIO_WritePin(TISLAMA1_GPIO_Port, TISLAMA1_Pin, 1);
FLAG.bits.basma_tamamlandi=1;
islenecek_index=i;
}
void M92() { //IKINCIKAFA_ASAGI;
FLAG.bits.basma_tamamlandi=0;
if(FLAG.bits.btn_calis==0){EKRANA_CIZ(1);return;}
Count_Systick=0;
if(HAL_GPIO_ReadPin(KAFA2_SENS_Y_GPIO_Port, KAFA2_SENS_Y_Pin)== 1) //yukarda degilse hata
{HATAKODU=5;return;}
while (HAL_GPIO_ReadPin(MALZEME_SENS2_GPIO_Port, MALZEME_SENS2_Pin) == 0) { //malzeme yoksa 5 sn dolmasını bekle
if (Count_Systick >= 5000 ) {HATAKODU = 6; break;}
}
if(HATAKODU !=0) return;
Count_Systick=0;
HAL_GPIO_WritePin(M92_M93_GPIO_Port, M92_M93_Pin, GPIO_PIN_SET);
EKRANA_CIZ(3);
islenecek_index=i;
while(HAL_GPIO_ReadPin(KAFA2_SENS_A_GPIO_Port, KAFA2_SENS_A_Pin)== 1){ //5 sn asagı inmesini bekle
if(Count_Systick >= 5000 ){HATAKODU=7;break;}
}
}
void M93() { //IKINCIKAFA_YUKARI;
if(FLAG.bits.btn_calis==0) return;
HAL_GPIO_WritePin(M92_M93_GPIO_Port, M92_M93_Pin, GPIO_PIN_RESET);
Count_Systick=0;
while(HAL_GPIO_ReadPin(KAFA2_SENS_Y_GPIO_Port, KAFA2_SENS_Y_Pin)== 1){ //5 sn yukarı cıkmasını bekle
if(Count_Systick >= 5000 ){HATAKODU=8;break;}
}
Count_Systick=0;
if(FLAG.bits.btn_calis==1)HAL_GPIO_WritePin(TISLAMA2_GPIO_Port, TISLAMA2_Pin, 1);
FLAG.bits.basma_tamamlandi=1;
islenecek_index=i;
}
void M94() { //UCUNCUKAFA_ASAGI;
FLAG.bits.basma_tamamlandi=0;
if(FLAG.bits.btn_calis==0){EKRANA_CIZ(1);return;}
Count_Systick=0;
if(HAL_GPIO_ReadPin(KAFA3_SENS_Y_GPIO_Port, KAFA3_SENS_Y_Pin)== 1) //yukarda degilse hata
{HATAKODU=9;return;}
while (HAL_GPIO_ReadPin(MALZEME_SENS3_GPIO_Port, MALZEME_SENS3_Pin) == 0) { //malzeme yoksa 5 sn dolmasını bekle
if (Count_Systick >= 5000 ) {HATAKODU = 10; break;}
}
if(HATAKODU !=0) return;
Count_Systick=0;
HAL_GPIO_WritePin(M94_M95_GPIO_Port, M94_M95_Pin, GPIO_PIN_SET);
EKRANA_CIZ(3);
islenecek_index=i;
while(HAL_GPIO_ReadPin(KAFA3_SENS_A_GPIO_Port, KAFA3_SENS_A_Pin)== 1){ //5 sn asagı inmesini bekle
if(Count_Systick >= 5000 ){HATAKODU=11;break;}
}
}
void M95() { //UCUNCUKAFA_YUKARI;
if(FLAG.bits.btn_calis==0) return;
HAL_GPIO_WritePin(M94_M95_GPIO_Port, M94_M95_Pin, GPIO_PIN_RESET);
Count_Systick=0;
while(HAL_GPIO_ReadPin(KAFA3_SENS_Y_GPIO_Port, KAFA3_SENS_Y_Pin)== 1){ //5 sn yukarı cıkmasını bekle
if(Count_Systick >= 5000 ){HATAKODU=12;break;}
}
Count_Systick=0;
if(FLAG.bits.btn_calis==1)HAL_GPIO_WritePin(TISLAMA3_GPIO_Port, TISLAMA3_Pin, 1);
FLAG.bits.basma_tamamlandi=1;
islenecek_index=i;
}