Skip to content

Commit

Permalink
Correct timeout for schema retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmunns committed Nov 4, 2024
1 parent 236f874 commit 69b3d47
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion example/firmware/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/workbook-host/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion source/postcard-rpc-test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion source/postcard-rpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "postcard-rpc"
version = "0.10.4"
version = "0.10.5"
authors = ["James Munns <[email protected]>"]
edition = "2021"
repository = "https://github.com/jamesmunns/postcard-rpc"
Expand Down
26 changes: 11 additions & 15 deletions source/postcard-rpc/src/server/impls/embassy_usb_v0_3.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
//! Implementation using `embassy-usb` and bulk interfaces
use crate::{
header::{VarHeader, VarKey, VarKeyKind, VarSeq},
server::{WireRx, WireRxErrorKind, WireSpawn, WireTx, WireTxErrorKind},
standard_icd::LoggingTopic,
Topic,
};
use core::fmt::Arguments;
use core::sync::atomic::{AtomicU8, Ordering};
use embassy_executor::{SpawnError, SpawnToken, Spawner};
use embassy_futures::select::{select, Either};
use embassy_sync::{blocking_mutex::raw::RawMutex, mutex::Mutex};
use embassy_time::Timer;
use embassy_usb_driver::{Driver, EndpointError, EndpointIn, EndpointOut};
use serde::Serialize;

use crate::{
header::{VarHeader, VarKey, VarKeyKind, VarSeq},
server::{WireRx, WireRxErrorKind, WireSpawn, WireTx, WireTxErrorKind},
standard_icd::LoggingTopic,
Topic,
};

use core::sync::atomic::{Ordering, AtomicU8};
use static_cell::ConstStaticCell;

struct PoststationHandler {

}
struct PoststationHandler {}

static STINDX: AtomicU8 = AtomicU8::new(0xFF);
static HDLR: ConstStaticCell<PoststationHandler> = ConstStaticCell::new(PoststationHandler { });
static HDLR: ConstStaticCell<PoststationHandler> = ConstStaticCell::new(PoststationHandler {});

impl embassy_usb::Handler for PoststationHandler {
fn get_string(&mut self, index: embassy_usb::types::StringIndex, lang_id: u16) -> Option<&str> {
Expand Down Expand Up @@ -412,8 +408,8 @@ where
}

// Calculate an estimated timeout based on the number of frames we need to send
// For now, we use 2ms/frame
let frames = out.len() / 64;
// For now, we use 2ms/frame, rounded UP
let frames = (out.len() + 63) / 64;
let timeout_ms = frames * 2;

let send_fut = async {
Expand Down

0 comments on commit 69b3d47

Please sign in to comment.