Run formatter on framing file.

This commit is contained in:
connor rigby 2018-05-16 16:10:49 -07:00
parent f46b8a36eb
commit afb8b0532c
No known key found for this signature in database
GPG key ID: 24DC438382965C3B
2 changed files with 18 additions and 5 deletions

5
.formatter.exs Normal file
View file

@ -0,0 +1,5 @@
# Used by "mix format"
[
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"],
line_length: 80
]

View file

@ -42,10 +42,18 @@ defmodule Farmbot.Firmware.UartHandler.Framing do
separator = Keyword.get(args, :separator, "\n") separator = Keyword.get(args, :separator, "\n")
log_input = log_input =
Farmbot.System.ConfigStorage.get_config_value(:bool, "settings", "firmware_input_log") Farmbot.System.ConfigStorage.get_config_value(
:bool,
"settings",
"firmware_input_log"
)
log_output = log_output =
Farmbot.System.ConfigStorage.get_config_value(:bool, "settings", "firmware_output_log") Farmbot.System.ConfigStorage.get_config_value(
:bool,
"settings",
"firmware_output_log"
)
state = %State{ state = %State{
max_length: max_length, max_length: max_length,
@ -89,7 +97,8 @@ defmodule Farmbot.Firmware.UartHandler.Framing do
{:ok, [partial_line], new_state} {:ok, [partial_line], new_state}
end end
def flush(direction, state) when direction == :receive or direction == :both do def flush(direction, state)
when direction == :receive or direction == :both do
%{state | processed: <<>>, in_process: <<>>} %{state | processed: <<>>, in_process: <<>>}
end end
@ -141,8 +150,7 @@ defmodule Farmbot.Firmware.UartHandler.Framing do
) )
# Handle line too long case # Handle line too long case
to_process to_process when byte_size(processed) == max_length and to_process != <<>> ->
when byte_size(processed) == max_length && to_process != <<>> ->
new_lines = lines ++ [{:partial, processed}] new_lines = lines ++ [{:partial, processed}]
process_data( process_data(