Quantcast
Channel: Reprap Forum - Firmware - Marlin
Viewing all articles
Browse latest Browse all 12090

Programming custom G29 command (Marlin)

$
0
0
Hi to you all,
I have a problem with my 3D printer. The original firmware was really bad. So I set out to write my own firmware. The printer is a rather obscure one with what I think is a one of a kind table calibration method.

Here is a video of the original firmware at work.
[www.youtube.com]

I'm trying to write a custom G29 command in Marlin_main.cpp. This is way above my head. I'm a absolute beginner.
What I have done so far is deleting all the code surrounding the G29 code. I successfully programmed most of the movements in my new G29 code. The rotating disc however remains problematic. I wrote a simple program which worked fine on its own. When I copy paste this simple program into the Marlin, it works for only several seconds. Then the whole printer freezes. All steppers are disabled and it is impossible to connect to the printer. It seams like some kind of time out.

Here are the problematic parts of the code. The problem happens within the for loop and while loop. This is a part of Marlin_main.cpp
Quote

st_synchronize();
refresh_cmd_timeout(); // to prevent stepper_inactive_time from running out

//0. Declareren variabelen
int Speed = 500; /

//Posities voor tafel calibratie
int BedPositieA = 2400;
int BedPositieB = 4500;
int BedPositieC = 7000;

pinMode(BED_ENABLE_PIN, OUTPUT);//Enable
pinMode(BED_DIR_PIN, OUTPUT);//direction
pinMode(BED_STEP_PIN, OUTPUT);//step
pinMode(BED_ENDSTOP_PIN, INPUT); //z+ eindstop voor tafel

digitalWrite(BED_ENABLE_PIN,LOW); //Enable

deleted working code

st_synchronize();
for (int i=0; i <= (BedPositieB-BedPositieA); i++){
digitalWrite(BED_DIR_PIN,LOW);
digitalWrite(BED_STEP_PIN,HIGH);
delayMicroseconds(Speed);
digitalWrite(BED_STEP_PIN,LOW);
delayMicroseconds(Speed);
}
refresh_cmd_timeout();

deleted working code

st_synchronize();
for (int i=0; i <= BedPositieA; i++){
digitalWrite(BED_DIR_PIN,LOW);
digitalWrite(BED_STEP_PIN,HIGH);
delayMicroseconds(Speed);
digitalWrite(BED_STEP_PIN,LOW);
delayMicroseconds(Speed);
}
refresh_cmd_timeout();

Does anyone know why Marlin shuts the program down after some seconds?

Viewing all articles
Browse latest Browse all 12090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>