Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add Map driver #110

Closed
rneswold opened this issue Apr 8, 2024 · 2 comments · Fixed by #120
Closed

✨ Add Map driver #110

rneswold opened this issue Apr 8, 2024 · 2 comments · Fixed by #120
Labels
difficulty:medium Issues will take some thought to complete driver Issue is about a driver

Comments

@rneswold
Copy link
Contributor

rneswold commented Apr 8, 2024

Create a driver that provides a constant array of device values. It creates two devices: index accepts an integer and indicates which value in the internal array should get sent to the output device.

The configuration should take two parameters: values is an array of device value types that will be used. The driver might check that all the entries are of the same type because most devices only accept one type of value. The other parameter is error and represents the value to be placed at the output when the index device is out of range.

@rneswold rneswold added driver Issue is about a driver difficulty:medium Issues will take some thought to complete labels Apr 8, 2024
@rneswold rneswold added this to the Release v0.4.0 milestone Apr 8, 2024
@rneswold
Copy link
Contributor Author

rneswold commented Apr 8, 2024

Should this be a driver? Can one come up with a way that this functionality could be expressed in a logic block's expression? This array device would be writing to the back-end with every index change.

@rneswold rneswold changed the title ✨ Add Array driver ✨ Add Map driver Jul 31, 2024
@rneswold
Copy link
Contributor Author

Changing this from an "array" driver to a "map" driver. An array would imply a value for an index. In this map driver, a range of indices will map to a value. So the configuration will take an array of tables. Each table will have a start index value, an inclusive end index value, and the value to be emitted in the output device. If the end parameter is omitted, then the end is the same as start and the driver instance behaves like an array. The driver will need to make sure there's no overlap in the ranges.

Allowing a range to be mapped to a value means we can use the day of the year to pick a color for an LED light, for instance.

If a value doesn't fit in a range, the error value is emitted.

@rneswold rneswold linked a pull request Aug 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty:medium Issues will take some thought to complete driver Issue is about a driver
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant