anchor.diff:  %%  Executes hostmode resync procedure: sends 1's till error is received.
   %%
   resync_hostmode(Port) ->
  -    resync_hostmode(Port, ?RESYNC_LEN).
  +    resync_hostmode(Port, ?RESYNC_ATTEMPTS).
   
   resync_hostmode(_Port, 0) ->
       {error, unable_to_sync};
   
   resync_hostmode(Port, Count) when Count > 0 ->
       ok = uart:send(Port, <<1>>),
  -    case uart:recv(Port, 1, 100) of
  +    case uart:recv(Port, 1, ?RESYNC_DELAY) of
           {ok, <<?HM_CHANNEL1>>} ->
               % Assume <<1>> is channel number. Now we expect of <<2>> -- error indicator.
               % If <<2>> received, read zero-ended error message and assume sync'ed state.
  -            case uart:recv(Port, 1, 100) of
  +            case uart:recv(Port, 1, ?RESYNC_DELAY) of
                   {ok, <<?HM_CODE_FAILURE>>} ->
                       {ok, ErrMsg} = read_zstr(Port),
                       lager:debug("Expexted error ~p received, synced!", [ErrMsg]),
  
positive.code: -compile([{parse_transform, lager_transform}]).
  -behavour(gen_server).
  -behaviour(ls1mcs_protocol).
  -export([start_link/3, send/2, received/2]). % Public API
  -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
  
  %%
  %%  See ASCII for more details.
  %%
  -define(DC1, 16#11).
  -define(CAN, 16#18).
  -define(ESC, 16#1B).
  -define(CR,  16#0D).
  
  -define(HM_CHANNEL0, 0).
  -define(HM_CHANNEL1, 1).
  
negative.code: %%  Reads length-prefixed data.
  %%
  read_lstr(Port) ->
      case uart:recv(Port, 1, ?BLOCK_READ_TIMEOUT) of
          {ok, <<ByteCount:8>>} ->
              case uart:recv(Port, ByteCount, ?BLOCK_READ_TIMEOUT) of
                  {ok, Message} -> {ok, Message};
                  {error, timeout} -> {error, timeout}
              end;
  