Skip to content

Commit 8cf276b

Browse files
committed
inky73: Add busy wait timeout.
Add a timeout to fix Inky 7.3" hanging on batteries. Basically assumes the update has finished if it takes > 45s, and allows a subsequent attempt rather than hanging indefinitely. Raised, texted and fixed by w3stbam: #900 Rewritten as mentioned in the PR.
1 parent f1ea35f commit 8cf276b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

drivers/inky73/inky73.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ namespace pimoroni {
4747
return !(sr.read() & 128);
4848
}
4949

50-
void Inky73::busy_wait() {
51-
while(is_busy()) {
50+
void Inky73::busy_wait(uint timeout_ms) {
51+
absolute_time_t timeout = make_timeout_time_ms(timeout_ms);
52+
while(is_busy() && !time_reached(timeout)) {
5253
tight_loop_contents();
5354
}
5455
}

drivers/inky73/inky73.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace pimoroni {
7070
// Methods
7171
//--------------------------------------------------
7272
public:
73-
void busy_wait();
73+
void busy_wait(uint timeout_ms=45000);
7474
void reset();
7575
void power_off();
7676

0 commit comments

Comments
 (0)