Resources
--
-
- - Guides & Docs - -
- - Source - -
- - v1.4 Changelog - -
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/firmware/config/target.exs b/firmware/config/target.exs index 399cb2e..d0b2ab0 100644 --- a/firmware/config/target.exs +++ b/firmware/config/target.exs @@ -31,8 +31,8 @@ config :nerves_firmware_ssh, node_name = if Mix.env() != :prod, do: "firmware" config :nerves_init_gadget, - ifname: "usb0", - address_method: :dhcpd, + ifname: "eth0", + address_method: :dhcp, mdns_domain: "nerves.local", node_name: node_name, node_host: :mdns_domain diff --git a/ui/lib/signal_morse.ex b/ui/lib/signal_morse.ex new file mode 100644 index 0000000..409e038 --- /dev/null +++ b/ui/lib/signal_morse.ex @@ -0,0 +1,5 @@ +defmodule Ui.SignalMorse do + def signal do + IO.puts("bleep bloop") + end +end diff --git a/ui/lib/ui_web/controllers/page_controller.ex b/ui/lib/ui_web/controllers/page_controller.ex index 3dccf01..05ff15f 100644 --- a/ui/lib/ui_web/controllers/page_controller.ex +++ b/ui/lib/ui_web/controllers/page_controller.ex @@ -2,6 +2,37 @@ defmodule UiWeb.PageController do use UiWeb, :controller def index(conn, _params) do - render(conn, "index.html") + conn + |> send_resp(201, "") + end + + def instructions(conn, _params) do + conn + |> render(:instructions) + end + + def morse(conn, _params) do + conn + |> render(:morse) + end + + def start(conn, _params) do + now = System.system_time(:second) + + case get_start_time() do + start_time when start_time + 35 <= now -> + System.put_env("MORSE_START_TIME", Integer.to_string(now)) + Ui.SignalMorse.signal() + text(conn, "Done.") + _ -> + text(conn, "It is still in progress...") + end + end + + defp get_start_time() do + case System.get_env("MORSE_START_TIME") do + nil -> 0 + start_time -> String.to_integer(start_time) + end end end diff --git a/ui/lib/ui_web/router.ex b/ui/lib/ui_web/router.ex index 1ebec48..6c155ba 100644 --- a/ui/lib/ui_web/router.ex +++ b/ui/lib/ui_web/router.ex @@ -17,10 +17,15 @@ defmodule UiWeb.Router do pipe_through :browser get "/", PageController, :index - end - # Other scopes may use custom stacks. - # scope "/api", UiWeb do - # pipe_through :api - # end + get "/ZZZZ", PageController, :instructions + get "/morse", PageController, :instructions + get "/esrom", PageController, :instructions + + get "/0B13", PageController, :morse + get "/OB13", PageController, :morse + get "/seinlamp", PageController, :morse + + get "/start", PageController, :start + end end diff --git a/ui/lib/ui_web/templates/layout/app.html.eex b/ui/lib/ui_web/templates/layout/app.html.eex index 91773ee..e2b88c1 100644 --- a/ui/lib/ui_web/templates/layout/app.html.eex +++ b/ui/lib/ui_web/templates/layout/app.html.eex @@ -4,22 +4,10 @@ -
<%= get_flash(@conn, :info) %>
<%= get_flash(@conn, :error) %>
diff --git a/ui/lib/ui_web/templates/page/index.html.eex b/ui/lib/ui_web/templates/page/index.html.eex deleted file mode 100644 index 8cbd9d8..0000000 --- a/ui/lib/ui_web/templates/page/index.html.eex +++ /dev/null @@ -1,35 +0,0 @@ -A productive web framework that
does not compromise speed or maintainability.
Welcome geocacher, you will need to go to the first coordinate and start from there.
+Good luck!
diff --git a/ui/lib/ui_web/templates/page/morse.html.eex b/ui/lib/ui_web/templates/page/morse.html.eex new file mode 100644 index 0000000..d649b59 --- /dev/null +++ b/ui/lib/ui_web/templates/page/morse.html.eex @@ -0,0 +1,41 @@ +en: Position yourself on the bridge. Watch carefully around to windows of houses, remember this is a nightly geocache. During daytime it is quite hard to see, but not impossible. After pushing the button, it takes 3 + seconds to start. The whole process takes about 35 sec. During the process it cannot be stopped nor restarted. You can start it all over again as much as you like. In case you are really stuck, you could try to contact me via WhatsApp on number +31 6 41633689. Best of luck to you!
+nl: Ga op de brug staan. Kijk goed om je heen naar ramen van woningen en realiseer je dat dit een een nachtcache is. Overdag is het slecht te zien, maar niet onmogelijk. Na het indrukken van de knop duurt het 3 seconden + voordat het begint. Het hele proces duurt ongeveer 35 sec. Het proces kan niet gestopt of herstart worden. Je kunt het zo vaak starten als je wilt. Als het helemaal niet lukt zou je me kunnen proberen te bereiken via WhatsApp nummer 06-41633689. Veel plezier!
+