fix v4l issue with opencv, serialize db for farmware
parent
94c59b293f
commit
44de8f4883
|
@ -96,11 +96,20 @@ defmodule Farmware.FarmScript do
|
|||
_something ->
|
||||
# Logger.debug ">> [#{thing.name}] [ got info: #{inspect something} ]"
|
||||
handle_port(port, thing)
|
||||
|
||||
after
|
||||
10_000 -> Logger.error ">> [#{thing.name}] Timed out"
|
||||
10_000 ->
|
||||
Logger.error ">> [#{thing.name}] Timed out"
|
||||
kill_port(port)
|
||||
end
|
||||
end
|
||||
|
||||
@spec kill_port(port) :: no_return
|
||||
defp kill_port(port) do
|
||||
info = Port.info(port)
|
||||
if info, do: System.cmd("kill", ["#{info[:os_pid]}"])
|
||||
end
|
||||
|
||||
# pattern matching is cool
|
||||
defp handle_script_output(string, thing) do
|
||||
l = String.split(string, "\n")
|
||||
|
|
|
@ -35,7 +35,6 @@ defmodule Farmware.Worker do
|
|||
end
|
||||
|
||||
# when a queue of scripts comes in execute them in order
|
||||
@lint false
|
||||
def handle_events(farm_scripts, _from, environment) do
|
||||
Logger.debug "Farmware Worker handling #{Enum.count(farm_scripts)} scripts"
|
||||
for scr <- farm_scripts do
|
||||
|
@ -45,19 +44,19 @@ defmodule Farmware.Worker do
|
|||
{:noreply, [], environment}
|
||||
end
|
||||
|
||||
@lint false
|
||||
def handle_call(:get_state, _from, state) do
|
||||
{:reply, state, [], state}
|
||||
end
|
||||
|
||||
@lint false
|
||||
# Discard leaking port info
|
||||
def handle_info({port, _info}, s) when is_port(port), do: {:noreply, [], s}
|
||||
|
||||
def handle_info(info, environment) do
|
||||
Logger.debug ">> got unhandled info in " <>
|
||||
"Farmware Worker: #{inspect info}", nopub: true
|
||||
{:noreply, [], environment}
|
||||
end
|
||||
|
||||
@lint false
|
||||
def handle_cast({:status, status}, environment) do
|
||||
env_map = status.user_env # this is kind of silly
|
||||
|
||||
|
|
|
@ -75,13 +75,17 @@ defmodule Farmbot.HTTP do
|
|||
@spec finish_upload({:ok, HTTPoison.Response.t} |
|
||||
{:error, HTTPoison.Error.t}, binary)
|
||||
:: {:ok, HTTPoison.Response.t} | {:error, any}
|
||||
defp finish_upload({:ok, _resp}, attachment_url) do
|
||||
|
||||
# We only want to upload if we get a 2XX response.
|
||||
defp finish_upload({:ok, %HTTPoison.Response{status_code: s}}, attachment_url)
|
||||
when s < 300 do
|
||||
[x, y, z] = Farmbot.BotState.get_current_pos
|
||||
meta = %{x: x, y: y, z: z}
|
||||
json = Poison.encode! %{"attachment_url" => attachment_url, "meta" => meta}
|
||||
Farmbot.HTTP.post "/api/images", json
|
||||
end
|
||||
|
||||
# This is just to strip the struct out of the error.
|
||||
defp finish_upload({:error, %HTTPoison.Error{reason: reason}}, aurl),
|
||||
do: finish_upload({:error, reason}, aurl)
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ BR2_PACKAGE_OPENCV_LIB_PYTHON=y
|
|||
BR2_PACKAGE_OPENCV_WITH_JASPER=y
|
||||
BR2_PACKAGE_OPENCV_WITH_JPEG=y
|
||||
BR2_PACKAGE_OPENCV_WITH_PNG=y
|
||||
BR2_PACKAGE_OPENCV_WITH_V4L=y
|
||||
BR2_PACKAGE_LIBMNL=y
|
||||
BR2_PACKAGE_DNSMASQ=y
|
||||
BR2_PACKAGE_DROPBEAR=y
|
||||
|
@ -74,6 +75,8 @@ BR2_PACKAGE_IW=y
|
|||
BR2_PACKAGE_WPA_SUPPLICANT=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT_DEBUG_SYSLOG=y
|
||||
BR2_PACKAGE_MRUBY=y
|
||||
BR2_PACKAGE_PYTHON_PICAM=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT_CLI=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT_WPA_CLIENT_SO=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
|
||||
|
|
|
@ -65,6 +65,7 @@ BR2_PACKAGE_OPENCV_LIB_PYTHON=y
|
|||
BR2_PACKAGE_OPENCV_WITH_JASPER=y
|
||||
BR2_PACKAGE_OPENCV_WITH_JPEG=y
|
||||
BR2_PACKAGE_OPENCV_WITH_PNG=y
|
||||
BR2_PACKAGE_OPENCV_WITH_V4L=y
|
||||
BR2_PACKAGE_LIBMNL=y
|
||||
BR2_PACKAGE_DNSMASQ=y
|
||||
BR2_PACKAGE_DROPBEAR=y
|
||||
|
@ -72,6 +73,8 @@ BR2_PACKAGE_HOSTAPD=y
|
|||
BR2_PACKAGE_IW=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT_DEBUG_SYSLOG=y
|
||||
BR2_PACKAGE_MRUBY=y
|
||||
BR2_PACKAGE_PYTHON_PICAM=y
|
||||
BR2_TARGET_ROOTFS_SQUASHFS=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_NERVES_SYSTEM_NAME="nerves_system_rpi2"
|
||||
|
|
|
@ -63,6 +63,7 @@ BR2_PACKAGE_OPENCV_LIB_PYTHON=y
|
|||
BR2_PACKAGE_OPENCV_WITH_JASPER=y
|
||||
BR2_PACKAGE_OPENCV_WITH_JPEG=y
|
||||
BR2_PACKAGE_OPENCV_WITH_PNG=y
|
||||
BR2_PACKAGE_OPENCV_WITH_V4L=y
|
||||
BR2_PACKAGE_LIBV4L=y
|
||||
BR2_PACKAGE_LIBV4L_UTILS=y
|
||||
BR2_PACKAGE_LIBMNL=y
|
||||
|
@ -72,6 +73,8 @@ BR2_PACKAGE_HOSTAPD=y
|
|||
BR2_PACKAGE_IW=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT_DEBUG_SYSLOG=y
|
||||
BR2_PACKAGE_MRUBY=y
|
||||
BR2_PACKAGE_PYTHON_PICAM=y
|
||||
BR2_TARGET_ROOTFS_SQUASHFS=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_NERVES_SYSTEM_NAME="nerves_system_rpi3"
|
||||
|
@ -82,5 +85,3 @@ BR2_PACKAGE_NERVES_CONFIG=y
|
|||
BR2_PACKAGE_NERVES_CONFIG_NO_ERLINIT_CONF=y
|
||||
BR2_PACKAGE_NERVES_CONFIG_APPS="crypto"
|
||||
BR2_PACKAGE_NERVES_CONFIG_SNAME="farmbot"
|
||||
BR2_PACKAGE_MRUBY=y
|
||||
BR2_PACKAGE_PYTHON_PICAM=y
|
||||
|
|
Loading…
Reference in New Issue