From 630635486e7c4f9cbbd755a11a2548063a5b72ea Mon Sep 17 00:00:00 2001 From: Egor Savkin Date: Fri, 23 Dec 2022 13:23:18 +0800 Subject: [PATCH] Polish minor issues Signed-off-by: Egor Savkin --- README.md | 2 +- flake.nix | 2 +- src/command_parser.rs | 12 +++++++++++- src/main.rs | 4 ++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b7187ba..e66c5b5 100644 --- a/README.md +++ b/README.md @@ -286,4 +286,4 @@ Please note that power doesn't correlate with the actual speed linearly. 3. `fcurve ` - set coefficients of the controlling curve `a*x^2 + b*x + c`, where `x` is `abs_max_tec_i/MAX_TEC_I`, i.e. receives values from 0 to 1 linearly tied to the maximum current. The controlling curve should produce values from 0 to 1, as below and beyond values would be substituted by 0 and 1 respectively. -4. `fan-restore` - restore fan settings to defaults: `auto = true, a = 1.0, b = 0.0, c = 0.0`. +4. `fan-restore` - restore fan settings to defaults: `auto = true, a = 1.0, b = 0.0, c = 0.04`. diff --git a/flake.nix b/flake.nix index 02b7c70..c28f806 100644 --- a/flake.nix +++ b/flake.nix @@ -69,7 +69,7 @@ buildInputs = with pkgs; [ rustPlatform.rust.rustc rustPlatform.rust.cargo - openocd dfu-util gcc-arm-embedded-10 + openocd dfu-util ] ++ (with python3Packages; [ numpy matplotlib ]); diff --git a/src/command_parser.rs b/src/command_parser.rs index df2372b..497b741 100644 --- a/src/command_parser.rs +++ b/src/command_parser.rs @@ -1,7 +1,17 @@ use core::fmt; use core::num::ParseIntError; use core::str::{from_utf8, Utf8Error}; -use nom::{IResult, branch::alt, bytes::complete::{is_a, tag, take_while1}, character::{is_digit, complete::{char, one_of}}, combinator::{complete, map, opt, value}, sequence::preceded, multi::{fold_many0, fold_many1}, error::ErrorKind, Needed}; +use nom::{ + IResult, + branch::alt, + bytes::complete::{is_a, tag, take_while1}, + character::{is_digit, complete::{char, one_of}}, + combinator::{complete, map, opt, value}, + sequence::preceded, + multi::{fold_many0, fold_many1}, + error::ErrorKind, + Needed, +}; use num_traits::{Num, ParseFloatError}; use serde::{Serialize, Deserialize}; diff --git a/src/main.rs b/src/main.rs index 1005315..dd1263e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -138,9 +138,9 @@ fn main() -> ! { usb::State::setup(usb); - let mut channels = RefCell::new(Channels::new(pins)); - let mut store = flash_store::store(dp.FLASH); + + let mut channels = RefCell::new(Channels::new(pins)); for c in 0..CHANNELS { match store.read_value::(CHANNEL_CONFIG_KEY[c]) { Ok(Some(config)) =>