cillian64 / thegrid

The·Grid - Interactive polychromatic lighting array
http://www.thegrid.fish/
2 stars 6 forks source link

Sinks should indicate failure to initialise #9

Open cillian64 opened 10 years ago

cillian64 commented 10 years ago

If the Leonardo sink fails to initialise, for instance because /dev/ttyACM0 isn't present, it has no way of indicating this failure, so the sink must be unloaded then reloaded. It would be nice if the sink could indicate failure to load and not be recorded as loaded, so it can be reloaded without unloading first. This could be implemented by, for instance, raising an exception in init which is caught by Control.

cillian64 commented 10 years ago

As a bonus, it would be nice if sinks could indicate from update() that they've had an issue and should unload.

They could raise an Exception which causes the sink to be reloaded, and then fail again from init using the mechanism above. It's a bit gross though.