z3ugma
11/01/2025, 11:01 PMfloitsch
11/01/2025, 11:01 PMGitHub
11/02/2025, 1:10 PMfloitsch
11/02/2025, 1:11 PMz3ugma
11/02/2025, 2:51 PMServices but I want some advice on when that's a better architecture pattern than using Tasks in a single container
Some things I expect to do:
- Wifi and setting provisioning from an HTML interface with HTTP
- Control loop monitoring - sensing temperature and other environment variables over I2C, turning GPIO pins on and off
- MQTT - reporting environment vars as state, accepting changes to control loop settings
- UART between two ESP32 boards, sending messages from one board to anotherz3ugma
11/02/2025, 2:58 PMz3ugma
11/02/2025, 3:00 PMfloitsch
11/02/2025, 3:03 PMsensors package).
- they make it possible to "override" services by just installing a higher-priority one. (Artemis uses this to implement a network manager that opens the cellular driver when a user does a net.open).
However, they are less efficient.
Even for the sensor package, I expect users to start prototyping with the services, and then merge the drivers into their applications once they optimize. At least if it makes a difference for them.floitsch
11/02/2025, 3:04 PMfloitsch
11/02/2025, 3:06 PMsensors package and API. It's a bit more work to write the sensor packages themselves, but it means that users can install "drivers" like on a modern OS, and then just use them without needing to worry about how the sensor data is provided.z3ugma
11/02/2025, 3:11 PMtemp_sensor.toit file and importing it at the top of a main coordinator script, and updating that file when needed? The major benefit being clear separation of code paths - if there's a crash in the sensor driver you know where it came from?floitsch
11/02/2025, 3:19 PMtemp-sensor at the top of the file.
With the sensors package you would just import sensors, independently of which kind of sensor you use.
Fundamentally, if you have hardware that doesn't change, then services don't help that much.
if you write more generic software (for example for different projects), then services can make your code more flexible/generic.floitsch
11/02/2025, 3:24 PMz3ugma
11/02/2025, 3:30 PMfloitsch
11/02/2025, 4:00 PMfloitsch
11/02/2025, 4:02 PMfloitsch
11/02/2025, 4:02 PMfloitsch
11/02/2025, 4:03 PMfloitsch
11/02/2025, 4:04 PMfloitsch
11/02/2025, 4:06 PMmilkmansson
11/02/2025, 4:55 PMfloitsch
11/02/2025, 4:56 PMmilkmansson
11/02/2025, 4:57 PMmilkmansson
11/02/2025, 5:01 PMmilkmansson
11/02/2025, 5:04 PMmilkmansson
11/02/2025, 5:05 PMmilkmansson
11/02/2025, 5:09 PMmilkmansson
11/02/2025, 5:09 PMkasperl
11/02/2025, 5:10 PMTask.group helper.kasperl
11/02/2025, 5:12 PM