static uint8_t _sync_to_planner() { if (mp_get_planner_buffers_available() == 0) { return (TG_EAGAIN); } return (TG_OK); }
static stat_t _sync_to_planner() { if (mp_get_planner_buffers_available() < PLANNER_BUFFER_HEADROOM) { // allow up to N planner buffers for this line return (STAT_EAGAIN); } return (STAT_OK); }
void rpt_request_queue_report(int8_t buffers) //void rpt_request_queue_report() { if (cfg.queue_report_verbosity == QR_OFF) return; qr.buffers_available = mp_get_planner_buffers_available(); if (buffers > 0) { qr.buffers_added += buffers; } else { qr.buffers_removed -= buffers; } // perform filtration for QR_FILTERED reports if (cfg.queue_report_verbosity == QR_FILTERED) { if (qr.buffers_available == qr.prev_available) { return; } if ((qr.buffers_available > cfg.queue_report_lo_water) && // e.g. > 2 buffers available (qr.buffers_available < cfg.queue_report_hi_water)) { // e.g. < 20 buffers available return; } } qr.prev_available = qr.buffers_available; qr.request = true; }
stat_t cm_arc_cycle_callback() { if (arc.run_state == MOVE_OFF) { return (STAT_NOOP);} if (mp_get_planner_buffers_available() < PLANNER_BUFFER_HEADROOM) { return (STAT_EAGAIN);} arc.theta += arc.segment_theta; arc.gm.target[arc.plane_axis_0] = arc.center_0 + sin(arc.theta) * arc.radius; arc.gm.target[arc.plane_axis_1] = arc.center_1 + cos(arc.theta) * arc.radius; arc.gm.target[arc.linear_axis] += arc.segment_linear_travel; mp_aline(&arc.gm); // run the line copy_vector(arc.position, arc.gm.target); // update arc current position if (--arc.segment_count > 0) return (STAT_EAGAIN); arc.run_state = MOVE_OFF; return (STAT_OK); }