Skip to content

Commit

Permalink
Multiple small improvement (#12)
Browse files Browse the repository at this point in the history
* multiple improvement

* provide a tree
  • Loading branch information
XdoctorwhoZ authored Dec 30, 2024
1 parent 58c8adb commit 996c6f1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,25 @@ Panduza Virtual Instruments
```bash
cargo install cargo-post
cargo post build --features plugin
```
```




# full usage


```json
{
"devices": [
{
"name": "Virtual REPL",
"dref": "vi.repl"
},
{
"name": "Attribute Tester",
"dref": "vi.tester"
}
]
}
```
4 changes: 3 additions & 1 deletion src/tester/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ impl DriverOperations for Device {
async fn mount(&mut self, instance: Instance) -> Result<(), Error> {
string_ro_wo::mount(instance.clone()).await?;
bool_ro_wo::mount(instance.clone()).await?;
enum_ro_wo::mount(instance.clone()).await?;
enum_ro_wo::mount(instance.clone(), 0).await?;
enum_ro_wo::mount(instance.clone(), 1).await?;
enum_ro_wo::mount(instance.clone(), 2).await?;
json_ro_wo::mount(instance.clone()).await?;
number_ro_wo::mount(instance.clone()).await?;
si_ro_wo::mount(instance.clone()).await?;
Expand Down
4 changes: 2 additions & 2 deletions src/tester/device/enum_ro_wo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use panduza_platform_core::{
///
///
///
pub async fn mount(mut instance: Instance) -> Result<(), Error> {
pub async fn mount(mut instance: Instance, id: usize) -> Result<(), Error> {
//
// Create interface
let mut class = instance.create_class("enum").finish().await;
let mut class = instance.create_class(format!("enum_{}", id)).finish().await;

//
// Some of the first contributors (sorted by alphabetic order)
Expand Down
6 changes: 3 additions & 3 deletions src/tester/device/si_ro_wo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub async fn mount(mut instance: Instance) -> Result<(), Error> {
.create_attribute("si_ro")
.with_ro()
.with_info(r#"read command"#)
.finish_as_si("test", 0.0, 100.0, 2)
.finish_as_si("Ω", -20.0, 100.0, 2)
.await?;
att_si_ro.set_from_f32(0.0).await?;

Expand All @@ -26,7 +26,7 @@ pub async fn mount(mut instance: Instance) -> Result<(), Error> {
.create_attribute("si_wo")
.with_wo()
.with_info(r#"write command"#)
.finish_as_si("test", 0.0, 100.0, 2)
.finish_as_si("Ω", -20.0, 100.0, 2)
.await?;

//
Expand All @@ -45,7 +45,7 @@ pub async fn mount(mut instance: Instance) -> Result<(), Error> {
.create_attribute("si_rw")
.with_rw()
.with_info(r#"read write command"#)
.finish_as_si("test", 0.0, 100.0, 2)
.finish_as_si("Ω", -20.0, 100.0, 2)
.await?;
att_si_rw.set_from_f32(0.0).await?;

Expand Down

0 comments on commit 996c6f1

Please sign in to comment.