forked from M-Labs/ionpak-thermostat
command_parser: s/CommandShow/ShowCommand/, delint
This commit is contained in:
parent
0dcd35c9f2
commit
44f5a8338c
|
@ -1,4 +1,4 @@
|
||||||
use logos::{Logos, Lexer};
|
use logos::Logos;
|
||||||
use super::session::ReportMode;
|
use super::session::ReportMode;
|
||||||
|
|
||||||
#[derive(Logos, Debug, PartialEq)]
|
#[derive(Logos, Debug, PartialEq)]
|
||||||
|
@ -37,14 +37,14 @@ pub enum Error {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum CommandShow {
|
pub enum ShowCommand {
|
||||||
ReportMode,
|
ReportMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
Quit,
|
Quit,
|
||||||
Show(CommandShow),
|
Show(ShowCommand),
|
||||||
Report(ReportMode),
|
Report(ReportMode),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ impl Command {
|
||||||
Quit => Ok(Command::Quit),
|
Quit => Ok(Command::Quit),
|
||||||
Report => choice![
|
Report => choice![
|
||||||
Mode => choice![
|
Mode => choice![
|
||||||
End => Ok(Command::Show(CommandShow::ReportMode)),
|
End => Ok(Command::Show(ShowCommand::ReportMode)),
|
||||||
Off => Ok(Command::Report(ReportMode::Off)),
|
Off => Ok(Command::Report(ReportMode::Off)),
|
||||||
Once => Ok(Command::Report(ReportMode::Once)),
|
Once => Ok(Command::Report(ReportMode::Once)),
|
||||||
Continuous => Ok(Command::Report(ReportMode::Continuous)),
|
Continuous => Ok(Command::Report(ReportMode::Continuous)),
|
||||||
|
|
|
@ -35,7 +35,7 @@ mod board;
|
||||||
use self::board::{gpio::Gpio, systick::get_time};
|
use self::board::{gpio::Gpio, systick::get_time};
|
||||||
mod ethmac;
|
mod ethmac;
|
||||||
mod command_parser;
|
mod command_parser;
|
||||||
use command_parser::{Command, CommandShow};
|
use command_parser::{Command, ShowCommand};
|
||||||
mod session;
|
mod session;
|
||||||
use self::session::{Session, SessionOutput};
|
use self::session::{Session, SessionOutput};
|
||||||
mod ad7172;
|
mod ad7172;
|
||||||
|
@ -227,7 +227,7 @@ fn main() -> ! {
|
||||||
Ok(SessionOutput::Command(Command::Report(mode))) => {
|
Ok(SessionOutput::Command(Command::Report(mode))) => {
|
||||||
let _ = writeln!(socket, "Report mode: {:?}", mode);
|
let _ = writeln!(socket, "Report mode: {:?}", mode);
|
||||||
}
|
}
|
||||||
Ok(SessionOutput::Command(Command::Show(CommandShow::ReportMode))) => {
|
Ok(SessionOutput::Command(Command::Show(ShowCommand::ReportMode))) => {
|
||||||
let _ = writeln!(socket, "Report mode: {:?}", session.report_mode());
|
let _ = writeln!(socket, "Report mode: {:?}", session.report_mode());
|
||||||
}
|
}
|
||||||
Ok(SessionOutput::Command(command)) => {
|
Ok(SessionOutput::Command(command)) => {
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl LineReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn feed(&mut self, c: u8) -> Option<&str> {
|
pub fn feed(&mut self, c: u8) -> Option<&str> {
|
||||||
if (c == 13 || c == 10) {
|
if c == 13 || c == 10 {
|
||||||
// Enter
|
// Enter
|
||||||
if self.pos > 0 {
|
if self.pos > 0 {
|
||||||
let len = self.pos;
|
let len = self.pos;
|
||||||
|
|
Loading…
Reference in New Issue