Commit Graph

62 Commits (0a9c664d17cba2139fcf93274536ea1ab1272cb4)

Author SHA1 Message Date
connor rigby 0a9c664d17
Update farmbot-arduino-firmware submodule to be built in
farmbot_firmware app
2019-09-13 16:03:17 -07:00
connor rigby eaa4839405
Pass variables from FarmEvent -> Regimen -> Sequence 2019-09-13 16:03:17 -07:00
Rick Carlino 016ea36f34
🎉 FarmEvent variables ✔️ 2019-09-13 16:03:17 -07:00
Rick Carlino 399ddf50c8
PersistentRegimen => RegimenInstance 2019-09-13 16:03:17 -07:00
connor rigby d842c3a123
🎉 Implement Variables in Regimen 2019-09-13 16:03:17 -07:00
Rick Carlino 18731e295d
Add `body` attribute to Regimen asset 2019-09-13 16:03:17 -07:00
Connor Rigby e80780aeb8
Remove EnigmaWorker in favor of db context hooks
* Add firmware_hardware setter on bot_state
* move firmware side effects to farmbot_core
* move firmware estop timer to farmbot_core
* change enigmas to be soft delete
2019-09-13 16:03:17 -07:00
Rick Carlino 673d8a834c
Add docs to modules that were missing them 2019-09-13 16:03:17 -07:00
Connor Rigby b7f4ebba57
Fixes for bootstrapping firmware.
* TTYDetector no longer causes side effects
* add new RPC for `flash_firmware` that takes a `package` arg
2019-09-13 16:03:17 -07:00
Rick Carlino aa9ad9523a
Update EnigmaWorker to not die causing supervisor restarts.
* Tests for enigma cleanup
2019-09-13 16:03:17 -07:00
Rick Carlino 0b5df60f67
Implement and test Enigmas for firmware_missing
* Test for create_or_update_enigma!() and clear_enigma()
2019-09-13 16:03:17 -07:00
Rick Carlino 17d24bdc0e
Begin impl of firmware flasher RPC, add `clear_enigma` helper 2019-09-13 16:03:16 -07:00
Connor Rigby d2c5a1a72b
Add enigma_worker config to farmbot_ext and frambot_os 2019-09-13 16:03:16 -07:00
Connor Rigby ee7c20c7fa
Expand enigma_worker_test to include lifecycle events 2019-09-13 16:03:16 -07:00
Rick Carlino cfa86293a4
Refactor fbos_config_worker_test to be less prone to races 2019-09-13 16:03:16 -07:00
Rick Carlino af7b9e3359
Add seeds, Add FarmbotFirmware back to core 2019-09-13 16:03:16 -07:00
Connor Rigby 981dee6fef
Update enigma schema to match other asset schema
This is because we need to hook the Enigma AssetWorker up to the
existing AssetWorker system. It expects some keys to exist including
`updated_at` and `created_at`
2019-09-13 16:03:16 -07:00
Connor Rigby b9ff313750
Fix and expand enigma state tracking tests 2019-09-13 16:03:16 -07:00
Rick Carlino b15a9a0129
Tests for BotState and BotStateNG WRT Enigma resources. 2019-09-13 16:03:16 -07:00
Rick Carlino acf4de0671
Add enigmas table / private asset 2019-09-13 16:03:16 -07:00
Connor Rigby b25f8526bc
Small doc update to bot_state_ng 2019-09-13 16:03:16 -07:00
Connor Rigby 092985cfc2
Rename `farmware_manifest_version` 2019-09-13 16:03:16 -07:00
connor rigby 2124c19fcd
Change how FarmwareManifests are built 2019-09-13 16:03:16 -07:00
Connor Rigby 1e7ae7a744
Finish implementing Farmware.
Farmware runtime seems to be working really well. The only
problem is currently the way Farmware is stored on the bot state
can not be properly serialized to the new method. This will require
a breaking change
2019-09-13 16:03:16 -07:00
connor rigby b204ce3b9e
Add some work for Farmware 2019-09-13 16:03:16 -07:00
connor rigby 218b33785d
Fix more namespaces 2019-09-13 16:03:16 -07:00
Connor Rigby f1dd9009ea
Rename FarmbotCore Namespace 2019-09-13 16:03:16 -07:00
Connor Rigby 21bb1a6f25
Misc cleanup and bug fixes.
* Fixes botstate changes being dispatched as nested lists
* Fixes jwt failing to decode `nil`. Doesn't fix token actually being`nil` though.
* Adds a syscall for read_pin
* Add/fix calibrate syscall
* tweak tty detector. This is still broken i think
2019-09-13 16:03:16 -07:00
Connor Rigby 4114e26804
Implement new CeleryScript Runtime environment.
This is obviously a rather large change warranting an essay describing
it.

