Commit Graph

10 Commits (3886304c54172deec30033934875a2b3b69ebc92)

Author SHA1 Message Date
Connor Rigby 503e62507e
Refactor bootup sequence to be in `farmbot_os` application
This moves it's execution to much later in the boot process. Doing this
allows the bootup sequence to check for a number of things before
executing. Checked systems are:

* firmware configured
* bot is synced (which happens on every boot now)
* peripherals loaded
2019-12-31 10:32:26 -08:00
Connor Rigby 1a1bcb49bc
Update fbos_config and peripherals to coordinate with firmware status 2019-12-31 10:32:08 -08:00
Connor Rigby 685177046b Set peripheral IO mode before read/writing 2019-11-05 13:09:40 -08:00
connor rigby 605b89102b
Remove duplicate peripheral worker logs 2019-09-13 16:03:25 -07:00
Connor Rigby e6b29ea559
Refactor CeleryScript execution
* FarmEvents now schedule all events up front
  * Executions are stored in the database
* Regimens now schedule all items up front
  * Executions are stored in the database
* fix Deleting a FarmEvent with a running RegimenInstance
* `execute`int and `schedule`ing a CeleryScript are not separate things
* Everywhere `scheduling` and `executing` CeleryScript updated to use
the new API
2019-09-13 16:03:23 -07:00
Connor Rigby b4aa042ea4
Quiet down peripheral logs 2019-09-13 16:03:22 -07:00
Connor Rigby 69c3322d12
Add new feature to asset_worker protocol
This sets up the ability for asset_workers to react to _changes_, rather than be restarted.
2019-09-13 16:03:18 -07:00
Connor Rigby a20db7c102
Update peripheral_worker to use new `idle` flag.
This prevents the peripheral_worker from suffering from a race condition
2019-09-13 16:03:18 -07:00
Connor Rigby f1dd9009ea
Rename FarmbotCore 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