anchor.diff:  -export([init/1, handle_event/3, handle_sync_event/4, handle_info/3,
            terminate/3, code_change/4]).
   
  --export([wait_for_hw_version/2, wait_for_dmx/2, wait_for_dmx_change/2]).
  -
  --record(state, {uart, dmxin = none}).
  +-export([wait_for_hw_version/2, get_parameters/2, get_parameters2/2,
  +         wait_for_dmx/2, wait_for_dmx_change/2]).
  +
  +-record(state, {uart, options = #{}, dmxin = none}).
   
   -type enttec_widget_opts() :: #{device => file:filename()}.
   
   -type enttec_packet_type() ::
       assign_ports | change_of_state | flash_page | get_hw_version |
  -    get_parameters | get_serial | receive_dmx_on_change | received_dmx |
  -    reprogram_firmware | send_dmx | send_dmx2 | send_rdm | send_rdm_discovery |
  -    set_parameters.
  +    get_parameters | get_parameters2 | get_serial | receive_dmx_on_change |
  +    received_dmx | reprogram_firmware | send_dmx | send_dmx2 | send_rdm |
  +    send_rdm_discovery | set_parameters | set_parameters2.
   
   -spec start_widget(enttec_widget_opts()) ->
       {ok, pid()} | ignore | {error, term()}.
  
positive.code:     uart:send(State#state.uart, EnableApi),
      {ok, AssignPorts} = encode_packet(assign_ports, {1, 1}),
      uart:send(State#state.uart, AssignPorts),
      {next_state, wait_for_dmx, State};
  
  wait_for_hw_version(timeout, State) ->
      {next_state, wait_for_dmx, State};
  
  wait_for_hw_version(_, State) ->
      {next_state, wait_for_hw_version, State}.
  
  wait_for_dmx({from_widget, received_dmx, Data}, State) ->
      {ok, ChangeOnly} = encode_packet(receive_dmx_on_change, on_change_only),
  
negative.code: match_ttyusb([$t, $t, $y, $U, $S, $B | _]) -> true;
  match_ttyusb(_)                            -> false.
  
  init(#{device := TTY} = Opts) ->
      {ok, Uart} = uart:open(TTY, [{mode, binary}]),
      {ok, SendFull} = encode_packet(receive_dmx_on_change, send_always),
      uart:send(Uart, SendFull),
      {ok, GetParams} = encode_packet(get_hw_version, none),
      uart:send(Uart, GetParams),
      uart:async_recv(Uart, 4),
      NewOpts = maps:remove(device, Opts),
      NewState = #state{uart = Uart, options = NewOpts},
      {ok, wait_for_hw_version, NewState, 2000};
  
  init(Opts) ->
      Dev = "/dev",
      {ok, Files} = file:list_dir(Dev),
      Found = hd([filename:join(Dev, F) || F <- Files, match_ttyusb(F)]),
      init(Opts#{device => Found}).
  
  wait_for_hw_version({from_widget, get_hw_version, _Ver}, State) ->
      % Permission to publish the API key granted by ENTTEC.
  