Skip to content

Commit

Permalink
Switch GPIO library (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyIvan359 committed Sep 22, 2019
1 parent ae8a9dd commit 57b5b99
Show file tree
Hide file tree
Showing 13 changed files with 996 additions and 402 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
* __Fixed__: Fixed typo in configuration file `/set` should have been `/get`
* __Fixed__: Module name now display only the module name instead of `modules.[name]`
* __Added__: GPIO module `direction` default is now `input`
* __Fixed__: GPIO module `resistor` default is now `GPIO.PUD_OFF` instead of invalid `None`
* __Fixed__: GPIO module `resistor` default is now `Resistor.OFF` instead of invalid `None`
* __Fixed__: Config `selection` type not adding value to config dict.
* __Fixed__: Modules loading in random order. MQTT module needs to be loaded first.
Switched to `yamlloader` to load config sections in file order.
Expand Down
19 changes: 18 additions & 1 deletion mqttany/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import time
import time, collections
from ctypes import c_char_p, c_int
import multiprocessing as mproc

Expand Down Expand Up @@ -225,5 +225,22 @@ def release_i2c_lock(bus, scl, sda, module):
return True


def update_dict(d, u):
"""
Recursively update dict ``d`` with dict ``u``
"""
for k in u:
dv = d.get(k, {})
if not isinstance(dv, collections.Mapping):
d[k] = u[k]
elif isinstance(u[k], collections.Mapping):
d[k] = update_dict(dv, u[k])
else:
d[k] = u[k]
return d




for bus in _i2c_lock:
bus["module"].raw = ""
Loading

0 comments on commit 57b5b99

Please sign in to comment.