A Brief overview
Basically the old implementation had quite a few down sides preventing
it from really working as intended, especially with the addition of the
variables feature. Here is the shortlist of things that needed
addressing:

* No scoping between sequences.
What this essentially means is that a sequence that executes another
sequence is unable to add data to the calle. This is important for using
Variables.

* Error recovery
certain nodes have a high likelyhood of failing such as anything that
interfaces the firmware. Much focus was spent ensuring that errors would
be recoverable when desired.

* Complexity of control flow asts versus action asts.
Nodes such as `if` will always work in the same way regardless of the
state of the rest of the system meaning there is no reason for it to
have a special implementation per environment. on the other hand
`move_absolute` is bound to a specific part of the system. Seperating
these concerns allows for better testing of each piece independently.

A More In Depth overview
The core of this change resolves around 1 really big change resulting in
many more small changes. This change is the CeleryScript `compiler`. The
TLDR of this system is that now CeleryScript ASTs are deterministicly
compiled to Elixir's AST and executed. Doing this has some big benifits
as described below.

1) CeleryScript "runtime" environment is now much simpiler in favor of a somewhat
complex "compile time" environment. Basically instead of EVERY single
CeleryScript AST having a custom runtime implementation, only a subset
of ASTs that require external services such as the Firmware, Database,
HTTP, etc require having a runtime implementation. This subset of ASTs
are called `SysCalls`. Also the runtime implementations are compiled to
a single function call that can be implemented instead of needing to
have a contextual environment and making decisions at runtime to
evaluate variables and the like.

2) Static analysis is now possible. This means an incorrectly crafted
sequence can be validated at compile time rather than getting half way
through a sequence before finding the error.

3) Having the "external services" separated leads to better plugability.
There is now a behaviour to be implemented for the subset of syscalls
that are system specific.
2019-09-13 16:03:15 -07:00
connor rigby a253715e96
Assign mountrap_opts if they don't exist 2019-09-13 16:03:15 -07:00
connor rigby 85e01728a3
Fix typo in stub farmware lookup 2019-09-13 16:03:15 -07:00
connor rigby d0edb1e19e
Update to Elixir 1.8!! 2019-09-13 16:03:15 -07:00
connor rigby a5b03a6f3b
Allow extra options to be passed to Muontrap via app env 2019-09-13 16:03:15 -07:00
connor rigby bc668b5ccd
Implement the RPC system in FarmwareRuntime 2019-09-13 16:03:15 -07:00
connor rigby 7c8ae09e34
Use Ports for communicating with FIFO 2019-09-13 16:03:15 -07:00
connor rigby 934f819476
Farmware Progress
* Allow installing a farmware from a directory on disk
2019-09-13 16:03:15 -07:00
connor rigby 236bb1d270
Farmware stuff 2019-09-13 16:03:15 -07:00
connor rigby a2339546e1
Update farmbot_os app to support eap + cleanup 2019-09-13 16:03:15 -07:00
Connor Rigby bb7306dabc
Work towards refactoring Farmware
* Add bot state serializer to filesystem
* Add helper to turn ecto types into TSC types
* Add module to extract ecto changes as a list of instructions
* Add new transport for bot_state_ng
* Update CSVM Runtime to poll until `await` can complete
2019-09-13 16:03:15 -07:00
Connor Rigby 5e864a35a9
Update rpi3 system and CI Config 2019-09-13 16:03:15 -07:00
Connor Rigby f7b573e6d5
Update celery_script
Support peripherals in read and write pin
2019-09-13 16:03:15 -07:00
Connor Rigby bad07b3bc3
Update movement rpcs to support tools and points 2019-09-13 16:03:14 -07:00
Connor Rigby ce84310050
Fix Firmware crashes blocking forever 2019-09-13 16:03:14 -07:00
Connor Rigby 8f3abc335a
Update NervesHub logs and abstractions 2019-09-13 16:03:14 -07:00
Connor Rigby cf5077e2a9
Start implementing firmware startup
Misc other cleanup
2019-09-13 16:03:14 -07:00
Connor Rigby 7cde2b2390
Change to ElixirCircuits. 2019-09-13 16:03:14 -07:00
Connor Rigby 56f6749595
Nerves hub pt2 (#654)
* Rework Networking

* Rework Configurator

* Fix NervesHub not connecting
2019-09-13 16:03:14 -07:00
Connor Rigby 3bc18fee09
Refactor tests to stop juggling timeouts 2019-09-13 16:03:14 -07:00
Connor Rigby 6e2a018598
Implement Regimens again, add tests and test support
* This also includes changes to all Farmbot API Assets adding
  a `monitor: :boolean` field. This allows tests to be run
  causing minimal side effects on the rest of the systems.
2019-09-13 16:03:14 -07:00
Connor Rigby a4c1eac2d2
Update image uploader to add `file_type` 2019-09-13 16:03:14 -07:00