Skip to content

Commit 79eb389

Browse files
committed
Fixing Copilot findings (6)
1 parent bdea521 commit 79eb389

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

shared-bindings/qspibus/QSPIBus.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,14 @@ static mp_obj_t qspibus_qspibus_send(size_t n_args, const mp_obj_t *pos_args, mp
139139
len = data_bufinfo.len;
140140
}
141141

142+
// Flush any pending command from a prior write_command() call.
143+
// begin_transaction() returns false while has_pending_command is set,
144+
// so entering the wait loop without flushing would spin forever.
145+
if (self->has_pending_command) {
146+
common_hal_qspibus_qspibus_write_data(self, NULL, 0);
147+
}
148+
142149
// Wait for display bus to be available, then acquire transaction.
143-
// Mirrors FourWire.send() pattern: begin_transaction → send → end_transaction.
144150
while (!common_hal_qspibus_qspibus_begin_transaction(MP_OBJ_FROM_PTR(self))) {
145151
RUN_BACKGROUND_TASKS;
146152
}

0 commit comments

Comments
 (0)