Skip to content

Commit 7ef74ee

Browse files
authored
Merge pull request #32 from Jim-Hodapp-Coaching/fix_number_of_params_issue
fix number_of_params issue
2 parents 2122e43 + f596fcc commit 7ef74ee

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

esp32-wroom-rp/src/spi.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ where
7070
}
7171

7272
/// Retrieves the current WiFi network connection status.
73-
///
73+
///
7474
/// NOTE: A future version will provide a enumerated type instead of the raw integer values
7575
/// from the NINA firmware.
7676
pub fn get_connection_status(&mut self) -> Result<u8, Error> {
@@ -147,8 +147,14 @@ where
147147
fn execute<P: NinaParam>(&mut self, operation: &Operation<P>) -> Result<(), Error> {
148148
let mut param_size: u16 = 0;
149149
self.control_pins.wait_for_esp_select();
150-
151-
self.send_cmd(&operation.command, operation.params.len() as u8).ok().unwrap();
150+
let number_of_params: u8 = if operation.has_params {
151+
operation.params.len() as u8
152+
} else {
153+
0
154+
};
155+
self.send_cmd(&operation.command, number_of_params)
156+
.ok()
157+
.unwrap();
152158

153159
// Only send params if they are present
154160
if operation.has_params {

0 commit comments

Comments
 (0)