viktorgino / headunit-desktop

HeadUnit Desktop is a car PC software built with Qt 5 and QML
https://github.com/viktorgino/headunit-desktop/wiki
GNU General Public License v3.0
285 stars 64 forks source link

I2C Light Sensor #74

Closed aselafernando closed 9 months ago

aselafernando commented 1 year ago

Added a plugin to set night mode based on the value read from an i2c light sensor. Different sensors can be added through json files in the sensor folder. Reading of the sensor can be disabled by setting the refresh interval to 0 (default).

It'll read the ambient light level from the specified register in the json file. In addition it has the ability to write a value to a configuration register each time, in case the module needs a write to turn it on.

This requires libi2c-dev be installed to compile (will need the wiki updated).

viktorgino commented 1 year ago

Thanks @aselafernando! I'll have a proper look at it this weekend

aselafernando commented 9 months ago

Made the changes, I also corrected a bug in the pro file where it wasn't copying the sensor json files over to the install directory.

I left m_pluginSettings.eventListeners = QStringList() << "AndroidAuto::connected"; in as the plugin does rely on this event to ensure that as soon as a phone is connected it sets the night mode value.

viktorgino commented 9 months ago

Made the changes, I also corrected a bug in the pro file where it wasn't copying the sensor json files over to the install directory.

I left m_pluginSettings.eventListeners = QStringList() << "AndroidAuto::connected"; in as the plugin does rely on this event to ensure that as soon as a phone is connected it sets the night mode value.

Perfect, thanks!