|
23 | 23 |
|
24 | 24 |
|
25 | 25 |
|
26 | | -Microchip MCP9808 driver for MicroPython v.1.0.0 |
| 26 | +Microchip MCP9808 driver for MicroPython |
27 | 27 |
|
28 | 28 | THE MCP9808 IS A COMPLEX SENSOR WITH MANY FEATURES. IS IT ADVISABLE TO READ THE DATASHEET. |
29 | 29 |
|
@@ -243,35 +243,35 @@ def _set_config( |
243 | 243 | # Type/value check the parameters |
244 | 244 | if hyst_mode not in [HYST_00, HYST_15, HYST_30, HYST_60]: |
245 | 245 | raise ValueError(f"hyst_mode: {hyst_mode}. Value should be between 0 and 3 inclusive.") |
246 | | - if shdn is not bool: |
| 246 | + if shdn.__class__ is not bool: |
247 | 247 | raise TypeError( |
248 | 248 | f"shdn: {shdn} {shdn.__class__}. Expecting a bool.", |
249 | 249 | ) |
250 | | - if crit_lock is not bool: |
| 250 | + if crit_lock.__class__ is not bool: |
251 | 251 | raise TypeError( |
252 | 252 | f"crit_lock: {crit_lock} {crit_lock.__class__}. Expecting a bool.", |
253 | 253 | ) |
254 | | - if alerts_lock is not bool: |
| 254 | + if alerts_lock.__class__ is not bool: |
255 | 255 | raise TypeError( |
256 | 256 | f"alerts_lock: {alerts_lock} {alerts_lock.__class__}. Expecting a bool.", |
257 | 257 | ) |
258 | | - if irq_clear_bit is not bool: |
| 258 | + if irq_clear_bit.__class__ is not bool: |
259 | 259 | raise TypeError( |
260 | 260 | f"irq_clear_bit: {irq_clear_bit} {irq_clear_bit.__class__}. Expecting a bool.", |
261 | 261 | ) |
262 | | - if alert_ctrl is not bool: |
| 262 | + if alert_ctrl.__class__ is not bool: |
263 | 263 | raise TypeError( |
264 | 264 | f"alert_ctrl: {alert_ctrl} {alert_ctrl.__class__}. Expecting a bool.", |
265 | 265 | ) |
266 | | - if alert_sel is not bool: |
| 266 | + if alert_sel.__class__ is not bool: |
267 | 267 | raise TypeError( |
268 | 268 | f"alert_sel: {alert_sel} {alert_sel.__class__}. Expecting a bool.", |
269 | 269 | ) |
270 | | - if alert_pol is not bool: |
| 270 | + if alert_pol.__class__ is not bool: |
271 | 271 | raise TypeError( |
272 | 272 | f"alert_pol: {alert_pol} {alert_pol.__class__}. Expecting a bool.", |
273 | 273 | ) |
274 | | - if alert_mode is not bool: |
| 274 | + if alert_mode.__class__ is not bool: |
275 | 275 | raise TypeError( |
276 | 276 | f"alert_mode: {alert_mode} {alert_mode.__class__}. Expecting a bool.", |
277 | 277 | ) |
@@ -346,7 +346,7 @@ def _set_alert_limit(self, limit: float, register: int) -> None: |
346 | 346 | ``None`` |
347 | 347 | """ |
348 | 348 |
|
349 | | - if limit.__class__ not in [float]: |
| 349 | + if limit.__class__ not in [float, int]: |
350 | 350 | raise TypeError( |
351 | 351 | f"limit: {limit} {limit.__class__}. Expecting float|int.", |
352 | 352 | ) |
|
0 commit comments