Commit Graph

495 Commits (staging)

Author SHA1 Message Date
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
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 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 95bd827518
Rename FarmbotOS 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 a28b6c4141
Variable resolution works? 2019-09-13 16:03:15 -07:00
connor rigby 09be64fe4e
Fix AMQP issue with hanging forever 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 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 d17f64f17f
Misc app cleanup and updates
* Add helpful Makefile task for fetching deps
* Remove dead nerves_hub code
* Update deps
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 4216eb401f
Fix deps for rpi 2019-09-13 16:03:15 -07:00
Connor Rigby d3b9f9c83a
Update nerves_hub_client logs 2019-09-13 16:03:14 -07:00
Connor Rigby ee3a88a6dd
Add ability to configure tty names per target 2019-09-13 16:03:14 -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 65436cd367
Update config files 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 451dfe1343
[WIP] Pull in NervesHub updates 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 f2b8abd692
Botstate refactor (#645)
* Refactor PinBindings

* Refactor logging to not require Farmbot.Registry

* Fix AMQP bot_state_transport and log_transport

* Update to use floats everywhere

* Refactor Farmbot.Firmware

* Write Firmware Tests

* dipping into FarmbotOS finally

* Cleanup peripheral_worker error message

* Implement remaining CeleryScript RPCs

* Refactor job progress

* Image Upload status notifications updates

* Fix compiler warnings and things

* Update Firmware submodule

* Fix FarmbotEXT tests
2019-09-13 16:03:14 -07:00
Connor Rigby 869d1ad1a4
Progress on refactoring data syncing (#643) 2019-09-13 16:03:13 -07:00
connor rigby 8c34f2eacd
Refactor farmbot application into separate folders/apps. 2019-09-13 16:03:13 -07:00
Connor Rigby 0d569301f1
Replace httpoison 2019-09-13 16:03:13 -07:00
Connor Rigby 6c9afd2533
Update circleci ? 2019-09-13 16:03:13 -07:00
connor rigby 10a4379568
Work toward farmware/celeryscript stuff
* Fix logger erros
* Fix migrations
* Fix compile errors
* Fix tzdata child_spec
2019-09-13 16:03:13 -07:00
Connor Rigby bdb11b2ea8
Lots of work on Farmware 2019-09-13 16:03:13 -07:00
connor rigby 66bb4e51f4
Update nerves_time 2019-09-13 16:03:13 -07:00
connor rigby e63683c500
Update Elixir version in circleci config. 2019-09-13 16:03:13 -07:00
connor rigby d7ff13422c
Test Migration 2019-09-13 16:03:13 -07:00
connor rigby 32f46b5fd3
Start refactoring Farmware 2019-09-13 16:03:13 -07:00
connor rigby 358a1e209e
Update AMQP workers to reconnect on a 4 second timer
Pull in new csvm implementation

Update circleci config

Implement syncing and write_pin

add migration for syncing

add saftey to write_pin

Implement read_pin

Implement set_servo_angle

Implement more ast nodes

Implement e-stop and e-unlock

Fix a bunch of stuf

Fix missing assets on boot/init

It actually works

Rename csvm -> farmbot_celery_script; fix initial sync/dispatch

Fix a bunch of small bugs

Identify problem

Fix Sqlite bug and increase performance by 10 times!!

Fix sequences inside of sequences
2019-09-13 16:03:13 -07:00
connor rigby cf1ef23b17
Start splitting Farmbot Application Poncho Style
This begins splitting the monolithic Farmbot application
into separate, independent OTP applicatoins.
2019-09-13 16:03:13 -07:00