Skip to content

Commit 87a7bf5

Browse files
committed
Support for the ESP-IDF framework
1 parent c67765d commit 87a7bf5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/reactor.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ cfg_if::cfg_if! {
4343
}
4444
}
4545

46+
#[cfg(not(target_os = "espidf"))]
47+
const TIMER_QUEUE_SIZE: usize = 1000;
48+
49+
/// ESP-IDF - being an embedded OS - does not need so many timers
50+
/// and this saves ~ 20K RAM which is a lot for an MCU with RAM < 400K
51+
#[cfg(target_os = "espidf")]
52+
const TIMER_QUEUE_SIZE: usize = 100;
53+
4654
const READ: usize = 0;
4755
const WRITE: usize = 1;
4856

@@ -98,7 +106,7 @@ impl Reactor {
98106
sources: Mutex::new(Slab::new()),
99107
events: Mutex::new(Vec::new()),
100108
timers: Mutex::new(BTreeMap::new()),
101-
timer_ops: ConcurrentQueue::bounded(1000),
109+
timer_ops: ConcurrentQueue::bounded(TIMER_QUEUE_SIZE),
102110
}
103111
})
104112
}

0 commit comments

Comments
 (0)