Skip to content

Commit 67d1205

Browse files
committed
Redo config options
1 parent f99dd18 commit 67d1205

File tree

5 files changed

+417
-354
lines changed

5 files changed

+417
-354
lines changed

esp-radio/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4848
- Event handlers are now passed the event by reference (#4113)
4949
- Some build-time configuration options have been replaced by runtime options in `WifiConfig` (#4121)
5050
- Update to bt-hci version with flash usage improvements (#4146, #4165)
51+
- `scan_mode`, `(ap_)beacon_timeout`, `listen_interval` and `failure_retry_cnt` config options have been replaced by runtime options in `AccessPointConfig`, `ClientConfig` and `EapClientConfig` (#4224)
52+
- The `ieee802154_rx_queue_size` config option has been replaced by a runtime option in `esp_radio::ieee802154::Config` (#4224)
5153

5254
### Fixed
5355

esp-radio/esp_config.yml

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -15,88 +15,7 @@ options:
1515
- type:
1616
validator: positive_integer
1717

18-
# TODO Should be part of ClientConfig
19-
- name: listen_interval
20-
description: 'Interval for station to listen to beacon from AP.
21-
The unit of listen interval is one beacon interval.
22-
For example, if beacon interval is 100 ms and listen interval is 3,
23-
the interval for station to listen to beacon is 300 ms'
24-
default:
25-
- value: 3
26-
27-
# TODO Should be part of ClientConfig
28-
- name: beacon_timeout
29-
description: 'For Station, If the station does not receive a beacon frame
30-
from the connected SoftAP during the inactive time, disconnect from SoftAP.
31-
Default 6s. Range 6-30'
32-
default:
33-
- value: 6
34-
constraints:
35-
- type:
36-
validator: integer_in_range
37-
value:
38-
start: 6
39-
end: 31
40-
41-
# TODO Should be part of ApConfig
42-
- name: ap_beacon_timeout
43-
description: "For SoftAP, If the SoftAP doesn't receive any data from the connected STA
44-
during inactive time, the SoftAP will force deauth the STA. Default is 300s"
45-
default:
46-
- value: 300
47-
48-
# TODO Should be part of ClientConfig
49-
- name: failure_retry_cnt
50-
description: "Number of connection retries station will do before moving to next AP.
51-
scan_method should be set as WIFI_ALL_CHANNEL_SCAN to use this config.
52-
Note: Enabling this may cause connection time to increase incase best AP
53-
doesn't behave properly. Defaults to 1"
54-
default:
55-
- value: 1
56-
constraints:
57-
- type:
58-
validator: positive_integer
59-
60-
# TODO: this is a scan API argument
61-
- name: scan_method
62-
description: "0 = WIFI_FAST_SCAN, 1 = WIFI_ALL_CHANNEL_SCAN, defaults to 0"
63-
default:
64-
- value: 0
65-
constraints:
66-
- type:
67-
validator: integer_in_range
68-
value:
69-
start: 0
70-
end: 2
71-
7218
- name: dump_packets
7319
description: "Dump packets via an info log statement"
7420
default:
7521
- value: false
76-
77-
# TODO: Should these be esp_radio::init config options?
78-
- name: phy_enable_usb
79-
description: "Keeps USB running when using WiFi.
80-
This allows debugging and log messages via USB Serial JTAG.
81-
Turn off for best WiFi performance."
82-
default:
83-
- value: true
84-
85-
- name: phy_skip_calibration_after_deep_sleep
86-
description: "Use PHY_RF_CAL_NONE after deep sleep."
87-
default:
88-
- value: false
89-
90-
- name: phy_full_calibration
91-
description: "Use PHY_RF_CAL_FULL instead of PHY_RF_CAL_PARTIAL."
92-
default:
93-
- value: true
94-
95-
# TODO: This could be a config option for Ieee802154::new
96-
- name: ieee802154_rx_queue_size
97-
description: Size of the RX queue in frames
98-
default:
99-
- value: 10
100-
constraints:
101-
- type:
102-
validator: positive_integer

esp-radio/src/ieee802154/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ pub struct Config {
8484
pub pan_id: Option<u16>,
8585
pub short_addr: Option<u16>,
8686
pub ext_addr: Option<u64>,
87+
pub rx_queue_size: usize,
8788
}
8889

8990
impl Default for Config {
@@ -102,6 +103,7 @@ impl Default for Config {
102103
pan_id: None,
103104
short_addr: None,
104105
ext_addr: None,
106+
rx_queue_size: 10,
105107
}
106108
}
107109
}
@@ -157,6 +159,8 @@ impl<'a> Ieee802154<'a> {
157159

158160
set_extended_address(0, address);
159161
}
162+
163+
raw::set_queue_size(cfg.rx_queue_size);
160164
}
161165

162166
/// Start receiving frames

esp-radio/src/ieee802154/raw.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,18 @@ use super::{
2929

3030
const PHY_ENABLE_VERSION_PRINT: u8 = 1;
3131

32-
const RX_QUEUE_SIZE: usize =
33-
esp_config::esp_config_int!(usize, "ESP_RADIO_CONFIG_IEEE802154_RX_QUEUE_SIZE");
34-
3532
static mut RX_BUFFER: [u8; FRAME_SIZE] = [0u8; FRAME_SIZE];
3633

3734
struct IeeeState {
3835
state: Ieee802154State,
3936
rx_queue: Queue<RawReceived>,
37+
rx_queue_size: usize,
4038
}
4139

4240
static STATE: NonReentrantMutex<IeeeState> = NonReentrantMutex::new(IeeeState {
4341
state: Ieee802154State::Idle,
4442
rx_queue: Queue::new(),
43+
rx_queue_size: 10,
4544
});
4645

4746
unsafe extern "C" {
@@ -186,6 +185,12 @@ pub fn tx_init(frame: *const u8) {
186185
}
187186
}
188187

188+
pub(crate) fn set_queue_size(rx_queue_size: usize) {
189+
STATE.with(|state| {
190+
state.rx_queue_size = rx_queue_size;
191+
});
192+
}
193+
189194
pub fn ieee802154_transmit(frame: *const u8, cca: bool) -> i32 {
190195
STATE.with(|state| {
191196
tx_init(frame);
@@ -385,7 +390,7 @@ fn zb_mac_handler() {
385390
);
386391
let mut state_for_notify = Ieee802154State::Idle;
387392
STATE.with(|state| {
388-
if state.rx_queue.len() <= RX_QUEUE_SIZE {
393+
if state.rx_queue.len() <= state.rx_queue_size {
389394
let item = RawReceived {
390395
data: RX_BUFFER,
391396
channel: freq_to_channel(freq()),

0 commit comments

Comments
 (0)