Commit a7fa4d23 authored by MagoKimbra's avatar MagoKimbra

Update firmware Test

parent 10e8a8e2
...@@ -12,24 +12,25 @@ ...@@ -12,24 +12,25 @@
static char serial_answer; static char serial_answer;
void FirmwareTest(){ void FirmwareTest()
{
SERIAL_ECHOLN("---------- FIRMWARE TEST --------------"); SERIAL_ECHOLN("---------- FIRMWARE TEST --------------");
SERIAL_ECHOLN("--------- by MarlinKimbra -------------"); SERIAL_ECHOLN("--------- by MarlinKimbra -------------");
SERIAL_ECHOLN(" "); SERIAL_ECHOLN(" ");
SERIAL_ECHOLN(MSG_FWTEST_01); SERIAL_ECHOLN(MSG_FWTEST_01);
SERIAL_ECHOLN(MSG_FWTEST_02); SERIAL_ECHOLN(MSG_FWTEST_02);
SERIAL_ECHOLN(MSG_FWTEST_YES_NO); SERIAL_ECHOLN(MSG_FWTEST_YES_NO);
serial_answer = MYSERIAL.read(); serial_answer = ' ';
while(serial_answer!='y' && serial_answer!='Y' && serial_answer!='n' && serial_answer!='N'){ while(serial_answer!='y' && serial_answer!='Y' && serial_answer!='n' && serial_answer!='N') {
serial_answer = MYSERIAL.read(); serial_answer = MYSERIAL.read();
} }
if (serial_answer=='y' || serial_answer=='Y'){ if (serial_answer=='y' || serial_answer=='Y') {
SERIAL_ECHOLN(MSG_FWTEST_03); SERIAL_ECHOLN(MSG_FWTEST_03);
SERIAL_ECHOLN(" "); SERIAL_ECHOLN(" ");
SERIAL_ECHOLN("***** ENDSTOP X *****"); SERIAL_ECHOLN("***** ENDSTOP X *****");
#if defined(X_MIN_PIN) && X_MIN_PIN > -1 && X_HOME_DIR == -1 #if defined(X_MIN_PIN) && X_MIN_PIN > -1 && X_HOME_DIR == -1
if (!READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING){ if (!READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING) {
SERIAL_ECHO("MIN ENDSTOP X: "); SERIAL_ECHO("MIN ENDSTOP X: ");
SERIAL_ECHOLN(MSG_ENDSTOP_OPEN); SERIAL_ECHOLN(MSG_ENDSTOP_OPEN);
} }
...@@ -43,11 +44,11 @@ void FirmwareTest(){ ...@@ -43,11 +44,11 @@ void FirmwareTest(){
SERIAL_ECHO(MSG_FWTEST_PRESS); SERIAL_ECHO(MSG_FWTEST_PRESS);
SERIAL_ECHOLN("X"); SERIAL_ECHOLN("X");
SERIAL_ECHOLN(MSG_FWTEST_YES); SERIAL_ECHOLN(MSG_FWTEST_YES);
serial_answer = MYSERIAL.read(); serial_answer = ' ';
while(serial_answer!='y' && serial_answer!='Y' && !(READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING)){ while(serial_answer!='y' && serial_answer!='Y' && !(READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING)){
serial_answer = MYSERIAL.read(); serial_answer = MYSERIAL.read();
} }
if (READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING){ if (READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING) {
SERIAL_ECHO("MIN ENDSTOP X: "); SERIAL_ECHO("MIN ENDSTOP X: ");
SERIAL_ECHOLN(MSG_ENDSTOP_HIT); SERIAL_ECHOLN(MSG_ENDSTOP_HIT);
} }
...@@ -57,8 +58,8 @@ void FirmwareTest(){ ...@@ -57,8 +58,8 @@ void FirmwareTest(){
SERIAL_ECHOLN(MSG_FWTEST_ENDSTOP_ERR); SERIAL_ECHOLN(MSG_FWTEST_ENDSTOP_ERR);
return; return;
} }
#elif defined(X_MAX_PIN) && X_MAX_PIN > -1 && X_HOME_DIR == 1 #elif defined(X_MAX_PIN) && X_MAX_PIN > -1 && X_HOME_DIR == 1
if (!READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING){ if (!READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING) {
SERIAL_ECHO("MAX ENDSTOP X: "); SERIAL_ECHO("MAX ENDSTOP X: ");
SERIAL_ECHOLN(MSG_ENDSTOP_OPEN); SERIAL_ECHOLN(MSG_ENDSTOP_OPEN);
} }
...@@ -72,11 +73,11 @@ void FirmwareTest(){ ...@@ -72,11 +73,11 @@ void FirmwareTest(){
SERIAL_ECHO(MSG_FWTEST_PRESS); SERIAL_ECHO(MSG_FWTEST_PRESS);
SERIAL_ECHOLN("X"); SERIAL_ECHOLN("X");
SERIAL_ECHOLN(MSG_FWTEST_YES); SERIAL_ECHOLN(MSG_FWTEST_YES);
serial_answer = MYSERIAL.read(); serial_answer = ' ';
while(serial_answer!='y' && serial_answer!='Y' && !(READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING)){ while(serial_answer!='y' && serial_answer!='Y' && !(READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING)) {
serial_answer = MYSERIAL.read(); serial_answer = MYSERIAL.read();
} }
if (READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING){ if (READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING) {
SERIAL_ECHO("MAX ENDSTOP X: "); SERIAL_ECHO("MAX ENDSTOP X: ");
SERIAL_ECHOLN(MSG_ENDSTOP_HIT); SERIAL_ECHOLN(MSG_ENDSTOP_HIT);
} }
...@@ -86,17 +87,17 @@ void FirmwareTest(){ ...@@ -86,17 +87,17 @@ void FirmwareTest(){
SERIAL_ECHOLN(MSG_FWTEST_ENDSTOP_ERR); SERIAL_ECHOLN(MSG_FWTEST_ENDSTOP_ERR);
return; return;
} }
#elif X_HOME_DIR == -1 #elif X_HOME_DIR == -1
SERIAL_ECHOLN("ERROR!!! X_MIN_PIN not defined"); SERIAL_ECHOLN("ERROR!!! X_MIN_PIN not defined");
return; return;
#elif X_HOME_DIR == 1 #elif X_HOME_DIR == 1
SERIAL_ECHOLN("ERROR!!! X_MAX_PIN not defined"); SERIAL_ECHOLN("ERROR!!! X_MAX_PIN not defined");
return; return;
#endif #endif
SERIAL_ECHOLN(" "); SERIAL_ECHOLN(" ");
SERIAL_ECHOLN("***** ENDSTOP Y *****"); SERIAL_ECHOLN("***** ENDSTOP Y *****");
#if defined(Y_MIN_PIN) && Y_MIN_PIN > -1 && Y_HOME_DIR == -1 #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1 && Y_HOME_DIR == -1
if (!READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING){ if (!READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING){
SERIAL_ECHO("MIN ENDSTOP Y: "); SERIAL_ECHO("MIN ENDSTOP Y: ");
SERIAL_ECHOLN(MSG_ENDSTOP_OPEN); SERIAL_ECHOLN(MSG_ENDSTOP_OPEN);
...@@ -111,7 +112,7 @@ void FirmwareTest(){ ...@@ -111,7 +112,7 @@ void FirmwareTest(){
SERIAL_ECHO(MSG_FWTEST_PRESS); SERIAL_ECHO(MSG_FWTEST_PRESS);
SERIAL_ECHOLN("Y"); SERIAL_ECHOLN("Y");
SERIAL_ECHOLN(MSG_FWTEST_YES); SERIAL_ECHOLN(MSG_FWTEST_YES);
serial_answer = MYSERIAL.read(); serial_answer = ' ';
while(serial_answer!='y' && serial_answer!='Y' && !(READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING)){ while(serial_answer!='y' && serial_answer!='Y' && !(READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING)){
serial_answer = MYSERIAL.read(); serial_answer = MYSERIAL.read();
} }
...@@ -125,7 +126,7 @@ void FirmwareTest(){ ...@@ -125,7 +126,7 @@ void FirmwareTest(){
SERIAL_ECHOLN(MSG_FWTEST_ENDSTOP_ERR); SERIAL_ECHOLN(MSG_FWTEST_ENDSTOP_ERR);
return; return;
} }
#elif defined(Y_MAX_PIN) && Y_MAX_PIN > -1 && Y_HOME_DIR == 1 #elif defined(Y_MAX_PIN) && Y_MAX_PIN > -1 && Y_HOME_DIR == 1
if (!READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING){ if (!READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING){
SERIAL_ECHO("MAX ENDSTOP Y: "); SERIAL_ECHO("MAX ENDSTOP Y: ");
SERIAL_ECHOLN(MSG_ENDSTOP_OPEN); SERIAL_ECHOLN(MSG_ENDSTOP_OPEN);
...@@ -140,7 +141,7 @@ void FirmwareTest(){ ...@@ -140,7 +141,7 @@ void FirmwareTest(){
SERIAL_ECHO(MSG_FWTEST_PRESS); SERIAL_ECHO(MSG_FWTEST_PRESS);
SERIAL_ECHOLN("Y"); SERIAL_ECHOLN("Y");
SERIAL_ECHOLN(MSG_FWTEST_YES); SERIAL_ECHOLN(MSG_FWTEST_YES);
serial_answer = MYSERIAL.read(); serial_answer = ' ';
while(serial_answer!='y' && serial_answer!='Y' && !(READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING)){ while(serial_answer!='y' && serial_answer!='Y' && !(READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING)){
serial_answer = MYSERIAL.read(); serial_answer = MYSERIAL.read();
} }
...@@ -154,17 +155,17 @@ void FirmwareTest(){ ...@@ -154,17 +155,17 @@ void FirmwareTest(){
SERIAL_ECHOLN(MSG_FWTEST_ENDSTOP_ERR); SERIAL_ECHOLN(MSG_FWTEST_ENDSTOP_ERR);
return; return;
} }
#elif Y_HOME_DIR == -1 #elif Y_HOME_DIR == -1
SERIAL_ECHOLN("ERROR!!! Y_MIN_PIN not defined"); SERIAL_ECHOLN("ERROR!!! Y_MIN_PIN not defined");
return; return;
#elif Y_HOME_DIR == 1 #elif Y_HOME_DIR == 1
SERIAL_ECHOLN("ERROR!!! Y_MAX_PIN not defined"); SERIAL_ECHOLN("ERROR!!! Y_MAX_PIN not defined");
return; return;
#endif #endif
SERIAL_ECHOLN(" "); SERIAL_ECHOLN(" ");
SERIAL_ECHOLN("***** ENDSTOP Z *****"); SERIAL_ECHOLN("***** ENDSTOP Z *****");
#if defined(Z_MIN_PIN) && Z_MIN_PIN > -1 && Z_HOME_DIR == -1 #if defined(Z_MIN_PIN) && Z_MIN_PIN > -1 && Z_HOME_DIR == -1
if (!READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING){ if (!READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING){
SERIAL_ECHO("MIN ENDSTOP Z: "); SERIAL_ECHO("MIN ENDSTOP Z: ");
SERIAL_ECHOLN(MSG_ENDSTOP_OPEN); SERIAL_ECHOLN(MSG_ENDSTOP_OPEN);
...@@ -179,7 +180,7 @@ void FirmwareTest(){ ...@@ -179,7 +180,7 @@ void FirmwareTest(){
SERIAL_ECHO(MSG_FWTEST_PRESS); SERIAL_ECHO(MSG_FWTEST_PRESS);
SERIAL_ECHOLN("Z"); SERIAL_ECHOLN("Z");
SERIAL_ECHOLN(MSG_FWTEST_YES); SERIAL_ECHOLN(MSG_FWTEST_YES);
serial_answer = MYSERIAL.read(); serial_answer = ' ';
while(serial_answer!='y' && serial_answer!='Y' && !(READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING)){ while(serial_answer!='y' && serial_answer!='Y' && !(READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING)){
serial_answer = MYSERIAL.read(); serial_answer = MYSERIAL.read();
} }
...@@ -193,7 +194,7 @@ void FirmwareTest(){ ...@@ -193,7 +194,7 @@ void FirmwareTest(){
SERIAL_ECHOLN(MSG_FWTEST_ENDSTOP_ERR); SERIAL_ECHOLN(MSG_FWTEST_ENDSTOP_ERR);
return; return;
} }
#elif defined(Z_MAX_PIN) && Z_MAX_PIN > -1 && Z_HOME_DIR == 1 #elif defined(Z_MAX_PIN) && Z_MAX_PIN > -1 && Z_HOME_DIR == 1
if (!READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING){ if (!READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING){
SERIAL_ECHO("MAX ENDSTOP Z: "); SERIAL_ECHO("MAX ENDSTOP Z: ");
SERIAL_ECHOLN(MSG_ENDSTOP_OPEN); SERIAL_ECHOLN(MSG_ENDSTOP_OPEN);
...@@ -208,7 +209,7 @@ void FirmwareTest(){ ...@@ -208,7 +209,7 @@ void FirmwareTest(){
SERIAL_ECHO(MSG_FWTEST_PRESS); SERIAL_ECHO(MSG_FWTEST_PRESS);
SERIAL_ECHOLN("Z"); SERIAL_ECHOLN("Z");
SERIAL_ECHOLN(MSG_FWTEST_YES); SERIAL_ECHOLN(MSG_FWTEST_YES);
serial_answer = MYSERIAL.read(); serial_answer = ' ';
while(serial_answer!='y' && serial_answer!='Y' && !(READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING)){ while(serial_answer!='y' && serial_answer!='Y' && !(READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING)){
serial_answer = MYSERIAL.read(); serial_answer = MYSERIAL.read();
} }
...@@ -222,22 +223,22 @@ void FirmwareTest(){ ...@@ -222,22 +223,22 @@ void FirmwareTest(){
SERIAL_ECHOLN(MSG_FWTEST_ENDSTOP_ERR); SERIAL_ECHOLN(MSG_FWTEST_ENDSTOP_ERR);
return; return;
} }
#elif Z_HOME_DIR == -1 #elif Z_HOME_DIR == -1
SERIAL_ECHOLN("ERROR!!! Z_MIN_PIN not defined"); SERIAL_ECHOLN("ERROR!!! Z_MIN_PIN not defined");
return; return;
#elif Z_HOME_DIR == 1 #elif Z_HOME_DIR == 1
SERIAL_ECHOLN("ERROR!!! Z_MAX_PIN not defined"); SERIAL_ECHOLN("ERROR!!! Z_MAX_PIN not defined");
return; return;
#endif #endif
SERIAL_ECHOLN("ENDSTOP OK"); SERIAL_ECHOLN("ENDSTOP OK");
SERIAL_ECHOLN(" "); SERIAL_ECHOLN(" ");
} }
#if defined(PS_ON_PIN) && PS_ON_PIN > -1 #if defined(PS_ON_PIN) && PS_ON_PIN > -1
SET_OUTPUT(PS_ON_PIN); SET_OUTPUT(PS_ON_PIN);
WRITE(PS_ON_PIN, PS_ON_AWAKE); WRITE(PS_ON_PIN, PS_ON_AWAKE);
#endif #endif
// Reset position to 0 // Reset position to 0
st_synchronize(); st_synchronize();
...@@ -247,19 +248,20 @@ void FirmwareTest(){ ...@@ -247,19 +248,20 @@ void FirmwareTest(){
SERIAL_ECHOLN("***** TEST MOTOR *****"); SERIAL_ECHOLN("***** TEST MOTOR *****");
SERIAL_ECHOLN(MSG_FWTEST_ATTENTION); SERIAL_ECHOLN(MSG_FWTEST_ATTENTION);
SERIAL_ECHOLN(MSG_FWTEST_YES); SERIAL_ECHOLN(MSG_FWTEST_YES);
serial_answer = MYSERIAL.read(); serial_answer = ' ';
while(serial_answer!='y' && serial_answer!='Y'){ while(serial_answer!='y' && serial_answer!='Y'){
serial_answer = MYSERIAL.read(); serial_answer = MYSERIAL.read();
} }
SERIAL_ECHOLN(MSG_FWTEST_04); SERIAL_ECHOLN(MSG_FWTEST_04);
SERIAL_ECHOLN(" "); SERIAL_ECHOLN(" ");
SERIAL_ECHOLN("***** MOTOR X *****"); SERIAL_ECHOLN("***** MOTOR X *****");
destination[X_AXIS] = current_position[X_AXIS] + 5; destination[X_AXIS] = 10;
prepare_move(); prepare_move();
st_synchronize(); st_synchronize();
SERIAL_ECHOLN(MSG_FWTEST_XAXIS); SERIAL_ECHOLN(MSG_FWTEST_XAXIS);
SERIAL_ECHOLN(MSG_FWTEST_YES_NO); SERIAL_ECHOLN(MSG_FWTEST_YES_NO);
serial_answer = MYSERIAL.read(); serial_answer = ' ';
while(serial_answer!='y' && serial_answer!='Y' && serial_answer!='n' && serial_answer!='N'){ while(serial_answer!='y' && serial_answer!='Y' && serial_answer!='n' && serial_answer!='N'){
serial_answer = MYSERIAL.read(); serial_answer = MYSERIAL.read();
} }
...@@ -274,12 +276,12 @@ void FirmwareTest(){ ...@@ -274,12 +276,12 @@ void FirmwareTest(){
} }
SERIAL_ECHOLN(" "); SERIAL_ECHOLN(" ");
SERIAL_ECHOLN("***** MOTOR Y *****"); SERIAL_ECHOLN("***** MOTOR Y *****");
destination[Y_AXIS] = current_position[Y_AXIS] + 5; destination[Y_AXIS] = 10;
prepare_move(); prepare_move();
st_synchronize(); st_synchronize();
SERIAL_ECHOLN(MSG_FWTEST_YAXIS); SERIAL_ECHOLN(MSG_FWTEST_YAXIS);
SERIAL_ECHOLN(MSG_FWTEST_YES_NO); SERIAL_ECHOLN(MSG_FWTEST_YES_NO);
serial_answer = MYSERIAL.read(); serial_answer = ' ';
while(serial_answer!='y' && serial_answer!='Y' && serial_answer!='n' && serial_answer!='N'){ while(serial_answer!='y' && serial_answer!='Y' && serial_answer!='n' && serial_answer!='N'){
serial_answer = MYSERIAL.read(); serial_answer = MYSERIAL.read();
} }
...@@ -294,12 +296,12 @@ void FirmwareTest(){ ...@@ -294,12 +296,12 @@ void FirmwareTest(){
} }
SERIAL_ECHOLN(" "); SERIAL_ECHOLN(" ");
SERIAL_ECHOLN("***** MOTOR Z *****"); SERIAL_ECHOLN("***** MOTOR Z *****");
destination[Z_AXIS] = current_position[Z_AXIS] + 5; destination[Z_AXIS] = 10;
prepare_move(); prepare_move();
st_synchronize(); st_synchronize();
SERIAL_ECHOLN(MSG_FWTEST_ZAXIS); SERIAL_ECHOLN(MSG_FWTEST_ZAXIS);
SERIAL_ECHOLN(MSG_FWTEST_YES_NO); SERIAL_ECHOLN(MSG_FWTEST_YES_NO);
serial_answer = MYSERIAL.read(); serial_answer = ' ';
while(serial_answer!='y' && serial_answer!='Y' && serial_answer!='n' && serial_answer!='N'){ while(serial_answer!='y' && serial_answer!='Y' && serial_answer!='n' && serial_answer!='N'){
serial_answer = MYSERIAL.read(); serial_answer = MYSERIAL.read();
} }
...@@ -314,4 +316,5 @@ void FirmwareTest(){ ...@@ -314,4 +316,5 @@ void FirmwareTest(){
} }
SERIAL_ECHOLN("MOTOR OK"); SERIAL_ECHOLN("MOTOR OK");
SERIAL_ECHOLN(" "); SERIAL_ECHOLN(" ");
SERIAL_ECHO(MSG_FWTEST_END);
} }
...@@ -168,6 +168,7 @@ ...@@ -168,6 +168,7 @@
#define MSG_FWTEST_03 "Start check ENDSTOP" #define MSG_FWTEST_03 "Start check ENDSTOP"
#define MSG_FWTEST_04 "Start check MOTOR" #define MSG_FWTEST_04 "Start check MOTOR"
#define MSG_FWTEST_ATTENTION "ATTENTION! Check that the three axes are more than 5 mm from the endstop!" #define MSG_FWTEST_ATTENTION "ATTENTION! Check that the three axes are more than 5 mm from the endstop!"
#define MSG_FWTEST_END "Finish Test. Disable FIRMWARE_TEST and recompile."
#endif // FIRMWARE_TEST #endif // FIRMWARE_TEST
#endif // LANGUAGE_EN_H #endif // LANGUAGE_EN_H
...@@ -168,6 +168,7 @@ ...@@ -168,6 +168,7 @@
#define MSG_FWTEST_03 "Inizio controllo ENDSTOP" #define MSG_FWTEST_03 "Inizio controllo ENDSTOP"
#define MSG_FWTEST_04 "Inizio controllo MOTORI" #define MSG_FWTEST_04 "Inizio controllo MOTORI"
#define MSG_FWTEST_ATTENTION "ATTENZIONE! Controlla che i tre assi siano a piu' di 5 mm dagli endstop!" #define MSG_FWTEST_ATTENTION "ATTENZIONE! Controlla che i tre assi siano a piu' di 5 mm dagli endstop!"
#define MSG_FWTEST_END "Test finito. Disabilitare FIRMWARE_TEST e ricompilare."
#endif // FIRMWARE_TEST #endif // FIRMWARE_TEST
#endif // LANGUAGE_IT_H #endif // LANGUAGE_IT_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment