Simplifying settings lock

This commit is contained in:
Ryan Summers 2021-05-07 13:04:25 +02:00
parent 7b76b1f14c
commit d68fa87fec
2 changed files with 8 additions and 14 deletions

View File

@ -193,19 +193,16 @@ const APP: () = {
let telemetry: TelemetryBuffer = let telemetry: TelemetryBuffer =
c.resources.telemetry.lock(|telemetry| *telemetry); c.resources.telemetry.lock(|telemetry| *telemetry);
let gains: [AfeGain; 2] = let (gains, telemetry_period) = c
c.resources.settings.lock(|settings| settings.afe); .resources
.settings
.lock(|settings| (settings.afe, settings.telemetry_period));
c.resources c.resources
.network .network
.telemetry .telemetry
.publish(&telemetry.finalize(gains[0], gains[1])); .publish(&telemetry.finalize(gains[0], gains[1]));
let telemetry_period = c
.resources
.settings
.lock(|settings| settings.telemetry_period);
// Schedule the telemetry task in the future. // Schedule the telemetry task in the future.
c.schedule c.schedule
.telemetry( .telemetry(

View File

@ -275,19 +275,16 @@ const APP: () = {
c.resources.digital_inputs.1.is_high().unwrap(), c.resources.digital_inputs.1.is_high().unwrap(),
]; ];
let gains: [AfeGain; 2] = let (gains, telemetry_period) = c
c.resources.settings.lock(|settings| settings.afe); .resources
.settings
.lock(|settings| (settings.afe, settings.telemetry_period));
c.resources c.resources
.network .network
.telemetry .telemetry
.publish(&telemetry.finalize(gains[0], gains[1])); .publish(&telemetry.finalize(gains[0], gains[1]));
let telemetry_period = c
.resources
.settings
.lock(|settings| settings.telemetry_period);
// Schedule the telemetry task in the future. // Schedule the telemetry task in the future.
c.schedule c.schedule
.telemetry( .telemetry(