---
# System prepended metadata

title: vex-rt meeting 5/24/21

---

# vex-rt meeting 5/24/21

## Topics
1. Async Conversion
    - List of stuff to change
        - Examples?
2. Architecture of system

## Units
- Expose public use for crate

## Async
- Break up vex stuff into writable and readable
    - Motors break up
        - Writable not `Clone`, takes `&mut self`
            - No reverse at runtime, only on construction
        - Readable `Clone`, takes `&self`
    - Sensors don't
- Only spawn tasks through `spawn_blocking`
    - Returns Result that shows panic state

## Architecture
- Bypass competition scheduler
    - Don't let `initialize` return
- Use race future to go between competition states
    - Disabled
    - Op control
    - Autonomous
    - VEXAI is...a future issue
- Make `spawn_blocking` generate a task with `ShouldFinish`

## Math stuff (sin, cos)
- Hard
- Use intrinsics

## Panic-ing
- For worker tasks, mark as panicked and kill self
- For main task, kill program
- Make sure lo log with worst level ever
- Make sure it's painful to panic

## Display
- Use sdk for printing panics (vexDisplayVStringAt - see header for args)

### `embedded-graphics`
- Remove clearing the buffer after draw calls, make it optional using `embedded-graphics` clear
- New task
- In peripherals need display object, `embedded-graphics` needs to `From` that
- Pass buffer as owned to task and return back with future

### Direct SDK Calls
- New task
- Queue of calls
- Queue up a bunch and only await on the commit?
- Take reference from [here](https://github.com/purduesigbots/pros/blob/feature/remove-lvgl/src/display/graphics.c)

```rust=
fn sdk_call<T: Send>(&'a mut self, func: impl FnOnce(&mut Sdk) -> T + Send + 'static) -> impl Future<Output=Result<T, ()>> + Send + 'a{
    async{
        Err(())
    }
}

let f = screen.sdk_call(move |sdk| {
    sdk.clear();
    sdk.foo();
});

//screen.sdk_call(...);

f.await;
```

### Other
- Low level display wrapper (Directly call SDK functions)
- LLEMU
