Skip to content

Commit

Permalink
Merge pull request #235 from BitsAndDroids/main
Browse files Browse the repository at this point in the history
App v0.6.1
  • Loading branch information
BitsAndDroids authored Sep 14, 2024
2 parents faa3292 + 65c715c commit c1ed348
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ class BitsAndDroidsFlightConnector {
String getVersion() { return "0.9.9.9"; }
void send(int command);
void switchHandling();
void getConnected() { return connected; };
int getConnected() { return connected; };
void checkConnection();
void dataHandling();
void simpleInputHandling(int throttlePin);
Expand Down
2 changes: 1 addition & 1 deletion crates/src-tauri/connector_library/library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Bits and Droids flight sim library
version=1.6.15
version=1.6.16
author=Bits and Droids <[email protected]>
maintainer=Bits and Droids <[email protected]>
sentence=Use serial communication to control Microsoft Flight Simulator 2020.
Expand Down
6 changes: 6 additions & 0 deletions crates/src-tauri/src/events/wasm_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ impl WASMRegistry {
self.wasm_default_events.clone()
}

pub fn set_wasm_output_value(&mut self, output_id: u32, value: f64) {
if let Some(output) = self.wasm_outputs.get_mut(&output_id) {
output.value = value;
}
}

pub fn register_wasm_inputs_to_simconnect(&self, conn: &mut simconnect::SimConnector) {
for wasm_input in self.wasm_inputs.values() {
let wasm_event = WasmEvent {
Expand Down
13 changes: 9 additions & 4 deletions crates/src-tauri/src/simconnect_mod/simconnect_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ impl SimconnectHandler {
);

// Mutably borrow self.output_registry to set the value
// TODO: refactor to return result instead
self.output_registry.set_output_value(output_id, value);
self.wasm_registry.set_wasm_output_value(output_id, value);

// After setting the value, we only need immutable access to output_registry
let output = match self.output_registry.get_output_by_id(output_id) {
Expand Down Expand Up @@ -322,10 +324,13 @@ impl SimconnectHandler {
let output_value = {
let output = match self.output_registry.get_output_by_id(output_id) {
Some(output) => output,
None => {
warn!(target: "output", "Output does not exist: {}", output_id);
return;
}
None => match self.wasm_registry.get_wasm_output_by_id(output_id) {
Some(output) => output,
None => {
warn!(target: "output", "Output does not exist: {}", output_id);
return;
}
},
};
output.value
};
Expand Down
2 changes: 1 addition & 1 deletion crates/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.6.0",
"version": "0.6.1",
"build": {
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm run build",
Expand Down

0 comments on commit c1ed348

Please sign in to comment.