Skip to content

Commit

Permalink
remove unreleased lua helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielburnworth committed May 2, 2024
1 parent 082af7d commit 4106218
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 28 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Firmware update to fix calibration deadzone settings.
* Add optional arguments to `take_photo` and `take_photo_raw` lua helpers.
* Add point group `planted_at`/`created_at` conditional.
* Add `utc`, `local_time`, `current_day`, and `current_year` lua helpers.
* Add `utc` and `local_time` lua helpers.
* Dependency updates (includes system updates).

# 15.4.6
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15.4.7-rc7
15.4.7-rc8
2 changes: 0 additions & 2 deletions lib/os/lua.ex
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ defmodule FarmbotOS.Lua do
cs_eval: &FarmbotOS.Celery.execute_from_lua/2,
current_hour: &Info.current_hour/2,
current_minute: &Info.current_minute/2,
current_day: &Info.current_day/2,
current_month: &Info.current_month/2,
current_year: &Info.current_year/2,
current_second: &Info.current_second/2,
detect_weeds: execute_script("plant-detection"),
dispense: &DataManipulation.dispense/2,
Expand Down
10 changes: 0 additions & 10 deletions lib/os/lua/info.ex
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,11 @@ defmodule FarmbotOS.Lua.Info do
Timex.Timezone.convert(datetime, tz)
end

@doc "Returns the current year"
def current_year(_args, lua) do
{[DateTime.utc_now().year], lua}
end

@doc "Returns the current month"
def current_month(_args, lua) do
{[DateTime.utc_now().month], lua}
end

@doc "Returns the current day"
def current_day(_args, lua) do
{[DateTime.utc_now().day], lua}
end

@doc "Returns the current hour"
def current_hour(_args, lua) do
{[DateTime.utc_now().hour], lua}
Expand Down
14 changes: 0 additions & 14 deletions test/os/lua/ext/info_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -222,27 +222,13 @@ defmodule FarmbotOS.Lua.InfoTest do
assert actual == second
end

test "current_year()" do
year = DateTime.utc_now().year
lua_code = "return current_year()"
{:ok, [actual]} = lua(lua_code, lua_code)
assert actual == year
end

test "current_month()" do
month = DateTime.utc_now().month
lua_code = "return current_month()"
{:ok, [actual]} = lua(lua_code, lua_code)
assert actual == month
end

test "current_day()" do
day = DateTime.utc_now().day
lua_code = "return current_day()"
{:ok, [actual]} = lua(lua_code, lua_code)
assert actual == day
end

test "current_hour()" do
hour = DateTime.utc_now().hour
lua_code = "return current_hour()"
Expand Down

0 comments on commit 4106218

Please sign in to comment.