Commit Graph

15 Commits (5722bea4217d0f86a3952689dd28df7516ce245a)

Author SHA1 Message Date
Rick Carlino 5722bea421 Huge formatting update (sorry) 2020-01-17 09:58:53 -06:00
Connor Rigby 1ff2a7d153 Implement `every_point` and `point_group` Celery nodes 2019-10-22 14:19:32 -07:00
Connor Rigby 8a816ba1f4
Change if and read_pin to function the same as v7
this prevents the possibility of reading a sensor and it changing
by the time an if statement is executed
2019-09-13 16:03:34 -07:00
Connor Rigby cf2877c76e
Ensure firmware/rpc logs always dispatch 2019-09-13 16:03:33 -07:00
Connor Rigby f400b2746f
Add new RPC for `toggle_pin`
This was previously implemented as a "macro" that just expanded
`toggle_pin` to a series of `read_pin` -> `write_pin` -> `read_pin` this
lead to three logs instead of just one. The implementation is still
mostly the same, but now there is less logging.

Also factored all pin control into it's own module
2019-09-13 16:03:32 -07:00
Connor Rigby 209ded96cb
Add Lua helpers for updating and getting resources 2019-09-13 16:03:32 -07:00
Connor Rigby 7e1ceaf7be
Implement new AST: `assert`.
This is a new AST that will allow executing a
simple expression and conditionally pass/fail
and cleanup when it completes.
2019-09-13 16:03:31 -07:00
Connor Rigby fcadeebe6e
Add `update_farmware` rpc back 2019-09-13 16:03:31 -07:00
connor rigby 3231651b5f
Add :set_pin_io_mode rpc back to known rpcs 2019-09-13 16:03:30 -07:00
connor rigby 55533675f5
Reenable sequence init and sequence complete logs
Sort of a hack, but store some metadata about a sequence in the AST
format, and if it exists, log it
2019-09-13 16:03:26 -07:00
Connor Rigby a160d6a41b
Fix factory_resetting the arduino-firmware
* Adds `api_migrated` field to FirmwareConfig
* Changes `factory_reset()` syscall to be `factory_reset(package)`
2019-09-13 16:03:25 -07:00
Connor Rigby c92c79347f
Add back step logs 2019-09-13 16:03:24 -07:00
Connor Rigby 00d0897672
Dry up celery_script compilation
This adds much more type checking and error
handling in the compiled celery_script.
Also removes the hack/shortcut in the StubSysCalls
module.
2019-09-13 16:03:23 -07:00
Connor Rigby ef3225878d
Change FarmbotCeleryScript Namespace 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