mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-26 13:25:54 +00:00
🧑💻 Guard queue advance_r
This commit is contained in:
parent
94e9f26544
commit
b53e14c7f8
@ -101,7 +101,7 @@ void GCodeQueue::RingBuffer::commit_command(const bool skip_ok
|
||||
commands[index_w].skip_ok = skip_ok;
|
||||
TERN_(HAS_MULTI_SERIAL, commands[index_w].port = serial_ind);
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.commit_sdpos(index_w));
|
||||
advance_pos(index_w, 1);
|
||||
advance_w();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -702,7 +702,7 @@ void GCodeQueue::advance() {
|
||||
#endif // HAS_MEDIA
|
||||
|
||||
// The queue may be reset by a command handler or by code invoked by idle() within a handler
|
||||
ring_buffer.advance_pos(ring_buffer.index_r, -1);
|
||||
ring_buffer.advance_r();
|
||||
}
|
||||
|
||||
#if ENABLED(BUFFER_MONITORING)
|
||||
|
@ -78,6 +78,8 @@ public:
|
||||
inline void clear() { length = index_r = index_w = 0; }
|
||||
|
||||
void advance_pos(uint8_t &p, const int inc) { if (++p >= BUFSIZE) p = 0; length += inc; }
|
||||
inline void advance_w() { advance_pos(index_w, 1); }
|
||||
inline void advance_r() { if (length) advance_pos(index_r, -1); }
|
||||
|
||||
void commit_command(const bool skip_ok
|
||||
OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind=serial_index_t())
|
||||
|
Loading…
Reference in New Issue
Block a user