Skip to content

Commit

Permalink
v15.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielburnworth committed Feb 9, 2022
2 parents f967e9b + 598cfbf commit ddefa85
Show file tree
Hide file tree
Showing 17 changed files with 175 additions and 34 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

# 15.0.0

* hotfix for uptime bug
* rpc() Lua helper
* sequence() Lua helper
* Dependency upgrades (including wifi scan edge case bugfix)

# 14.9.0

* Ability to manage `resource` variables from Lua.
Expand Down
1 change: 1 addition & 0 deletions FEATURE_MIN_VERSIONS.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"api_ota_releases": "11.1.0",
"ota_update_hour": "8.2.3",
"quiet_motors": "14.0.0",
"resource_variables": "14.9.0",
"rpi_led_control": "6.4.4",
"safe_height_input": "12.1.0",
"sensors": "6.3.0",
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15.0.0
15.0.0
1 change: 1 addition & 0 deletions lib/core/bot_state.ex
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ defmodule FarmbotOS.BotState do
end

def handle_call({:report_uptime, seconds}, _form, state) do
FarmbotOS.SysCalls.CheckUpdate.uptime_hotfix(seconds)
change = %{informational_settings: %{uptime: seconds}}

{reply, state} = get_reply_from_change(state, change)
Expand Down
2 changes: 2 additions & 0 deletions lib/os/lua.ex
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ defmodule FarmbotOS.Lua do
photo_grid: &DataManipulation.photo_grid/2,
read_pin: &Firmware.read_pin/2,
read_status: &Info.read_status/2,
rpc: &DataManipulation.rpc/2,
sequence: &DataManipulation.sequence/2,
send_message: &Info.send_message/2,
set_job_progress: &Info.set_job_progress/2,
set_pin_io_mode: &Firmware.set_pin_io_mode/2,
Expand Down
2 changes: 2 additions & 0 deletions lib/os/lua/data_manipulation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ defmodule FarmbotOS.Lua.DataManipulation do

def photo_grid(args, lua), do: lua_extension(args, lua, "photo_grid")
def api(args, lua), do: lua_extension(args, lua, "api")
def rpc(args, lua), do: lua_extension(args, lua, "rpc")
def sequence(args, lua), do: lua_extension(args, lua, "sequence")

def lua_extension(args, lua, filename) do
lua_code = File.read!("#{:code.priv_dir(:farmbot)}/lua/#{filename}.lua")
Expand Down
18 changes: 18 additions & 0 deletions lib/os/sys_calls/check_update.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,22 @@ defmodule FarmbotOS.SysCalls.CheckUpdate do
UpdateProgress.set(progress_pid, 100)
{:error, error}
end

def max_uptime, do: 31
# Rebooting allows the bot to refresh its API token.
def uptime_hotfix(uptime_seconds) do
days = uptime_seconds / 86400

if days > max_uptime() do
{tz, ota_hour} = FarmbotOS.UpdateSupport.get_hotfix_info()

if tz && ota_hour do
if Timex.now(tz).hour == ota_hour do
FarmbotOS.UpdateSupport.do_hotfix()
end
else
FarmbotOS.UpdateSupport.do_hotfix()
end
end
end
end
13 changes: 13 additions & 0 deletions lib/os/update_support.ex
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,17 @@ defmodule FarmbotOS.UpdateSupport do
string = "#{server}/api/releases?platform=#{target}"
to_charlist(string)
end

def get_hotfix_info() do
device = FarmbotOS.Asset.device()
tz = device.timezone
ota_hour = device.ota_hour
{tz, ota_hour}
end

def do_hotfix() do
uptime = FarmbotOS.SysCalls.CheckUpdate.max_uptime()
FarmbotOS.Logger.debug(3, "Rebooting after #{uptime} days of uptime.")
FarmbotOS.SysCalls.reboot()
end
end
38 changes: 19 additions & 19 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,17 @@ defmodule FarmbotOS.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:busybox, "~> 0.1.5", targets: @all_targets},
{:busybox, "~> 0.1", targets: @all_targets},
{:certifi, "~> 2.8"},
{:circuits_gpio, "~> 1.0", targets: @all_targets},
{:circuits_i2c, "~> 1.0", targets: @all_targets},
{:circuits_uart, "~> 1.4"},
{:cors_plug, "~> 2.0.3", targets: @all_targets},
{:cors_plug, "~> 2.0", targets: @all_targets},
{:dns, "~> 2.3"},
{:ecto_sqlite3, "~> 0.7.2"},
{:ecto_sqlite3, "~> 0.7"},
{:ecto, "~> 3.7"},
{:ex_doc, "~> 0.25", only: [:dev], targets: [:host], runtime: false},
{:ex_doc, "~> 0.28", only: [:dev], targets: [:host], runtime: false},
{:excoveralls, "~> 0.14", only: [:test], targets: [:host]},
{:extty, "~> 0.2.1"},
{:farmbot_system_rpi,
git: "git@github.com:FarmBot/farmbot_system_rpi.git",
tag: "v1.18.1-farmbot.1",
Expand All @@ -122,29 +121,30 @@ defmodule FarmbotOS.MixProject do
tag: "v1.18.1-farmbot.1",
runtime: false,
targets: :rpi4},
{:extty, "~> 0.2"},
{:hackney, "~> 1.18"},
{:jason, "~> 1.2"},
{:luerl, github: "rvirding/luerl", tag: "1.0"},
{:jason, "~> 1.3"},
{:luerl, "~> 1.0"},
{:mdns_lite, "~> 0.8", targets: @all_targets},
{:mimic, "~> 1.5", only: :test},
{:mix_unused, "~> 0.3.0", only: :dev},
{:mix_unused, "~> 0.4", only: :dev},
{:muontrap, "~> 1.0"},
{:nerves_runtime, "~> 0.11.6", targets: @all_targets},
{:nerves_runtime, "~> 0.11", targets: @all_targets},
{:nerves_time, "~> 0.4", targets: @all_targets},
{:nerves, "~> 1.7.11", runtime: false},
{:nerves, "~> 1.7", runtime: false},
{:phoenix_html, "~> 3.2"},
{:plug_cowboy, "~> 2.5.2"},
{:ring_logger, "~> 0.8.3"},
{:rollbax, ">= 0.0.0"},
{:plug_cowboy, "~> 2.5"},
{:ring_logger, "~> 0.8"},
{:rollbax, "~> 0.11"},
{:shoehorn, "~> 0.8"},
{:telemetry, "~> 1.0.0"},
{:tesla, "~> 1.4.3"},
{:telemetry, "~> 1.0"},
{:tesla, "~> 1.4"},
{:timex, "~> 3.7"},
{:toolshed, "~> 0.2.22", targets: @all_targets},
{:toolshed, "~> 0.2", targets: @all_targets},
{:tortoise, "~> 0.10"},
{:uuid, "~> 1.1.8"},
{:vintage_net_ethernet, "~> 0.10.1", targets: @all_targets},
{:vintage_net_wifi, "~> 0.10.1", targets: @all_targets},
{:uuid, "~> 1.1"},
{:vintage_net_ethernet, "~> 0.10", targets: @all_targets},
{:vintage_net_wifi, "~> 0.10", targets: @all_targets},
{:vintage_net, "~> 0.11", targets: @all_targets}
]
end
Expand Down
Loading

0 comments on commit ddefa85

Please sign in to comment.