本文为在用龙芯1c做3D打印机过程中的笔记。龙芯1c做的3d打印机简称“龙印”
参考了以下两篇博文,再其基础上增加了对marlin源码的注解和我的一些理解。
http://blog.sina.com.cn/s/blog_6ad165790102vo09.html
http://blog.sina.com.cn/s/blog_679933490102vv8z.html
先来看一下
marlin中bresenham算法的相关代码。源码位于源文件“Marlin\stepper.cpp”中的函数ISR(TIMER1_COMPA_vect)内。如下
// If there is no current block, attempt to pop one from the buffer
if (!current_block) {
// Anything in the buffer?
current_block = plan_get_current_block();
if (current_block) {
current_block->busy = true;
trapezoid_generator_reset();
counter_x = -(current_block->step_event_count >> 1);
counter_y = counter_z = counter_e = counter_x;
step_events_completed = 0;
#if ENABLED(Z_LATE_ENABLE)
if (current_block->steps[Z_AXIS] > 0) {
enable_z();
OCR1A = 2000; //1ms wait
return;
}
#endif
// #if ENABLED(ADVANCE)
// e_steps[current_block->active_extruder] = 0;
// #endif
}
else {
OCR1A = 2000; // 1kHz.
}
}
if (current_block != NULL) {
// Update endstops state, if enabled
#if ENABLED(HAS_Z_MIN_PROBE)
if (check_endstops || z_probe_is_active) update_endstops();
#else
if (check_endstops) update_endstops();
#endif
// Take multiple steps per interrupt (For
版权声明:本文为caogos原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。